aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/js/custom.js
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2014-12-17 22:44:36 +0100
committerThomas Citharel <tcit@tcit.fr>2014-12-17 22:44:36 +0100
commit2903ffc54fc1f24c0f3f57700eab51a08a96777a (patch)
tree0e4d97562e79a5a3e0f55fa8f70716f7dcb75cf4 /docs/js/custom.js
parent5ea5310ab450035143e2f5637f9fa69773f7879b (diff)
parentc4457fba85d4b564bebde844d3176964d4f252b3 (diff)
downloadwallabag-2903ffc54fc1f24c0f3f57700eab51a08a96777a.tar.gz
wallabag-2903ffc54fc1f24c0f3f57700eab51a08a96777a.tar.zst
wallabag-2903ffc54fc1f24c0f3f57700eab51a08a96777a.zip
Merge branch 'add-html-doc' of https://github.com/wallabag/wallabag into documentation-integration
Diffstat (limited to 'docs/js/custom.js')
-rw-r--r--docs/js/custom.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/docs/js/custom.js b/docs/js/custom.js
new file mode 100644
index 00000000..23578e2e
--- /dev/null
+++ b/docs/js/custom.js
@@ -0,0 +1,65 @@
1$(function () {
2 $('.aj-nav').click(function (e) {
3 e.preventDefault();
4 $(this).parent().siblings().find('ul').slideUp();
5 $(this).next().slideToggle();
6 });
7
8 // Bootstrap Table Class
9 $('table').addClass('table');
10
11 // Responsive menu spinner
12 $('#menu-spinner-button').click(function () {
13 $('#sub-nav-collapse').slideToggle();
14 });
15
16 // Catch browser resize
17 $(window).resize(function () {
18 // Remove transition inline style on large screens
19 if ($(window).width() >= 768)
20 $('#sub-nav-collapse').removeAttr('style');
21 });
22});
23
24//Fix GitHub Ribbon overlapping Scrollbar
25var t = $('#github-ribbon');
26var a = $('article');
27if (t[0] && a[0] && a[0].scrollHeight > $('.right-column').height()) t[0].style.right = '16px';
28
29//Toggle Code Block Visibility
30function toggleCodeBlocks() {
31 var t = localStorage.getItem("toggleCodeStats")
32 t = (t + 1) % 3;
33 localStorage.setItem("toggleCodeStats", t);
34 var a = $('.content-page article');
35 var c = a.children().filter('pre');
36 var d = $('.right-column');
37 if (d.hasClass('float-view')) {
38 d.removeClass('float-view');
39 $('#toggleCodeBlockBtn')[0].innerHTML = "Hide Code Blocks";
40 } else {
41 if (c.hasClass('hidden')) {
42 d.addClass('float-view');
43 c.removeClass('hidden');
44 $('#toggleCodeBlockBtn')[0].innerHTML = "Show Code Blocks Inline";
45 } else {
46 c.addClass('hidden');
47 $('#toggleCodeBlockBtn')[0].innerHTML = "Show Code Blocks";
48 }
49 }
50}
51
52if (localStorage.getItem("toggleCodeStats") >= 0) {
53 var t = localStorage.getItem("toggleCodeStats");
54 if (t == 1) {
55 toggleCodeBlocks();
56 localStorage.setItem("toggleCodeStats", 1);
57 }
58 if (t == 2) {
59 toggleCodeBlocks();
60 toggleCodeBlocks();
61 localStorage.setItem("toggleCodeStats", 2);
62 }
63} else {
64 localStorage.setItem("toggleCodeStats", 0);
65}