Display a warning to the user if they're viewing old versions of the
[exim-website.git] / templates / web / doc / chapter.js
index 1e81a848afef053a3bab27405caeb19e37f11eaa..add4bd3184415e1a0b2102a25889491050cd97b5 100644 (file)
@@ -1,3 +1,17 @@
+// Warnings about reading old version of documentation
+(function ($) {
+    if( $.grep( document.cookie.split(/\s*;\s*/), function(a){return a === 'old_version_warning_removed=true' ? true : false }).length === 0 ){
+        $('#old_version_warning')
+           .show()
+           .find('span.closebar a')
+               .click(function(e){
+                    $('#old_version_warning').remove();
+                    document.cookie="old_version_warning_removed=true";
+                    e.preventDefault();
+                });
+    }
+})(jQuery);
+
 // Sidebar table of contents
 (function ($) {
 
@@ -47,7 +61,7 @@
             $ul.removeClass('hidden').css('visibility', 'hidden').appendTo('#toc').css('left', '-' + $ul.width() + 'px').css('visibility', 'visible');
             $('#toc > img').mousedown(click_func);
             $('#toc > ul').click(click_func);
-            $('#toc a').click(function (e) {
+            $('#toc, #toc a').click(function (e) {
                 e.stopPropagation()
             });
         });