mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #461 from MananJethwani/issue/444
This commit is contained in:
commit
0f368791a2
|
@ -1,5 +1,37 @@
|
|||
function htmlDecode(input) {
|
||||
var doc = new DOMParser().parseFromString(input, "text/html");
|
||||
return doc.documentElement.textContent;
|
||||
}
|
||||
|
||||
(function ($) {
|
||||
const root = $( `link[type='root']` ).attr("href");
|
||||
|
||||
$( "#kiwixsearchbox" ).autocomplete({
|
||||
|
||||
source: `${root}/suggest?content=${window.location.pathname.split(`${root}/`)[1].split('/')[0]}`,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
|
||||
response: function( event, ui ) {
|
||||
|
||||
for(const item of ui.content) {
|
||||
item.label = htmlDecode(item.label);
|
||||
item.value = htmlDecode(item.value);
|
||||
}
|
||||
},
|
||||
|
||||
select: function(event, ui) {
|
||||
$( "#kiwixsearchbox" ).val(ui.item.value);
|
||||
$( "#kiwixsearchform" ).submit();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
/* cybook hack */
|
||||
if (navigator.userAgent.indexOf("bookeen/cybook") != -1) {
|
||||
$("html").addClass("cybook");
|
||||
}
|
||||
|
||||
if ($(window).width() < 520) {
|
||||
var didScroll;
|
||||
var lastScrollTop = 0;
|
||||
|
|
|
@ -1,39 +1,7 @@
|
|||
<link type="text/css" href="{{root}}/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="{{root}}/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="{{root}}/skin/taskbar.css" rel="Stylesheet" />
|
||||
<link type="root" href="{{root}}">
|
||||
<script type="text/javascript" src="{{root}}/skin/jquery-ui/external/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="{{root}}/skin/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script>
|
||||
function htmlDecode(input) {
|
||||
var doc = new DOMParser().parseFromString(input, "text/html");
|
||||
return doc.documentElement.textContent;
|
||||
}
|
||||
var jk = jQuery.noConflict();
|
||||
jk(function() {
|
||||
jk( "#kiwixsearchbox" ).autocomplete({
|
||||
|
||||
source: "{{root}}/suggest?content={{#urlencoded}}{{{content}}}{{/urlencoded}}",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
|
||||
response: function( event, ui ) {
|
||||
for(const item of ui.content) {
|
||||
item.label = htmlDecode(item.label);
|
||||
item.value = htmlDecode(item.value);
|
||||
}
|
||||
},
|
||||
|
||||
select: function(event, ui) {
|
||||
jk( "#kiwixsearchbox" ).val(ui.item.value);
|
||||
jk( "#kiwixsearchform" ).submit();
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
/* cybook hack */
|
||||
if (navigator.userAgent.indexOf("bookeen/cybook") != -1) {
|
||||
jk("html").addClass("cybook");
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="{{root}}/skin/taskbar.js" async></script>
|
||||
|
|
Loading…
Reference in New Issue