Browse Source

Merge pull request #9850 from Extarys/frio-formating

frio: formating, otherwise untouched
pull/9851/head
Hypolite Petovan 1 year ago committed by GitHub
parent
commit
1a9bc9e444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      view/theme/frio/css/font-awesome.custom.css
  2. 3
      view/theme/frio/css/hovercard.css
  3. 38
      view/theme/frio/css/mod_admin.css
  4. 3539
      view/theme/frio/css/style.css
  5. 48
      view/theme/frio/js/compose.js
  6. 82
      view/theme/frio/js/event_edit.js
  7. 180
      view/theme/frio/js/filebrowser.js
  8. 166
      view/theme/frio/js/hovercard.js
  9. 22
      view/theme/frio/js/jot.js
  10. 32
      view/theme/frio/js/mod_admin.js
  11. 10
      view/theme/frio/js/mod_contacts.js
  12. 4
      view/theme/frio/js/mod_display.js
  13. 213
      view/theme/frio/js/mod_events.js
  14. 41
      view/theme/frio/js/mod_group.js
  15. 8
      view/theme/frio/js/mod_notifications.js
  16. 44
      view/theme/frio/js/mod_photos.js
  17. 205
      view/theme/frio/js/modal.js
  18. 77
      view/theme/frio/js/textedit.js
  19. 504
      view/theme/frio/js/theme.js
  20. 78
      view/theme/frio/scheme/black.css
  21. 50
      view/theme/frio/scheme/dark.css
  22. 51
      view/theme/frio/scheme/koyu-dark.css
  23. 58
      view/theme/frio/scheme/love-music.css
  24. 170
      view/theme/frio/scheme/plusminus.css
  25. 578
      view/theme/frio/templates/nav.tpl

38
view/theme/frio/css/font-awesome.custom.css

@ -4,18 +4,30 @@ This file applies Font Awesome icons to some friendica standard classes
*/
.icon:before {
font-family: ForkAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: inherit;
vertical-align: top;
font-size: 1.4em;
font-family: ForkAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: inherit;
vertical-align: top;
font-size: 1.4em;
}
/* media icons */
.icon.type-image:before { content: "\f1c5"; }
.icon.type-video:before { content: "\f1c8"; }
.icon.type-audio:before { content: "\f1c7"; }
.icon.type-text:before { content: "\f0f6"; }
.icon.type-application:before { content: "\f016"; }
.icon.type-unkn:before { content: "\f016"; }
.icon.type-image:before {
content: "\f1c5";
}
.icon.type-video:before {
content: "\f1c8";
}
.icon.type-audio:before {
content: "\f1c7";
}
.icon.type-text:before {
content: "\f0f6";
}
.icon.type-application:before {
content: "\f016";
}
.icon.type-unkn:before {
content: "\f016";
}

3
view/theme/frio/css/hovercard.css

@ -1,4 +1,3 @@
.hovercard {
position: absolute;
top: 0;
@ -202,7 +201,6 @@
text-decoration: none !important;
}
/* Basic hovercard */
.basic-content {
padding: 9px;
@ -285,7 +283,6 @@
.hover-card-header h4 {
display: block;
}
.hover-card-header h4 a {

38
view/theme/frio/css/mod_admin.css

@ -1,24 +1,42 @@
#adminpage.adminpage > h1 { padding: 0 15px; }
#adminpage.adminpage > h1 {
padding: 0 15px;
}
#users th:first-of-type { width: 1em; }
#users th:nth-of-type(2) { width: 40px; }
#users th:last-of-type { width: 1em; }
.admin-settings-footer-elements { padding-left: 8px; padding-right: 8px; }
#users th:first-of-type {
width: 1em;
}
#users th:nth-of-type(2) {
width: 40px;
}
#users th:last-of-type {
width: 1em;
}
.admin-settings-footer-elements {
padding-left: 8px;
padding-right: 8px;
}
#deleted th:first-of-type { width: 40px; }
#deleted th:first-of-type {
width: 40px;
}
#users img.avatar-nano,
#deleted img.avatar-nano {
height: 24px; width: 24px;
height: 24px;
width: 24px;
}
.opened .caret {
transform: rotate(180deg);
}
.opened .caret { transform: rotate(180deg); }
tr.details td,
tr.details th {
border-top: 0!important;
border-top: 0 !important;
}
.adminpage td > .checkbox,
.adminpage th > .checkbox {
margin: 0;
}
.adminpage td { word-break: break-all; }
.adminpage td {
word-break: break-all;
}

3539
view/theme/frio/css/style.css

File diff suppressed because it is too large Load Diff

48
view/theme/frio/js/compose.js

@ -1,51 +1,53 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
$(function() {
$(function () {
// Jot attachment live preview.
let $textarea = $('textarea[name=body]');
let $textarea = $("textarea[name=body]");
$textarea.linkPreview();
$textarea.keyup(function(){
$textarea.keyup(function () {
var textlen = $(this).val().length;
$('#character-counter').text(textlen);
$("#character-counter").text(textlen);
});
$textarea.editor_autocomplete(baseurl + '/search/acl');
$textarea.bbco_autocomplete('bbcode');
$textarea.editor_autocomplete(baseurl + "/search/acl");
$textarea.bbco_autocomplete("bbcode");
let location_button = document.getElementById('profile-location');
let location_input = document.getElementById('jot-location');
let location_button = document.getElementById("profile-location");
let location_input = document.getElementById("jot-location");
if (location_button && location_input) {
updateLocationButtonDisplay(location_button, location_input);
location_input.addEventListener('change', function () {
location_input.addEventListener("change", function () {
updateLocationButtonDisplay(location_button, location_input);
});
location_input.addEventListener('keyup', function () {
location_input.addEventListener("keyup", function () {
updateLocationButtonDisplay(location_button, location_input);
});
location_button.addEventListener('click', function() {
location_button.addEventListener("click", function () {
if (location_input.value) {
location_input.value = '';
location_input.value = "";
updateLocationButtonDisplay(location_button, location_input);
} else if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
location_input.value = position.coords.latitude + ', ' + position.coords.longitude;
updateLocationButtonDisplay(location_button, location_input);
}, function (error) {
location_button.disabled = true;
updateLocationButtonDisplay(location_button, location_input);
});
navigator.geolocation.getCurrentPosition(
function (position) {
location_input.value = position.coords.latitude + ", " + position.coords.longitude;
updateLocationButtonDisplay(location_button, location_input);
},
function (error) {
location_button.disabled = true;
updateLocationButtonDisplay(location_button, location_input);
},
);
}
});
}
});
function updateLocationButtonDisplay(location_button, location_input)
{
location_button.classList.remove('btn-primary');
function updateLocationButtonDisplay(location_button, location_input) {
location_button.classList.remove("btn-primary");
if (location_input.value) {
location_button.disabled = false;
location_button.classList.add('btn-primary');
location_button.classList.add("btn-primary");
location_button.title = location_button.dataset.titleClear;
} else if (!"geolocation" in navigator) {
location_button.disabled = true;

82
view/theme/frio/js/event_edit.js

@ -1,39 +1,45 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
$(document).ready(function() {
$(document).ready(function () {
// Go to the permissions tab if the checkbox is checked.
$('body').on("click", "#id_share", function() {
if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) {
$('#acl-wrapper').show();
$("a#event-perms-lnk").parent("li").show();
toggleEventNav("a#event-perms-lnk");
eventAclActive();
}
else {
$('#acl-wrapper').hide();
$("a#event-perms-lnk").parent("li").hide();
}
}).trigger('change');
$("body")
.on("click", "#id_share", function () {
if ($("#id_share").is(":checked") && !$("#id_share").attr("disabled")) {
$("#acl-wrapper").show();
$("a#event-perms-lnk").parent("li").show();
toggleEventNav("a#event-perms-lnk");
eventAclActive();
} else {
$("#acl-wrapper").hide();
$("a#event-perms-lnk").parent("li").hide();
}
})
.trigger("change");
// Disable the finish time input if the user disable it.
$('body').on("change", "#id_nofinish", function() {
enableDisableFinishDate()
}).trigger('change');
$("body")
.on("change", "#id_nofinish", function () {
enableDisableFinishDate();
})
.trigger("change");
// JS for the permission section.
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
var selstr;
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
selstr = $(this).html();
$('#jot-public').hide();
});
if (selstr == null) {
$('#jot-public').show();
}
}).trigger('change');
$("#contact_allow, #contact_deny, #group_allow, #group_deny")
.change(function () {
var selstr;
$(
"#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected",
).each(function () {
selstr = $(this).html();
$("#jot-public").hide();
});
if (selstr == null) {
$("#jot-public").show();
}
})
.trigger("change");
// Change the event nav menu.tabs on click.
$("body").on("click", "#event-nav > li > a", function(e){
$("body").on("click", "#event-nav > li > a", function (e) {
e.preventDefault();
toggleEventNav(this);
});
@ -46,7 +52,7 @@ $(document).ready(function() {
// Clear some elements (e.g. the event-preview container) when
// selecting a event nav link so it don't appear more than once.
$('body').on("click", "#event-nav a", function(e) {
$("body").on("click", "#event-nav a", function (e) {
$("#event-preview").empty();
e.preventDefault();
});
@ -55,14 +61,13 @@ $(document).ready(function() {
// Load the html of the actual event and incect the output to the
// event-edit section.
function doEventPreview() {
$('#event-edit-preview').val(1);
$.post('events',$('#event-edit-form').serialize(), function(data) {
$("#event-edit-preview").val(1);
$.post("events", $("#event-edit-form").serialize(), function (data) {
$("#event-preview").append(data);
});
$('#event-edit-preview').val(0);
$("#event-edit-preview").val(0);
}
// The following functions show/hide the specific event-edit content
// in dependence of the selected nav.
function eventAclActive() {
@ -70,7 +75,6 @@ function eventAclActive() {
$("#event-acl-wrapper").show();
}
function eventPreviewActive() {
$("#event-acl-wrapper, #event-edit-wrapper, #event-desc-wrapper").hide();
$("#event-preview").show();
@ -92,20 +96,16 @@ function eventDescActive() {
}
// Give the active "event-nav" list element the class "active".
function toggleEventNav (elm) {
function toggleEventNav(elm) {
// Select all li of #event-nav and remove the active class.
$(elm).closest("#event-nav").children("li").removeClass("active");
// Add the active class to the parent of the link which was selected.
$(elm).parent("li").addClass("active");
}
// Disable the input for the finish date if it is not available.
function enableDisableFinishDate() {
if( $('#id_nofinish').is(':checked'))
$('#id_finish_text').prop("disabled", true);
else
$('#id_finish_text').prop("disabled", false);
if ($("#id_nofinish").is(":checked")) $("#id_finish_text").prop("disabled", true);
else $("#id_finish_text").prop("disabled", false);
}
// @license-end

180
view/theme/frio/js/filebrowser.js

@ -52,7 +52,6 @@
* });
**/
/*
* IMPORTANT
*
@ -64,21 +63,20 @@
*
*/
var FileBrowser = {
nickname : "",
type : "",
nickname: "",
type: "",
event: "",
folder: "",
id : null,
id: null,
init: function(nickname, type, hash) {
init: function (nickname, type, hash) {
FileBrowser.nickname = nickname;
FileBrowser.type = type;
FileBrowser.event = "fbrowser."+type;
FileBrowser.event = "fbrowser." + type;
if (hash!=="") {
var h = hash.replace("#","");
if (hash !== "") {
var h = hash.replace("#", "");
var destination = h.split("-")[0];
FileBrowser.id = h.split("-")[1];
FileBrowser.event = FileBrowser.event + "." + destination;
@ -86,28 +84,34 @@ var FileBrowser = {
// Get the comment textimput field
var commentElm = document.getElementById("comment-edit-text-" + FileBrowser.id);
}
};
}
console.log("FileBrowser: " + nickname, type, FileBrowser.event, FileBrowser.id);
console.log("FileBrowser: " + nickname, type, FileBrowser.event, FileBrowser.id);
FileBrowser.postLoad();
$(".error .close").on("click", function(e) {
$(".error .close").on("click", function (e) {
e.preventDefault();
$(".error").addClass("hidden");
});
// Click on album link
$(".fbrowser").on("click", ".folders a, .path a", function(e) {
$(".fbrowser").on("click", ".folders a, .path a", function (e) {
e.preventDefault();
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + encodeURIComponent(this.dataset.folder) + "?mode=none&theme=frio";
var url =
baseurl +
"/fbrowser/" +
FileBrowser.type +
"/" +
encodeURIComponent(this.dataset.folder) +
"?mode=none&theme=frio";
FileBrowser.folder = this.dataset.folder;
FileBrowser.loadContent(url);
});
//Embed on click
$(".fbrowser").on('click', ".photo-album-photo-link", function(e) {
$(".fbrowser").on("click", ".photo-album-photo-link", function (e) {
e.preventDefault();
var embed = "";
@ -123,36 +127,34 @@ var FileBrowser = {
// Note: not the best solution but function commentOpenUI don't
// work as expected (we need a way to wait until commentOpenUI would be finished).
// As for now we insert pieces of this function here
if ((commentElm !== null) && (typeof commentElm !== "undefined")) {
if (commentElm !== null && typeof commentElm !== "undefined") {
if (commentElm.value === "") {
$("#comment-edit-text-" + FileBrowser.id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
$("#comment-edit-text-" + FileBrowser.id)
.addClass("comment-edit-text-full")
.removeClass("comment-edit-text-empty");
$("#comment-edit-submit-wrapper-" + FileBrowser.id).show();
$("#comment-edit-text-" + FileBrowser.id).attr('tabindex','9');
$("#comment-edit-submit-" + FileBrowser.id).attr('tabindex','10');
$("#comment-edit-text-" + FileBrowser.id).attr("tabindex", "9");
$("#comment-edit-submit-" + FileBrowser.id).attr("tabindex", "10");
}
}
console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);
$("body").trigger(FileBrowser.event, [
this.dataset.filename,
embed,
FileBrowser.id,
this.dataset.img
]);
$("body").trigger(FileBrowser.event, [this.dataset.filename, embed, FileBrowser.id, this.dataset.img]);
// Close model
$('#modal').modal('hide');
$("#modal").modal("hide");
// Update autosize for this textarea
autosize.update($(".text-autosize"));
});
// EventListener for switching between image and file mode
$(".fbrowser").on('click', ".fbswitcher .btn", function(e) {
$(".fbrowser").on("click", ".fbswitcher .btn", function (e) {
e.preventDefault();
FileBrowser.type = this.getAttribute("data-mode");
$(".fbrowser").removeClass().addClass("fbrowser " + FileBrowser.type);
$(".fbrowser")
.removeClass()
.addClass("fbrowser " + FileBrowser.type);
url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none&theme=frio";
FileBrowser.loadContent(url);
@ -160,67 +162,73 @@ var FileBrowser = {
},
// Initialize the AjaxUpload for the upload buttons
uploadButtons: function() {
uploadButtons: function () {
if ($("#upload-image").length) {
//AjaxUpload for images
var image_uploader = new window.AjaxUpload(
'upload-image',
{
action: 'wall_upload/' + FileBrowser.nickname + '?response=json&album=' + encodeURIComponent(FileBrowser.folder),
name: 'userfile',
responseType: 'json',
onSubmit: function(file, ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass('hidden');
},
onComplete: function(file,response) {
if (response['error'] != undefined) {
$(".error span").html(response['error']);
$(".error").removeClass('hidden');
$(".fbrowser .profile-rotator-wrapper").hide();
$(".fbrowser-content").show();
return;
}
// load new content to fbrowser window
FileBrowser.loadContent(baseurl + '/fbrowser/' + FileBrowser.type + '/' + encodeURIComponent(FileBrowser.folder) + '?mode=none&theme=frio');
var image_uploader = new window.AjaxUpload("upload-image", {
action:
"wall_upload/" +
FileBrowser.nickname +
"?response=json&album=" +
encodeURIComponent(FileBrowser.folder),
name: "userfile",
responseType: "json",
onSubmit: function (file, ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass("hidden");
},
onComplete: function (file, response) {
if (response["error"] != undefined) {
$(".error span").html(response["error"]);
$(".error").removeClass("hidden");
$(".fbrowser .profile-rotator-wrapper").hide();
$(".fbrowser-content").show();
return;
}
}
);
// load new content to fbrowser window
FileBrowser.loadContent(
baseurl +
"/fbrowser/" +
FileBrowser.type +
"/" +
encodeURIComponent(FileBrowser.folder) +
"?mode=none&theme=frio",
);
},
});
}
if ($("#upload-file").length) {
//AjaxUpload for files
var file_uploader = new window.AjaxUpload(
'upload-file',
{ action: 'wall_attach/' + FileBrowser.nickname + '?response=json',
name: 'userfile',
onSubmit: function(file, ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass('hidden');
},
onComplete: function(file,response) {
if (response['error']!= undefined) {
$(".error span").html(response['error']);
$(".error").removeClass('hidden');
$('#profile-rotator').hide();
$(".fbrowser-content").show();
return;
}
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none&theme=frio";
// Load new content to fbrowser window
FileBrowser.loadContent(url);
var file_uploader = new window.AjaxUpload("upload-file", {
action: "wall_attach/" + FileBrowser.nickname + "?response=json",
name: "userfile",
onSubmit: function (file, ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass("hidden");
},
onComplete: function (file, response) {
if (response["error"] != undefined) {
$(".error span").html(response["error"]);
$(".error").removeClass("hidden");
$("#profile-rotator").hide();
$(".fbrowser-content").show();
return;
}
}
);
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none&theme=frio";
// Load new content to fbrowser window
FileBrowser.loadContent(url);
},
});
}
},
// Stuff which should be executed if ne content was loaded
postLoad: function() {
postLoad: function () {
FileBrowser.initGallery();
$(".fbrowser .fbswitcher .btn").removeClass("active");
$(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active");
@ -229,14 +237,14 @@ var FileBrowser = {
},
// Load new content (e.g. change photo album)
loadContent: function(url) {
loadContent: function (url) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
// load new content to fbrowser window
$(".fbrowser").load(url, function(responseText, textStatus) {
$(".fbrowser").load(url, function (responseText, textStatus) {
$(".profile-rotator-wrapper").hide();
if (textStatus === 'success') {
if (textStatus === "success") {
$(".fbrowser_content").show();
FileBrowser.postLoad();
}
@ -244,12 +252,12 @@ var FileBrowser = {
},
// Initialize justified Gallery
initGallery: function() {
initGallery: function () {
$(".fbrowser.image .fbrowser-content-container").justifiedGallery({
'rowHeight': 80,
'margins': 4,
'border': 0
rowHeight: 80,
margins: 4,
border: 0,
});
}
},
};
// @license-end

166
view/theme/frio/js/hovercard.js

@ -9,16 +9,16 @@
*
*/
$(document).ready(function () {
let $body = $('body');
let $body = $("body");
// Prevents normal click action on click hovercard elements
$body.on('click', '.userinfo.click-card', function (e) {
$body.on("click", ".userinfo.click-card", function (e) {
e.preventDefault();
});
// This event listener needs to be declared before the one that removes
// all cards so that we can stop the immediate propagation of the event
// Since the manual popover appears instantly and the hovercard removal is
// on a 100ms delay, leaving event propagation immediately hides any click hovercard
$body.on('mousedown', '.userinfo.click-card', function (e) {
$body.on("mousedown", ".userinfo.click-card", function (e) {
e.stopImmediatePropagation();
let timeNow = new Date().getTime();
@ -26,14 +26,14 @@ $(document).ready(function () {
let targetElement = $(this);
// get href-attribute
if (targetElement.is('[href]')) {
contactUrl = targetElement.attr('href');
if (targetElement.is("[href]")) {
contactUrl = targetElement.attr("href");
} else {
return true;
}
// no hovercard for anchor links
if (contactUrl.substring(0, 1) === '#') {
if (contactUrl.substring(0, 1) === "#") {
return true;
}
@ -41,59 +41,62 @@ $(document).ready(function () {
});
// hover cards should be removed very easily, e.g. when any of these events happens
$body.on('mouseleave touchstart scroll mousedown submit keydown', function (e) {
$body.on("mouseleave touchstart scroll mousedown submit keydown", function (e) {
// remove hover card only for desktiop user, since on mobile we open the hovercards
// by click event insteadof hover
removeAllHovercards(e, new Date().getTime());
});
$body.on('mouseover', '.userinfo.hover-card, .wall-item-responses a, .wall-item-bottom .mention a', function (e) {
let timeNow = new Date().getTime();
removeAllHovercards(e, timeNow);
let contactUrl = false;
let targetElement = $(this);
// get href-attribute
if (targetElement.is('[href]')) {
contactUrl = targetElement.attr('href');
} else {
return true;
}
$body
.on("mouseover", ".userinfo.hover-card, .wall-item-responses a, .wall-item-bottom .mention a", function (e) {
let timeNow = new Date().getTime();
removeAllHovercards(e, timeNow);
let contactUrl = false;
let targetElement = $(this);
// get href-attribute
if (targetElement.is("[href]")) {
contactUrl = targetElement.attr("href");
} else {
return true;
}
// no hover card if the element has the no-hover-card class
if (targetElement.hasClass('no-hover-card')) {
return true;
}
// no hover card if the element has the no-hover-card class
if (targetElement.hasClass("no-hover-card")) {
return true;
}
// no hovercard for anchor links
if (contactUrl.substring(0, 1) === '#') {
return true;
}
// no hovercard for anchor links
if (contactUrl.substring(0, 1) === "#") {
return true;
}
targetElement.attr('data-awaiting-hover-card', timeNow);
targetElement.attr("data-awaiting-hover-card", timeNow);
// Delay until the hover-card does appear
setTimeout(function () {
if (
targetElement.is(':hover')
&& parseInt(targetElement.attr('data-awaiting-hover-card'), 10) === timeNow
&& $('.hovercard').length === 0
) {
openHovercard(targetElement, contactUrl, timeNow);
}
}, 500);
}).on('mouseleave', '.userinfo.hover-card, .wall-item-responses a, .wall-item-bottom .mention a', function (e) { // action when mouse leaves the hover-card
removeAllHovercards(e, new Date().getTime());
});
// Delay until the hover-card does appear
setTimeout(function () {
if (
targetElement.is(":hover") &&
parseInt(targetElement.attr("data-awaiting-hover-card"), 10) === timeNow &&
$(".hovercard").length === 0
) {
openHovercard(targetElement, contactUrl, timeNow);
}
}, 500);
})
.on("mouseleave", ".userinfo.hover-card, .wall-item-responses a, .wall-item-bottom .mention a", function (e) {
// action when mouse leaves the hover-card
removeAllHovercards(e, new Date().getTime());
});
// if we're hovering a hover card, give it a class, so we don't remove it
$body.on('mouseover', '.hovercard', function (e) {
$(this).addClass('dont-remove-card');
$body.on("mouseover", ".hovercard", function (e) {
$(this).addClass("dont-remove-card");
});
$body.on('mouseleave', '.hovercard', function (e) {
$(this).removeClass('dont-remove-card');
$(this).popover('hide');
$body.on("mouseleave", ".hovercard", function (e) {
$(this).removeClass("dont-remove-card");
$(this).popover("hide");
});
}); // End of $(document).ready
@ -101,20 +104,20 @@ $(document).ready(function () {
function removeAllHovercards(event, priorTo) {
// don't remove hovercards until after 100ms, so user have time to move the cursor to it (which gives it the dont-remove-card class)
setTimeout(function () {
$.each($('.hovercard'), function () {
let title = $(this).attr('data-orig-title');
$.each($(".hovercard"), function () {
let title = $(this).attr("data-orig-title");
// don't remove card if it was created after removeAllhoverCards() was called
if ($(this).data('card-created') < priorTo) {
if ($(this).data("card-created") < priorTo) {
// don't remove it if we're hovering it right now!
if (!$(this).hasClass('dont-remove-card')) {
let $handle = $('[data-hover-card-active="' + $(this).data('card-created') + '"]');
$handle.removeAttr('data-hover-card-active');
if (!$(this).hasClass("dont-remove-card")) {
let $handle = $('[data-hover-card-active="' + $(this).data("card-created") + '"]');
$handle.removeAttr("data-hover-card-active");
// Restoring the popover handle title
let title = $handle.attr('data-orig-title');
$handle.attr({'data-orig-title': '', title: title});
let title = $handle.attr("data-orig-title");
$handle.attr({ "data-orig-title": "", title: title });
$(this).popover('hide');
$(this).popover("hide");
}
}
});
@ -124,35 +127,40 @@ function removeAllHovercards(event, priorTo) {
function openHovercard(targetElement, contactUrl, timeNow) {
// store the title in a data attribute because Bootstrap
// popover destroys the title attribute.
let title = targetElement.attr('title');
targetElement.attr({'data-orig-title': title, title: ''});
let title = targetElement.attr("title");
targetElement.attr({ "data-orig-title": title, title: "" });
// get an additional data atribute if the card is active
targetElement.attr('data-hover-card-active', timeNow);
targetElement.attr("data-hover-card-active", timeNow);
// get the whole html content of the hover card and
// push it to the bootstrap popover
getHoverCardContent(contactUrl, function (data) {
if (data) {
targetElement.popover({
html: true,
placement: function () {
// Calculate the placement of the the hovercard (if top or bottom)
// The placement depence on the distance between window top and the element
// which triggers the hover-card
let get_position = $(targetElement).offset().top - $(window).scrollTop();
if (get_position < 270) {
return 'bottom';
}
return 'top';
},
trigger: 'manual',
template: '<div class="popover hovercard" data-card-created="' + timeNow + '"><div class="arrow"></div><div class="popover-content hovercard-content"></div></div>',
content: data,
container: 'body',
sanitizeFn: function (content) {
return DOMPurify.sanitize(content)
},
}).popover('show');
targetElement
.popover({
html: true,
placement: function () {
// Calculate the placement of the the hovercard (if top or bottom)
// The placement depence on the distance between window top and the element
// which triggers the hover-card
let get_position = $(targetElement).offset().top - $(window).scrollTop();
if (get_position < 270) {
return "bottom";
}
return "top";
},
trigger: "manual",
template:
'<div class="popover hovercard" data-card-created="' +
timeNow +
'"><div class="arrow"></div><div class="popover-content hovercard-content"></div></div>',
content: data,
container: "body",
sanitizeFn: function (content) {
return DOMPurify.sanitize(content);
},
})
.popover("show");
}
});
}
@ -176,7 +184,7 @@ function getHoverCardContent(contact_url, callback) {
}
$.ajax({
url: baseurl + '/contact/hovercard',
url: baseurl + "/contact/hovercard",
data: postdata,
success: function (data, textStatus, request) {
getHoverCardContent.cache[nurl] = data;

22
view/theme/frio/js/jot.js

@ -6,33 +6,33 @@ var linkPreview;
/**
* Insert a link into friendica jot.
*
*
* @returns {void}
*/
function jotGetLink() {
var currentText = $("#profile-jot-text").val();
var noAttachment = '';
var noAttachment = "";
reply = prompt(aStr.linkurl);
if(reply && reply.length) {
if (reply && reply.length) {
// There should be only one attachment per post.
// So we need to remove the old one.
$('#jot-attachment-preview').empty();
$('#profile-rotator').show();
$("#jot-attachment-preview").empty();
$("#profile-rotator").show();
if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
noAttachment = '&noAttachment=1';
noAttachment = "&noAttachment=1";
}
// We use the linkPreview library to have a preview
// of the attachments.
if (typeof linkPreview === 'object') {
if (typeof linkPreview === "object") {
linkPreview.crawlText(reply + noAttachment);
// Fallback: insert the attachment bbcode directly into the textarea
// if the attachment live preview isn't available
// Fallback: insert the attachment bbcode directly into the textarea
// if the attachment live preview isn't available
} else {
$.get('parse_url?binurl=' + bin2hex(reply) + noAttachment, function(data) {
$.get("parse_url?binurl=" + bin2hex(reply) + noAttachment, function (data) {
addeditortext(data);
$('#profile-rotator').hide();
$("#profile-rotator").hide();
});
}
autosize.update($("#profile-jot-text"));

32
view/theme/frio/js/mod_admin.js

@ -2,42 +2,40 @@
/**
* Javascript for the admin module
*/
$(function() {
let $body = $('body');
$body.on('click', '.selectall', function() {
selectall($(this).data('selectAll'));
$(function () {
let $body = $("body");
$body.on("click", ".selectall", function () {
selectall($(this).data("selectAll"));
});
$body.on('click', '.selectnone', function() {
selectnone($(this).data('selectNone'));
$body.on("click", ".selectnone", function () {
selectnone($(this).data("selectNone"));
});
// Toggle checkbox status to all or none for all checkboxes of a specific
// css class.
$body.on('change', 'input[type=checkbox].selecttoggle', function() {
$body.on("change", "input[type=checkbox].selecttoggle", function () {
$this = $(this);
if ($this.prop('checked')) {
selectall($this.data('selectClass'));
$this.attr('title', $this.data('selectNone'));
if ($this.prop("checked")) {
selectall($this.data("selectClass"));
$this.attr("title", $this.data("selectNone"));
} else {
selectnone($this.data('selectClass'));
$this.attr('title', $this.data('selectAll'));
selectnone($this.data("selectClass"));
$this.attr("title", $this.data("selectAll"));
}
});
function selectall(cls) {
$('.' + cls).prop('checked', true);
$("." + cls).prop("checked", true);
return false;
}
function selectnone(cls) {
$('.' + cls).prop('checked', false);
$("." + cls).prop("checked", false);
return false;
}
});
// Users
function confirm_delete(msg, uname){
function confirm_delete(msg, uname) {
return confirm(msg.format(uname));
}

10
view/theme/frio/js/mod_contacts.js

@ -2,22 +2,20 @@
var batchConfirmed = false;
$(document).ready(function() {
$(document).ready(function () {
// Initiale autosize for the textareas.
autosize($("textarea.text-autosize"));
// Replace the drop contact link of the photo menu
// with a confirmation modal.
$("body").on("click", ".contact-photo-menu a", function(e) {
var photoMenuLink = $(this).attr('href');
$("body").on("click", ".contact-photo-menu a", function (e) {
var photoMenuLink = $(this).attr("href");
if (typeof photoMenuLink !== "undefined" && photoMenuLink.indexOf("/drop?confirm=1") !== -1) {
e.preventDefault();
addToModal(photoMenuLink);
return false;
}
});
});
/**
@ -25,7 +23,7 @@ $(document).ready(function() {
*
* @param {string} name The name of the batch action.
* @param {string} value If it isn't empty the action will be posted.
*
*
* @return {void}
*/
function batch_submit_handler(name, value) {

4
view/theme/frio/js/mod_display.js

@ -6,8 +6,8 @@
// Catch the GUID from the URL
var itemGuid = window.location.pathname.split("/").pop();
$(window).load(function(){
$(window).load(function () {
// Scroll to the Item by its GUID
scrollToItem('item-' + itemGuid);
scrollToItem("item-" + itemGuid);
});
// @license-end

213
view/theme/frio/js/mod_events.js

@ -4,75 +4,86 @@
* Initialization of the fullCalendar and format the output.
*/
$(document).ready(function() {
$(document).ready(function () {
// start the fullCalendar
$('#events-calendar').fullCalendar({
$("#events-calendar").fullCalendar({
firstDay: aStr.firstDay,
monthNames: aStr['monthNames'],
monthNamesShort: aStr['monthNamesShort'],
dayNames: aStr['dayNames'],
dayNamesShort: aStr['dayNamesShort'],
monthNames: aStr["monthNames"],
monthNamesShort: aStr["monthNamesShort"],
dayNames: aStr["dayNames"],
dayNamesShort: aStr["dayNamesShort"],
allDayText: aStr.allday,
noEventsMessage: aStr.noevent,
buttonText: {
today: aStr.today,
month: aStr.month,
week: aStr.week,
day: aStr.day
day: aStr.day,
},
events: baseurl + moduleUrl + '/json/',
events: baseurl + moduleUrl + "/json/",
header: {
left: '',
// center: 'title',
right: ''
},
timeFormat: 'H:mm',
eventClick: function(calEvent, jsEvent, view) {
left: "",
// center: 'title',
right: "",
},
timeFormat: "H:mm",
eventClick: function (calEvent, jsEvent, view) {
showEvent(calEvent.id);
},
loading: function(isLoading, view) {
if(!isLoading) {
$('td.fc-day').dblclick(function() { addToModal('/events/new?start='+$(this).data('date')); });
loading: function (isLoading, view) {
if (!isLoading) {
$("td.fc-day").dblclick(function () {
addToModal("/events/new?start=" + $(this).data("date"));
});
}
},
defaultView: 'month',
defaultView: "month",
aspectRatio: 1,
eventRender: function(event, element, view) {
eventRender: function (event, element, view) {
//console.log(view.name);
switch(view.name){
switch (view.name) {
case "month":
element.find(".fc-title").html(
"<span class='item-desc'>{2}</span>".format(
event.item['author-avatar'],
event.item['author-name'],
event.title,
event.item.desc,
event.item.location
));
element
.find(".fc-title")
.html(
"<span class='item-desc'>{2}</span>".format(
event.item["author-avatar"],
event.item["author-name"],
event.title,
event.item.desc,
event.item.location,
),
);
break;
case "agendaWeek":
if (event.item['author-name'] == null) return;
element.find(".fc-title").html(
"<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
event.item['author-avatar'],
event.item['author-name'],
event.item.desc,
htmlToText(event.item.location)
));
break;
if (event.item["author-name"] == null) return;
element
.find(".fc-title")
.html(
"<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
event.item["author-avatar"],
event.item["author-name"],
event.item.desc,
htmlToText(event.item.location),
),
);
break;
case "agendaDay":
if (event.item['author-name'] == null) return;
element.find(".fc-title").html(
"<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
event.item['author-avatar'],
event.item['author-name'],
event.item.desc,
htmlToText(event.item.location)
));
if (event.item["author-name"] == null) return;
element
.find(".fc-title")
.html(
"<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
event.item["author-avatar"],
event.item["author-name"],
event.item.desc,
htmlToText(event.item.location),
),
);
break;
case "listMonth":
element.find(".fc-list-item-title").html(formatListViewEvent(event));
break;
break;
}
},
eventAfterRender: function (event, element) {
@ -82,54 +93,53 @@ $(document).ready(function() {
html: true,
trigger: "hover",
placement: "auto",
template: '<div class="popover hovercard event-card"><div class="arrow"></div><div class="popover-content hovercard-content"></div></div>',
template:
'<div class="popover hovercard event-card"><div class="arrow"></div><div class="popover-content hovercard-content"></div></div>',
sanitizeFn: function (content) {
return DOMPurify.sanitize(content)
return DOMPurify.sanitize(content);
},
});
}
})
},
});
// center on date
var args=location.href.replace(baseurl,"").split("/");
var args = location.href.replace(baseurl, "").split("/");
if (modparams == 2) {
if (args.length>=5) {
$("#events-calendar").fullCalendar('gotoDate',args[3] , args[4]-1);
if (args.length >= 5) {
$("#events-calendar").fullCalendar("gotoDate", args[3], args[4] - 1);
}
} else {
if (args.length>=4) {
$("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
if (args.length >= 4) {
$("#events-calendar").fullCalendar("gotoDate", args[2], args[3] - 1);
}
}
// echo the title
var view = $('#events-calendar').fullCalendar('getView');
$('#fc-title').text(view.title);
var view = $("#events-calendar").fullCalendar("getView");
$("#fc-title").text(view.title);
// show event popup
var hash = location.hash.split("-")
if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
var hash = location.hash.split("-");
if (hash.length == 2 && hash[0] == "#link") showEvent(hash[1]);
});
// loads the event into a modal
function showEvent(eventid) {
addToModal(baseurl + moduleUrl + '/?id=' + eventid);
addToModal(baseurl + moduleUrl + "/?id=" + eventid);
}
function changeView(action, viewName) {
$('#events-calendar').fullCalendar(action, viewName);
var view = $('#events-calendar').fullCalendar('getView');
$('#fc-title').text(view.title);
$("#events-calendar").fullCalendar(action, viewName);
var view = $("#events-calendar").fullCalendar("getView");
$("#fc-title").text(view.title);
}
// The template for the bootstrap popover for displaying the event title and
// author (it's the nearly the same template we use in frio for the contact
// hover cards. So be careful when changing the css)
function eventHoverBodyTemplate() {
var template = '\
var template =
'\
<div class="event-card-basic-content media">\
<div class="event-card-details">\
<div class="event-card-header">\
@ -154,52 +164,53 @@ function eventHoverBodyTemplate() {
// The template for presenting the event location in the event hover-card
function eventHoverLocationTemplate() {
var template = '<span role="presentation" aria-hidden="true"> · </span>\
var template =
'<span role="presentation" aria-hidden="true"> · </span>\
<span class="event-card-location"> {0}</span></div>';
return template;
}
function eventHoverProfileNameTemplate() {
var template = '\
var template =
'\
<div class="event-card-profile-name profile-entry-name">\
<a href="{0}" class="userinfo">{1}</a>\
</div>';
return template;
}
// transform the event data to html so we can use it in the event hover-card
// transform the event data to html so we can use it in the event hover-card
function eventHoverHtmlContent(event) {
var eventLocation = '';
var eventProfileName = '';
var eventLocation = "";
var eventProfileName = "";
// Get the Browser language
var locale = window.navigator.userLanguage || window.navigator.language;
var data = '';
var data = "";
// Use the browser language for date formatting
moment.locale(locale);