refactor
[edumed.git] / edumed / static / js / annoy.js
1 (function($) {
2     $(function() {
3
4
5 var have_localstorage;
6 try {
7     localStorage.setItem("test", "test");
8     localStorage.removeItem("test");
9     have_localstorage = true;
10 } catch(e) {
11     have_localstorage = false;
12 }
13
14
15
16 $("#annoy-on").click(function(e) {
17     e.preventDefault();
18     $("#annoy").slideDown('fast');
19     $(this).hide();
20     if (have_localstorage) localStorage.removeItem("annoyed2013");
21 });
22
23 $("#annoy-off").click(function() {
24     $("#annoy").slideUp('fast');
25     $("#annoy-on").show();
26     if (have_localstorage) localStorage["annoyed2013"] = true;
27 });
28
29
30 if (have_localstorage) {
31     if (!localStorage["annoyed2013"]) {
32         $("#annoy-on").hide();
33         $("#annoy").show();
34     }
35 }
36
37
38
39     });
40 })(jQuery);