kopia lustrzana https://github.com/friendica/friendica
Merge pull request #7561 from MrPetovan/bug/7406-remove-contacts-auto-completion
Remove contacts auto completionpull/7567/head
commit
ff7d7feac6
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,81 +487,6 @@ 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() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
String.prototype.normalizeLink = function () {
|
||||
var ret = this.replace('https:', 'http:');
|
||||
var ret = ret.replace('//www', '//');
|
||||
|
|
Ładowanie…
Reference in New Issue