jenkins-bot has submitted this change and it was merged.

Change subject: Add npm entry point
......................................................................


Add npm entry point

Change-Id: I66262db1cf221bb841db6de68b7970446dbf4c52
---
A .jshintignore
A .jshintrc
A Gruntfile.js
A package.json
M skin/lookup.js
M skin/md5.js
M skin/utf8.js
7 files changed, 78 insertions(+), 11 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..6a6552f
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,24 @@
+{
+       // Enforcing
+       "bitwise": false,
+       "eqeqeq": true,
+       "freeze": true,
+       "latedef": "nofunc",
+       "noarg": true,
+       "nonew": true,
+       "undef": true,
+       "unused": false,
+       "strict": false,
+
+       // Relaxing
+       "es5": false,
+
+       // Environment
+       "browser": true,
+       "jquery": true,
+
+       "globals": {
+               "mediaWiki": false,
+               "location": true
+       }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..f294c83
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,26 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+
+       grunt.initConfig( {
+               jshint: {
+                       options: {
+                               jshintrc: true
+                       },
+                       all: [
+                               '**/*.js',
+                               '!node_modules/**'
+                       ]
+               },
+               jsonlint: {
+                       all: [
+                               '**/*.json',
+                               '!node_modules/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'test', [ 'jshint', 'jsonlint' ] );
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a0b255c
--- /dev/null
+++ b/package.json
@@ -0,0 +1,11 @@
+{
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "grunt": "0.4.5",
+    "grunt-cli": "0.1.13",
+    "grunt-contrib-jshint": "1.0.0",
+    "grunt-jsonlint": "1.0.7"
+  }
+}
diff --git a/skin/lookup.js b/skin/lookup.js
index 6f9a875..00a8d02 100644
--- a/skin/lookup.js
+++ b/skin/lookup.js
@@ -3,7 +3,8 @@
  */
 function goToStatic(depth) {
        var url = getStaticURL(document.getElementById("searchInput").value, 
depth);
-       if (url != "") {
+       var alert;
+       if (url !== "") {
                location = url;
        } else {
                alert("Invalid title");
@@ -15,7 +16,7 @@
  */
 function getStaticURL(text, depth) {
        var pdbk = getPDBK(text);
-       if (pdbk == "") {
+       if (pdbk === "") {
                return "";
        } else {
                var i;
@@ -47,6 +48,8 @@
        // Find the first colon if there is one, use characters after it
        var dbk = pdbk.replace(/^[^:]*:_*(.*)$/, "$1");
        var i, c, dir = "";
+       var cc;
+       var binl2hex;
 
        for (i=0; i < depth; i++) {
                if (i) {
@@ -75,13 +78,15 @@
 function getFriendlyName(name) {
        // Replace illegal characters for Windows paths with underscores
        var friendlyName = name.replace(/[\/\\*?"<>|~]/g, "_");
+       var hex_md5;
+       var _to_utf8;
 
        // Work out lower case form. We assume we're on a system with 
case-insensitive
        // filenames, so unless the case is of a special form, we have to 
disambiguate
        var lowerCase = ucfirst(name.toLowerCase());
 
        // Make it mostly unique
-       if (lowerCase != friendlyName) {
+       if (lowerCase !== friendlyName) {
                friendlyName += "_" + hex_md5(_to_utf8(name)).substring(0, 4);
        }
        // Handle colon specially by replacing it with tilde
diff --git a/skin/md5.js b/skin/md5.js
index 46d2aab..71bdc74 100644
--- a/skin/md5.js
+++ b/skin/md5.js
@@ -31,7 +31,7 @@
  */
 function md5_vm_test()
 {
-  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
+  return hex_md5("abc") === "900150983cd24fb0d6963f7d28e17f72";
 }
 
 /*
diff --git a/skin/utf8.js b/skin/utf8.js
index ea3b890..9de4f11 100644
--- a/skin/utf8.js
+++ b/skin/utf8.js
@@ -42,25 +42,25 @@
   var c, d = "", flag = 0, tmp;
   for (var i = 0; i < s.length; i++) {
     c = s.charCodeAt(i);
-    if (flag == 0) {
-      if ((c & 0xe0) == 0xe0) {
+    if (flag === 0) {
+      if ((c & 0xe0) === 0xe0) {
         flag = 2;
         tmp = (c & 0x0f) << 12;
-      } else if ((c & 0xc0) == 0xc0) {
+      } else if ((c & 0xc0) === 0xc0) {
         flag = 1;
         tmp = (c & 0x1f) << 6;
-      } else if ((c & 0x80) == 0) {
+      } else if ((c & 0x80) === 0) {
         d += s.charAt(i);
       } else {
         flag = 0;
       }
-    } else if (flag == 1) {
+    } else if (flag === 1) {
       flag = 0;
       d += String.fromCharCode(tmp | (c & 0x3f));
-    } else if (flag == 2) {
+    } else if (flag === 2) {
       flag = 3;
       tmp |= (c & 0x3f) << 6;
-    } else if (flag == 3) {
+    } else if (flag === 3) {
       flag = 0;
       d += String.fromCharCode(tmp | (c & 0x3f));
     } else {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66262db1cf221bb841db6de68b7970446dbf4c52
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DumpHTML
Gerrit-Branch: master
Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
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