aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/js/poche.js
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
commit4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch)
tree6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /tpl/js/poche.js
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'tpl/js/poche.js')
-rw-r--r--tpl/js/poche.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/tpl/js/poche.js b/tpl/js/poche.js
new file mode 100644
index 00000000..97d9911d
--- /dev/null
+++ b/tpl/js/poche.js
@@ -0,0 +1,57 @@
1function toggle_favorite(element, id) {
2 $(element).toggleClass('fav-off');
3 $.ajax ({
4 url: "index.php?action=toggle_fav",
5 data:{id:id}
6 });
7}
8
9function toggle_archive(element, id, view_article) {
10 $(element).toggleClass('archive-off');
11 $.ajax ({
12 url: "index.php?action=toggle_archive",
13 data:{id:id}
14 });
15 var obj = $('#entry-'+id);
16
17 // on vient de la vue de l'article, donc pas de gestion de grille
18 if (view_article != 1) {
19 $('#content').masonry('remove',obj);
20 $('#content').masonry('reloadItems');
21 $('#content').masonry('reload');
22 }
23}
24
25function sort_links(view, sort) {
26 $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) {
27 $('#content').html(data);
28 });
29}
30
31
32// ---------- Swith light or dark view
33function setActiveStyleSheet(title) {
34 var i, a, main;
35 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
36 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
37 a.disabled = true;
38 if(a.getAttribute("title") == title) a.disabled = false;
39 }
40 }
41}
42$('#themeswitch').click(function() {
43 // we want the dark
44 if ($('body').hasClass('light-style')) {
45 setActiveStyleSheet('dark-style');
46 $('body').addClass('dark-style');
47 $('body').removeClass('light-style');
48 $('#themeswitch').text('light');
49 // we want the light
50 } else if ($('body').hasClass('dark-style')) {
51 setActiveStyleSheet('light-style');
52 $('body').addClass('light-style');
53 $('body').removeClass('dark-style');
54 $('#themeswitch').text('dark');
55 }
56 return false;
57});