Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/280411
Change subject: Add npm entry point
......................................................................
Add npm entry point
Change-Id: I621aa336c2a09b3256300dfc0b4fc1ca86411876
---
A .jshintignore
A .jshintrc
A Gruntfile.js
A package.json
M skins/ext.headertabs.core.js
5 files changed, 86 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/HeaderTabs
refs/changes/11/280411/1
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..04c3a97
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,23 @@
+{
+ // Enforcing
+ "bitwise": true,
+ "eqeqeq": true,
+ "freeze": true,
+ "latedef": "nofunc",
+ "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..36b6671
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,30 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+ grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+ grunt.loadNpmTasks( 'grunt-jsonlint' );
+ grunt.loadNpmTasks( 'grunt-banana-checker' );
+
+ grunt.initConfig( {
+ jshint: {
+ options: {
+ jshintrc: true
+ },
+ all: [
+ '**/*.js',
+ '!node_modules/**'
+ ]
+ },
+ banana: {
+ all: 'i18n/'
+ },
+ jsonlint: {
+ all: [
+ '**/*.json',
+ '!node_modules/**'
+ ]
+ }
+ } );
+
+ grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
+ grunt.registerTask( 'default', 'test' );
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ec97d7b
--- /dev/null
+++ b/package.json
@@ -0,0 +1,12 @@
+{
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt": "0.4.5",
+ "grunt-cli": "0.1.13",
+ "grunt-banana-checker": "0.4.0",
+ "grunt-contrib-jshint": "1.0.0",
+ "grunt-jsonlint": "1.0.7"
+ }
+}
diff --git a/skins/ext.headertabs.core.js b/skins/ext.headertabs.core.js
index 4d68848..b93108a 100644
--- a/skins/ext.headertabs.core.js
+++ b/skins/ext.headertabs.core.js
@@ -9,6 +9,8 @@
* @author Olivier Beaton
*/
+var tabName;
+
function tabNameEscape(tabName) {
tabName = escape( tabName );
// For some reason, the JS escape() function doesn't handle
@@ -21,7 +23,7 @@
return tabName;
}
-var $tabs = $("#headertabs").tabs();
+var $tabs = jQuery("#headertabs").tabs();
// delete the rule hiding unselected tabs
var sheets = document.styleSheets;
@@ -46,13 +48,13 @@
* Get links to tabs in Table of Contents to work.
* @author Chad Catlett
*/
-$(document).ready(function(){
- $(".toc ul a").each(function(){
- $(this).click(function() {
+jQuery(document).ready(function(){
+ jQuery(".toc ul a").each(function(){
+ jQuery(this).click(function() {
// Don't escape #'s for our entries. Copied from:
//
http://totaldev.com/content/escaping-characters-get-valid-jquery-id
var escapedHash =
this.hash.replace(/([;&,\.\+\*\~':"\!\^$%@\[\]\(\)=>\|])/g, '\\$1');
- var tabId =
$(escapedHash).closest('.ui-tabs-panel').attr('id');
+ var tabId =
jQuery(escapedHash).closest('.ui-tabs-panel').attr('id');
$tabs.tabs('select', tabNameEscape(tabId));
});
});
@@ -63,14 +65,14 @@
var curHash = window.location.hash;
if ( curHash.indexOf( "#tab=" ) == 0 ) {
// remove the fragment identifier, we're using it for the name of the
tab.
- var tabName = curHash.replace( "#tab=", "" );
+ tabName = curHash.replace( "#tab=", "" );
$tabs.tabs('select', tabName);
} else if (curHash != '') {
/* select tab in a fragment
thanks kboudloche, Alphos
http://forum.jquery.com/topic/jquery-ui-tabs-create-an-anchor-to-content-within-tab#14737000001187015
*/
- var tabName = $(curHash).closest('.ui-tabs-panel').attr('id');
+ tabName = jQuery(curHash).closest('.ui-tabs-panel').attr('id');
$tabs.tabs('select', tabNameEscape(tabName));
}
@@ -82,7 +84,7 @@
}
if (hash != '') {
- section = $(hash).attr('class');
+ section = jQuery(hash).attr('class');
var s = section.indexOf('section-')+8;
section = section.substring(s, s+section.substring(s).indexOf('
'));
if (section != 0) {
@@ -96,31 +98,31 @@
section = '';
}
//
http://wiki.org/wiki/index.php?title=User_talk:Finlay&action=edit§ion=1
- var $anchor = $('#edittab').find('a');
- $anchor.attr('href',
mw.config.get("wgScript")+'?title='+mw.config.get("wgPageName")+'&action=edit'+section);
+ var $anchor = jQuery('#edittab').find('a');
+ $anchor.attr('href',
mediaWiki.config.get("wgScript")+'?title='+mediaWiki.config.get("wgPageName")+'&action=edit'+section);
}
// page load behaviour
-if (mw.config.get("wgHeaderTabsEditTabLink")) {
+if (mediaWiki.config.get("wgHeaderTabsEditTabLink")) {
tabEditTabLink(window.location.hash);
}
// only fires when the user clicks on a tab, not on page load
$tabs.bind('tabsshow', function(event, ui) {
// make the url show the current tab name for bookmarks
- if (mw.config.get("wgHeaderTabsUseHistory")) {
- window.location.hash = '#tab='+ui.tab.hash.slice(1);
+ if (mediaWiki.config.get( "wgHeaderTabsUseHistory" ) ) {
+ window.location.hash = '#tab='+ui.tab.hash.slice( 1 );
}
- if (mw.config.get("wgHeaderTabsEditTabLink")) {
+ if (mediaWiki.config.get( "wgHeaderTabsEditTabLink" ) ) {
tabEditTabLink(ui.tab.hash);
}
-});
+} );
/* click a tab parserhook link */
-$(".tabLink").click( function() {
- var tabName = $(this).attr('href').replace('#tab=', '');
+jQuery( ".tabLink" ).click( function () {
+ tabName = jQuery( this ).attr( 'href' ).replace( '#tab=', '' );
var tabIndex = wgHeaderTabsTabIndexes[tabName];
- $tabs.tabs('select', tabIndex ); //tabNameEscape(href));
+ $tabs.tabs( 'select', tabIndex ); //tabNameEscape(href));
return false;
} );
--
To view, visit https://gerrit.wikimedia.org/r/280411
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I621aa336c2a09b3256300dfc0b4fc1ca86411876
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/HeaderTabs
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits