From 901efb0a0ec4440cc02cb8e8fa5f327b0257f5ea Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 24 Aug 2019 12:59:30 -0400 Subject: [PATCH 1/2] [frio] Remove /contacts module incomplete autocompletion in search field --- view/theme/frio/js/mod_contacts.js | 16 -------- view/theme/frio/js/theme.js | 64 ------------------------------ 2 files changed, 80 deletions(-) diff --git a/view/theme/frio/js/mod_contacts.js b/view/theme/frio/js/mod_contacts.js index ab5721810..dd7ae4356 100644 --- a/view/theme/frio/js/mod_contacts.js +++ b/view/theme/frio/js/mod_contacts.js @@ -2,22 +2,6 @@ var batchConfirmed = false; $(document).ready(function() { - // Add contact_filter autocompletion to the search field. - $("#contacts-search").contact_filter(baseurl + '/acl', 'r', true); - - // Hide the viewcontact_wrapper if there is an input in the search field - // We are doing this to let the the contact_filter replace the original - // shown contacts. - $("#contacts-search").keyup(function(){ - var elText = $(this).val(); - if (elText.length !== 0) { - $("#viewcontact_wrapper").hide(); - $("ul.textcomplete-dropdown").addClass("show media-list"); - } else { - $("#viewcontact_wrapper").show(); - $("ul.textcomplete-dropdown").removeClass("show"); - } - }); // Initiale autosize for the textareas. autosize($("textarea.text-autosize")); diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 44a24b30a..ad6308595 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -504,75 +504,11 @@ function qOrAmp(url) { } } -function contact_filter(item) { - // get the html content from the js template of the contact-wrapper - contact_tpl = unescape($(".javascript-template[rel=contact-template]").html()); - - var variables = { - id: item.id, - name: item.name, - username: item.username, - thumb: item.thumb, - img_hover: item.img_hover, - edit_hover: item.edit_hover, - account_type: item.account_type, - photo_menu: item.photo_menu, - alt_text: item.alt_text, - dir_icon: item.dir_icon, - sparkle: item.sparkle, - itemurl: item.itemurl, - url: item.url, - network: item.network, - tags: item.tags, - details: item.details, - }; - - // open a new jSmart instance with the template - var tpl = new jSmart (contact_tpl); - - // replace the variable with the values - var html = tpl.fetch(variables); - - return html; -} - function filter_replace(item) { return item.name; } -(function($) { - $.fn.contact_filter = function(backend_url, typ, autosubmit, onselect) { - if (typeof typ === 'undefined') { - typ = ''; - } - - if (typeof autosubmit === 'undefined') { - autosubmit = false; - } - - // Autocomplete contacts - contacts = { - match: /(^)([^\n]+)$/, - index: 2, - search: function(term, callback) {contact_search(term, callback, backend_url, typ);}, - replace: filter_replace, - template: contact_filter - }; - - this.attr('autocomplete','off'); - var a = this.textcomplete([contacts], {className:'accontacts', appendTo: '#contact-list'}); - - if(autosubmit) { - a.on('textComplete:select', function(e,value,strategy) {submit_form(this);}); - } - - a.on('textComplete:select', function(e, value, strategy) { - $(".dropdown-menu.textcomplete-dropdown.media-list").show(); - }); - }; -})( jQuery ); - // current time in milliseconds, to send each request to make sure // we 're not getting 304 response function timeNow() { From 082827b67ecdf0466eae9d1d633b680a7932a2fe Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 24 Aug 2019 13:00:16 -0400 Subject: [PATCH 2/2] Remove unused Javascript methods and functions --- view/js/autocomplete.js | 51 ------------------------------------- view/theme/frio/js/modal.js | 9 ------- view/theme/frio/js/theme.js | 28 -------------------- 3 files changed, 88 deletions(-) diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 1ba8900c2..18deaa1d3 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -286,57 +286,6 @@ function string2bb(element) { }; })( jQuery ); -(function( $ ) { - $.fn.contact_autocomplete = function(backend_url, typ, autosubmit, onselect) { - if(typeof typ === 'undefined') typ = ''; - if(typeof autosubmit === 'undefined') autosubmit = false; - - // Autocomplete contacts - contacts = { - match: /(^)([^\n]+)$/, - index: 2, - search: function(term, callback) { contact_search(term, callback, backend_url, typ); }, - replace: basic_replace, - template: contact_format, - }; - - this.attr('autocomplete','off'); - var a = this.textcomplete([contacts], {className:'acpopup', zIndex:10000}); - - if(autosubmit) - a.on('textComplete:select', function(e,value,strategy) { submit_form(this); }); - - if(typeof onselect !== 'undefined') - a.on('textComplete:select', function(e, value, strategy) { onselect(value); }); - }; -})( jQuery ); - - -(function( $ ) { - $.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) { - if(typeof typ === 'undefined') typ = ''; - if(typeof autosubmit === 'undefined') autosubmit = false; - - // Autocomplete contacts - names = { - match: /(^)([^\n]+)$/, - index: 2, - search: function(term, callback) { contact_search(term, callback, backend_url, typ); }, - replace: trim_replace, - template: contact_format, - }; - - this.attr('autocomplete','off'); - var a = this.textcomplete([names], {className:'acpopup', zIndex:10000}); - - if(autosubmit) - a.on('textComplete:select', function(e,value,strategy) { submit_form(this); }); - - if(typeof onselect !== 'undefined') - a.on('textComplete:select', function(e, value, strategy) { onselect(value); }); - }; -})( jQuery ); - (function( $ ) { $.fn.bbco_autocomplete = function(type) { diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 9bca42777..f33988e13 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -277,7 +277,6 @@ function editpost(url) { var modal = $('#jot-modal').modal(); url = url + " #jot-sections"; - //var rand_num = random_digits(12); $(".jot-nav .jot-perms-lnk").parent("li").addClass("hidden"); // For editpost we load the modal html of "jot-sections" of the edit page. So we would have two jot forms in @@ -326,14 +325,6 @@ function jotreset() { $("#profile-jot-form #jot-title-wrap").show(); $("#profile-jot-form #jot-category-wrap").show(); - // the following was commented out because it is needed anymore - // because we changed the behavior at an other place. - // var rand_num = random_digits(12); - // $('#jot-title, #jot-category, #profile-jot-text').val(""); - // $( "#profile-jot-form input[name='type']" ).val("wall"); - // $( "#profile-jot-form input[name='post_id']" ).val(""); - // $( "#profile-jot-form input[name='post_id_random']" ).val(rand_num); - // Remove the "edit-jot" class so we can the standard behavior on close. $("#jot-modal.edit-jot").removeClass("edit-jot"); $("#jot-modal-content").empty(); diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index ad6308595..2ab11e637 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -454,11 +454,6 @@ function justifyPhotos() { }).on('jg.complete', function(e){ justifiedGalleryActive = false; }); } -function justifyPhotosAjax() { - justifiedGalleryActive = true; - $('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; }); -} - // Load a js script to the html head. function loadScript(url, callback) { // Check if the script is already in the html head. @@ -483,18 +478,6 @@ function loadScript(url, callback) { head.appendChild(script); } -function random_digits(digits) { - var rn = ""; - var rnd = ""; - - for(var i = 0; i < digits; i++) { - var rn = Math.round(Math.random() * (9)); - rnd += rn; - } - - return rnd; -} - // Does we need a ? or a & to append values to a url function qOrAmp(url) { if(url.search('\\?') < 0) { @@ -504,17 +487,6 @@ function qOrAmp(url) { } } -function filter_replace(item) { - - return item.name; -} - -// current time in milliseconds, to send each request to make sure -// we 're not getting 304 response -function timeNow() { - return new Date().getTime(); -} - String.prototype.normalizeLink = function () { var ret = this.replace('https:', 'http:'); var ret = ret.replace('//www', '//');