diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/poche.js | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/js/poche.js b/js/poche.js index 6bc3c188..d27ecbba 100644 --- a/js/poche.js +++ b/js/poche.js | |||
@@ -27,4 +27,32 @@ function sort_links(view, sort) { | |||
27 | $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) { | 27 | $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) { |
28 | $('#content').html(data); | 28 | $('#content').html(data); |
29 | }); | 29 | }); |
30 | } \ No newline at end of file | 30 | } |
31 | |||
32 | |||
33 | // ---------- Swith light or dark view | ||
34 | function setActiveStyleSheet(title) { | ||
35 | var i, a, main; | ||
36 | for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { | ||
37 | if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { | ||
38 | a.disabled = true; | ||
39 | if(a.getAttribute("title") == title) a.disabled = false; | ||
40 | } | ||
41 | } | ||
42 | } | ||
43 | $('#themeswitch').click(function() { | ||
44 | // we want the dark | ||
45 | if ($('body').hasClass('light-style')) { | ||
46 | setActiveStyleSheet('dark-style'); | ||
47 | $('body').addClass('dark-style'); | ||
48 | $('body').removeClass('light-style'); | ||
49 | $('#themeswitch').text('light'); | ||
50 | // we want the light | ||
51 | } else if ($('body').hasClass('dark-style')) { | ||
52 | setActiveStyleSheet('light-style'); | ||
53 | $('body').addClass('light-style'); | ||
54 | $('body').removeClass('dark-style'); | ||
55 | $('#themeswitch').text('dark'); | ||
56 | } | ||
57 | return false; | ||
58 | }); | ||