]>
Commit | Line | Data |
---|---|---|
a1953dff | 1 | function toggle_favorite(element, id) { |
e46efced | 2 | $(element).toggleClass('fav-off'); |
3 | $.ajax ({ | |
139769aa | 4 | url: "index.php?action=toggle_fav", |
a1953dff | 5 | data:{id:id} |
e46efced | 6 | }); |
7 | } | |
8 | ||
a1953dff | 9 | function toggle_archive(element, id, view_article) { |
c8bbe19b | 10 | $(element).toggleClass('archive-off'); |
e46efced | 11 | $.ajax ({ |
139769aa | 12 | url: "index.php?action=toggle_archive", |
a1953dff | 13 | data:{id:id} |
e46efced | 14 | }); |
b70971e0 | 15 | var obj = $('#entry-'+id); |
b70971e0 | 16 | |
c8bbe19b | 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 | } | |
139769aa | 23 | } |
24 | ||
a1953dff | 25 | function sort_links(view, sort) { |
a1953dff | 26 | $.get('index.php', { view: view, sort: sort, full_head: 'no' }, function(data) { |
27 | $('#content').html(data); | |
28 | }); | |
b4397510 | 29 | } |
30 | ||
31 | ||
32 | // ---------- Swith light or dark view | |
33 | function 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 | }); |