Merge pull request #1198 from SamBrishes/patch-005

[BUGFIX] Remove deprecated autoComplete Function
This commit is contained in:
Diego Najar 2020-05-23 17:01:23 +02:00 committed by GitHub
commit 5a5585d5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 36 deletions

View File

@ -282,44 +282,8 @@ echo Bootstrap::formOpen(array(
$("#jscoverImage").val( $(this).val() ); $("#jscoverImage").val( $(this).val() );
}); });
// Parent
$("#jsparentTMP").change(function() {
var parent = $("#jsparentTMP").val();
if (parent.length===0) {
$("#jsparent").val("");
}
});
// Datepicker // Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT}); $("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
// Parent autocomplete
var parentsXHR;
var parentsList; // Keep the parent list returned to get the key by the title page
$("#jsparentTMP").autoComplete({
minChars: 1,
source: function(term, response) {
// Prevent call inmediatly another ajax request
try { parentsXHR.abort(); } catch(e){}
// Get the list of parent pages by title (term)
parentsXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-parents", {query: term},
function(data) {
parentsList = data;
term = term.toLowerCase();
var matches = [];
for (var title in data) {
if (~title.toLowerCase().indexOf(term))
matches.push(title);
}
response(matches);
});
},
onSelect: function(event, term, item) {
// parentsList = array( pageTitle => pageKey )
var parentKey = parentsList[sanitizeHTML(term)];
$("#jsparent").attr("value", parentKey);
}
});
}); });
</script> </script>
</div> </div>