Paladox has submitted this change and it was merged.
Change subject: Update gruntfile.js
......................................................................
Update gruntfile.js
Change-Id: I5197d91dc46e85eeb6103842691700ec20b4b8c8
---
M .jshintignore
M Gruntfile.js
M js/collapsibleNav.js
M js/collapsibleTabs.js
M js/metrolook.js
M js/metrolook.search.js
M js/vector.js
7 files changed, 83 insertions(+), 84 deletions(-)
Approvals:
Paladox: Looks good to me, approved
diff --git a/.jshintignore b/.jshintignore
index 9836c42..099f69c 100644
--- a/.jshintignore
+++ b/.jshintignore
@@ -1,3 +1,4 @@
node_modules
+vendor
js/overthrow.js
diff --git a/Gruntfile.js b/Gruntfile.js
index 32da573..0d08aa6 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -12,7 +12,10 @@
jshintrc: true
},
all: [
- '*.js'
+ '*.js',
+ '**/*.js',
+ '!node_modules/**',
+ '!js/overthrow.js'
]
},
jscs: {
diff --git a/js/collapsibleNav.js b/js/collapsibleNav.js
index dd62e58..1899f20 100644
--- a/js/collapsibleNav.js
+++ b/js/collapsibleNav.js
@@ -12,7 +12,7 @@
$.cookie(
'vector-nav-' + $element.parent().attr( 'id' ),
isCollapsed,
- { 'expires': 30, 'path': '/' }
+ { expires: 30, path: '/' }
);
$element
@@ -37,20 +37,20 @@
// Left-to-right languages
ltr: {
// Collapsible Nav is broken in Opera < 9.6 and
Konqueror < 4
- opera: [['>=', 9.6]],
- konqueror: [['>=', 4.0]],
+ opera: [ [ '>=', 9.6 ] ],
+ konqueror: [ [ '>=', 4.0 ] ],
blackberry: false,
- ipod: [['>=', 6]],
- iphone: [['>=', 6]],
+ ipod: [ [ '>=', 6 ] ],
+ iphone: [ [ '>=', 6 ] ],
ps3: false
},
// Right-to-left languages
rtl: {
- opera: [['>=', 9.6]],
- konqueror: [['>=', 4.0]],
+ opera: [ [ '>=', 9.6 ] ],
+ konqueror: [ [ '>=', 4.0 ] ],
blackberry: false,
- ipod: [['>=', 6]],
- iphone: [['>=', 6]],
+ ipod: [ [ '>=', 6 ] ],
+ iphone: [ [ '>=', 6 ] ],
ps3: false
}
};
@@ -68,9 +68,9 @@
// Use cookie data to restore preferences of what to show and
hide
$( '#mw-panel > .portal:not(.persistent)' )
.each( function ( i ) {
- var id = $(this).attr( 'id' ),
+ var id = $( this ).attr( 'id' ),
state = $.cookie( 'vector-nav-' + id );
- $(this).find( 'ul:first' ).attr( 'id', id +
'-list' );
+ $( this ).find( 'ul:first' ).attr( 'id', id +
'-list' );
// Add anchor tag to heading for better
accessibility
$( this ).find( 'h5' ).wrapInner(
$( '<a>' )
@@ -88,22 +88,22 @@
( state === null && i < 1 ) ||
( state === null && id === 'p-lang' )
) {
- $(this)
+ $( this )
.addClass( 'expanded' )
.removeClass( 'collapsed' )
.find( '.body' )
.hide() // bug 34450
.show();
- $(this).find( 'h5 > a' )
+ $( this ).find( 'h5 > a' )
.attr( {
'aria-pressed': 'true',
'aria-expanded': 'true'
} );
} else {
- $(this)
+ $( this )
.addClass( 'collapsed' )
.removeClass( 'expanded' );
- $(this).find( 'h5 > a' )
+ $( this ).find( 'h5 > a' )
.attr( {
'aria-pressed': 'false',
'aria-expanded': 'false'
@@ -111,7 +111,7 @@
}
// Re-save cookie
if ( state !== null ) {
- $.cookie( 'vector-nav-' + $(this).attr(
'id' ), state, { 'expires': 30, 'path': '/' } );
+ $.cookie( 'vector-nav-' + $( this
).attr( 'id' ), state, { expires: 30, path: '/' } );
}
} );
@@ -127,22 +127,18 @@
.delegate( '.portal:not(.persistent) > h5', 'keydown',
function ( e ) {
// Make the space and enter keys act as a click
if ( e.which === 13 /* Enter */ || e.which ===
32 /* Space */ ) {
- toggle( $(this) );
+ toggle( $( this ) );
}
} )
.delegate( '.portal:not(.persistent) > h5',
'mousedown', function ( e ) {
if ( e.which !== 3 ) { // Right mouse click
- toggle( $(this) );
- $(this).blur();
+ toggle( $( this ) );
+ $( this ).blur();
}
return false;
} );
- });
-
+ } );
}( mediaWiki, jQuery ) );
-
-
-
/*
*
@@ -150,7 +146,7 @@
*
*
*/
-
+
/**
* Collapsible navigation for Vector
*/
@@ -165,7 +161,7 @@
$.cookie(
'vector-nav-' + $element.parent().attr( 'id' ),
isCollapsed,
- { 'expires': 30, 'path': '/' }
+ { expires: 30, path: '/' }
);
$element
@@ -190,20 +186,20 @@
// Left-to-right languages
ltr: {
// Collapsible Nav is broken in Opera < 9.6 and
Konqueror < 4
- opera: [['>=', 9.6]],
- konqueror: [['>=', 4.0]],
+ opera: [ [ '>=', 9.6 ] ],
+ konqueror: [ [ '>=', 4.0 ] ],
blackberry: false,
- ipod: [['>=', 6]],
- iphone: [['>=', 6]],
+ ipod: [ [ '>=', 6 ] ],
+ iphone: [ [ '>=', 6 ] ],
ps3: false
},
// Right-to-left languages
rtl: {
- opera: [['>=', 9.6]],
- konqueror: [['>=', 4.0]],
+ opera: [ [ '>=', 9.6 ] ],
+ konqueror: [ [ '>=', 4.0 ] ],
blackberry: false,
- ipod: [['>=', 6]],
- iphone: [['>=', 6]],
+ ipod: [ [ '>=', 6 ] ],
+ iphone: [ [ '>=', 6 ] ],
ps3: false
}
};
@@ -221,9 +217,9 @@
// Use cookie data to restore preferences of what to show and
hide
$( '#mw-panel-custom > .portal-custom:not(.persistent)' )
.each( function ( i ) {
- var id = $(this).attr( 'id' ),
+ var id = $( this ).attr( 'id' ),
state = $.cookie( 'vector-nav-' + id );
- $(this).find( 'ul:first' ).attr( 'id', id +
'-list' );
+ $( this ).find( 'ul:first' ).attr( 'id', id +
'-list' );
// Add anchor tag to heading for better
accessibility
$( this ).find( 'h5' ).wrapInner(
$( '<a>' )
@@ -241,22 +237,22 @@
( state === null && i < 1 ) ||
( state === null && id === 'p-lang' )
) {
- $(this)
+ $( this )
.addClass( 'expanded' )
.removeClass( 'collapsed' )
.find( '.body-custom' )
.hide() // bug 34450
.show();
- $(this).find( 'h5 > a' )
+ $( this ).find( 'h5 > a' )
.attr( {
'aria-pressed': 'true',
'aria-expanded': 'true'
} );
} else {
- $(this)
+ $( this )
.addClass( 'collapsed' )
.removeClass( 'expanded' );
- $(this).find( 'h5 > a' )
+ $( this ).find( 'h5 > a' )
.attr( {
'aria-pressed': 'false',
'aria-expanded': 'false'
@@ -264,7 +260,7 @@
}
// Re-save cookie
if ( state !== null ) {
- $.cookie( 'vector-nav-' + $(this).attr(
'id' ), state, { 'expires': 30, 'path': '/' } );
+ $.cookie( 'vector-nav-' + $( this
).attr( 'id' ), state, { expires: 30, path: '/' } );
}
} );
@@ -280,16 +276,15 @@
.delegate( '.portal-custom:not(.persistent) > h5',
'keydown', function ( e ) {
// Make the space and enter keys act as a click
if ( e.which === 13 /* Enter */ || e.which ===
32 /* Space */ ) {
- toggle( $(this) );
+ toggle( $( this ) );
}
} )
.delegate( '.portal-custom:not(.persistent) > h5',
'mousedown', function ( e ) {
if ( e.which !== 3 ) { // Right mouse click
- toggle( $(this) );
- $(this).blur();
+ toggle( $( this ) );
+ $( this ).blur();
}
return false;
} );
- });
-
+ } );
}( mediaWiki, jQuery ) );
diff --git a/js/collapsibleTabs.js b/js/collapsibleTabs.js
index 6de9957..bf5ee1c 100644
--- a/js/collapsibleTabs.js
+++ b/js/collapsibleTabs.js
@@ -4,12 +4,13 @@
( function ( $ ) {
var rtl = $( 'html' ).attr( 'dir' ) === 'rtl';
$.fn.collapsibleTabs = function ( options ) {
+ // Merge options into the defaults
+ var settings = $.extend( {}, $.collapsibleTabs.defaults,
options );
+
// return if the function is called on an empty jquery object
if ( !this.length ) {
return this;
}
- // Merge options into the defaults
- var settings = $.extend( {}, $.collapsibleTabs.defaults,
options );
this.each( function () {
var $el = $( this );
@@ -94,7 +95,7 @@
if ( $( data.collapsedContainer + ' ' +
data.collapsible ).length > 0 &&
data.expandCondition(
$.collapsibleTabs.getSettings( $( data.collapsedContainer ).children(
data.collapsible + ':first' ) ).expandedWidth ) ) {
- //move the element from the dropdown to
the tab
+ // move the element from the dropdown
to the tab
$el.trigger( 'beforeTabExpand' );
$.collapsibleTabs
.moveToExpanded(
data.collapsedContainer + ' ' + data.collapsible + ':first' );
@@ -160,8 +161,8 @@
.css( 'width', '1px' )
.data( 'collapsibleTabsSettings', data )
.animate( { width: expandedWidth + 'px' },
'normal', function () {
- $( this ).attr( 'style', 'display:
block;' );
var data, expContainerSettings;
+ $( this ).attr( 'style', 'display:
block;' );
data = $.collapsibleTabs.getSettings(
$( this ) );
if ( data ) {
expContainerSettings =
$.collapsibleTabs.getSettings( $( data.expandedContainer ) );
diff --git a/js/metrolook.js b/js/metrolook.js
index 2309db3..b80d681 100644
--- a/js/metrolook.js
+++ b/js/metrolook.js
@@ -1,12 +1,12 @@
/* global $ */
var openDiv;
function toggleDiv( divID ) {
- $( '#' + divID ).fadeToggle( 150, function() {
+ $( '#' + divID ).fadeToggle( 150, function () {
openDiv = $( this ).is( ':visible' ) ? divID : null;
} );
}
-$( document ).click( function( e ) {
+$( document ).click( function ( e ) {
if ( !$( e.target ).closest( '#' + openDiv ).length ) {
toggleDiv( openDiv );
}
@@ -20,11 +20,11 @@
return !!(
/mobi|alcatel|Android|android|kindle|webOS|webos|iPhone|iPad|iPod|Tablet|PlayBook|Wii|Silk|BlackBerry|playstation|phone|nintendo|htc[-_]|IEMobile|CriOS|Opera
Mini|opera.m|palm|panasonic|philips|samsung|Mobile|mobile/i.test(
navigator.userAgent ) );
}
-$( function() {
+$( function () {
if ( isTouchDevice() && isMobileUserAgent() ) {
$( '#usermenu > div' ).toggleClass( 'no-js js' );
$( '#usermenu .js div' ).hide();
- $( '#usermenu .js' ).click( function( e ) {
+ $( '#usermenu .js' ).click( function ( e ) {
$( '#usermenu .js div' ).fadeToggle( 150 );
$( '#usermenu' ).toggleClass( 'active' );
e.stopPropagation();
@@ -32,13 +32,13 @@
$( '.actionmenu > div' ).toggleClass( 'no-js js' );
$( '.actionmenu .js div' ).hide();
- $( '.actionmenu .js' ).click( function( e ) {
+ $( '.actionmenu .js' ).click( function ( e ) {
$( '.actionmenu .js div' ).fadeToggle( 150 );
$( '.clicker' ).toggleClass( 'active' );
e.stopPropagation();
} );
- $( document ).click( function() {
+ $( document ).click( function () {
if ( $( '.actionmenu .js div' ).is( ':visible' ) ) {
$( '.actionmenu .js div', this ).fadeOut( 150 );
$( '.clicker' ).removeClass( 'active' );
@@ -51,21 +51,20 @@
} );
} // end mobile-only code
- $( '#hamburgerIcon' ).click( function( e ) {
+ $( '#hamburgerIcon' ).click( function ( e ) {
$( '#mw-panel, #mw-panel-custom' ).fadeToggle( 150 );
$( '.clicker' ).toggleClass( 'active' );
if (
$( '#mw-panel' ).is( ':visible' ) ||
$( '#mw-panel-custom' ).is( ':visible' )
- )
- {
+ ) {
$( '#mw-panel, #mw-panel-custom', this ).fadeOut( 150 );
$( '.clicker' ).removeClass( 'active' );
}
e.stopPropagation();
} );
- $( 'img.editbutton' ).click( function( e ) {
+ $( 'img.editbutton' ).click( function ( e ) {
$( '#left-navigation' ).fadeToggle( 150 );
$( '.clicker' ).toggleClass( 'active' );
if ( $( '#left-navigation' ).is( ':visible' ) ) {
@@ -75,7 +74,7 @@
e.stopPropagation();
} );
- $( 'img.downarrow' ).click( function( e ) {
+ $( 'img.downarrow' ).click( function ( e ) {
toggleDiv( 'bartile' );
if ( $( '#bartile' ).is( ':visible' ) ) {
$( '#bartile', this ).fadeOut( 150 );
@@ -89,7 +88,7 @@
// This improves usability especially on lower-end mobile devices with
// smaller screens.
// Fixes https://phabricator.wikimedia.org/T105785
- $( '#tilegroup' ).not( '.tile-wrapper' ).on( 'click', function() {
+ $( '#tilegroup' ).not( '.tile-wrapper' ).on( 'click', function () {
if ( $( '#bartile' ).is( ':visible' ) ) {
toggleDiv( 'bartile' );
}
diff --git a/js/metrolook.search.js b/js/metrolook.search.js
index a6d9987..47b30e3 100644
--- a/js/metrolook.search.js
+++ b/js/metrolook.search.js
@@ -1,30 +1,30 @@
/* global $ */
function isTouchDevice() {
- return !!('ontouchstart' in window);
+ return !!( 'ontouchstart' in window );
}
/* This is here to fix js issue with iPad (all models) */
-$(function () {
- if( isTouchDevice() ) {
- if(
/mobi|alcatel|Android|android|webOS|webos|iPhone|iPod|Wii|Silk|BlackBerry|playstation|phone|nintendo|htc[-_]|IEMobile|CriOS|Opera
Mini|opera.m|palm|panasonic|philips|samsung|Mobile|mobile/i.test(navigator.userAgent)
) {
+$( function () {
+ if ( isTouchDevice() ) {
+ if (
/mobi|alcatel|Android|android|webOS|webos|iPhone|iPod|Wii|Silk|BlackBerry|playstation|phone|nintendo|htc[-_]|IEMobile|CriOS|Opera
Mini|opera.m|palm|panasonic|philips|samsung|Mobile|mobile/i.test(
navigator.userAgent ) ) {
$( '#p-search' ).hide();
- $( 'img.searchbar' ).click(function(e) {
- $( '#p-search' ).fadeToggle(150);
- $('.clicker').toggleClass( 'active' );
+ $( 'img.searchbar' ).click( function ( e ) {
+ $( '#p-search' ).fadeToggle( 150 );
+ $( '.clicker' ).toggleClass( 'active' );
e.stopPropagation();
- });
- $( 'img.searchbar').click(function() {
- if ($( '#p-search' ).is( ':visible' )) {
- $( '#p-search', this).fadeOut(150);
+ } );
+ $( 'img.searchbar' ).click( function () {
+ if ( $( '#p-search' ).is( ':visible' ) ) {
+ $( '#p-search', this ).fadeOut( 150 );
$( '.clicker' ).removeClass( 'active' );
}
- });
+ } );
}
/* Fix search bar not showing on iPad */
- if( /kindle|iPad|PlayBook|Tablet/i.test(navigator.userAgent) ) {
+ if ( /kindle|iPad|PlayBook|Tablet/i.test( navigator.userAgent )
) {
$( '#p-search' ).show();
}
}
-});
+} );
diff --git a/js/vector.js b/js/vector.js
index 93faf5e..110f64c 100644
--- a/js/vector.js
+++ b/js/vector.js
@@ -3,6 +3,13 @@
*/
jQuery( function ( $ ) {
/**
+ * Collapsible tabs
+ */
+ var $cactions = $( '#p-cactions' ),
+ $tabContainer = $( '#p-views ul' ),
+ originalDropdownWidth = $cactions.width();
+
+ /**
* Focus search input at the very end
*/
$( '#searchInput' ).attr( 'tabindex', $( document ).lastTabIndex() + 1
);
@@ -32,13 +39,6 @@
// As the h3 can already be focused there's no need for
the link to be focusable
.attr( 'tabindex', '-1' );
} );
-
- /**
- * Collapsible tabs
- */
- var $cactions = $( '#p-cactions' ),
- $tabContainer = $( '#p-views ul' ),
- originalDropdownWidth = $cactions.width();
// Bind callback functions to animate our drop down menu in and out
// and then call the collapsibleTabs function on the menu
--
To view, visit https://gerrit.wikimedia.org/r/245486
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5197d91dc46e85eeb6103842691700ec20b4b8c8
Gerrit-PatchSet: 21
Gerrit-Project: mediawiki/skins/Metrolook
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits