[MediaWiki-commits] [Gerrit] Initial commit. - change (mediawiki...RevisionSlider)
WMDE-leszek has submitted this change and it was merged. Change subject: Initial commit. .. Initial commit. This turns the prototype code of the Revision Slider into a MediaWiki extension. With this extension enabled the slider should appear on diff pages already but it won't actually show diffs when adjusting the slider pointers. Things that changed so far in the prototype JS code: - pulled out the rainbow function and made it use Math.floor instead of the ~~ binary operator - pulled out the API request that fetches the revisions into its own module - cleaned up and documented some parts of the code The code is still very much WIP and JSCS still has a couple of complaints. Bug: T132576 Change-Id: I2e22365f3b93a76d5b8d3997242b5fed996c6d78 --- A .gitignore A .jscsrc A .jshintignore A .jshintrc A Gruntfile.js A RevisionSlider.hooks.php A RevisionSlider.php A composer.json A extension.json A i18n/en.json A i18n/qqq.json A modules/ext.RevisionSlider.css A modules/ext.RevisionSlider.fetchRevisions.js A modules/ext.RevisionSlider.init.js A modules/ext.RevisionSlider.rainbow.js A package.json A phpcs.xml A tests/RevisionSlider.test.js A tests/RevisionSlider.test.php 19 files changed, 702 insertions(+), 0 deletions(-) Approvals: WMDE-Fisch: Verified; Looks good to me, but someone else must approve WMDE-leszek: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/.gitignore b/.gitignore new file mode 100644 index 000..fbc2c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea/ +composer.lock +node_modules/ +vendor/ diff --git a/.jscsrc b/.jscsrc new file mode 100755 index 000..a031ea4 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,3 @@ +{ + "preset": "wikimedia" +} \ No newline at end of file diff --git a/.jshintignore b/.jshintignore new file mode 100755 index 000..b512c09 --- /dev/null +++ b/.jshintignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100755 index 000..69882aa --- /dev/null +++ b/.jshintrc @@ -0,0 +1,22 @@ +{ + // Enforcing + "bitwise": true, + "eqeqeq": true, + "es3": true, + "latedef": true, + "noarg": true, + "nonew": true, + "undef": true, + "unused": true, + "strict": false, + + // Environment + "browser": true, + + "globals": { + "mw": false, + "$": false, + "mediaWiki": false, + "jQuery": false + } +} diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100755 index 000..56ff218 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,35 @@ +/*jshint node:true */ +module.exports = function ( grunt ) { + grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'grunt-jsonlint' ); + grunt.loadNpmTasks( 'grunt-banana-checker' ); + grunt.loadNpmTasks( 'grunt-jscs' ); + + grunt.initConfig( { + jshint: { + options: { + jshintrc: true + }, + all: [ + '*.js', + 'modules/**/*.js' + ] + }, + jscs: { + src: '<%= jshint.all %>' + }, + banana: { + all: 'i18n/' + }, + jsonlint: { + all: [ + '*.json', + '**/*.json', + '!node_modules/**' + ] + } + } ); + + grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); + grunt.registerTask( 'default', 'test' ); +}; diff --git a/RevisionSlider.hooks.php b/RevisionSlider.hooks.php new file mode 100755 index 000..0efe5a3 --- /dev/null +++ b/RevisionSlider.hooks.php @@ -0,0 +1,20 @@ +getContext()->getRequest() ) ) { + $out->addModules( 'ext.RevisionSlider.init' ); + } + } + + private static function isRevisionPage( WebRequest $request ) { + return $request->getVal( 'action' ) === 'history' || $request->getVal( 'type' ) === 'revision'; + } +} diff --git a/RevisionSlider.php b/RevisionSlider.php new file mode 100644 index 000..6df2e0a --- /dev/null +++ b/RevisionSlider.php @@ -0,0 +1,36 @@ + [ + 'modules/ext.RevisionSlider.init.js', + ], + 'styles' => [ + 'modules/ext.RevisionSlider.css', + ], + 'dependencies' => [ + 'ext.RevisionSlider.rainbow', + 'ext.RevisionSlider.fetchRevisions', + ], + + 'localBasePath' => __DIR__, +]; + +$wgResourceModules['ext.RevisionSlider.rainbow'] = [ + 'scripts' => [ + 'modules/ext.RevisionSlider.rainbow.js',
[MediaWiki-commits] [Gerrit] Initial commit. - change (mediawiki...RevisionSlider)
Jakob has uploaded a new change for review. https://gerrit.wikimedia.org/r/284173 Change subject: Initial commit. .. Initial commit. This turns the prototype code of the Revision Slider into a MediaWiki extension. With this extension enabled the slider should appear on diff pages already but it won't actually show diffs when adjusting the slider pointers. Things that changed so far in the prototype JS code: - pulled out the rainbow function and made it use Math.floor instead of the ~~ binary operator - pulled out the API request that fetches the revisions into its own module - cleaned up and documented some parts of the code The code is still very much WIP and JSCS still has a couple of complaints. Bug: T132576 Change-Id: I2e22365f3b93a76d5b8d3997242b5fed996c6d78 --- A .gitignore A .jscsrc A .jshintignore A .jshintrc A Gruntfile.js A RevisionSlider.hooks.php A RevisionSlider.php A composer.json A extension.json A i18n/en.json A i18n/qqq.json A modules/ext.RevisionSlider.css A modules/ext.RevisionSlider.fetchRevisions.js A modules/ext.RevisionSlider.init.js A modules/ext.RevisionSlider.rainbow.js A package.json A phpcs.xml A tests/RevisionSlider.test.js A tests/RevisionSlider.test.php 19 files changed, 688 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RevisionSlider refs/changes/73/284173/1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000..fbc2c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea/ +composer.lock +node_modules/ +vendor/ diff --git a/.jscsrc b/.jscsrc new file mode 100755 index 000..a031ea4 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,3 @@ +{ + "preset": "wikimedia" +} \ No newline at end of file diff --git a/.jshintignore b/.jshintignore new file mode 100755 index 000..b512c09 --- /dev/null +++ b/.jshintignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100755 index 000..69882aa --- /dev/null +++ b/.jshintrc @@ -0,0 +1,22 @@ +{ + // Enforcing + "bitwise": true, + "eqeqeq": true, + "es3": true, + "latedef": true, + "noarg": true, + "nonew": true, + "undef": true, + "unused": true, + "strict": false, + + // Environment + "browser": true, + + "globals": { + "mw": false, + "$": false, + "mediaWiki": false, + "jQuery": false + } +} diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100755 index 000..56ff218 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,35 @@ +/*jshint node:true */ +module.exports = function ( grunt ) { + grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'grunt-jsonlint' ); + grunt.loadNpmTasks( 'grunt-banana-checker' ); + grunt.loadNpmTasks( 'grunt-jscs' ); + + grunt.initConfig( { + jshint: { + options: { + jshintrc: true + }, + all: [ + '*.js', + 'modules/**/*.js' + ] + }, + jscs: { + src: '<%= jshint.all %>' + }, + banana: { + all: 'i18n/' + }, + jsonlint: { + all: [ + '*.json', + '**/*.json', + '!node_modules/**' + ] + } + } ); + + grunt.registerTask( 'test', [ 'jshint', 'jscs', 'jsonlint', 'banana' ] ); + grunt.registerTask( 'default', 'test' ); +}; diff --git a/RevisionSlider.hooks.php b/RevisionSlider.hooks.php new file mode 100755 index 000..0efe5a3 --- /dev/null +++ b/RevisionSlider.hooks.php @@ -0,0 +1,20 @@ +getContext()->getRequest() ) ) { + $out->addModules( 'ext.RevisionSlider.init' ); + } + } + + private static function isRevisionPage( WebRequest $request ) { + return $request->getVal( 'action' ) === 'history' || $request->getVal( 'type' ) === 'revision'; + } +} diff --git a/RevisionSlider.php b/RevisionSlider.php new file mode 100644 index 000..6df2e0a --- /dev/null +++ b/RevisionSlider.php @@ -0,0 +1,36 @@ + [ + 'modules/ext.RevisionSlider.init.js', + ], + 'styles' => [ + 'modules/ext.RevisionSlider.css', + ], + 'dependencies' => [ + 'ext.RevisionSlider.rainbow', + 'ext.RevisionSlider.fetchRevisions', + ], + + 'localBasePath' => __DIR__, +]; + +$wgResourceModules['ext.RevisionSlider.rainbow'] = [ + 'scripts' => [ + 'modules/ext.RevisionSlider.rainbow.js', + ], + 'localBa