add userinfo to ajax calls; combine settings and global-search to one

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-08 16:57:55 +01:00
parent f758d0d943
commit 218028de2b
4 changed files with 201 additions and 113 deletions

View File

@@ -1,30 +1,20 @@
$(document).ready(function () {
console.log('included search');
$.typeahead({
input: '.js-typeahead-search_v1',
order: "desc",
dynamic: true,
display: ['title'],
href: "{{href}}",
emptyTemplate: "No results for {{query}}",
debug: true,
source: {
settings: {
ajax: {
method: "post",
url: "lib/ajax.php?action=searchsetting&theme=" + window.$theme + "&s=" + window.$session,
path: "settings",
data: {
searchtext: '{{query}}'
},
}
$('input[class=js-typeahead-search_v1]').on('change keyup keydown', function () {
$.ajax({
url: "lib/ajax.php?action=searchglobal&theme=" + window.$theme + "&s=" + window.$session,
type: "POST",
data: {
searchtext: $(this).val()
},
},
callback: {
onInit: function (node) {
console.log('Typeahead Initiated');
dataType: "json",
success: function (data) {
console.log(data);
},
error: function (a, b) {
console.log(a, b);
}
}
});
});
});