Brion VIBBER has submitted this change and it was merged.

Change subject: Added jshintrc and fixed warning
......................................................................


Added jshintrc and fixed warning

Change-Id: I8615914bc5cb292db2a1c7ffa6f22d87c303f158
---
A .jshintignore
A .jshintrc
M wikipedia/assets/abusefilter.js
M wikipedia/assets/bundle.js
M wikipedia/assets/preview.js
D www/.jshintrc
M www/Gruntfile.js
M www/js/sections.js
R www/lib/js/classList.js
9 files changed, 160 insertions(+), 180 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, but someone else must approve
  Brion VIBBER: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..873cd5c
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,2 @@
+www/lib/*
+wikipedia/assets/*
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..d3f1852
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+       "globals": {
+               "console": true,
+        "require": true,
+        "module": true,
+        "marshaller": true
+       },
+
+       "browser": true,
+       "curly": true,
+       "eqeqeq": true,
+       "forin": false,
+       "onevar": false,
+       "trailing": true,
+       "undef" : true,
+       "unused": true,
+       "supernew": true
+}
diff --git a/wikipedia/assets/abusefilter.js b/wikipedia/assets/abusefilter.js
index d82f5c3..5410caa 100644
--- a/wikipedia/assets/abusefilter.js
+++ b/wikipedia/assets/abusefilter.js
@@ -21,7 +21,7 @@
     content.appendChild( warning );
 } );
 
-},{"./bridge":2,"./transformer":5}],2:[function(require,module,exports){
+},{"./bridge":2,"./transformer":4}],2:[function(require,module,exports){
 function Bridge() {
 }
 
@@ -60,6 +60,40 @@
     module.exports.sendMessage( "DOMLoaded", {} );
 };
 },{}],3:[function(require,module,exports){
+var bridge = require("./bridge");
+
+bridge.registerListener( "setDirectionality", function( payload ) {
+    var html = document.getElementsByTagName( "html" )[0];
+    html.setAttribute( "dir", payload.contentDirection );
+    html.classList.add( "content-" + payload.contentDirection );
+    html.classList.add( "ui-" + payload.uiDirection );
+} );
+
+},{"./bridge":2}],4:[function(require,module,exports){
+function Transformer() {
+}
+
+var transforms = {};
+
+Transformer.prototype.register = function( transform, fun ) {
+    if ( transform in transforms ) {
+        transforms[transform].append( fun );
+    } else {
+        transforms[transform] = [ fun ];
+    }
+};
+
+Transformer.prototype.transform = function( transform, element ) {
+    var functions = transforms[transform];
+    for ( var i = 0; i < functions.length; i++ ) {
+        element = functions[i](element);
+    }
+    return element;
+};
+
+module.exports = new Transformer();
+
+},{}],5:[function(require,module,exports){
 /**
  * MIT LICENSCE
  * From: https://github.com/remy/polyfills
@@ -136,38 +170,4 @@
 
 })();
 
-},{}],4:[function(require,module,exports){
-var bridge = require("./bridge");
-
-bridge.registerListener( "setDirectionality", function( payload ) {
-    var html = document.getElementsByTagName( "html" )[0];
-    html.setAttribute( "dir", payload.contentDirection );
-    html.classList.add( "content-" + payload.contentDirection );
-    html.classList.add( "ui-" + payload.uiDirection );
-} );
-
-},{"./bridge":2}],5:[function(require,module,exports){
-function Transformer() {
-}
-
-var transforms = {};
-
-Transformer.prototype.register = function( transform, fun ) {
-    if ( transform in transforms ) {
-        transforms[transform].append( fun );
-    } else {
-        transforms[transform] = [ fun ];
-    }
-};
-
-Transformer.prototype.transform = function( transform, element ) {
-    var functions = transforms[transform];
-    for ( var i = 0; i < functions.length; i++ ) {
-        element = functions[i](element);
-    }
-    return element;
-};
-
-module.exports = new Transformer();
-
-},{}]},{},[2,1,4,3])
\ No newline at end of file
+},{}]},{},[2,1,3,5])
\ No newline at end of file
diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js
index 25f47ca..44c8036 100644
--- a/wikipedia/assets/bundle.js
+++ b/wikipedia/assets/bundle.js
@@ -108,83 +108,6 @@
 } );
 
 },{"./bridge":2}],5:[function(require,module,exports){
-/**
- * MIT LICENSCE
- * From: https://github.com/remy/polyfills
- * FIXME: Don't copy paste libraries, use a dep management system.
- */
-(function () {
-
-if (typeof window.Element === "undefined" || "classList" in 
document.documentElement) return;
-
-var prototype = Array.prototype,
-    push = prototype.push,
-    splice = prototype.splice,
-    join = prototype.join;
-
-function DOMTokenList(el) {
-  this.el = el;
-  // The className needs to be trimmed and split on whitespace
-  // to retrieve a list of classes.
-  var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/);
-  for (var i = 0; i < classes.length; i++) {
-    push.call(this, classes[i]);
-  }
-};
-
-DOMTokenList.prototype = {
-  add: function(token) {
-    if(this.contains(token)) return;
-    push.call(this, token);
-    this.el.className = this.toString();
-  },
-  contains: function(token) {
-    return this.el.className.indexOf(token) != -1;
-  },
-  item: function(index) {
-    return this[index] || null;
-  },
-  remove: function(token) {
-    if (!this.contains(token)) return;
-    for (var i = 0; i < this.length; i++) {
-      if (this[i] == token) break;
-    }
-    splice.call(this, i, 1);
-    this.el.className = this.toString();
-  },
-  toString: function() {
-    return join.call(this, ' ');
-  },
-  toggle: function(token) {
-    if (!this.contains(token)) {
-      this.add(token);
-    } else {
-      this.remove(token);
-    }
-
-    return this.contains(token);
-  }
-};
-
-window.DOMTokenList = DOMTokenList;
-
-function defineElementGetter (obj, prop, getter) {
-    if (Object.defineProperty) {
-        Object.defineProperty(obj, prop,{
-            get : getter
-        });
-    } else {
-        obj.__defineGetter__(prop, getter);
-    }
-}
-
-defineElementGetter(Element.prototype, 'classList', function () {
-  return new DOMTokenList(this);
-});
-
-})();
-
-},{}],6:[function(require,module,exports){
 var bridge = require("./bridge");
 
 bridge.registerListener( "setDirectionality", function( payload ) {
@@ -194,7 +117,7 @@
     html.classList.add( "ui-" + payload.uiDirection );
 } );
 
-},{"./bridge":2}],7:[function(require,module,exports){
+},{"./bridge":2}],6:[function(require,module,exports){
 var bridge = require("./bridge");
 var transformer = require("./transformer");
 
@@ -302,11 +225,11 @@
     return curClosest.getAttribute( "data-id" );
 }
 
-bridge.registerListener( "requestCurrentSection", function( payload ) {
+bridge.registerListener( "requestCurrentSection", function() {
     bridge.sendMessage( "currentSectionResponse", { sectionID: 
getCurrentSection() } );
 } );
 
-},{"./bridge":2,"./transformer":8}],8:[function(require,module,exports){
+},{"./bridge":2,"./transformer":7}],7:[function(require,module,exports){
 function Transformer() {
 }
 
@@ -330,7 +253,7 @@
 
 module.exports = new Transformer();
 
-},{}],9:[function(require,module,exports){
+},{}],8:[function(require,module,exports){
 var bridge = require("./bridge");
 var transformer = require("./transformer");
 
@@ -368,4 +291,81 @@
     return content;
 } );
 
-},{"./bridge":2,"./transformer":8}]},{},[4,8,9,2,1,3,7,6,5])
\ No newline at end of file
+},{"./bridge":2,"./transformer":7}],9:[function(require,module,exports){
+/**
+ * MIT LICENSCE
+ * From: https://github.com/remy/polyfills
+ * FIXME: Don't copy paste libraries, use a dep management system.
+ */
+(function () {
+
+if (typeof window.Element === "undefined" || "classList" in 
document.documentElement) return;
+
+var prototype = Array.prototype,
+    push = prototype.push,
+    splice = prototype.splice,
+    join = prototype.join;
+
+function DOMTokenList(el) {
+  this.el = el;
+  // The className needs to be trimmed and split on whitespace
+  // to retrieve a list of classes.
+  var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/);
+  for (var i = 0; i < classes.length; i++) {
+    push.call(this, classes[i]);
+  }
+};
+
+DOMTokenList.prototype = {
+  add: function(token) {
+    if(this.contains(token)) return;
+    push.call(this, token);
+    this.el.className = this.toString();
+  },
+  contains: function(token) {
+    return this.el.className.indexOf(token) != -1;
+  },
+  item: function(index) {
+    return this[index] || null;
+  },
+  remove: function(token) {
+    if (!this.contains(token)) return;
+    for (var i = 0; i < this.length; i++) {
+      if (this[i] == token) break;
+    }
+    splice.call(this, i, 1);
+    this.el.className = this.toString();
+  },
+  toString: function() {
+    return join.call(this, ' ');
+  },
+  toggle: function(token) {
+    if (!this.contains(token)) {
+      this.add(token);
+    } else {
+      this.remove(token);
+    }
+
+    return this.contains(token);
+  }
+};
+
+window.DOMTokenList = DOMTokenList;
+
+function defineElementGetter (obj, prop, getter) {
+    if (Object.defineProperty) {
+        Object.defineProperty(obj, prop,{
+            get : getter
+        });
+    } else {
+        obj.__defineGetter__(prop, getter);
+    }
+}
+
+defineElementGetter(Element.prototype, 'classList', function () {
+  return new DOMTokenList(this);
+});
+
+})();
+
+},{}]},{},[4,7,8,2,1,3,6,5,9])
\ No newline at end of file
diff --git a/wikipedia/assets/preview.js b/wikipedia/assets/preview.js
index 798f8c2..fc0ff38 100644
--- a/wikipedia/assets/preview.js
+++ b/wikipedia/assets/preview.js
@@ -76,6 +76,24 @@
     module.exports.sendMessage( "DOMLoaded", {} );
 };
 },{}],3:[function(require,module,exports){
+var bridge = require("./bridge");
+
+bridge.registerListener( "displayPreviewHTML", function( payload ) {
+    var content = document.getElementById( "content" );
+    content.innerHTML = payload.html;
+} );
+
+},{"./bridge":2}],4:[function(require,module,exports){
+var bridge = require("./bridge");
+
+bridge.registerListener( "setDirectionality", function( payload ) {
+    var html = document.getElementsByTagName( "html" )[0];
+    html.setAttribute( "dir", payload.contentDirection );
+    html.classList.add( "content-" + payload.contentDirection );
+    html.classList.add( "ui-" + payload.uiDirection );
+} );
+
+},{"./bridge":2}],5:[function(require,module,exports){
 /**
  * MIT LICENSCE
  * From: https://github.com/remy/polyfills
@@ -152,22 +170,4 @@
 
 })();
 
-},{}],4:[function(require,module,exports){
-var bridge = require("./bridge");
-
-bridge.registerListener( "displayPreviewHTML", function( payload ) {
-    var content = document.getElementById( "content" );
-    content.innerHTML = payload.html;
-} );
-
-},{"./bridge":2}],5:[function(require,module,exports){
-var bridge = require("./bridge");
-
-bridge.registerListener( "setDirectionality", function( payload ) {
-    var html = document.getElementsByTagName( "html" )[0];
-    html.setAttribute( "dir", payload.contentDirection );
-    html.classList.add( "content-" + payload.contentDirection );
-    html.classList.add( "ui-" + payload.uiDirection );
-} );
-
-},{"./bridge":2}]},{},[2,1,4,5,3])
\ No newline at end of file
+},{}]},{},[2,1,3,4,5])
\ No newline at end of file
diff --git a/www/.jshintrc b/www/.jshintrc
deleted file mode 100644
index 2af4189..0000000
--- a/www/.jshintrc
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       /* Common */
-
-       // Enforcing
-       "camelcase": true,
-       "curly": true,
-       "eqeqeq": true,
-       "immed": true,
-       "latedef": true,
-       "newcap": true,
-       "noarg": true,
-       "noempty": true,
-       "nonew": true,
-       "trailing": true,
-       "undef": true,
-       "unused": true,
-
-       /* Local */
-
-       // Enforcing
-       "bitwise": true,
-       "forin": false,
-       "regexp": false,
-       "strict": false,
-       // Relaxing
-       "laxbreak": true,
-       "smarttabs": true,
-       "multistr": true,
-       // Environment
-       "browser": true,
-       // Legacy
-       "nomen": true,
-
-       "predef": [
-               "marshaller",
-        "require",
-        "console",
-        "module"
-       ]
-}
diff --git a/www/Gruntfile.js b/www/Gruntfile.js
index ce9212f..17a9e7d 100644
--- a/www/Gruntfile.js
+++ b/www/Gruntfile.js
@@ -8,7 +8,7 @@
         "js/editaction.js",
         "js/sections.js",
         "js/rtlsupport.js",
-        "js/polyfill/classList.js",
+        "lib/js/classList.js",
         "tests/*.js"
     ];
     var allStyleFiles = [
@@ -20,7 +20,7 @@
     ];
     // FIXME: Unconditionally included polyfills. Should be included only for 
Android 2.3
     var oldDroidPolyfills = [
-        "js/polyfill/classList.js"
+        "lib/js/classList.js"
     ];
 
     grunt.initConfig( {
diff --git a/www/js/sections.js b/www/js/sections.js
index c6583ee..be8fbed 100644
--- a/www/js/sections.js
+++ b/www/js/sections.js
@@ -105,6 +105,6 @@
     return curClosest.getAttribute( "data-id" );
 }
 
-bridge.registerListener( "requestCurrentSection", function( payload ) {
+bridge.registerListener( "requestCurrentSection", function() {
     bridge.sendMessage( "currentSectionResponse", { sectionID: 
getCurrentSection() } );
 } );
diff --git a/www/js/polyfill/classList.js b/www/lib/js/classList.js
similarity index 100%
rename from www/js/polyfill/classList.js
rename to www/lib/js/classList.js

-- 
To view, visit https://gerrit.wikimedia.org/r/124552
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8615914bc5cb292db2a1c7ffa6f22d87c303f158
Gerrit-PatchSet: 6
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to