diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2013-04-19 22:41:02 -0700 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2013-04-19 22:41:02 -0700 |
commit | 4e97e6e8b9b6b02942f506b930b215540cd1f2a1 (patch) | |
tree | 9e82447101d85d63f486dbad541707a8e3ea47be /js | |
parent | 682536a9e759bf8c17e171bbd75d64c4cb3a308d (diff) | |
parent | b4397510e75fe9c387bec4161769392906c81bd7 (diff) | |
download | wallabag-4e97e6e8b9b6b02942f506b930b215540cd1f2a1.tar.gz wallabag-4e97e6e8b9b6b02942f506b930b215540cd1f2a1.tar.zst wallabag-4e97e6e8b9b6b02942f506b930b215540cd1f2a1.zip |
Merge pull request #61 from Silvus/master
Fixed #36 - Thème dark
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 | }); | ||