Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/264956
Change subject: Fix jslint test and update tests to npm and composer
......................................................................
Fix jslint test and update tests to npm and composer
Change-Id: I828221e27fb385455f93db8e4085bca50462aba0
---
A .jshintignore
A .jshintrc
A Gruntfile.js
M auth.js
A composer.json
A package.json
6 files changed, 85 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialLogin
refs/changes/56/264956/1
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..022b988
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,2 @@
+node_modules
+vendor
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..8a2a10c
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,23 @@
+{
+ // Enforcing
+ "bitwise": true,
+ "eqeqeq": true,
+ "freeze": true,
+ "latedef": true,
+ "noarg": true,
+ "nonew": true,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+
+ // Relaxing
+ "es5": false,
+
+ // Environment
+ "browser": true,
+ "jquery": true,
+
+ "globals": {
+ "mediaWiki": false
+ }
+}
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/auth.js b/auth.js
index 5a9f7fc..b5189e1 100644
--- a/auth.js
+++ b/auth.js
@@ -5,12 +5,15 @@
}
function unlink(profile) {
- $.ajax({
+ jQuery.ajax({
url: '/Special:SocialLogin',
data: {action: 'unlink', profile: profile},
success: function(response) {
- if (response == 'yes') $('#' + profile.replace('@',
'_').replace('.', '_')).remove();
- else alert('Не удалось отсоединить профиль социальной
сети.');
+ if (response == 'yes') {
+ jQuery('#' + profile.replace('@',
'_').replace('.', '_')).remove();
+ } else {
+ alert('Не удалось отсоединить профиль
социальной сети.');
+ }
}
});
}
@@ -20,18 +23,18 @@
var regexS = "[\\#&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
- return (results == null)?"":results[1];
+ return (results === null)?"":results[1];
}
function tryLogin(data, cb) {
var formText = '<form action="" method="post"><input type="hidden"
name="action" value="login" />';
- $.each(data, function(key, value) {
+ jQuery.each(data, function(key, value) {
formText += '<input type="hidden" name="' + key + '" value="' +
value + '" />';
});
formText += '</form>';
- var form = $(formText);
- $('body').append(form);
- $(form).submit();
+ var form = jQuery(formText);
+ jQuery('body').append(form);
+ jQuery(form).submit();
}
function hacking() {
@@ -52,4 +55,4 @@
} catch(e) {
}
}, 50);
-}
\ No newline at end of file
+}
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..1c63f9e
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,10 @@
+{
+ "require-dev": {
+ "jakub-onderka/php-parallel-lint": "0.9.2"
+ },
+ "scripts": {
+ "test": [
+ "parallel-lint . --exclude vendor"
+ ]
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..af588b6
--- /dev/null
+++ b/package.json
@@ -0,0 +1,12 @@
+{
+ "private": true,
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt": "0.4.5",
+ "grunt-cli": "0.1.13",
+ "grunt-contrib-jshint": "0.12.0",
+ "grunt-jsonlint": "1.0.7"
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/264956
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I828221e27fb385455f93db8e4085bca50462aba0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialLogin
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits