mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-23 03:52:35 -04:00
Switch caret to image and move JS to separate file
This commit is contained in:
parent
5b612e67bd
commit
7db7d2a2ab
BIN
static/server/caret.png
Normal file
BIN
static/server/caret.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -40,6 +40,7 @@
|
|||||||
}
|
}
|
||||||
.book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }
|
.book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }
|
||||||
</style>
|
</style>
|
||||||
|
<script type="text/javascript" src="__ROOT_LOCATION__/skin/taskbar.js" async></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="kiwix">
|
<body class="kiwix">
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@
|
|||||||
jk("html").addClass("cybook");
|
jk("html").addClass("cybook");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/javascript" src="__ROOT_LOCATION__/skin/taskbar.js" async></script>
|
@ -19,6 +19,8 @@ jquery-ui/jquery-ui.theme.min.css
|
|||||||
jquery-ui/jquery-ui.min.css
|
jquery-ui/jquery-ui.min.css
|
||||||
home.html.tmpl
|
home.html.tmpl
|
||||||
include.html.part
|
include.html.part
|
||||||
|
caret.png
|
||||||
|
taskbar.js
|
||||||
taskbar.css
|
taskbar.css
|
||||||
taskbar.html.part
|
taskbar.html.part
|
||||||
global_taskbar.html.part
|
global_taskbar.html.part
|
||||||
|
@ -52,16 +52,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#button_show_toggle:not(:checked)~label:after {
|
|
||||||
content: '⌃';
|
|
||||||
transform: rotate(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
#button_show_toggle:checked~label:after {
|
|
||||||
content: '⌃';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#button_show_toggle:checked~label~.kiwix_button_cont,
|
#button_show_toggle:checked~label~.kiwix_button_cont,
|
||||||
#button_show_toggle:checked~label~.kiwix_button_cont>a {
|
#button_show_toggle:checked~label~.kiwix_button_cont>a {
|
||||||
display: block;
|
display: block;
|
||||||
@ -71,12 +61,18 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
label[for="button_show_toggle"]:after {
|
label[for="button_show_toggle"] {
|
||||||
transition: 0.1s;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 30px;
|
height: 26px;
|
||||||
line-height: 21px;
|
}
|
||||||
vertical-align: middle;
|
|
||||||
|
label[for="button_show_toggle"] img {
|
||||||
|
transition: 0.1s;
|
||||||
|
height: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#button_show_toggle:checked~label img {
|
||||||
|
transform: rotate(-180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
label[for="button_show_toggle"],
|
label[for="button_show_toggle"],
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<input type="checkbox" id="button_show_toggle">
|
<input type="checkbox" id="button_show_toggle">
|
||||||
<label for="button_show_toggle"></label>
|
<label for="button_show_toggle"><img src="__ROOT_LOCATION__/skin/caret.png" alt=""></label>
|
||||||
<div class="kiwix_button_cont">
|
<div class="kiwix_button_cont">
|
||||||
<a id="kiwix_serve_taskbar_library_button" href="__ROOT_LOCATION__/"><button>🏠</button></a>
|
<a id="kiwix_serve_taskbar_library_button" href="__ROOT_LOCATION__/"><button>🏠</button></a>
|
||||||
<a id="kiwix_serve_taskbar_home_button" href="__ROOT_LOCATION__/__CONTENT__/"><button>__ZIM_TITLE__</button></a>
|
<a id="kiwix_serve_taskbar_home_button" href="__ROOT_LOCATION__/__CONTENT__/"><button>__ZIM_TITLE__</button></a>
|
||||||
@ -20,53 +20,3 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<div style="display: block; height: 5em;"></div>
|
<div style="display: block; height: 5em;"></div>
|
||||||
<script>
|
|
||||||
(function ($) {
|
|
||||||
if ($(window).width() < 520) {
|
|
||||||
var didScroll;
|
|
||||||
var lastScrollTop = 0;
|
|
||||||
var delta = 5;
|
|
||||||
// on scroll, let the interval function know the user has scrolled
|
|
||||||
$(window).scroll(function (event) {
|
|
||||||
didScroll = true;
|
|
||||||
});
|
|
||||||
// run hasScrolled() and reset didScroll status
|
|
||||||
setInterval(function () {
|
|
||||||
if (didScroll) {
|
|
||||||
hasScrolled();
|
|
||||||
didScroll = false;
|
|
||||||
}
|
|
||||||
}, 250);
|
|
||||||
function hasScrolled() {
|
|
||||||
var st = $(this).scrollTop();
|
|
||||||
|
|
||||||
// Make sure they scroll more than delta
|
|
||||||
if (Math.abs(lastScrollTop - st) <= delta)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// If they scrolled down and are past the navbar, add class .nav-up.
|
|
||||||
// This is necessary so you never see what is "behind" the navbar.
|
|
||||||
if (st > lastScrollTop) {
|
|
||||||
// Scroll Down
|
|
||||||
$('#kiwixtoolbar').css({ top: '-100%' });
|
|
||||||
} else {
|
|
||||||
// Scroll Up
|
|
||||||
$('#kiwixtoolbar').css({ top: '0' });
|
|
||||||
}
|
|
||||||
|
|
||||||
lastScrollTop = st;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#kiwixsearchbox').on({
|
|
||||||
focus: function(){
|
|
||||||
$('.kiwix_searchform').addClass('full_width');
|
|
||||||
$('label[for="button_show_toggle"], .kiwix_button_cont').addClass('searching');
|
|
||||||
},
|
|
||||||
blur: function(){
|
|
||||||
$('.kiwix_searchform').removeClass('full_width');
|
|
||||||
$('label[for="button_show_toggle"], .kiwix_button_cont').removeClass('searching');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
</script>
|
|
49
static/server/taskbar.js
Normal file
49
static/server/taskbar.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
(function ($) {
|
||||||
|
if ($(window).width() < 520) {
|
||||||
|
var didScroll;
|
||||||
|
var lastScrollTop = 0;
|
||||||
|
var delta = 5;
|
||||||
|
// on scroll, let the interval function know the user has scrolled
|
||||||
|
$(window).scroll(function (event) {
|
||||||
|
didScroll = true;
|
||||||
|
});
|
||||||
|
// run hasScrolled() and reset didScroll status
|
||||||
|
setInterval(function () {
|
||||||
|
if (didScroll) {
|
||||||
|
hasScrolled();
|
||||||
|
didScroll = false;
|
||||||
|
}
|
||||||
|
}, 250);
|
||||||
|
function hasScrolled() {
|
||||||
|
var st = $(this).scrollTop();
|
||||||
|
|
||||||
|
// Make sure they scroll more than delta
|
||||||
|
if (Math.abs(lastScrollTop - st) <= delta)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If they scrolled down and are past the navbar, add class .nav-up.
|
||||||
|
// This is necessary so you never see what is "behind" the navbar.
|
||||||
|
if (st > lastScrollTop) {
|
||||||
|
// Scroll Down
|
||||||
|
$('#kiwixtoolbar').css({ top: '-100%' });
|
||||||
|
} else {
|
||||||
|
// Scroll Up
|
||||||
|
$('#kiwixtoolbar').css({ top: '0' });
|
||||||
|
}
|
||||||
|
|
||||||
|
lastScrollTop = st;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#kiwixsearchbox').on({
|
||||||
|
focus: function () {
|
||||||
|
$('.kiwix_searchform').addClass('full_width');
|
||||||
|
$('label[for="button_show_toggle"], .kiwix_button_cont').addClass('searching');
|
||||||
|
},
|
||||||
|
blur: function () {
|
||||||
|
$('.kiwix_searchform').removeClass('full_width');
|
||||||
|
$('label[for="button_show_toggle"], .kiwix_button_cont').removeClass('searching');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})(jQuery);
|
Loading…
x
Reference in New Issue
Block a user