From ea62f4ffebfd23e0e697adc135da0b414d851926 Mon Sep 17 00:00:00 2001
From: Adrian Lang <mail@adrianlang.de>
Date: Tue, 21 Jun 2011 16:19:14 +0200
Subject: [PATCH] Cleanup behaviour.js

  * Add var statement for dw_behaviour
  * Use live instead of click for smb share warnings
---
 lib/scripts/behaviour.js | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js
index 31b82050e..62c20eb0f 100644
--- a/lib/scripts/behaviour.js
+++ b/lib/scripts/behaviour.js
@@ -1,3 +1,6 @@
+/*jslint sloppy: true */
+/*global jQuery, LANG, document, alert */
+
 /**
  * Automatic behaviours
  *
@@ -6,7 +9,7 @@
  * class was found
  */
 
-dw_behaviour = {
+var dw_behaviour = {
 
     init: function(){
         dw_behaviour.focusMarker();
@@ -22,15 +25,16 @@ dw_behaviour = {
      */
     scrollToMarker: function(){
         var obj = jQuery('#scroll__here');
-        if(obj.length) obj[0].scrollIntoView();
+        if(obj.length) {
+            obj[0].scrollIntoView();
+        }
     },
 
     /**
      * Looks for an element with the ID focus__this at sets focus to it
      */
     focusMarker: function(){
-        var obj = jQuery('#focus__this');
-        if(obj.length) obj[0].focus();
+        jQuery('#focus__this').focus();
     },
 
     /**
@@ -78,11 +82,13 @@ dw_behaviour = {
      * @author Michael Klier <chi@chimeric.de>
      */
     checkWindowsShares: function() {
-        if(!LANG['nosmblinks']) return true;
-        if(document.all != null) return true;
+        if(!LANG.nosmblinks || document.all !== null) {
+            // No warning requested or none necessary
+            return;
+        }
 
-        jQuery('a.windows').click(function(){
-            alert(LANG['nosmblinks']);
+        jQuery('a.windows').live('click', function(){
+            alert(LANG.nosmblinks);
         });
     }
 
-- 
GitLab