]>
Commit | Line | Data |
---|---|---|
1 | function 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 | ||
9 | function 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 | ||
25 | function sort_links(view, sort) { | |
26 | //$('#content').load('index.php', { view: view, sort: sort, full_head: 'no' } ); | |
27 | $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) { | |
28 | $('#content').html(data); | |
29 | }); | |
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 | }); |