Start annoying.
[prawokultury.git] / prawokultury / static / js / annoy.js
diff --git a/prawokultury/static/js/annoy.js b/prawokultury/static/js/annoy.js
new file mode 100755 (executable)
index 0000000..78c34e4
--- /dev/null
@@ -0,0 +1,40 @@
+(function($) {
+    $(function() {
+
+
+var have_localstorage;
+try {
+    localStorage.setItem("test", "test");
+    localStorage.removeItem("test");
+    have_localstorage = true;
+} catch(e) {
+    have_localstorage = false;
+}
+
+
+
+$("#annoy-on").click(function(e) {
+    e.preventDefault();
+    $("#annoy").slideDown('fast');
+    $(this).hide();
+    if (have_localstorage) localStorage.removeItem("annoyed2013");
+});
+
+$("#annoy-off").click(function() {
+    $("#annoy").slideUp('fast');
+    $("#annoy-on").show();
+    if (have_localstorage) localStorage["annoyed2013"] = true;
+});
+
+
+if (have_localstorage) {
+    if (!localStorage["annoyed2013"]) {
+        $("#annoy-on").hide();
+        $("#annoy").show();
+    }
+}
+
+
+
+    });
+})(jQuery);