From 2b242db0ae77c88f7e437ca7c30ef80aefb80f9e Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Mon, 2 Mar 2015 12:53:02 -0500 Subject: [PATCH] Build: Updated JSCS and fixed code style errors --- .jscsrc | 9 +- Gruntfile.coffee | 2 + package.json | 2 +- src/core/helpers.js | 30 +- src/core/wb.js | 32 +- src/i18n/base.js | 2 +- src/other/feedback/demo/feedback.js | 6 +- src/other/feedback/test.js | 76 +- .../tablevalidator/demo/tablevalidator.js | 4 +- src/other/wamethod/demo/wamethod.js | 10 +- src/plugins/ajax-fetch/ajax-fetch.js | 16 +- src/plugins/cal-events/cal-events.js | 22 +- src/plugins/calendar/calendar.js | 24 +- src/plugins/charts/charts.js | 24 +- .../collapsible-alerts/collapsible-alerts.js | 10 +- .../country-content/country-content.js | 12 +- src/plugins/country-content/test.js | 36 +- src/plugins/data-ajax/data-ajax.js | 12 +- src/plugins/data-ajax/test.js | 118 ++-- src/plugins/data-inview/data-inview.js | 16 +- src/plugins/data-inview/demo/data-inview.js | 8 +- src/plugins/data-inview/test.js | 116 ++-- src/plugins/data-picture/data-picture.js | 8 +- src/plugins/data-picture/test.js | 74 +- src/plugins/deps/geomap-lib.js | 214 +++--- src/plugins/deps/tableparser.js | 648 +++++++++--------- src/plugins/equalheight/equalheight.js | 4 +- src/plugins/equalheight/test.js | 86 +-- src/plugins/favicon/favicon.js | 6 +- src/plugins/favicon/test.js | 64 +- src/plugins/feeds/feeds.js | 28 +- src/plugins/feeds/test.js | 56 +- src/plugins/footnotes/footnotes.js | 6 +- src/plugins/formvalid/formvalid.js | 20 +- src/plugins/geomap/demo/client_functions.js | 10 +- src/plugins/geomap/geomap.js | 8 +- src/plugins/lightbox/demo/lightbox.js | 16 +- src/plugins/lightbox/lightbox.js | 28 +- src/plugins/menu/menu.js | 62 +- src/plugins/multimedia/multimedia.js | 94 +-- src/plugins/navcurrent/navcurrent.js | 4 +- src/plugins/overlay/demo/overlay.js | 6 +- src/plugins/overlay/overlay.js | 18 +- src/plugins/prettify/prettify.js | 8 +- src/plugins/prettify/test.js | 82 +-- src/plugins/resize/resize.js | 4 +- .../session-timeout/session-timeout.js | 26 +- src/plugins/session-timeout/test.js | 78 +-- src/plugins/share/share.js | 8 +- src/plugins/tables/tables.js | 18 +- src/plugins/tabs/tabs.js | 68 +- src/plugins/texthighlight/test.js | 48 +- src/plugins/texthighlight/texthighlight.js | 8 +- src/plugins/toggle/test.js | 224 +++--- src/plugins/toggle/toggle.js | 26 +- src/plugins/twitter/test.js | 22 +- src/plugins/twitter/twitter.js | 6 +- src/plugins/wb-disable/disable.js | 8 +- src/plugins/wb-focus/focus.js | 12 +- src/plugins/zebra/zebra.js | 14 +- src/polyfills/datalist/datalist.js | 26 +- .../datalist/demo/datalist_dynamic.js | 12 +- src/polyfills/datepicker/datepicker.js | 18 +- src/polyfills/details/details.js | 6 +- src/polyfills/jawsariafixes/jawsariafixes.js | 4 +- src/polyfills/meter/demo/meter.js | 6 +- src/polyfills/meter/meter.js | 10 +- src/polyfills/progress/demo/progress.js | 6 +- src/polyfills/progress/progress.js | 12 +- src/polyfills/slider/demo/slider.js | 10 +- src/polyfills/slider/slider_wrapper.js | 10 +- src/polyfills/svg/svg.js | 4 +- src/test.js | 18 +- theme/theme.js | 6 +- 74 files changed, 1425 insertions(+), 1430 deletions(-) diff --git a/.jscsrc b/.jscsrc index 9b8ac78cbe6..0622e4fca4e 100644 --- a/.jscsrc +++ b/.jscsrc @@ -7,12 +7,5 @@ // Additional preset tightening "requireBlocksOnNewline": true, "requireSpaceBeforeBlockStatements": true, - "disallowMixedSpacesAndTabs": true, - "excludeFiles": [ - "node_modules/**", - "dist/**", - "lib/**", - "src/polyfills/slider/slider.js", - "src/polyfills/events/mobile.js" - ] + "disallowMixedSpacesAndTabs": true } diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 5c676cba3ad..2292c3cec09 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1144,6 +1144,8 @@ module.exports = (grunt) -> src: [ "<%= jshint.all.src %>" + "!src/polyfills/slider/slider.js", + "!src/polyfills/events/mobile.js" ] connect: diff --git a/package.json b/package.json index d9b7da5c492..6342a9048bd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "grunt-html": "^1.4.0", "grunt-i18n-csv": "^0.1.0", "grunt-imagine": "^0.3.4", - "grunt-jscs": "^0.7.1", + "grunt-jscs": "^1.5.0", "grunt-mocha": "~0.4.1", "grunt-modernizr": "~0.5.2", "grunt-sass": "^0.14.1", diff --git a/src/core/helpers.js b/src/core/helpers.js index 9d2ea70d85d..5e12977daf3 100644 --- a/src/core/helpers.js +++ b/src/core/helpers.js @@ -5,7 +5,7 @@ * @author WET Community * Credits: http://kaibun.net/blog/2013/04/19/a-fully-fledged-coffeescript-boilerplate-for-jquery-plugins/ */ -(function( $, wb ) { +( function( $, wb ) { wb.getData = function( element, dataName ) { var elm = !element.jquery ? element : element[ 0 ], dataAttr = elm.getAttribute( "data-" + dataName ), @@ -22,9 +22,9 @@ return dataObj; }; -})( jQuery, wb ); +} )( jQuery, wb ); -(function( wb ) { +( function( wb ) { "use strict"; // Escapes the characters in a string for use in a jQuery selector @@ -1094,16 +1094,16 @@ * Originally from http://stackoverflow.com/a/2117523/455535 */ wb.guid = function() { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function( replacementChar ) { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( /[xy]/g, function( replacementChar ) { var rand = Math.random() * 16 | 0, newChar = replacementChar === "x" ? rand : ( rand & 0x3 | 0x8 ); - return newChar.toString(16); - }); + return newChar.toString( 16 ); + } ); }; -})( wb ); +} )( wb ); -(function( $, undef ) { +( function( $, undef ) { "use strict"; var methods, @@ -1156,12 +1156,12 @@ } }; -})( jQuery ); +} )( jQuery ); /* :focusable and :tabable jQuery helper expressions - https://github.com/jquery/jquery-ui/blob/24756a978a977d7abbef5e5bce403837a01d964f/ui/jquery.ui.core.js */ -(function( $ ) { +( function( $ ) { "use strict"; function focusable( element, isTabIndexNotNaN, visibility ) { @@ -1195,14 +1195,14 @@ return $.expr.filters.visible( element ) && !$( element ) .parents( ) .addBack( ) - .filter(function() { + .filter( function() { return $.css( this, "visibility" ) === "hidden"; - }) + } ) .length; } $.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? $.expr.createPseudo(function(dataName ) { + data: $.expr.createPseudo ? $.expr.createPseudo( function( dataName ) { return function( elem ) { return !!$.data( elem, dataName ); }; @@ -1223,6 +1223,6 @@ isTabIndexNaN = isNaN( tabIndex ); return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); } - }); + } ); -})( jQuery ); +} )( jQuery ); diff --git a/src/core/wb.js b/src/core/wb.js index 21489158683..66aed405656 100644 --- a/src/core/wb.js +++ b/src/core/wb.js @@ -7,7 +7,7 @@ /* * Vapour Object that will store tombstone data for plugins to leverage */ -(function( $, window, document, undef ) { +( function( $, window, document, undef ) { "use strict"; /** @@ -30,7 +30,7 @@ var getUrlParts = function( url ) { search: a.search, // A collection of the parameters of the query string part of the URL. - params: (function() { + params: ( function() { var results = {}, queryString = a.search.replace( /^\?/, "" ).split( "&" ), len = queryString.length, @@ -43,7 +43,7 @@ var getUrlParts = function( url ) { } } return results; - }()) + }() ) }; }, @@ -92,7 +92,7 @@ var getUrlParts = function( url ) { * @variable oldie * @return {integer} of IE version */ - oldie = (function() { + oldie = ( function() { var undef, v = 3, div = document.createElement( "div" ), @@ -104,7 +104,7 @@ var getUrlParts = function( url ) { ) {} return v > 4 ? v : undef; - }()), + }() ), /** * @variable currentpage @@ -116,7 +116,7 @@ var getUrlParts = function( url ) { * @variable disabled * @return {boolean} of state of disabled flag */ - disabled = (function() { + disabled = ( function() { var disabledSaved = "false", disabled; @@ -126,7 +126,7 @@ var getUrlParts = function( url ) { disabled = currentpage.params.wbdisable || disabledSaved; return ( typeof disabled === "string" ) ? ( disabled.toLowerCase() === "true" ) : Boolean( disabled ); - }()), + }() ), /*----------------------------- * Core Library Object @@ -376,7 +376,7 @@ window.wb = wb; yepnope.addPrefix( "site", function( resourceObj ) { resourceObj.url = $homepath + "/" + resourceObj.url; return resourceObj; -}); +} ); /** * @prefix: plyfll! - builds the path for the polyfill resource @@ -400,7 +400,7 @@ yepnope.addPrefix( "plyfll", function( resourceObj ) { resourceObj.url = path + "/polyfills/" + url; return resourceObj; -}); +} ); /** * @prefix: i18n! - adds the correct document language for our i18n library @@ -408,12 +408,12 @@ yepnope.addPrefix( "plyfll", function( resourceObj ) { yepnope.addPrefix( "i18n", function( resourceObj ) { resourceObj.url = $homepath + "/" + resourceObj.url + lang + $mode + ".js"; return resourceObj; -}); +} ); /*----------------------------- * Modernizr Polyfill Loading *-----------------------------*/ -Modernizr.load([ +Modernizr.load( [ { test: Modernizr.details, nope: [ @@ -476,15 +476,15 @@ Modernizr.load([ // Load the MathML dependency. Since the polyfill is only loaded // when !Modernizr.mathml, we can skip the test here. - Modernizr.load({ + Modernizr.load( { load: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=Accessible", complete: function() { // Identify that initialization has completed wb.ready( $document, componentName ); } - }); - }); + } ); + } ); wb.add( selector ); } @@ -507,6 +507,6 @@ Modernizr.load([ wb.start(); } } -]); +] ); -})( jQuery, window, document ); +} )( jQuery, window, document ); diff --git a/src/i18n/base.js b/src/i18n/base.js index 1b061f24ffd..0d3b7a66df1 100644 --- a/src/i18n/base.js +++ b/src/i18n/base.js @@ -210,4 +210,4 @@ wb.i18nDict = { "tmpl-signin": "@tmpl-signin@" }; -})( wb ); +} )( wb ); diff --git a/src/other/feedback/demo/feedback.js b/src/other/feedback/demo/feedback.js index a8f9b10e967..5ffea5b9af0 100644 --- a/src/other/feedback/demo/feedback.js +++ b/src/other/feedback/demo/feedback.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -152,9 +152,9 @@ $document.on( "click", selector + " input[type=reset]", function( event ) { showHide( fbcntc1 ); showHide( fbcntc2 ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/other/feedback/test.js b/src/other/feedback/test.js index a8a22badbf4..7ffe8345ce7 100644 --- a/src/other/feedback/test.js +++ b/src/other/feedback/test.js @@ -7,7 +7,7 @@ */ /* global jQuery, describe, it, expect, before, after */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -17,7 +17,7 @@ describe( "Feedback test suite", function() { var $document = wb.doc, - $body = $document.find("body"), + $body = $document.find( "body" ), $elm, $script, $form, $reason, $reasonWeb, $access, $accessComp, $accessMobile, $info, $contact1, $contact2, // Tests sections for visibility. Not using the ":visible" jQuery selector @@ -36,20 +36,20 @@ describe( "Feedback test suite", function() { /* * Before beginning the test suite, this function is executed once. */ - before(function( done ) { - $elm = $("
") + before( function( done ) { + $elm = $( "
" ) .appendTo( $body ); - $elm.trigger({ + $elm.trigger( { type: "ajax-fetch.wb", fetch: { url: "../demos/feedback/feedback-en.html" } - }); + } ); $document.on( "ajax-fetched.wb ajax-failed.wb", ".feedback", function( event ) { if ( event.type === "ajax-fetched" ) { - $script = $("") + $script = $( "" ) .appendTo( $elm ); $form = event.fetch.pointer.find( ".wb-fdbck" ) .appendTo( $elm ) @@ -65,16 +65,16 @@ describe( "Feedback test suite", function() { } else { done( event.fetch.error ); } - }); + } ); $document.on( "wb-init.wb-fdbck", ".wb-fdbck", function() { done(); - }); - }); + } ); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); /* * Test the initialization events of the plugin @@ -82,96 +82,96 @@ describe( "Feedback test suite", function() { describe( "plugin init", function() { it( "should have added the plugin init class to the form", function() { expect( $form.hasClass( "wb-fdbck-inited" ) ).to.equal( true ); - }); + } ); it( "should have set aria-controls attributes", function() { expect( $reason.attr( "aria-controls" ) ).to.equal( "fbweb" ); expect( $access.attr( "aria-controls" ) ).to.equal( "fbmob fbcomp" ); - }); + } ); it( "should have set the referrer", function() { expect( $( "#fbpg" ).val() ).to.equal( document.referrer ); - }); - }); + } ); + } ); /* * Test showHide Web behaviour */ describe( "showHide Web", function() { - before(function() { + before( function() { $reasonWeb.hide(); - }); + } ); it( "should hide the 'Web' section when reason is not 'web'", function() { $reason.val( "" ).trigger( "change" ); expectHidden( $reasonWeb ); - }); + } ); it( "should show the 'Web' section when reason is 'web'", function() { $reason.val( "web" ).trigger( "change" ); expectVisible( $reasonWeb ); - }); - }); + } ); + } ); /* * Test showHide Access behaviour */ describe( "showHide Access", function() { - before(function() { + before( function() { $accessComp.hide(); $accessMobile.hide(); - }); + } ); it( "should hide the 'Mobile' section when reason is not 'mobile'", function() { $access.val( "desktop" ).trigger( "change" ); expectVisible( $accessComp ); expectHidden( $accessMobile ); - }); + } ); it( "should show the 'Mobile' section when reason is 'mobile'", function() { $access.val( "mobile" ).trigger( "change" ); expectVisible( $accessMobile ); - }); - }); + } ); + } ); /* * Test showHide Info behaviour */ describe( "showHide Info", function() { - before(function() { + before( function() { $info.hide(); - }); + } ); it( "should hide the 'Info' section when contacts are not checked", function() { $contact1.prop( "checked", false ); $contact2.prop( "checked", false ).trigger( "change" ); expectHidden( $info ); - }); + } ); it( "should show the 'Info' section when contact1 is checked", function() { $contact1.prop( "checked", true ).trigger( "change" ); expectVisible( $info ); - }); + } ); it( "should show the 'Info' section when contact2 is checked", function() { $contact1.prop( "checked", false ).trigger( "change" ); $contact2.prop( "checked", true ).trigger( "change" ); expectVisible( $info ); - }); - }); + } ); + } ); /* * Test reset button behaviour */ describe( "Reset button click", function() { - before(function() { + before( function() { $reason.val( "web" ); $contact1.prop( "checked", true ).trigger( "change" ); - }); + } ); it( "should hide all sections when reset is clicked", function() { expectVisible( $info ); @@ -181,8 +181,8 @@ describe( "Feedback test suite", function() { expectHidden( $info ); expectHidden( $reasonWeb ); - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/other/tablevalidator/demo/tablevalidator.js b/src/other/tablevalidator/demo/tablevalidator.js index 29ecd8deec4..08f182fd7d6 100644 --- a/src/other/tablevalidator/demo/tablevalidator.js +++ b/src/other/tablevalidator/demo/tablevalidator.js @@ -109,7 +109,7 @@ // Prevent any form to submit $document.on( "submit", formSelector, function( ) { return false; -}); +} ); // Take the source code of the HTML table to be encoded and displayed $document.on( showHTMLEvent, "#visualoutput > table:eq( 0 )", function( event ) { @@ -736,7 +736,7 @@ $document.on( "click", "#validatetable", function( ) { $( "[ headers ]", $tbl ).each( function( ) { $( this ).removeAttr( "headers" ); } ); - $( "[ aria-describedby ]", $tbl ).each(function( ) { + $( "[ aria-describedby ]", $tbl ).each( function( ) { $( this ).removeAttr( "aria-describedby" ); } ); diff --git a/src/other/wamethod/demo/wamethod.js b/src/other/wamethod/demo/wamethod.js index cba2f2ed010..5f25c2c5e81 100644 --- a/src/other/wamethod/demo/wamethod.js +++ b/src/other/wamethod/demo/wamethod.js @@ -5,7 +5,7 @@ /* * Web Accessibility Assessment Methodology */ -(function( $, document ) { +( function( $, document ) { "use strict"; /* @@ -54,12 +54,12 @@ var componentName = "wb-wamethod", $input.eq( 0 ).trigger( "change" ); // Apply WAI-ARIA - $summaryTd.attr({ + $summaryTd.attr( { "aria-live": "polite", "aria-relevant": "text", "aria-atomic": "true", "aria-busy": "false" - }); + } ); // Identify that initialization has completed wb.ready( $( elm ), componentName ); @@ -96,9 +96,9 @@ $document.on( "change", selector + " input", function() { percTotal.innerHTML = Math.round( ( aPassed + aaPassed + aaaPassed ) / successCriteriaDivideBy ); percNATotal.innerHTML = Math.round( naChecked / successCriteriaDivideBy ); $summaryTd.attr( "aria-busy", "false" ); -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, document ); +} )( jQuery, document ); diff --git a/src/plugins/ajax-fetch/ajax-fetch.js b/src/plugins/ajax-fetch/ajax-fetch.js index 73b9834edeb..db8e9a5de54 100644 --- a/src/plugins/ajax-fetch/ajax-fetch.js +++ b/src/plugins/ajax-fetch/ajax-fetch.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; /* @@ -32,7 +32,7 @@ $document.on( "ajax-fetch.wb", function( event ) { callerId = caller.id; $.ajax( fetchOpts ) - .done(function( response, status, xhr ) { + .done( function( response, status, xhr ) { var responseType = typeof response; fetchData = { @@ -44,13 +44,13 @@ $document.on( "ajax-fetch.wb", function( event ) { fetchData.pointer = $( "
" ) .append( responseType === "string" ? response : "" ); - $( "#" + callerId ).trigger({ + $( "#" + callerId ).trigger( { type: "ajax-fetched.wb", fetch: fetchData }, this ); - }) - .fail(function( xhr, status, error ) { - $( "#" + callerId ).trigger({ + } ) + .fail( function( xhr, status, error ) { + $( "#" + callerId ).trigger( { type: "ajax-failed.wb", fetch: { xhr: xhr, @@ -60,6 +60,6 @@ $document.on( "ajax-fetch.wb", function( event ) { }, this ); }, this ); } -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/cal-events/cal-events.js b/src/plugins/cal-events/cal-events.js index 241cd2ebbdf..137aea2eaaa 100644 --- a/src/plugins/cal-events/cal-events.js +++ b/src/plugins/cal-events/cal-events.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -51,7 +51,7 @@ var componentName = "wb-calevt", // Identify that initialization has completed wb.ready( $elm, componentName ); - }); + } ); } }, @@ -71,9 +71,9 @@ var componentName = "wb-calevt", promises.push( $.get( urls[ i ], appendData, "html" ) ); } - $.when.apply( $, promises ).always(function() { + $.when.apply( $, promises ).always( function() { dfd.resolve(); - }); + } ); return dfd.promise(); }, @@ -352,7 +352,7 @@ $document.on( "displayed.wb-cal", selector + "-cal", function( event, year, mont $( selector ).filter( "[data-calevt-src='" + $target[ 0 ].id + "']" ) .trigger( "wb-updated" + selector ); } -}); +} ); $document.on( "focusin focusout", ".wb-calevt-cal .cal-days a", function( event ) { var eventType = event.type, @@ -373,7 +373,7 @@ $document.on( "focusin focusout", ".wb-calevt-cal .cal-days a", function( event break; case "focusout": - setTimeout(function() { + setTimeout( function() { if ( dayEvents.find( "a:focus" ).length === 0 ) { dayEvents.removeClass( evDetails ) .addClass( "wb-inv" ) @@ -383,7 +383,7 @@ $document.on( "focusin focusout", ".wb-calevt-cal .cal-days a", function( event }, 5 ); break; } -}); +} ); $document.on( "mouseover mouseout", ".wb-calevt-cal .cal-days td", function( event ) { var target = event.currentTarget, @@ -402,17 +402,17 @@ $document.on( "mouseover mouseout", ".wb-calevt-cal .cal-days td", function( eve break; case "mouseout": - dayEvents.delay( 100 ).queue(function() { + dayEvents.delay( 100 ).queue( function() { $( this ).removeClass( evDetails ) .addClass( "wb-inv" ) .dequeue(); - }); + } ); break; } } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/calendar/calendar.js b/src/plugins/calendar/calendar.js index 53e6e56d05c..683d273a135 100644 --- a/src/plugins/calendar/calendar.js +++ b/src/plugins/calendar/calendar.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -61,10 +61,10 @@ var namespace = "wb-cal", .attr( "id", calendarId ); if ( ariaLabelledBy ) { - $calendar.attr({ + $calendar.attr( { "aria-controls": ariaControls, "aria-labelledby": ariaLabelledBy - }); + } ); } // Converts min and max date from string to date objects @@ -101,8 +101,8 @@ var namespace = "wb-cal", // Reset calendar if the calendar previously existed $objCalendar = $( objCalendarId ); if ( $objCalendar.length !== 0 ) { - $objCalendar.find( "#cal-" + calendarId + "-wd, .cal-mnth, #cal-" + calendarId + "-days").remove(); - $objCalendar = $calendar.children("#cal-" + calendarId + "-cnt"); + $objCalendar.find( "#cal-" + calendarId + "-wd, .cal-mnth, #cal-" + calendarId + "-days" ).remove(); + $objCalendar = $calendar.children( "#cal-" + calendarId + "-cnt" ); } else { $objCalendar = $( "
" ); $calendar.append( $objCalendar ); @@ -233,7 +233,7 @@ var namespace = "wb-cal", true, eventData.mindate, eventData.maxdate - ]); + ] ); } $container.find( classes.indexOf( "wb-inv" ) !== -1 ? @@ -308,7 +308,7 @@ var namespace = "wb-cal", event.preventDefault(); onGoTo( calendarId, minDate, maxDate ); return false; - }) + } ) // Update the list of available months when changing the year // and populate the initial month list. @@ -456,7 +456,7 @@ var namespace = "wb-cal", true, minDate, maxDate - ]); + ] ); $container.trigger( hideGoToFrmEvent ); // Go to the first day to avoid having to tab over the navigation again. @@ -641,7 +641,7 @@ $document.on( "keydown", ".cal-days a", function( event ) { return false; } -}); +} ); $document.on( hideGoToFrmEvent, ".cal-cnt", hideGoToFrm ); @@ -656,7 +656,7 @@ $document.on( "click", ".cal-goto-lnk", function( event ) { if ( !which || which === 1 ) { showGoToForm( $( event.currentTarget ).closest( ".cal-cnt" ).attr( "id" ) ); } -}); +} ); $document.on( "click", ".cal-goto-cancel", function( event ) { var which = event.which; @@ -665,6 +665,6 @@ $document.on( "click", ".cal-goto-cancel", function( event ) { if ( !which || which === 1 ) { $( event.currentTarget ).closest( ".cal-cnt" ).trigger( hideGoToFrmEvent ); } -}); +} ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/charts/charts.js b/src/plugins/charts/charts.js index 765ce20fa9b..cdb8694c43f 100644 --- a/src/plugins/charts/charts.js +++ b/src/plugins/charts/charts.js @@ -6,7 +6,7 @@ * @author @duboisp * */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /** @@ -872,7 +872,7 @@ $( currentDataGroupVector.header[ currentDataGroupVector.header.length - 1 ].elem ).text() ); // Add the series - allSeries.push(pieQuaterFlotSeries); + allSeries.push( pieQuaterFlotSeries ); } // Create a sub Figure or use the main one @@ -881,10 +881,10 @@ currentRowGroup.row[ 0 ].header.length === 0 ) ) { $placeHolder = $wetChartContainer; - $placeHolder.css({ + $placeHolder.css( { height: optionsCharts.height, width: optionsCharts.width - }); + } ); } else { @@ -969,12 +969,12 @@ nbBarChart += 1; // Set a default setting specially for bar charts - if (!currVectorOptions.bars) { + if ( !currVectorOptions.bars ) { currVectorOptions.bars = { show: true, barWidth: 0.9 }; } // Set a default order for orderBars flot plugin - if (!currVectorOptions.bars.order) { + if ( !currVectorOptions.bars.order ) { currVectorOptions.bars.order = nbBarChart; } } @@ -1100,8 +1100,8 @@ ]; //TODO: Revist this in the new plugin structure - if (settings && settings.plugins) { - deps = deps.concat(settings.plugins); + if ( settings && settings.plugins ) { + deps = deps.concat( settings.plugins ); } // Only initialize the i18nText once @@ -1114,7 +1114,7 @@ } // Load the required dependencies - Modernizr.load({ + Modernizr.load( { // For loading multiple dependencies load: deps, @@ -1127,7 +1127,7 @@ // Identify that initialization has completed wb.ready( $elm, componentName ); } - }); + } ); } }; @@ -1161,9 +1161,9 @@ $document.on( "timerpoke.wb " + initEvent + " " + tableParsingCompleteEvent, sel * so returning true allows for events to always continue */ return true; -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/collapsible-alerts/collapsible-alerts.js b/src/plugins/collapsible-alerts/collapsible-alerts.js index 8b6c693fb8f..5796585feee 100644 --- a/src/plugins/collapsible-alerts/collapsible-alerts.js +++ b/src/plugins/collapsible-alerts/collapsible-alerts.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET community */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -31,7 +31,7 @@ var componentName = "wb-collapsible", if ( details ) { - key = "alert-collapsible-state-" + details.getAttribute("id"); + key = "alert-collapsible-state-" + details.getAttribute( "id" ); try { if ( localStorage.getItem( key ) ) { @@ -104,12 +104,12 @@ $document.on( "timerpoke.wb", function() { * so returning true allows for events to always continue */ return true; - }); + } ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/country-content/country-content.js b/src/plugins/country-content/country-content.js index 44d9c62cd7f..b35f0c2ff6d 100644 --- a/src/plugins/country-content/country-content.js +++ b/src/plugins/country-content/country-content.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @nschonni */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -52,8 +52,8 @@ var componentName = "wb-ctrycnt", // Identify that initialization has completed wb.ready( $elm, componentName ); - }); - }); + } ); + } ); } }, getCountry = function() { @@ -64,7 +64,7 @@ var componentName = "wb-ctrycnt", if ( countryCode === null ) { // From https://github.com/aFarkas/webshim/blob/master/src/shims/geolocation.js#L89-L127 - $.ajax({ + $.ajax( { url: "http://freegeoip.net/json/", dataType: "jsonp", cache: true, @@ -83,7 +83,7 @@ var componentName = "wb-ctrycnt", error: function() { dfd.reject( "" ); } - }); + } ); } else { dfd.resolve( countryCode ); } @@ -97,4 +97,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/country-content/test.js b/src/plugins/country-content/test.js index 2775d714c91..d5b21120682 100644 --- a/src/plugins/country-content/test.js +++ b/src/plugins/country-content/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, sinon, before, after */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -23,7 +23,7 @@ describe( "Country Content test suite", function() { stubs = {}, sandbox = sinon.sandbox.create(); - before(function() { + before( function() { // Stub the $.ajax method to return data.country_code = "CA" on success. // This must be used instead of Sinon's fakeServer because the plugin uses @@ -38,17 +38,17 @@ describe( "Country Content test suite", function() { $elm = $( "
" ) .appendTo( wb.doc.find( "body" ) ) .trigger( "wb-init.wb-ctrycnt" ); - }); + } ); - after(function() { + after( function() { // Restore original behaviour of $.ajax sandbox.restore(); $elm.remove(); - }); + } ); it( "should have added the wb-ctrycnt-inited CSS class", function() { expect( $elm.hasClass( "wb-ctrycnt-inited" ) ).to.equal( true ); - }); + } ); it( "should have performed a geo IP lookup", function() { var i = 0, @@ -62,16 +62,16 @@ describe( "Country Content test suite", function() { } } expect( isLookup ).to.equal( true ); - }); + } ); it( "should have loaded the country specific content", function() { expect( stubs.load.calledWith( "ajax/country-content-ca-en.html" ) ).to.equal( true ); - }); + } ); it( "should have saved the country code", function() { expect( localStorage.getItem( "countryCode" ) ).to.equal( "CA" ); - }); - }); + } ); + } ); /* * Test loading specific content @@ -79,7 +79,7 @@ describe( "Country Content test suite", function() { describe( "load specific country content from localStorage", function() { var $elm; - before(function( done ) { + before( function( done ) { // Load the US content localStorage.setItem( "countryCode", "US" ); @@ -90,16 +90,16 @@ describe( "Country Content test suite", function() { // Give the content time to load setTimeout( done, 100 ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should have saved the country code", function() { expect( localStorage.getItem( "countryCode" ) ).to.equal( "US" ); - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/data-ajax/data-ajax.js b/src/plugins/data-ajax/data-ajax.js index dc891ea4658..9e096fffcd9 100644 --- a/src/plugins/data-ajax/data-ajax.js +++ b/src/plugins/data-ajax/data-ajax.js @@ -5,7 +5,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -68,15 +68,15 @@ var componentName = "wb-data-ajax", if ( typeof settings.corsFallback === "function" ) { fetchObj.dataType = "jsonp"; fetchObj.jsonp = "callback"; - fetchObj = settings.corsFallback(fetchObj); + fetchObj = settings.corsFallback( fetchObj ); } } } - $elm.trigger({ + $elm.trigger( { type: "ajax-fetch.wb", fetch: fetchObj - }); + } ); }; $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " ajax-fetched.wb", selector, function( event ) { @@ -122,7 +122,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " ajax-fetched.w jQuery.ajaxSettings.cache = true; // "replace" is the only event that doesn't map to a jQuery function - if ( ajaxType === "replace") { + if ( ajaxType === "replace" ) { $elm.html( content ); } else { $elm[ ajaxType ]( content ); @@ -147,4 +147,4 @@ for ( s = 0; s !== selectorsLength; s += 1 ) { wb.add( selectors[ s ] ); } -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/data-ajax/test.js b/src/plugins/data-ajax/test.js index 17324359cc8..8eb3de7eb3e 100644 --- a/src/plugins/data-ajax/test.js +++ b/src/plugins/data-ajax/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -32,7 +32,7 @@ describe( "data-ajax test suite", function() { /* * Before beginning the test suite, this function is executed once. */ - before(function() { + before( function() { // Spy on jQuery's trigger method to see how it's called during the plugin's initialization spy = sandbox.spy( $.prototype, "trigger" ); @@ -41,16 +41,16 @@ describe( "data-ajax test suite", function() { if ( typeof callback === "function" ) { callback(); } - }); - }); + } ); + } ); /* * After finishing the test suite, this function is executed once. */ - after(function() { + after( function() { // Restore the original behaviour of trigger once the tests are finished sandbox.restore(); - }); + } ); /* * Test the initialization events of the plugin @@ -58,25 +58,25 @@ describe( "data-ajax test suite", function() { describe( "init events", function() { var $elm; - before(function( ) { + before( function( ) { $elm = createElm( "replace" ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should trigger an ajax-fetch.wb event", function() { var arg, len = spy.args.length, isEvent = false; while ( len-- && !isEvent ) { - arg = spy.args[len][0]; + arg = spy.args[ len ][ 0 ]; isEvent = typeof arg === "object" && arg.type === "ajax-fetch.wb"; } expect( isEvent ).to.equal( true ); - }); - }); + } ); + } ); /* * Test data-ajax-before @@ -84,25 +84,25 @@ describe( "data-ajax test suite", function() { describe( "data-ajax-before", function() { var $elm, $before; - before(function( done ) { + before( function( done ) { $elm = createElm( "before", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); $before.remove(); - }); + } ); it( "should add the .wb-data-ajax-before-inited class", function() { expect( $elm.hasClass( "wb-data-ajax-before-inited" ) ).to.equal( true ); - }); + } ); it( "should load an element before itself", function() { $before = $elm.prev( ".ajaxed-in" ); expect( $before.length ).to.be.greaterThan( 0 ); expect( $before.children().length ).to.be.greaterThan( 0 ); - }); - }); + } ); + } ); /* * Test data-ajax-after @@ -110,25 +110,25 @@ describe( "data-ajax test suite", function() { describe( "data-ajax-after", function() { var $elm, $after; - before(function( done ) { + before( function( done ) { $elm = createElm( "after", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); $after.remove(); - }); + } ); it( "should add the .wb-data-ajax-after-inited class", function() { expect( $elm.hasClass( "wb-data-ajax-after-inited" ) ).to.equal( true ); - }); + } ); it( "should load an element after itself", function() { $after = $elm.next( ".ajaxed-in" ); expect( $after.length ).to.be.greaterThan( 0 ); expect( $after.children().length ).to.be.greaterThan( 0 ); - }); - }); + } ); + } ); /* * Test data-ajax-replace @@ -136,25 +136,25 @@ describe( "data-ajax test suite", function() { describe( "data-ajax-replace", function() { var $elm; - before(function( done ) { + before( function( done ) { $elm = createElm( "replace", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should add the .wb-data-ajax-replace-inited class", function() { expect( $elm.hasClass( "wb-data-ajax-replace-inited" ) ).to.equal( true ); - }); + } ); it( "should replace its content", function() { var $replace = $elm.find( ".ajaxed-in" ); - expect( $elm.children().first()[0] ).to.equal( $replace[ 0 ] ); + expect( $elm.children().first()[ 0 ] ).to.equal( $replace[ 0 ] ); expect( $replace.length ).to.be.greaterThan( 0 ); expect( $replace.children().length ).to.be.greaterThan( 0 ); - }); - }); + } ); + } ); /* * Test data-ajax-prepend @@ -162,25 +162,25 @@ describe( "data-ajax test suite", function() { describe( "data-ajax-prepend", function() { var $elm; - before(function( done ) { + before( function( done ) { $elm = createElm( "prepend", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should add the .wb-data-ajax-prepend-inited class", function() { expect( $elm.hasClass( "wb-data-ajax-prepend-inited" ) ).to.equal( true ); - }); + } ); it( "should prepend to its content", function() { var $prepend = $elm.find( ".ajaxed-in" ); - expect( $elm.children().first()[0] ).to.equal( $prepend[0] ); + expect( $elm.children().first()[ 0 ] ).to.equal( $prepend[ 0 ] ); expect( $prepend.length ).to.be.greaterThan( 0 ); expect( $prepend.children().length ).to.be.greaterThan( 0 ); - }); - }); + } ); + } ); /* * Test data-ajax-append @@ -188,36 +188,36 @@ describe( "data-ajax test suite", function() { describe( "data-ajax-append", function() { var $elm; - before(function( done ) { + before( function( done ) { $elm = createElm( "append", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should add the .wb-data-ajax-append-inited class", function() { expect( $elm.hasClass( "wb-data-ajax-append-inited" ) ).to.equal( true ); - }); + } ); it( "should append to its content", function() { var $append = $elm.find( ".ajaxed-in" ); - expect( $elm.children().last()[0] ).to.equal( $append[0] ); + expect( $elm.children().last()[ 0 ] ).to.equal( $append[ 0 ] ); expect( $append.length ).to.be.greaterThan( 0 ); expect( $append.children().length ).to.be.greaterThan( 0 ); - }); - }); + } ); + } ); describe( "dynamic data-ajax", function() { var $elm; - before(function( done ) { + before( function( done ) { $elm = createElm( "append", done ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should use the updated URL", function( done ) { callback = done; @@ -230,8 +230,8 @@ describe( "data-ajax test suite", function() { expect( $elm.find( ".ajaxed-in2" ).length ).to.be.greaterThan( 0 ); done(); }; - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/data-inview/data-inview.js b/src/plugins/data-inview/data-inview.js index cf8af82fe1c..3d23999ed7b 100644 --- a/src/plugins/data-inview/data-inview.js +++ b/src/plugins/data-inview/data-inview.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -38,7 +38,7 @@ var componentName = "wb-inview", $elms = $elms.add( $elm ); // Allow other plugins to run first - setTimeout(function() { + setTimeout( function() { onInView( $elm ); // Identify that initialization has completed @@ -89,11 +89,11 @@ var componentName = "wb-inview", if ( !oldViewState ) { $dataInView.addClass( "outside-off" ); } - $dataInView.trigger({ + $dataInView.trigger( { type: ( show ? "open" : "close" ), namespace: "wb-overlay", noFocus: true - }); + } ); } else { $dataInView .attr( "aria-hidden", !show ) @@ -134,17 +134,17 @@ $document.on( "timerpoke.wb " + initEvent + " " + scrollEvent, selector, functio * so returning true allows for events to always continue */ return true; -}); +} ); $window.on( "scroll scrollstop", function() { $elms.trigger( scrollEvent ); -}); +} ); $document.on( "txt-rsz.wb win-rsz-width.wb win-rsz-height.wb", function() { $elms.trigger( scrollEvent ); -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/data-inview/demo/data-inview.js b/src/plugins/data-inview/demo/data-inview.js index 5c8d2f9b1d8..2f6ba5643bc 100644 --- a/src/plugins/data-inview/demo/data-inview.js +++ b/src/plugins/data-inview/demo/data-inview.js @@ -4,13 +4,13 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; -wb.doc.on( "all.wb-inview partial.wb-inview none.wb-inview", function( event) { +wb.doc.on( "all.wb-inview partial.wb-inview none.wb-inview", function( event ) { if ( event.namespace === "wb-inview" ) { $( event.target ).find( ".view-state-status" ).html( event.type ); } -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/data-inview/test.js b/src/plugins/data-inview/test.js index 1ecefe8b9d0..46cf0ed4cf4 100644 --- a/src/plugins/data-inview/test.js +++ b/src/plugins/data-inview/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, beforeEach, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -32,19 +32,19 @@ describe( "data-inview test suite", function() { /* * Before beginning the test suite, this function is executed once. */ - before(function( done ) { + before( function( done ) { // Spy on jQuery's trigger method to see how it's called during the plugin's initialization spy = sandbox.spy( $.prototype, "trigger" ); $document.on( initEvent, selector, function( event ) { done(); - }); + } ); $document.on( "all.wb-inview partial.wb-inview none.wb-inview", selector, function( event ) { - if (callback) { + if ( callback ) { callback(); } - }); + } ); $bar.appendTo( $body ); @@ -53,19 +53,19 @@ describe( "data-inview test suite", function() { .trigger( initEvent ); $window.scrollTop( 0 ); - }); + } ); /* * After finishing the test suite, this function is executed once. */ - after(function() { + after( function() { // Restore the original behaviour of trigger once the tests are finished sandbox.restore(); $bar.remove(); $content.remove(); $window.scrollTop( 0 ); - }); + } ); /* * Test the initialization events of the plugin @@ -77,57 +77,57 @@ describe( "data-inview test suite", function() { isSelector = false, len = spy.thisValues.length; while ( !isSelector && len-- ) { - elm = spy.thisValues[len][0]; + elm = spy.thisValues[ len ][ 0 ]; isSelector = elm && elm.className && elm.className.indexOf( "wb-inview" ) > -1; } expect( isSelector ).to.equal( true ); - }); - }); + } ); + } ); /* * Test triggering of the 'scroll.wb-inview' event */ describe( "scroll.wb-inview event triggering", function() { - beforeEach(function() { + beforeEach( function() { spy.reset(); - }); + } ); it( "window 'scroll' event should trigger a scroll.wb-inview event", function() { $window.trigger( "scroll" ); expect( spy.calledWith( "scroll.wb-inview" ) ).to.equal( true ); - }); + } ); it( "window 'scrollstop' event should trigger a scroll.wb-inview event", function() { $window.trigger( "scrollstop" ); expect( spy.calledWith( "scroll.wb-inview" ) ).to.equal( true ); - }); + } ); it( "document 'txt-rsz.wb' event should trigger a scroll.wb-inview event", function() { $document.trigger( "txt-rsz.wb" ); expect( spy.calledWith( "scroll.wb-inview" ) ).to.equal( true ); - }); + } ); it( "document 'win-rsz-width.wb' event should trigger a scroll.wb-inview event", function() { $document.trigger( "win-rsz-width.wb" ); expect( spy.calledWith( "scroll.wb-inview" ) ).to.equal( true ); - }); + } ); it( "document 'win-rsz-height.wb' event should trigger a scroll.wb-inview event", function() { $document.trigger( "win-rsz-height.wb" ); expect( spy.calledWith( "scroll.wb-inview" ) ).to.equal( true ); - }); - }); + } ); + } ); describe( "inview bottom", function() { before( function() { $bar.addClass( "wb-bar-b" ); - }); + } ); after( function() { $bar.removeClass( "wb-bar-b" ); - }); + } ); /* * Test that inview bottom works as expected @@ -141,55 +141,55 @@ describe( "data-inview test suite", function() { before( function( done ) { callback = done; $window.scrollTop( $content.offset().top - 1 ); - }); + } ); it( "should not have an inview bottom bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "all" ); expect( $bar.hasClass( "open" ) ).to.equal( false ); expect( $bar.is( ":visible" ) ).to.equal( false ); - }); - }); + } ); + } ); } describe( "'partial'", function() { - before(function( done ) { + before( function( done ) { callback = done; $window.scrollTop( $content.offset().top + 50 ); - }); + } ); it( "should have an inview bottom bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "partial" ); expect( $bar.hasClass( "open" ) ).to.equal( true ); expect( $bar.is( ":visible" ) ).to.equal( true ); - }); - }); + } ); + } ); describe( "'none'", function() { - before(function( done ) { + before( function( done ) { callback = done; $window.scrollTop( $content.offset().top + 500 ); - }); + } ); it( "should have an inview bottom bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "none" ); expect( $bar.hasClass( "open" ) ).to.equal( true ); expect( $bar.is( ":visible" ) ).to.equal( true ); - }); - }); + } ); + } ); - }); + } ); describe( "inview top", function() { before( function() { $bar.addClass( "wb-bar-t" ); - }); + } ); after( function() { $bar.removeClass( "wb-bar-t" ); - }); + } ); /* * Test that inview top works as expected. @@ -200,69 +200,69 @@ describe( "data-inview test suite", function() { describe( "'all'", function() { - before(function( done ) { + before( function( done ) { callback = done; $window.scrollTop( $content.offset().top - 1 ); - }); + } ); it( "should not have an inview top bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "all" ); expect( $bar.hasClass( "open" ) ).to.equal( false ); expect( $bar.is( ":visible" ) ).to.equal( false ); - }); - }); + } ); + } ); } describe( "'partial'", function() { - before(function( done ) { + before( function( done ) { callback = done; $window.scrollTop( $content.offset().top + 40 ); - }); + } ); it( "should have an inview top bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "partial" ); expect( $bar.hasClass( "open" ) ).to.equal( true ); expect( $bar.is( ":visible" ) ).to.equal( true ); - }); - }); + } ); + } ); describe( "'none'", function() { - before(function( done ) { + before( function( done ) { callback = done; $window.scrollTop( $content.offset().top + 500 ); - }); + } ); it( "should have an inview top bar visible", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "none" ); expect( $bar.hasClass( "open" ) ).to.equal( true ); expect( $bar.is( ":visible" ) ).to.equal( true ); - }); - }); - }); + } ); + } ); + } ); describe( "inview show-none", function() { - before(function( done ) { + before( function( done ) { callback = done; $bar.addClass( "wb-bar-t" ); - $content.addClass("show-none"); + $content.addClass( "show-none" ); $window.scrollTop( $content.offset().top + 50 ); - }); + } ); - after(function() { + after( function() { $bar.removeClass( "wb-bar-t" ); - $content.removeClass("show-none"); - }); + $content.removeClass( "show-none" ); + } ); it( "should not have an inview top bar visible (.show-none CSS class prevents it)", function() { expect( $content.attr( "data-inviewstate" ) ).to.equal( "partial" ); expect( $bar.hasClass( "open" ) ).to.equal( false ); expect( $bar.is( ":visible" ) ).to.equal( false ); - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/data-picture/data-picture.js b/src/plugins/data-picture/data-picture.js index a14b6abe6a7..41790958759 100644 --- a/src/plugins/data-picture/data-picture.js +++ b/src/plugins/data-picture/data-picture.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @patheard */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -112,14 +112,14 @@ $document.on( "timerpoke.wb " + initEvent + " " + picturefillEvent, selector, fu } break; } -}); +} ); // Handles window resize so images can be updated as new media queries match $document.on( "txt-rsz.wb win-rsz-width.wb win-rsz-height.wb", function() { $( selector ).trigger( picturefillEvent ); -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/data-picture/test.js b/src/plugins/data-picture/test.js index ad7c8854690..3d2f884fba0 100644 --- a/src/plugins/data-picture/test.js +++ b/src/plugins/data-picture/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -23,13 +23,13 @@ describe( "[data-pic] test suite", function() { /* * Before beginning the test suite, this function is executed once. */ - before(function( done ) { + before( function( done ) { // Spy on jQuery's trigger method to see how it's called during the plugin's initialization spy = sandbox.spy( $.prototype, "trigger" ); $document.on( "wb-init.wb-pic", selector, function() { done(); - }); + } ); $elm = $( "" + @@ -40,18 +40,18 @@ describe( "[data-pic] test suite", function() { $elm.appendTo( $body ); $( selector ).trigger( "wb-init.wb-pic" ); - }); + } ); /* * After finishing the test suite, this function is executed once. */ - after(function() { + after( function() { // Restore the original behaviour of trigger once the tests are finished sandbox.restore(); // Remove test data from the page $elm.remove(); - }); + } ); /* * Test the initialization events of the plugin @@ -60,17 +60,17 @@ describe( "[data-pic] test suite", function() { it( "should have a picfill.wb-pic event", function() { expect( spy.calledWith( "picfill.wb-pic" ) ).to.equal( true ); - }); + } ); it( "should have been triggered on a [data-pic] element", function() { var len = spy.thisValues.length, isSelector = false; while ( !isSelector && len-- ) { - isSelector = spy.thisValues[len].selector === "[data-pic]"; + isSelector = spy.thisValues[ len ].selector === "[data-pic]"; } expect( isSelector ).to.equal( true ); - }); - }); + } ); + } ); /* * Test that onresize, the plugin reacts correctly @@ -80,18 +80,18 @@ describe( "[data-pic] test suite", function() { it( "should have txt-rsz.wb event handler", function() { $document.trigger( "txt-rsz.wb" ); expect( spy.calledWith( "picfill.wb-pic" ) ).to.equal( true ); - }); + } ); it( "should have win-rsz-width.wb event handler", function() { $document.trigger( "win-rsz-width.wb" ); expect( spy.calledWith( "picfill.wb-pic" ) ).to.equal( true ); - }); + } ); it( "should have win-rsz-height.wb event handler", function() { $document.trigger( "win-rsz-height.wb" ); expect( spy.calledWith( "picfill.wb-pic" ) ).to.equal( true ); - }); - }); + } ); + } ); /* * Test that the plugin creates responsive images as expected @@ -99,71 +99,71 @@ describe( "[data-pic] test suite", function() { describe( "responsive images", function() { var $img; - before(function() { + before( function() { $img = $elm.find( "img" ); - }); + } ); it( "should have created one responsive image that matches one of the span[data-src] elements", function() { var $span; - $span = $elm.find( "[data-src='" + $img.attr("src") + "']" ); + $span = $elm.find( "[data-src='" + $img.attr( "src" ) + "']" ); expect( $img ).to.have.length( 1 ); expect( $span.length ).to.be.greaterThan( 0 ); - }); + } ); it( "should create a responsive image with src for the matching media query", function() { expect( $img ).to.have.length( 1 ); expect( $img.attr( "src" ) ).to.equal( "baz.jpg" ); - }); + } ); it( "should have set the responsive image alt attribute", function() { expect( $img.attr( "alt" ) ).to.equal( $elm.data( "alt" ) ); - }); + } ); it( "should have set the responsive image's class attribute", function() { expect( $img.attr( "class" ) ).to.equal( $elm.data( "class" ) ); - }); - }); + } ); + } ); describe( "responsive images with no matching media query", function() { var $img; - before(function() { + before( function() { $img = $( "" + "" + "" ) .appendTo( $body ) .trigger( "picfill.wb-pic" ); - }); + } ); - after(function() { + after( function() { $img.remove(); - }); + } ); it( "should not create a responsive image when no matching media query", function() { expect( $img.find( "img" ) ).to.have.length( 0 ); - }); - }); + } ); + } ); describe( "responsive images with no source", function() { var $img; - before(function() { - $img = $("" ) + before( function() { + $img = $( "" ) .appendTo( $body ) .trigger( "picfill.wb-pic" ); - }); + } ); - after(function() { + after( function() { $img.remove(); - }); + } ); it( "should not create a responsive image when no span[data-src]", function() { expect( $img.find( "img" ) ).to.have.length( 0 ); - }); - }); + } ); + } ); -}); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/deps/geomap-lib.js b/src/plugins/deps/geomap-lib.js index 312835b342b..1470ab58a8a 100644 --- a/src/plugins/deps/geomap-lib.js +++ b/src/plugins/deps/geomap-lib.js @@ -5,7 +5,7 @@ * @author @pjackson28 */ /*global wet_boew_geomap: false, OpenLayers: false, proj4: false*/ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; var componentName = "wb-geomap", @@ -81,7 +81,7 @@ var componentName = "wb-geomap", accessTitle: i18n( "geo-allyttl" ), attribLink: i18n( "geo-attrlnk" ), attribTitle: i18n( "geo-attrttl" ), - ariaMap: i18n( "geo-ariamap"), + ariaMap: i18n( "geo-ariamap" ), geoLocationURL: i18n( "geo-locurl-geogratis" ), geoCoderPlaceholder: i18n( "geo-loc-placeholder" ), geoCoderLabel: i18n( "geo-loc-label" ), @@ -136,7 +136,7 @@ var componentName = "wb-geomap", OpenLayers.ImgPath = wb.getPath( "/assets" ) + "/"; // Add projection for default base map - proj4.defs( "EPSG:3978", "+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"); + proj4.defs( "EPSG:3978", "+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs" ); // Set the Geomap object geomap = setGeomapObject( $elm ); @@ -146,7 +146,7 @@ var componentName = "wb-geomap", // Load configuration file if ( settings.layersFile ) { - $.ajax({ + $.ajax( { url: settings.layersFile, dataType: "script", async: false, @@ -158,7 +158,7 @@ var componentName = "wb-geomap", createMap( geomap, settings ); } - }); + } ); } else { createMap( geomap, settings ); } @@ -226,7 +226,7 @@ var componentName = "wb-geomap", return oButtons.div; } - }); + } ); geomap.map.addControl( panZoom ); setPanZoom( geomap ); @@ -402,10 +402,10 @@ var componentName = "wb-geomap", if ( $tabs.length !== 0 ) { $tabs - .attr({ + .attr( { "class": "wb-tabs auto-height-none", id: "geomap-tabs-" + geomap.mapid - }); + } ); // User hasn't specified where they want the tabs } else { @@ -439,7 +439,7 @@ var componentName = "wb-geomap", } var $divLayer = geomap.glayers, - $parent = $("
"), + $parent = $( "
" ), featureTableId = featureTable[ 0 ].id, $layerTab = $( "
" ), title = featureTable[ 0 ].attributes[ "aria-label" ].value, @@ -452,7 +452,7 @@ var componentName = "wb-geomap", addToTabs( geomap, featureTable, enabled, olLayerId ); // Tabs are not specified } else { - $layerTab.append( $layerTitle, $parent.append(featureTable) ); + $layerTab.append( $layerTitle, $parent.append( featureTable ) ); $divLayer.append( "
" + $layerTab.html() + "
" ); } @@ -498,7 +498,7 @@ var componentName = "wb-geomap", $label = $( "
" ) .appendTo( $document.find( "body" ) ) .trigger( "wb-init.wb-feeds" ); - }); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); it( "should have made two ajax calls to load the feed entries", function() { var i = 0, @@ -178,12 +178,12 @@ describe( "Feeds test suite", function() { } expect( isLookup1 ).to.equal( true ); expect( isLookup2 ).to.equal( true ); - }); + } ); it( "should have populated .feeds-cont with 6 feed links", function() { expect( $elm.find( ".feeds-cont > li" ).length ).to.equal( 6 ); - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/footnotes/footnotes.js b/src/plugins/footnotes/footnotes.js index 94afcba6425..47a15e46fd8 100644 --- a/src/plugins/footnotes/footnotes.js +++ b/src/plugins/footnotes/footnotes.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @EricDunsworth */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -91,9 +91,9 @@ $document.on( "click vclick", selector + " dd p.fn-rtn a", function( event ) { $document.find( refId + " a" ).trigger( setFocusEvent ); return false; } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/formvalid/formvalid.js b/src/plugins/formvalid/formvalid.js index bd37095ab33..c9110932c85 100644 --- a/src/plugins/formvalid/formvalid.js +++ b/src/plugins/formvalid/formvalid.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -64,7 +64,7 @@ var componentName = "wb-frmvld", }; } - Modernizr.load({ + Modernizr.load( { // For loading multiple dependencies both: [ @@ -113,7 +113,7 @@ var componentName = "wb-frmvld", if ( wb.ieVersion > 0 && wb.ieVersion < 9 ) { len = $required.length; $required.removeAttr( "required" ); - for ( i = 0; i !== len; i += 1) { + for ( i = 0; i !== len; i += 1 ) { $required[ i ].setAttribute( "data-rule-required", "true" ); } $inputs.filter( "[type=date]" ).each( function() { @@ -121,12 +121,12 @@ var componentName = "wb-frmvld", $parent = $this.wrap( "
" ).parent(), newElm = $( $parent.html().replace( "type=date", "type=text" ) ); $parent.replaceWith( newElm ); - }); + } ); $formElms = $form.find( "input, select, textarea" ); } // The jQuery validation plug-in in action - validator = $form.validate({ + validator = $form.validate( { meta: "validate", focusInvalid: false, ignore: settings.ignore, @@ -147,7 +147,7 @@ var componentName = "wb-frmvld", $fieldset = $element.closest( "fieldset" ); if ( $fieldset.length !== 0 ) { $legend = $fieldset.find( "legend" ).first(); - if ( $legend.length !== 0 && $fieldset.find( "input[name='" + $element.attr( "name" ) + "']" ) !== 1) { + if ( $legend.length !== 0 && $fieldset.find( "input[name='" + $element.attr( "name" ) + "']" ) !== 1 ) { $error.appendTo( $legend ); return; } @@ -239,7 +239,7 @@ var componentName = "wb-frmvld", } // Delay updating the summary container in case a summary link was clicked - setTimeout(function() { + setTimeout( function() { // Output our error summary and place it in the error container // Create our container if one doesn't already exist @@ -290,7 +290,7 @@ var componentName = "wb-frmvld", ariaLive.innerHTML = ""; } } - }); + } ); // Tell the i18n file to execute to run any $.validator extends $form.trigger( "formLanguages.wb" ); @@ -298,7 +298,7 @@ var componentName = "wb-frmvld", // Identify that initialization has completed wb.ready( $( eventTarget ), componentName ); } - }); + } ); } }; @@ -308,4 +308,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/geomap/demo/client_functions.js b/src/plugins/geomap/demo/client_functions.js index e5633a994dc..f5f3aea77e8 100644 --- a/src/plugins/geomap/demo/client_functions.js +++ b/src/plugins/geomap/demo/client_functions.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; var $document = wb.doc, @@ -37,16 +37,16 @@ $document.on( "wb-ready.wb-geomap", "#sample_map", function( event, map ) { //console.log( "BBox: " + $( this ).val() ); } ); - $aoiExtentLonLat.on("change", function() { + $aoiExtentLonLat.on( "change", function() { //console.log( "BBox LonLat: " + $( this ).val() ); } ); } -}); +} ); $document.on( "wb-ready.wb-geomap", "#location_map", function( event, map ) { // Zoom to location on location_map map.zoomToExtent( map.getLayer( "#addNRCan" ).getDataExtent() ); -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/geomap/geomap.js b/src/plugins/geomap/geomap.js index b314ed6ad33..b69373a530b 100644 --- a/src/plugins/geomap/geomap.js +++ b/src/plugins/geomap/geomap.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; var componentName = "wb-geomap", @@ -28,7 +28,7 @@ var componentName = "wb-geomap", $elm = $( elm ); modeJS = wb.getMode() + ".js"; - Modernizr.load([ { + Modernizr.load( [ { // For loading multiple dependencies both: [ @@ -39,7 +39,7 @@ var componentName = "wb-geomap", complete: function() { $elm.trigger( "geomap.wb" ); } - } ]); + } ] ); } }; @@ -49,4 +49,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/lightbox/demo/lightbox.js b/src/plugins/lightbox/demo/lightbox.js index fce142ad39a..3c5d05e5a26 100644 --- a/src/plugins/lightbox/demo/lightbox.js +++ b/src/plugins/lightbox/demo/lightbox.js @@ -3,7 +3,7 @@ * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ /*jshint unused: false*/ -(function( $, wb ) { +( function( $, wb ) { "use strict"; var $document = wb.doc; @@ -23,7 +23,7 @@ $document.on( "click vclick", "#lbx-open-btn", function( event ) { [ "Image 1" ] - ]); + ] ); } else if ( value === "2" ) { $document.trigger( "open.wb-lbx", [ [ @@ -32,7 +32,7 @@ $document.on( "click vclick", "#lbx-open-btn", function( event ) { type: "ajax" } ] - ]); + ] ); } else if ( value === "3" ) { $document.trigger( "open.wb-lbx", [ [ @@ -41,7 +41,7 @@ $document.on( "click vclick", "#lbx-open-btn", function( event ) { type: "inline" } ] - ]); + ] ); } else if ( value === "4" ) { $document.trigger( "open.wb-lbx", [ [ @@ -51,7 +51,7 @@ $document.on( "click vclick", "#lbx-open-btn", function( event ) { } ], true - ]); + ] ); } else if ( value === "5" ) { $document.trigger( "open.wb-lbx", [ [ @@ -72,8 +72,8 @@ $document.on( "click vclick", "#lbx-open-btn", function( event ) { "Image 2", "Image 3" ] - ]); + ] ); } -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/lightbox/lightbox.js b/src/plugins/lightbox/lightbox.js index 7f302a54891..9b785cc5b97 100644 --- a/src/plugins/lightbox/lightbox.js +++ b/src/plugins/lightbox/lightbox.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -103,7 +103,7 @@ var componentName = "wb-lbx", // Identify that initialization has completed wb.ready( $elm, componentName ); - }); + } ); // Load dependencies as needed setup(); @@ -230,7 +230,7 @@ var componentName = "wb-lbx", } // Load Magnific Popup dependency and bind the init event handler - Modernizr.load({ + Modernizr.load( { load: "site!deps/jquery.magnific-popup" + wb.getMode() + ".js", complete: function() { @@ -240,7 +240,7 @@ var componentName = "wb-lbx", $document.trigger( dependenciesLoadedEvent ); } - }); + } ); }; // Bind the init event of the plugin @@ -269,7 +269,7 @@ $document.on( "keydown", ".mfp-wrap", function( event ) { * so returning true allows for events to always continue */ return true; -}); +} ); /* * Sends focus to the close button if focus moves beyond the Lightbox (Jaws fix) @@ -287,7 +287,7 @@ $document.on( "focus", ".lbx-end", function( event ) { * so returning true allows for events to always continue */ return true; -}); +} ); // Outside focus detection (for screen readers that exit the lightbox // outside the normal means) @@ -300,7 +300,7 @@ $document.on( "focusin", "body", function( event ) { // Close the popup $.magnificPopup.close(); } -}); +} ); // Handler for clicking on a same page link within the overlay to outside the overlay $document.on( "click vclick", ".mfp-wrap a[href^='#']", function( event ) { @@ -332,13 +332,13 @@ $document.on( "click vclick", ".mfp-wrap a[href^='#']", function( event ) { } } } -}); +} ); // Event handler for closing a modal popup $( document ).on( "click", ".popup-modal-dismiss", function( event ) { event.preventDefault(); $.magnificPopup.close(); -}); +} ); // Event handler for opening a popup without a link $( document ).on( "open" + selector, function( event, items, modal, title ) { @@ -353,7 +353,7 @@ $( document ).on( "open" + selector, function( event, items, modal, title ) { // Ensure the dependencies are loaded first $document.one( dependenciesLoadedEvent, function() { - $.magnificPopup.open({ + $.magnificPopup.open( { items: items, modal: isModal, gallery: { @@ -363,15 +363,15 @@ $( document ).on( "open" + selector, function( event, items, modal, title ) { titleSrc: titleSrc }, callbacks: callbacks - }); - }); + } ); + } ); // Load dependencies as needed setup(); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/menu/menu.js b/src/plugins/menu/menu.js index 849f03df13c..ec476e52154 100644 --- a/src/plugins/menu/menu.js +++ b/src/plugins/menu/menu.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET community */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -52,12 +52,12 @@ var componentName = "wb-menu", // This is required for backwards compatibility. In previous versions, the menu was not integrated witht he data ajax plugin. ajaxFetch = $elm.data( "ajax-fetch" ); if ( ajaxFetch ) { - $elm.trigger({ + $elm.trigger( { type: "ajax-fetch.wb", fetch: { url: ajaxFetch } - }); + } ); } else { //Enhance menus that don't rely on the data-ajax plugin @@ -83,21 +83,21 @@ var componentName = "wb-menu", $elm = $elements.eq( i ); $subMenu = $elm.siblings( "ul" ); - $elm.attr({ + $elm.attr( { "aria-posinset": ( i + 1 ), "aria-setsize": length, role: "menuitem" - }); + } ); // if there is a submenu lets put in the aria for it if ( $subMenu.length !== 0 ) { $elm.attr( "aria-haspopup", "true" ); - $subMenu.attr({ + $subMenu.attr( { "aria-expanded": "false", "aria-hidden": "true" - }); + } ); // recurse into submenu drizzleAria( $subMenu.children( "li" ).find( menuItemSelector ) ); @@ -259,11 +259,11 @@ var componentName = "wb-menu", // Add the secondary menu if ( $secnav.length !== 0 ) { - allProperties.push([ + allProperties.push( [ $secnav.find( "> ul > li > *:first-child" ).get(), "sec-pnl", $secnav.find( "h2" ).html() - ]); + ] ); if ( $secnav.find( ".wb-navcurr" ).length === 0 ) { @@ -280,20 +280,20 @@ var componentName = "wb-menu", $menubar.attr( "role", "menubar" ); } - allProperties.push([ + allProperties.push( [ $menu.get(), "sm-pnl", $ajaxed.find( "h2" ).html() - ]); + ] ); } // Add the site information if ( $info.length !== 0 ) { - allProperties.push([ + allProperties.push( [ $info.find( "h3, a" ).not( "section a" ), "info-pnl", $info.find( "h2" ).html() - ]); + ] ); if ( $info.find( ".wb-navcurr" ).length === 0 ) { @@ -341,7 +341,7 @@ var componentName = "wb-menu", $elm.html( $ajaxed.html() ); // Trigger the navcurrent plugin - setTimeout(function() { + setTimeout( function() { $elm.trigger( navCurrentEvent, breadcrumb ); $panel.find( "#sm-pnl" ).trigger( navCurrentEvent, breadcrumb ); @@ -401,10 +401,10 @@ var componentName = "wb-menu", .removeClass( "sm-open" ) .children( ".open" ) .removeClass( "open" ) - .attr({ + .attr( { "aria-hidden": "true", "aria-expanded": "false" - }); + } ); if ( removeActive ) { $elm.removeClass( "active" ); @@ -429,10 +429,10 @@ var componentName = "wb-menu", .addClass( "active sm-open" ) .children( ".sm" ) .addClass( "open" ) - .attr({ + .attr( { "aria-hidden": "false", "aria-expanded": "true" - }); + } ); } }, @@ -492,7 +492,7 @@ $document.on( "timerpoke.wb " + initEvent + " ajax-fetched.wb ajax-failed.wb", s * so returning true allows for events to always continue */ return true; -}); +} ); $document.on( "mouseleave", selector + " .menu", function( event ) { // Clear the timeout for open/closing menus @@ -501,7 +501,7 @@ $document.on( "mouseleave", selector + " .menu", function( event ) { globalTimeout = setTimeout( function() { menuClose( $( event.currentTarget ).find( ".active" ), true ); }, hoverDelay ); -}); +} ); // Touchscreen "touches" on menubar items should close the submenu if it is open $document.on( "touchstart click", selector + " .item[aria-haspopup=true]", function( event ) { @@ -524,7 +524,7 @@ $document.on( "touchstart click", selector + " .item[aria-haspopup=true]", funct menuClose( $parent, true ); } } -}); +} ); // Click on menu items with submenus should open and close those submenus $document.on( "click", selector + " [role=menu] [aria-haspopup=true]", function( event ) { @@ -556,7 +556,7 @@ $document.on( "click", selector + " [role=menu] [aria-haspopup=true]", function( submenu.setAttribute( "aria-expanded", !isOpen ); submenu.setAttribute( "aria-hidden", isOpen ); -}); +} ); // Clicks and touches outside of menus should close any open menus $document.on( "click touchstart", function( event ) { @@ -572,9 +572,9 @@ $document.on( "click touchstart", function( event ) { menuClose( $openMenus, true ); } } -}); +} ); -$document.on( "mouseover focusin", selector + " .item", function(event) { +$document.on( "mouseover focusin", selector + " .item", function( event ) { var $elm = $( event.currentTarget ), $parent = $elm.parent(), $container = $parent.closest( selector ); @@ -589,7 +589,7 @@ $document.on( "mouseover focusin", selector + " .item", function(event) { menuDisplay( $container, $parent ); }, hoverDelay ); } -}); +} ); /* * Keyboard bindings @@ -703,10 +703,10 @@ $document.on( "keydown", selector + " [role=menuitem]", function( event ) { // Update the WAI-ARIA states and move focus to // the first submenu item $parent.children( "ul" ) - .attr({ + .attr( { "aria-expanded": "true", "aria-hidden": "false" - }) + } ) .find( "[role=menuitem]:first" ) .trigger( "setfocus.wb" ); } @@ -729,7 +729,7 @@ $document.on( "keydown", selector + " [role=menuitem]", function( event ) { $menuLink.trigger( focusEvent ); // Close the menu but keep the referring link active - setTimeout(function() { + setTimeout( function() { menuClose( $menuLink.parent(), false ); }, 1 ); @@ -785,7 +785,7 @@ $document.on( "keydown", selector + " [role=menuitem]", function( event ) { } } } -}); +} ); // Close the mobile panel if switching to medium, large or extra large view $document.on( "mediumview.wb largeview.wb xlargeview.wb", function() { @@ -793,9 +793,9 @@ $document.on( "mediumview.wb largeview.wb xlargeview.wb", function() { if ( mobilePanel && mobilePanel.getAttribute( "aria-hidden" ) === "false" ) { $( mobilePanel ).trigger( "close.wb-overlay" ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/multimedia/multimedia.js b/src/plugins/multimedia/multimedia.js index f2d310c88bd..8db6929f246 100644 --- a/src/plugins/multimedia/multimedia.js +++ b/src/plugins/multimedia/multimedia.js @@ -5,7 +5,7 @@ * @author WET Community */ /* globals YT */ -(function( $, window, wb, undef ) { +( function( $, window, wb, undef ) { "use strict"; /* Local scoped variables*/ @@ -64,12 +64,12 @@ var componentName = "wb-mltmd", if ( template === undef ) { template = ""; - $( eventTarget ).trigger({ + $( eventTarget ).trigger( { type: "ajax-fetch.wb", fetch: { url: wb.getPath( "/assets" ) + "/mediacontrols.html" } - }); + } ); } else if ( template !== "" ) { $( eventTarget ).trigger( templateLoadedEvent ); } @@ -147,7 +147,7 @@ var componentName = "wb-mltmd", * @credit: https://github.com/premasagar/tim/blob/master/tinytim.js * @todo: caching */ - tmpl = (function() { + tmpl = ( function() { var start = "{{", end = "}}", // e.g. config.person.name @@ -171,9 +171,9 @@ var componentName = "wb-mltmd", return lookup; } } - }); + } ); }; - }()), + } () ), /** * @method parseHtml @@ -263,7 +263,7 @@ var componentName = "wb-mltmd", * @fires ccloadfail.wb-mltmd */ loadCaptionsExternal = function( elm, url ) { - $.ajax({ + $.ajax( { url: url, dataType: "html", //Filters out images and objects from the content to avoid loading them @@ -271,20 +271,20 @@ var componentName = "wb-mltmd", return data.replace( /]*>/g, "" ); }, success: function( data ) { - elm.trigger({ + elm.trigger( { type: captionsLoadedEvent, captions: data.indexOf( " 0 ) { // lets tweak some variables and start the load sequence - url = wb.getUrlParts( $this.find( "[type='video/youtube']").attr( "src") ); + url = wb.getUrlParts( $this.find( "[type='video/youtube']" ).attr( "src" ) ); // lets set the flag for the call back data.youTubeId = url.params.v; @@ -589,7 +589,7 @@ $document.on( initializedEvent, selector, function( event ) { // Identify that initialization has completed wb.ready( $this, componentName ); } -}); +} ); $document.on( fallbackEvent, selector, function( event, data ) { if ( event.namespace === componentName ) { @@ -626,7 +626,7 @@ $document.on( fallbackEvent, selector, function( event, data ) { $this.trigger( renderUIEvent, [ type, data ] ); } -}); +} ); /* * Youtube Video mode Event @@ -663,7 +663,7 @@ $document.on( youtubeEvent, selector, function( event, data ) { t.player( "setCaptionsVisible", t.player( "getCaptionsVisible" ) ); } } - }); + } ); $this.addClass( "youtube" ); @@ -673,7 +673,7 @@ $document.on( youtubeEvent, selector, function( event, data ) { $this.trigger( renderUIEvent, "youtube", data ); } -}); +} ); $document.on( renderUIEvent, selector, function( event, type, data ) { if ( event.namespace === componentName ) { @@ -685,14 +685,14 @@ $document.on( renderUIEvent, selector, function( event, type, data ) { $media .after( tmpl( template, data ) ) - .wrap("
"); + .wrap( "
" ); $eventReceiver = $media.is( "object" ) ? $media.children( ":first-child" ) : $media; // Create an adapter for the event management $eventReceiver.on( multimediaEvents, function( event ) { $this.trigger( event ); - }); + } ); this.object = data.ytPlayer || $media.get( 0 ); this.player = ( data.ytPlayer ) ? youTubeApi : playerApi; @@ -729,7 +729,7 @@ $document.on( renderUIEvent, selector, function( event, type, data ) { loadCaptionsInternal( $media, $( "#" + wb.jqEscape( captionsUrl.hash.substring( 1 ) ) ) ); } } -}); +} ); /* * UI Bindings @@ -756,22 +756,22 @@ $document.on( "click", selector, function( event ) { } else if ( $target.is( "progress" ) || $target.hasClass( "progress" ) || $target.hasClass( "progress-bar" ) ) { this.player( "setCurrentTime", this.player( "getDuration" ) * ( ( event.pageX - $target.offset().left ) / $target.width() ) ); } else if ( className.match( /\brewind\b|-backward/ ) ) { - this.player( "setCurrentTime", this.player( "getCurrentTime" ) - this.player( "getDuration" ) * 0.05); + this.player( "setCurrentTime", this.player( "getCurrentTime" ) - this.player( "getDuration" ) * 0.05 ); } else if ( className.match( /\bfastforward\b|-forward/ ) ) { - this.player( "setCurrentTime", this.player( "getCurrentTime" ) + this.player( "getDuration" ) * 0.05); + this.player( "setCurrentTime", this.player( "getCurrentTime" ) + this.player( "getDuration" ) * 0.05 ); } else if ( className.match( /cuepoint/ ) ) { - $(this).trigger( { type: "cuepoint", cuepoint: $target.data( "cuepoint" ) } ); + $( this ).trigger( { type: "cuepoint", cuepoint: $target.data( "cuepoint" ) } ); } -}); +} ); -$document.on( "input change", selector, function(event) { +$document.on( "input change", selector, function( event ) { var target = event.target; if ( $( target ).hasClass( "volume" ) ) { event.currentTarget.player( "setMuted", false ); event.currentTarget.player( "setVolume", target.value / 100 ); } -}); +} ); $document.on( "keydown", selector, function( event ) { var $this = $( event.currentTarget ), @@ -788,11 +788,11 @@ $document.on( "keydown", selector, function( event ) { break; case 37: - playerTarget.player( "setCurrentTime", this.player( "getCurrentTime" ) - this.player( "getDuration" ) * 0.05); + playerTarget.player( "setCurrentTime", this.player( "getCurrentTime" ) - this.player( "getDuration" ) * 0.05 ); break; case 39: - playerTarget.player( "setCurrentTime", this.player( "getCurrentTime" ) + this.player( "getDuration" ) * 0.05); + playerTarget.player( "setCurrentTime", this.player( "getCurrentTime" ) + this.player( "getDuration" ) * 0.05 ); break; case 38: @@ -810,7 +810,7 @@ $document.on( "keydown", selector, function( event ) { } return false; } -}); +} ); $document.on( "keyup", selector, function( event ) { if ( event.which === 32 && !( event.ctrlKey || event.altKey || event.metaKey ) ) { @@ -818,11 +818,11 @@ $document.on( "keyup", selector, function( event ) { // Allows the spacebar to be used for play/pause without double triggering return false; } -}); +} ); $document.on( "wb-activate", selector, function() { this.player( "play" ); -}); +} ); $document.on( multimediaEvents, selector, function( event, simulated ) { var eventTarget = event.currentTarget, @@ -952,7 +952,7 @@ $document.on( multimediaEvents, selector, function( event, simulated ) { eventTarget.player( "setCurrentTime", parseTime( event.cuepoint ) ); break; } -}); +} ); // Fallback for browsers that don't implement the waiting events $document.on( "progress", selector, function( event ) { @@ -972,7 +972,7 @@ $document.on( "progress", selector, function( event ) { $this.trigger( "canplay", true ); } eventTarget.player( "setPreviousTime", eventTarget.player( "getCurrentTime" ) ); -}); +} ); $document.on( resizeEvent, selector, function( event ) { if ( event.namespace === componentName ) { @@ -993,7 +993,7 @@ $document.on( resizeEvent, selector, function( event ) { } } } -}); +} ); window.onYouTubeIframeAPIReady = youTubeAPIReady; @@ -1003,4 +1003,4 @@ window.youTube = { wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/navcurrent/navcurrent.js b/src/plugins/navcurrent/navcurrent.js index 669479c07b2..56bbca49ddb 100644 --- a/src/plugins/navcurrent/navcurrent.js +++ b/src/plugins/navcurrent/navcurrent.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -134,4 +134,4 @@ var componentName = "wb-navcurr", // Bind the navcurrent event of the plugin $document.on( "navcurr.wb", init ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/overlay/demo/overlay.js b/src/plugins/overlay/demo/overlay.js index d97de9f1a85..929d98e4805 100644 --- a/src/plugins/overlay/demo/overlay.js +++ b/src/plugins/overlay/demo/overlay.js @@ -3,7 +3,7 @@ * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ /*jshint unused: false*/ -(function( $, wb ) { +( function( $, wb ) { "use strict"; wb.doc.on( "click vclick", "#overlay-open-btn", function( event ) { @@ -14,6 +14,6 @@ wb.doc.on( "click vclick", "#overlay-open-btn", function( event ) { } $( "#" + $( "#overlay-select" ).val() ).trigger( "open.wb-overlay" ); -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/overlay/overlay.js b/src/plugins/overlay/overlay.js index bc972b73a37..6fa80680cbb 100644 --- a/src/plugins/overlay/overlay.js +++ b/src/plugins/overlay/overlay.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @thomasgohard, @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -88,7 +88,7 @@ var componentName = "wb-overlay", // Register the overlay if it wasn't previously registered // (only required when opening through an event) if ( !sourceLinks[ overlayId ] ) { - setTimeout(function() { + setTimeout( function() { sourceLinks[ overlayId ] = null; }, 1 ); } @@ -174,7 +174,7 @@ $document.on( "timerpoke.wb " + initEvent + " keydown open" + selector + break; } } -}); +} ); // Handler for clicking on the close button of the overlay $document.on( "click vclick", "." + closeClass, function( event ) { @@ -188,7 +188,7 @@ $document.on( "click vclick", "." + closeClass, function( event ) { true ); } -}); +} ); // Handler for clicking on a source link for the overlay $document.on( "click vclick", "." + linkClass, function( event ) { @@ -201,7 +201,7 @@ $document.on( "click vclick", "." + linkClass, function( event ) { event.preventDefault(); // Introduce a delay to prevent outside activity detection - setTimeout(function() { + setTimeout( function() { // Stores the source link for the overlay sourceLinks[ overlayId ] = sourceLink; @@ -210,7 +210,7 @@ $document.on( "click vclick", "." + linkClass, function( event ) { openOverlay( overlayId ); }, 1 ); } -}); +} ); // Handler for clicking on a same page link within the overlay to outside the overlay $document.on( "click vclick", selector + " a[href^='#']", function( event ) { @@ -239,7 +239,7 @@ $document.on( "click vclick", selector + " a[href^='#']", function( event ) { $( linkTarget ).trigger( setFocusEvent ); } } -}); +} ); // Outside activity detection $document.on( "click vclick touchstart focusin", "body", function( event ) { @@ -263,9 +263,9 @@ $document.on( "click vclick touchstart focusin", "body", function( event ) { } } } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/prettify/prettify.js b/src/plugins/prettify/prettify.js index 8d0076b4647..777c68a3854 100644 --- a/src/plugins/prettify/prettify.js +++ b/src/plugins/prettify/prettify.js @@ -30,7 +30,7 @@ * - lang-xq * - lang-yaml */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -98,12 +98,12 @@ var componentName = "wb-prettify", } // Load the required dependencies and prettify the code once finished - Modernizr.load({ + Modernizr.load( { load: deps, complete: function() { $document.trigger( prettyPrintEvent ); } - }); + } ); } }, @@ -133,4 +133,4 @@ $document // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/prettify/test.js b/src/plugins/prettify/test.js index a5d463aafa4..49374c4022f 100644 --- a/src/plugins/prettify/test.js +++ b/src/plugins/prettify/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -22,14 +22,14 @@ describe( "Prettify test suite", function() { /* * Before beginning the test suite, this function is executed once. */ - before(function(done) { + before( function( done ) { // Spy on jQuery's trigger method to see how it's called during the plugin's initialization spy = sandbox.spy( $.prototype, "trigger" ); // Start the tests once the plugin has been finished processing $document.on( "wb-ready.wb-prettify", function() { callback(); - }); + } ); callback = done; @@ -40,19 +40,19 @@ describe( "Prettify test suite", function() { $body.append( "
" );
 		$body.append( "
" );
-	});
+	} );
 
 	/*
 	 * After finishing the test suite, this function is executed once.
 	 */
-	after(function() {
+	after( function() {
 		// Restore the original behaviour of trigger once the tests are finished
 		sandbox.restore();
 
 		// Remove test elements from the page
 		$prettify.remove();
 		$( "pre.test" ).remove();
-	});
+	} );
 
 	/*
 	 * Test the initialization events of the plugin
@@ -61,24 +61,24 @@ describe( "Prettify test suite", function() {
 
 		it( "should have marked the element as initialized", function() {
 			expect( $prettify.hasClass( "wb-prettify-inited" ) ).to.equal( true );
-		});
+		} );
 
 		it( "should have created a window.prettyPrint function", function() {
 			expect( typeof window.prettyPrint ).to.equal( "function" );
-		});
+		} );
 
 		it( "should have added a .prettyprinted CSS class to pre.prettyprint elements", function() {
-			$( "pre.prettyprint" ).each(function() {
+			$( "pre.prettyprint" ).each( function() {
 				expect( this.className.indexOf( "prettyprinted" ) ).to.be.greaterThan( -1 );
-			});
-		});
+			} );
+		} );
 
 		it( "should not have added a .prettyprinted CSS class to pre elements without a .prettyprint class", function() {
-			$( "pre.noprettify" ).each(function() {
+			$( "pre.noprettify" ).each( function() {
 				expect( this.className.indexOf( "prettyprinted" ) ).to.equal( -1 );
-			});
-		});
-	});
+			} );
+		} );
+	} );
 
 	/*
 	 * Test default plugin settings
@@ -86,27 +86,27 @@ describe( "Prettify test suite", function() {
 	describe( "dependency loading", function() {
 
 		it( "should have loaded prettify.js file", function() {
-			expect( $("script[src*='deps/prettify']") ).to.have.length( 1 );
-		});
+			expect( $( "script[src*='deps/prettify']" ) ).to.have.length( 1 );
+		} );
 
 		it( "should have loaded lang-css.js syntax file", function() {
-			expect( $("script[src*='/lang-css']") ).to.have.length( 1 );
-		});
+			expect( $( "script[src*='/lang-css']" ) ).to.have.length( 1 );
+		} );
 
 		it( "should not have loaded lang-sql.js syntax file", function() {
-			expect( $("script[src*='/lang-sql']") ).to.have.length( 0 );
-		});
-	});
+			expect( $( "script[src*='/lang-sql']" ) ).to.have.length( 0 );
+		} );
+	} );
 
 	/*
 	 * Test plugin settings
 	 */
 	describe( "override plugin settings with CSS classes", function() {
 
-		before(function( done ) {
+		before( function( done ) {
 
 			//Prettify needs more time in IE to complete, due to the pre from mocha results
-			this.timeout(5000);
+			this.timeout( 5000 );
 
 			callback = done;
 
@@ -117,52 +117,52 @@ describe( "Prettify test suite", function() {
 				.addClass( "all-pre" )
 				.addClass( "linenums" )
 				.trigger( "wb-init.wb-prettify" );
-		});
+		} );
 
 		it( "should have loaded lang-sql.js syntax file", function() {
-			expect( $("script[src*='/lang-sql']") ).to.have.length( 1 );
-		});
+			expect( $( "script[src*='/lang-sql']" ) ).to.have.length( 1 );
+		} );
 
 		it( "should have added a .prettyprinted CSS class to all pre elements", function() {
 			expect( $( "pre.test.prettyprinted" ).length ).to.be( $( "pre.test" ).length );
-		});
+		} );
 
 		it( "should have added a .linenums CSS class to all pre elements", function() {
 			expect( $( "pre.test.linenums" ).length ).to.be( $( "pre.test" ).length );
-		});
-	});
+		} );
+	} );
 
 	/*
 	 * Test plugin settings
 	 */
 	describe( "override plugin settings with data attributes", function() {
 
-		before(function( done ) {
+		before( function( done ) {
 
 			//Prettify needs more time in IE to complete, due to the pre from mocha results
-			this.timeout(5000);
+			this.timeout( 5000 );
 
 			callback = done;
 
 			$body.append( "
" );
 			$prettify
 				.removeClass( "wb-prettify-inited" )
-				.removeClass( "all-pre linenums")
-				.data({
+				.removeClass( "all-pre linenums" )
+				.data( {
 					allpre: true,
 					linenums: true
-				})
+				} )
 				.trigger( "wb-init.wb-prettify" );
-		});
+		} );
 
 		it( "should have added a .prettyprinted CSS class to all pre elements", function() {
 			expect( $( "pre.test.prettyprinted" ).length ).to.be( $( "pre.test" ).length );
-		});
+		} );
 
 		it( "should have added a .linenums CSS class to all pre elements", function() {
 			expect( $( "pre.test.linenums" ).length ).to.be( $( "pre.test" ).length );
-		});
-	});
-});
+		} );
+	} );
+} );
 
-}( jQuery, wb ));
+}( jQuery, wb ) );
diff --git a/src/plugins/resize/resize.js b/src/plugins/resize/resize.js
index 7d8b09d05d3..3ed540ee33f 100644
--- a/src/plugins/resize/resize.js
+++ b/src/plugins/resize/resize.js
@@ -4,7 +4,7 @@
  * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
  * @author @pjackson28
  */
-(function( $, window, document, wb ) {
+( function( $, window, document, wb ) {
 "use strict";
 
 /*
@@ -145,4 +145,4 @@ $document.trigger( initEvent );
 // Add the timer poke to initialize the plugin
 wb.add( selector );
 
-})( jQuery, window, document, wb );
+} )( jQuery, window, document, wb );
diff --git a/src/plugins/session-timeout/session-timeout.js b/src/plugins/session-timeout/session-timeout.js
index a3fcbf124db..0266b360b98 100644
--- a/src/plugins/session-timeout/session-timeout.js
+++ b/src/plugins/session-timeout/session-timeout.js
@@ -4,7 +4,7 @@
  * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
  * @author @patheard
  */
-(function( $, window, document, wb ) {
+( function( $, window, document, wb ) {
 "use strict";
 
 /*
@@ -90,7 +90,7 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText,
 			};
 
 			// Create the modal dialog
-			initModalDialog(onReady);
+			initModalDialog( onReady );
 		}
 	},
 
@@ -107,7 +107,7 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText,
 		clearTimeout( $elm.data( eventName ) );
 
 		// Create the new timeout that will trigger the event
-		$elm.data( eventName, setTimeout(function() {
+		$elm.data( eventName, setTimeout( function() {
 			$elm.trigger( eventName, settings );
 		}, parseTime( time ) ) );
 	},
@@ -143,7 +143,7 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText,
 
 			// Get object references to the modal and its triggering link
 			$modalLink = $modal.prev()
-				.one( "wb-ready.wb-lbx", callback)
+				.one( "wb-ready.wb-lbx", callback )
 				.trigger( "wb-init.wb-lbx" );
 		} else {
 			callback();
@@ -176,7 +176,7 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText,
 					}
 					$elm.data( "lastActivity", currentTime );
 				}
-			});
+			} );
 		}
 	},
 
@@ -201,14 +201,14 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText,
 					clearTimeout( $elm.data( inactivityEvent ) );
 					clearTimeout( $elm.data( keepaliveEvent ) );
 
-					openModal({
+					openModal( {
 						body: "

" + i18nText.timeoutAlready + "

", buttons: $( "" ) .data( "logouturl", settings.logouturl ) - }); + } ); } - }); + } ); } }, @@ -238,13 +238,13 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText, i18nText.buttonEnd + buttonEnd ) .data( "logouturl", settings.logouturl ); - openModal({ + openModal( { body: "

" + timeoutBegin + "
" + i18nText.timeoutEnd + "

", buttons: [ $buttonContinue, $buttonEnd ], open: function() { var $minutes = $modal.find( ".min" ), $seconds = $modal.find( ".sec" ); - countdownInterval = setInterval(function() { + countdownInterval = setInterval( function() { if ( countdown( $minutes, $seconds ) ) { clearInterval( countdownInterval ); @@ -255,7 +255,7 @@ var $modal, $modalLink, countdownInterval, i18n, i18nText, } }, 1000 ); } - }); + } ); }, /** @@ -427,11 +427,11 @@ $document.on( "timerpoke.wb " + initEvent + " " + keepaliveEvent + " " + reset( event, settings ); break; } -}); +} ); $document.on( "click", "." + confirmClass, confirm ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/session-timeout/test.js b/src/plugins/session-timeout/test.js index 387a4eb0ac7..60f27172935 100644 --- a/src/plugins/session-timeout/test.js +++ b/src/plugins/session-timeout/test.js @@ -7,7 +7,7 @@ */ /* global jQuery, describe, it, expect, before, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -22,12 +22,12 @@ describe( "Session Timeout test suite", function() { $document = wb.doc, callback; - this.timeout(5000); + this.timeout( 5000 ); /* * Before beginning the test suite, this function is executed once. */ - before(function( done ) { + before( function( done ) { // Spy on jQuery's trigger and post methods spies.trigger = sandbox.spy( $.prototype, "trigger" ); @@ -37,13 +37,13 @@ describe( "Session Timeout test suite", function() { $document.on( "inactivity.wb-sessto", function() { $( ".wb-sessto-confirm.btn-primary" ).trigger( "click" ); - }); + } ); $document.on( "wb-ready.wb-sessto", ".wb-sessto", function() { if ( callback ) { callback(); } - }); + } ); $session = $( "" ) .data( "wet-boew", { @@ -51,22 +51,22 @@ describe( "Session Timeout test suite", function() { sessionalive: 10000, refreshLimit: 42000, refreshOnClick: true - }) - .appendTo( $document.find( "body" )) + } ) + .appendTo( $document.find( "body" ) ) .trigger( "wb-init.wb-sessto" ); - }); + } ); /* * After finishing the test suite, this function is executed once. */ - after(function() { + after( function() { // Cleanup the test element $session.remove(); $( "#wb-sessto-modal" ).remove(); // Restore the original behaviour of spies, server and timer sandbox.restore(); - }); + } ); /* * Test initialization of the plugin @@ -74,16 +74,16 @@ describe( "Session Timeout test suite", function() { describe( "init plugin", function() { it( "should trigger reset.wb-sessto event", function() { expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( true ); - }); + } ) ; it( "should have marked the element as initialized", function() { expect( $session.hasClass( "wb-sessto-inited" ) ).to.equal( true ); - }); - }); + } ); + } ); describe( "inactivity", function() { - before(function( done ) { + before( function( done ) { // Allow time for magnificPopup dependency to load setTimeout( function() { @@ -97,20 +97,20 @@ describe( "Session Timeout test suite", function() { done(); }, 500 ); - }); + } ); it( "should trigger inactivity.wb-sessto after 10000ms", function() { clock.tick( 10010 ); expect( spies.trigger.calledWith( "inactivity.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "should trigger keepalive.wb-sessto event after 10000ms", function() { expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "should trigger reset.wb-sessto event after 10000ms", function() { expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "should not have triggered inactivity events 19950ms", function() { spies.trigger.reset(); @@ -118,7 +118,7 @@ describe( "Session Timeout test suite", function() { expect( spies.trigger.calledWith( "inactivity.wb-sessto" ) ).to.equal( false ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( false ); expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( false ); - }); + } ); it( "should have triggered inactivity events after 20000ms", function() { spies.trigger.reset(); @@ -126,42 +126,42 @@ describe( "Session Timeout test suite", function() { expect( spies.trigger.calledWith( "inactivity.wb-sessto" ) ).to.equal( true ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( true ); expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "has no refreshCallbackUrl so should not call $.post", function() { expect( spies.post.called ).to.equal( false ); - }); + } ); - }); + } ); describe( "refresh onclick", function() { - before(function() { + before( function() { // Reset the state of the spies spies.trigger.reset(); spies.post.reset(); - }); + } ); it( "should trigger keepalive.wb-sessto on document click", function() { clock.tick( 42010 ); $document.trigger( "click" ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "should trigger reset.wb-sessto on document click", function() { expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "has no refreshCallbackUrl so should not call $.post", function() { expect( spies.post.called ).to.equal( false ); - }); + } ); it( "should not trigger keepalive.wb-sessto on document click (refresh limit prevents)", function() { spies.trigger.reset(); $document.trigger( "click" ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( false ); - }); + } ); it( "should trigger keepalive.wb-sessto on document click (refresh limit allows)", function() { spies.trigger.reset(); @@ -169,12 +169,12 @@ describe( "Session Timeout test suite", function() { $document.trigger( "click" ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( true ); - }); - }); + } ); + } ); describe( "refreshCallbackUrl", function() { - before(function( done ) { + before( function( done ) { // Setup the fake server response for all POST requests to foo.html server = sandbox.useFakeServer(); server.respondWith( "POST", "foo.html", "true" ); @@ -185,10 +185,10 @@ describe( "Session Timeout test suite", function() { $session.data( "wet-boew", { sessionalive: 5000, refreshCallbackUrl: "foo.html" - }) + } ) .removeClass( "wb-sessto-inited" ) .trigger( "wb-init.wb-sessto" ); - }); + } ); it( "should trigger keepalive.wb-sessto after 5000ms", function() { spies.trigger.reset(); @@ -196,19 +196,19 @@ describe( "Session Timeout test suite", function() { clock.tick( 5010 ); expect( spies.trigger.calledWith( "keepalive.wb-sessto" ) ).to.equal( true ); - }); + } ); it( "has refreshCallbackUrl so should call $.post", function() { expect( spies.post.called ).to.equal( true ); expect( spies.post.calledWith( "foo.html" ) ).to.equal( true ); - }); + } ); it( "successful response triggers reset.wb-sessto event", function() { server.respond(); expect( spies.trigger.calledWith( "reset.wb-sessto" ) ).to.equal( true ); - }); - }); + } ); + } ); -}); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/share/share.js b/src/plugins/share/share.js index 386b59ad0a2..b7710680ab6 100644 --- a/src/plugins/share/share.js +++ b/src/plugins/share/share.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -201,9 +201,9 @@ var componentName = "wb-share", } // i18n-friendly sort of the site keys - keys.sort(function( x, y ) { + keys.sort( function( x, y ) { return wb.normalizeDiacritics( x ).localeCompare( wb.normalizeDiacritics( y ) ); - }); + } ); len = keys.length; // Generate the panel @@ -248,4 +248,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/tables/tables.js b/src/plugins/tables/tables.js index 196a25f2dc7..529a885415a 100644 --- a/src/plugins/tables/tables.js +++ b/src/plugins/tables/tables.js @@ -5,7 +5,7 @@ * @author @jeresiv */ /*jshint scripturl:true*/ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -77,7 +77,7 @@ var componentName = "wb-tables", dom: "<'top'ilf>rt<'bottom'p><'clear'>" }; - Modernizr.load({ + Modernizr.load( { load: [ "site!deps/jquery.dataTables" + wb.getMode() + ".js" ], complete: function() { var $elm = $( "#" + elmId ), @@ -139,7 +139,7 @@ var componentName = "wb-tables", // Create the DataTable object $elm.dataTable( $.extend( true, {}, defaults, window[ componentName ], wb.getData( $elm, componentName ) ) ); } - }); + } ); } }; @@ -153,15 +153,15 @@ $document.on( "init.dt draw.dt", selector, function( event, settings ) { // Update the aria-pressed properties on the pagination buttons // Should be pushed upstream to DataTables $elm.next( ".bottom" ).find( ".paginate_button" ) - .attr({ + .attr( { "role": "button", "href": "javascript:;" - }) + } ) .not( ".previous, .next" ) .attr( "aria-pressed", "false" ) - .html( function(index) { + .html( function( index ) { return "" + i18nText.paginate.page + " " + ( index + 1 ) ; - }) + } ) .filter( ".current" ) .attr( "aria-pressed", "true" ); @@ -173,9 +173,9 @@ $document.on( "init.dt draw.dt", selector, function( event, settings ) { // Identify that the table has been updated $elm.trigger( "wb-updated" + selector, [ settings ] ); -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/tabs/tabs.js b/src/plugins/tabs/tabs.js index 3f421ee421a..afb7a64f5db 100644 --- a/src/plugins/tabs/tabs.js +++ b/src/plugins/tabs/tabs.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author WET Community */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -132,7 +132,7 @@ var componentName = "wb-tabs", space: i18n( "space" ), hyphen: i18n( "hyphen" ), pause: i18n( "pause" ), - tabCount: i18n( "lb-curr") + tabCount: i18n( "lb-curr" ) }; } @@ -182,10 +182,10 @@ var componentName = "wb-tabs", $panel.toggleClass( "open", isOpen ); } } else { - $panel.attr({ + $panel.attr( { role: "tabpanel", open: open - }); + } ); $panel.addClass( ( Modernizr.details ? "" : open + " " ) + "fade " + ( isOpen ? "in" : "out wb-inv" ) ); } @@ -237,7 +237,7 @@ var componentName = "wb-tabs", if ( hashFocus ) { // Need a slight delay to allow for the reflow - setTimeout(function() { + setTimeout( function() { positionY = $tablist.offset().top; if ( positionY < document.body.scrollTop ) { document.body.scrollTop = positionY; @@ -245,14 +245,14 @@ var componentName = "wb-tabs", }, 1 ); } - $elm.data({ + $elm.data( { "wb-tabs": { panels: $panels, tablist: $tablist, settings: settings, ctime: 0 } - }); + } ); initialized = true; onResize( $elm ); @@ -421,10 +421,10 @@ var componentName = "wb-tabs", $currPanel .removeClass( "in" ) .addClass( "out" ) - .attr({ + .attr( { "aria-hidden": "true", "aria-expanded": "false" - }); + } ); // Pause all multimedia players in the current panel for ( i = 0; i !== mPlayersLen; i += 1 ) { @@ -437,19 +437,19 @@ var componentName = "wb-tabs", $next .removeClass( "out" ) .addClass( "in" ) - .attr({ + .attr( { "aria-hidden": "false", "aria-expanded": "true" - }); + } ); $controls .find( ".active" ) .removeClass( "active" ) .children( "a" ) - .attr({ + .attr( { "aria-selected": "false", tabindex: "-1" - }); + } ); // Update the Item x of n $controls @@ -457,10 +457,10 @@ var componentName = "wb-tabs", .html( newIndex ); $control - .attr({ + .attr( { "aria-selected": "true", tabindex: "0" - }) + } ) .parent() .addClass( "active" ); @@ -528,10 +528,10 @@ var componentName = "wb-tabs", $panel.children( "summary" ).trigger( $panel.attr( "open" ) ? setFocusEvent : "click" ); } else { $panelSelectorLink = $( panelSelector + "-lnk" ); - $panelSelectorLink.trigger({ + $panelSelectorLink.trigger( { type: "click", which: autoCycle ? undefined : 1 - }); + } ); // Don't change the focus if change is cause by an auto cycle if ( !autoCycle ) { @@ -546,10 +546,10 @@ var componentName = "wb-tabs", * @param {integer} shifto The item to shift to */ onCycle = function( $elm, shifto ) { - $elm.trigger({ + $elm.trigger( { type: shiftEvent, shiftto: shifto - }); + } ); }, /** @@ -604,25 +604,25 @@ var componentName = "wb-tabs", $openDetails = ( $openDetails.length === 0 ? $details : $openDetails ).eq( 0 ); $details - .attr({ + .attr( { role: "tabpanel", open: "open" - }) + } ) .not( $openDetails ) .addClass( "fade out wb-inv" ) - .attr({ + .attr( { "aria-hidden": "true", "aria-expanded": "false" - }); + } ); $details.children( ".tgl-panel" ).removeAttr( "role" ); $openDetails .addClass( "fade in" ) - .attr({ + .attr( { "aria-hidden": "false", "aria-expanded": "true" - }); + } ); } // Enable equal heights for large view or disable for small view @@ -650,7 +650,7 @@ var componentName = "wb-tabs", // Need timeout to account for Toggle changes if ( isInit && !isSmallView && $elms.hasClass( tabsAccordionClass ) ) { - setTimeout(function() { + setTimeout( function() { $elms .removeAttr( "role" ) .find( nestedTglPanelSelector ).removeAttr( "role" ); @@ -664,7 +664,7 @@ var componentName = "wb-tabs", if ( viewChange || isInit ) { // Remove wb-inv from regular tabs that were used to prevent FOUC (after 300ms delay) - setTimeout(function() { + setTimeout( function() { $( selector + " .tabpanels > details.wb-inv" ).removeClass( "wb-inv" ); }, 300 ); } @@ -716,7 +716,7 @@ var componentName = "wb-tabs", * so returning true allows for events to always continue */ return true; - }); + } ); /* * Tabs, next, previous and play/pause @@ -809,7 +809,7 @@ var componentName = "wb-tabs", * so returning true allows for events to always continue */ return true; -}); +} ); $document.on( activateEvent, selector + " [role=tabpanel]", function( event ) { var currentTarget = event.currentTarget, @@ -845,7 +845,7 @@ $document.on( activateEvent, selector + " [role=tabpanel]", function( event ) { $container.find( ".plypause" ).trigger( "click" ); } } -}); +} ); // Handling for links to tabs from within a panel $document.on( "click", selector + " [role=tabpanel] a", function( event ) { @@ -868,7 +868,7 @@ $document.on( "click", selector + " [role=tabpanel] a", function( event ) { } } } -}); +} ); // These events only fire at the document level $document.on( wb.resizeEvents, onResize ); @@ -907,7 +907,7 @@ $document.on( activateEvent, selector + " > .tabpanels > details > summary", fun $container.trigger( updatedEvent, [ $details ] ); } } -}); +} ); // Change the panel based upon an external link click $document.on( "click", ".wb-tabs-ext", function( event ) { @@ -918,9 +918,9 @@ $document.on( "click", ".wb-tabs-ext", function( event ) { event.preventDefault(); onSelect( event.currentTarget.getAttribute( "href" ).substring( 1 ) ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/texthighlight/test.js b/src/plugins/texthighlight/test.js index 909676b5125..b3657fb9ab0 100644 --- a/src/plugins/texthighlight/test.js +++ b/src/plugins/texthighlight/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, beforeEach, after, afterEach, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -33,15 +33,15 @@ describe( "Text highlighting test suite", function() { if ( callback ) { callback(); } - }); - }); + } ); + } ); /* * After finishing the test suite, this function is exectued once. */ after( function() { sandbox.restore(); - }); + } ); beforeEach( function( done ) { callback = done; @@ -49,11 +49,11 @@ describe( "Text highlighting test suite", function() { $elm = $( "

This is a test. It's just some testing.

" ) .appendTo( $body ) .trigger( initEventObj ); - }); + } ); afterEach( function() { $elm.remove(); - }); + } ); /* * Test initialization of the plugin @@ -61,19 +61,19 @@ describe( "Text highlighting test suite", function() { describe( "init plugin", function() { before( function() { initEventObj = defaultInitEventObj; - }); + } ); it( "should have marked the element as initialized", function() { expect( $elm.hasClass( "wb-txthl-inited" ) ).to.equal( true ); - }); - }); + } ); + } ); ( wb.pageUrlParts.params.txthl ? describe : describe.skip )( "search query from the querystring", function() { var $matches; before( function() { initEventObj = defaultInitEventObj; - }); + } ); it( "should have highlighted words matching the query", function() { var matchesLength; @@ -86,8 +86,8 @@ describe( "Text highlighting test suite", function() { expect( $matches.eq( 0 ).text() ).to.equal( "test" ); expect( $matches.eq( 1 ).text() ).to.equal( "just some" ); expect( $matches.eq( 2 ).text() ).to.equal( "test" ); - }); - }); + } ); + } ); describe( "dynamic search query", function() { var $matches; @@ -96,7 +96,7 @@ describe( "Text highlighting test suite", function() { before( function() { initEventObj = defaultInitEventObj; initEventObj.txthl = "test"; - }); + } ); it( "should have highlighted words matching the query", function() { var matchesLength, m; @@ -109,14 +109,14 @@ describe( "Text highlighting test suite", function() { for ( m = 0; m < matchesLength; m += 1 ) { expect( $matches.eq( m ).text() ).to.equal( "test" ); } - }); - }); + } ); + } ); describe( "complex query as a string", function() { before( function() { initEventObj = defaultInitEventObj; initEventObj.txthl = "just some|test"; - }); + } ); it( "should have highlighted words matching the query", function() { var matchesLength; @@ -129,8 +129,8 @@ describe( "Text highlighting test suite", function() { expect( $matches.eq( 0 ).text() ).to.equal( "test" ); expect( $matches.eq( 1 ).text() ).to.equal( "just some" ); expect( $matches.eq( 2 ).text() ).to.equal( "test" ); - }); - }); + } ); + } ); describe( "complex query as an array", function() { before( function() { @@ -139,7 +139,7 @@ describe( "Text highlighting test suite", function() { "just some", "test" ]; - }); + } ); it( "should have highlighted words matching the query", function() { var matchesLength; @@ -152,9 +152,9 @@ describe( "Text highlighting test suite", function() { expect( $matches.eq( 0 ).text() ).to.equal( "test" ); expect( $matches.eq( 1 ).text() ).to.equal( "just some" ); expect( $matches.eq( 2 ).text() ).to.equal( "test" ); - }); - }); - }); -}); + } ); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/texthighlight/texthighlight.js b/src/plugins/texthighlight/texthighlight.js index de1396a84d9..56c5870b7a5 100644 --- a/src/plugins/texthighlight/texthighlight.js +++ b/src/plugins/texthighlight/texthighlight.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -33,7 +33,7 @@ var componentName = "wb-txthl", if ( elm ) { if ( event.txthl ) { - searchCriteria = $.isArray(event.txthl) ? event.txthl.join( "|" ) : event.txthl; + searchCriteria = $.isArray( event.txthl ) ? event.txthl.join( "|" ) : event.txthl; } else if ( params && params.txthl ) { searchCriteria = decodeURIComponent( wb.pageUrlParts.params.txthl @@ -48,7 +48,7 @@ var componentName = "wb-txthl", newText = elm.innerHTML.replace( new RegExp( searchCriteria, "gi" ), function( match, group1, group2, group3 ) { return ( !group2 ? "" : group2 ) + "" + group3 + ""; - }); + } ); elm.innerHTML = newText; } @@ -63,4 +63,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/plugins/toggle/test.js b/src/plugins/toggle/test.js index e239f1886ff..4185fe802f3 100644 --- a/src/plugins/toggle/test.js +++ b/src/plugins/toggle/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, after, sinon */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -21,18 +21,18 @@ describe( "Toggle test suite", function() { /* * Before begining the test suite, this function is exectued once. */ - before(function() { + before( function() { // Spy on jQuery's trigger method to see how it's called during the plugin's initialization spy = sandbox.spy( $.prototype, "trigger" ); - }); + } ); /* * After finishing the test suite, this function is exectued once. */ - after(function() { + after( function() { // Restore the original behaviour of trigger once the tests are finished sandbox.restore(); - }); + } ); /* * Test initialization of the plugin @@ -40,7 +40,7 @@ describe( "Toggle test suite", function() { describe( "initialization", function() { var $test, $toggleSelf, $toggleOthers, $accordion, $toggleTabs; - before(function() { + before( function() { // Create test element $test = $( "
" ) .appendTo( $body ); @@ -63,36 +63,36 @@ describe( "Toggle test suite", function() { "" + "
" + "" + - "
") + "
" ) .appendTo( $body ); $toggleTabs = $accordion.find( ".wb-toggle" ) .trigger( "wb-init.wb-toggle" ); - }); + } ); - after(function() { + after( function() { $test.remove(); $toggleSelf.remove(); $toggleOthers.remove(); $accordion.remove(); - }); + } ); it( "should have been marked toggle elements as initialized", function() { expect( $toggleSelf.hasClass( "wb-toggle-inited" ) ).to.equal( true ); expect( $toggleOthers.hasClass( "wb-toggle-inited" ) ).to.equal( true ); $toggleTabs.each( function() { expect( $( this ).hasClass( "wb-toggle-inited" ) ).to.equal( true ); - }); - }); + } ); + } ); it( "should have merged default settings with toggle element's data", function() { var data = $toggleSelf.data( "toggle" ); expect( data.stateOn ).to.equal( "on" ); expect( data.stateOff ).to.equal( "off" ); - }); + } ); it( "$toggleSelf should have aria-controls attribute set to own ID", function() { expect( $toggleSelf.attr( "aria-controls" ) ).to.equal( $toggleSelf.attr( "id" ) ); - }); + } ); it( "$toggleOthers should have aria-controls attribute set to controlled elements", function() { var ariaControls = "", @@ -100,9 +100,9 @@ describe( "Toggle test suite", function() { $( selector ).each( function() { ariaControls += this.id + " "; - }); + } ); expect( $toggleOthers.attr( "aria-controls" ) ).to.equal( $.trim( ariaControls ) ); - }); + } ); it( "should have aria tablist attributes if a tablist", function() { var data, $panel, $parent; @@ -114,17 +114,17 @@ describe( "Toggle test suite", function() { $parent.find( ".tgl-tab" ).each( function() { expect( this.getAttribute( "role" ) ).to.equal( "tab" ); - }); + } ); $parent.find( ".tgl-panel" ).each( function() { expect( this.getAttribute( "role" ) ).to.equal( "tabpanel" ); - }); + } ); $parent.find( data.group ).each( function() { $panel = $( this ); expect( $panel.find( ".tgl-panel" ).attr( "aria-labelledby" ) ).to.equal( $panel.find( ".tgl-tab" ).attr( "id" ) ); - }); - }); - }); - }); + } ); + } ); + } ); + } ); /* * Test plugin click event @@ -132,7 +132,7 @@ describe( "Toggle test suite", function() { describe( "click event", function() { var $toggle; - before(function() { + before( function() { spy.reset(); // Create toggle element and trigger plugin init @@ -140,24 +140,24 @@ describe( "Toggle test suite", function() { .appendTo( $body ) .trigger( "wb-init.wb-toggle" ) .trigger( "click" ); - }); + } ); - after(function() { + after( function() { $toggle.remove(); - }); + } ); it( "should trigger toggle.wb-toggle", function() { expect( spy.calledWith( "toggle.wb-toggle" ) ).to.equal( true ); - }); + } ); it( "should trigger toggled.wb-toggle", function() { expect( spy.calledWith( "toggled.wb-toggle" ) ).to.equal( true ); - }); + } ); it( "should trigger focus.wb", function() { expect( spy.calledWith( "setfocus.wb" ) ).to.equal( true ); - }); - }); + } ); + } ); /* * Test specific toggle element @@ -165,30 +165,30 @@ describe( "Toggle test suite", function() { describe( "toggle on/off states of selector", function() { var $toggler, $toggledElm; - before(function() { + before( function() { // Create the toggle element and start testing once it has been initialized $toggledElm = $( "
" ).appendTo( $body ); $toggler = $( "
" ) .appendTo( $body ); $details = $accordion.find( "details" ); $panels = $accordion.find( ".tgl-panel" ); $tabs = $accordion.find( ".tgl-tab" ) .trigger( "wb-init.wb-toggle" ); - }); + } ); - after(function() { + after( function() { $accordion.remove(); - }); + } ); it( "should open the first accordion panel", function() { $tabs.eq( 0 ).trigger( "click" ); testAccordionOpen( 0 ); testAccordionClosed( 1 ); - }); + } ); it( "should open the second accordion panel", function() { $tabs.eq( 1 ).trigger( "click" ); testAccordionOpen( 1 ); testAccordionClosed( 0 ); - }); + } ); it( "should close the second accordion panel", function() { $tabs.eq( 1 ).trigger( "click" ); testAccordionClosed( 0 ); testAccordionClosed( 1 ); - }); - }); + } ); + } ); /* * Test onbeforeprint behaviour @@ -430,7 +430,7 @@ describe( "Toggle test suite", function() { describe( "Printing toggle elements", function() { var $detailsOn, $detailsOff; - before(function() { + before( function() { spy.reset(); $detailsOn = $( "
" ) @@ -441,25 +441,25 @@ describe( "Toggle test suite", function() { .trigger( "wb-init.wb-toggle" ); wb.win.trigger( "beforeprint" ); - }); + } ); - after(function() { + after( function() { $detailsOn.remove(); $detailsOff.remove(); - }); + } ); it( "should trigger toggle.wb-toggle", function() { expect( spy.calledWith( "toggle.wb-toggle" ) ).to.equal( true ); - }); + } ); it( "should toggle on the $detailsOn element", function() { expect( $detailsOn.hasClass( "on" ) ).to.equal( true ); - }); + } ); it( "should toggle off the $detailsOff element", function() { expect( $detailsOff.hasClass( "off" ) ).to.equal( true ); - }); - }); + } ); + } ); /* * Test persistence behaviour @@ -469,7 +469,7 @@ describe( "Toggle test suite", function() { keyLocal = "wb-toggletest-local", keySession = "wb-toggletest-session"; - before(function() { + before( function() { spy.reset(); localStorage.removeItem( keyLocal ); sessionStorage.removeItem( keySession ); @@ -481,74 +481,74 @@ describe( "Toggle test suite", function() { $detailsSession = $( "
" ) .appendTo( $body ) .trigger( "wb-init.wb-toggle" ); - }); + } ); - after(function() { + after( function() { $detailsLocal.remove(); $detailsSession.remove(); - }); + } ); it( "should not trigger toggle.wb-toggle when initialized", function() { expect( spy.calledWith( "toggle.wb-toggle" ) ).to.equal( false ); expect( localStorage.getItem( keyLocal ) ).to.equal( null ); expect( sessionStorage.getItem( keySession ) ).to.equal( null ); - }); + } ); it( "should save the toggle 'on' state in localStorage", function() { $detailsLocal.trigger( "click" ); expect( localStorage.getItem( keyLocal ) ).to.equal( "on" ); - }); + } ); it( "should save the toggle 'off' state in localStorage", function() { $detailsLocal.trigger( "click" ); expect( localStorage.getItem( keyLocal ) ).to.equal( "off" ); - }); + } ); it( "should save the toggle 'on' state in sessionStorage", function() { $detailsSession.trigger( "click" ); expect( sessionStorage.getItem( keySession ) ).to.equal( "on" ); - }); + } ); it( "should save the toggle 'off' state in sessionStorage", function() { $detailsSession.trigger( "click" ); expect( sessionStorage.getItem( keySession ) ).to.equal( "off" ); - }); - }); + } ); + } ); describe( "Persist toggle state: saved state", function() { var $details, key = "wb-toggletest-session"; - before(function() { + before( function() { spy.reset(); sessionStorage.setItem( key, "on" ); $details = $( "
" ) .appendTo( $body ) .trigger( "wb-init.wb-toggle" ); - }); + } ); - after(function() { + after( function() { $details.remove(); - }); + } ); it( "should trigger toggle.wb-toggle when initialized", function() { expect( spy.calledWith( "toggle.wb-toggle" ) ).to.equal( true ); expect( sessionStorage.getItem( key ) ).to.equal( "on" ); - }); + } ); it( "should save the toggle 'off' state in sessionStorage", function() { $details.trigger( "click" ); expect( sessionStorage.getItem( key ) ).to.equal( "off" ); - }); - }); + } ); + } ); describe( "Persist toggle state: group toggle", function() { var $details1, $details2, key1 = "wb-toggle.test-grouptest-1", key2 = "wb-toggle.test-grouptest-2"; - before(function() { + before( function() { spy.reset(); sessionStorage.removeItem( key1 ); sessionStorage.removeItem( key2 ); @@ -560,31 +560,31 @@ describe( "Toggle test suite", function() { $details1.trigger( "wb-init.wb-toggle" ); $details2.trigger( "wb-init.wb-toggle" ); - }); + } ); - after(function() { + after( function() { $details1.remove(); $details2.remove(); - }); + } ); it( "should save the 'on' state for $details1 and clear the state for $details2", function() { $details1.trigger( "click" ); expect( sessionStorage.getItem( key1 ) ).to.equal( "on" ); expect( sessionStorage.getItem( key2 ) ).to.equal( null ); - }); + } ); it( "should save the 'off' state for $details1 and clear the state for $details2", function() { $details1.trigger( "click" ); expect( sessionStorage.getItem( key1 ) ).to.equal( "off" ); expect( sessionStorage.getItem( key2 ) ).to.equal( null ); - }); + } ); it( "should clear the state for $details1 and save the 'on' state for $details2", function() { $details2.trigger( "click" ); expect( sessionStorage.getItem( key1 ) ).to.equal( null ); expect( sessionStorage.getItem( key2 ) ).to.equal( "on" ); - }); - }); -}); + } ); + } ); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/toggle/toggle.js b/src/plugins/toggle/toggle.js index d72a0220264..094a18e52f1 100644 --- a/src/plugins/toggle/toggle.js +++ b/src/plugins/toggle/toggle.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @patheard */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -181,7 +181,7 @@ var componentName = "wb-toggle", $window.on( printEvent, function() { $link.trigger( toggleEvent, $.extend( {}, data, { type: data.print } ) ); - }); + } ); // Fallback for browsers that don't support print events if ( window.matchMedia ) { @@ -191,7 +191,7 @@ var componentName = "wb-toggle", if ( query.matches ) { $window.trigger( printEvent ); } - }); + } ); } } }, @@ -246,7 +246,7 @@ var componentName = "wb-toggle", isOn: false, isTablist: isTablist, elms: $elmsGroup - }); + } ); // Remove all grouped persistence keys if ( isPersist ) { @@ -267,7 +267,7 @@ var componentName = "wb-toggle", isOn: isToggleOn, isTablist: isTablist, elms: $elms - }); + } ); // Store the toggle link's current state if persistence is turned on. // Try/catch is required to address exceptions thrown when using BB10 or @@ -313,14 +313,14 @@ var componentName = "wb-toggle", if ( data.isTablist ) { // Set the required aria attributes - $elms.find( selectorTab ).attr({ + $elms.find( selectorTab ).attr( { "aria-selected": isOn, tabindex: isOn ? "0" : "-1" - }); - $elms.find( selectorPanel ).attr({ + } ); + $elms.find( selectorPanel ).attr( { "aria-hidden": !isOn, "aria-expanded": isOn - }); + } ); // Check that the top of the open element is in view. if ( isOn && $elms.length === 1 ) { @@ -438,7 +438,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + toggleEvent + init( event ); break; } -}); +} ); $document.on( toggledEvent, "details", toggleDetails ); @@ -492,7 +492,7 @@ $document.on( "keydown", selectorTab, function( event ) { .children( "summary" ) .trigger( setFocusEvent ); } -}); +} ); $document.on( "keydown", selectorPanel, function( event ) { @@ -504,9 +504,9 @@ $document.on( "keydown", selectorPanel, function( event ) { .prev() .trigger( setFocusEvent ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/twitter/test.js b/src/plugins/twitter/test.js index 42c6a117e4a..ab329aa07d0 100644 --- a/src/plugins/twitter/test.js +++ b/src/plugins/twitter/test.js @@ -6,7 +6,7 @@ */ /* global jQuery, describe, it, expect, before, after */ /* jshint unused:vars */ -(function( $, wb ) { +( function( $, wb ) { /* * Create a suite of related test cases using `describe`. Test suites can also be @@ -23,10 +23,10 @@ describe( "Twitter test suite", function() { $document = wb.doc, $body = $document.find( "body" ); - before(function( done ) { + before( function( done ) { // The Twitter widget sometimes takes longer than two second to load - this.timeout(5000); + this.timeout( 5000 ); // Trigger plugin init $elm = $( "" ) @@ -35,12 +35,12 @@ describe( "Twitter test suite", function() { $document.on( "wb-ready.wb-twitter", ".wb-twitter", function() { done(); - }); - }); + } ); + } ); - after(function() { + after( function() { $elm.remove(); - }); + } ); /* * Test the initialization events of the plugin @@ -48,9 +48,9 @@ describe( "Twitter test suite", function() { describe( "init event", function() { it( "should have added the wb-twitter-inited CSS class", function() { expect( $elm.hasClass( "wb-twitter-inited" ) ).to.equal( true ); - }); - }); + } ); + } ); -}); +} ); -}( jQuery, wb )); +}( jQuery, wb ) ); diff --git a/src/plugins/twitter/twitter.js b/src/plugins/twitter/twitter.js index c50d0252ee9..443c88cd3c6 100644 --- a/src/plugins/twitter/twitter.js +++ b/src/plugins/twitter/twitter.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -38,7 +38,7 @@ var componentName = "wb-twitter", // Identify that initialization has completed wb.ready( $( eventTarget ), componentName ); } - }); + } ); } }; @@ -47,4 +47,4 @@ $document.on( "timerpoke.wb " + initEvent, selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/wb-disable/disable.js b/src/plugins/wb-disable/disable.js index 8f918e940dd..9604e78924c 100644 --- a/src/plugins/wb-disable/disable.js +++ b/src/plugins/wb-disable/disable.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @gc */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -50,8 +50,8 @@ var componentName = "wb-disable", try { // Store preference for WET plugins and polyfills to be disabled in localStorage - localStorage.setItem( "wbdisable", "true"); - } catch (e) {} + localStorage.setItem( "wbdisable", "true" ); + } catch ( e ) {} // Append the Standard version link li.innerHTML = "" + i18n( "wb-enable" ) + ""; @@ -88,4 +88,4 @@ $document.on( "timerpoke.wb", selector, init ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/plugins/wb-focus/focus.js b/src/plugins/wb-focus/focus.js index 3c5f15df44d..dd20883ba6a 100644 --- a/src/plugins/wb-focus/focus.js +++ b/src/plugins/wb-focus/focus.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; var $document = wb.doc, @@ -54,7 +54,7 @@ $document.on( setFocusEvent, function( event ) { .attr( "tabindex", "-1" ); // Assigns focus to an element (delay allows for revealing of hidden content) - setTimeout(function() { + setTimeout( function() { $elm.trigger( "focus" ); var $topBar = $( ".wb-bar-t[aria-hidden=false]" ); @@ -67,7 +67,7 @@ $document.on( setFocusEvent, function( event ) { return $elm; }, 100 ); } -}); +} ); // Set focus to the target of a deep link from a different page // (helps browsers that can't set the focus on their own) @@ -79,7 +79,7 @@ $window.on( "hashchange", function() { if ( !wb.ignoreHashChange ) { processHash(); } -}); +} ); // Helper for browsers that can't change keyboard and/or event focus on a same page link click $document.on( clickEvents, linkSelector, function( event ) { @@ -91,6 +91,6 @@ $document.on( clickEvents, linkSelector, function( event ) { wb.ignoreHashChange = true; $linkTarget.trigger( setFocusEvent ); } -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/plugins/zebra/zebra.js b/src/plugins/zebra/zebra.js index db3c879348e..ca2504427b1 100644 --- a/src/plugins/zebra/zebra.js +++ b/src/plugins/zebra/zebra.js @@ -6,7 +6,7 @@ * @author @duboisp * */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /** @@ -121,7 +121,7 @@ } // Load the required dependencies - Modernizr.load({ + Modernizr.load( { // For loading multiple dependencies load: deps, @@ -130,7 +130,7 @@ // Let's parse the table $( "#" + elmId ).trigger( tableParsingEvent ); } - }); + } ); } }; @@ -163,7 +163,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + tableParsingCompleteEvent, sel * so returning true allows for events to always continue */ return true; -}); +} ); // Applying the hover, Simulate Column Hovering Effect $document.on( "mouseenter focusin", selectorHoverCol, function( event ) { @@ -172,7 +172,7 @@ $document.on( "mouseenter focusin", selectorHoverCol, function( event ) { if ( tblparserCell.col && tblparserCell.col.elem ) { $( tblparserCell.col.elem ).addClass( "table-hover" ); } -}); +} ); // Removing the hover, Simulate Column Hovering Effect $document.on( "mouseleave focusout", selectorHoverCol, function( event ) { @@ -181,9 +181,9 @@ $document.on( "mouseleave focusout", selectorHoverCol, function( event ) { if ( tblparserCell.col && tblparserCell.col.elem ) { $( tblparserCell.col.elem ).removeClass( "table-hover" ); } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/polyfills/datalist/datalist.js b/src/polyfills/datalist/datalist.js index 8ced4428f97..01784db6fc2 100644 --- a/src/polyfills/datalist/datalist.js +++ b/src/polyfills/datalist/datalist.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -82,7 +82,7 @@ var componentName = "wb-datalist", $options = $autolist.next().children().clone(), comparator; - if ( value && value.length !== 0) { + if ( value && value.length !== 0 ) { comparator = value.toLowerCase(); $options = $options.filter( function() { var $this = $( this ), @@ -91,7 +91,7 @@ var componentName = "wb-datalist", value = $this.find( "span.al-lbl" ).html(); } return ( comparator.length === 0 || value.toLowerCase().indexOf( comparator ) !== -1 ); - }); + } ); } // Add the visible options to the autolist @@ -131,10 +131,10 @@ var componentName = "wb-datalist", var $elm = $( input ), $autolist = $elm.next(); - $autolist.css({ + $autolist.css( { width: $elm.outerWidth(), left: $elm.position().left - }); + } ); }, /** @@ -170,7 +170,7 @@ var componentName = "wb-datalist", } // Up / down arrow - } else if ( ( which === 38 || which === 40) && input.getAttribute( "aria-activedescendent" ) === "" ) { + } else if ( ( which === 38 || which === 40 ) && input.getAttribute( "aria-activedescendent" ) === "" ) { if ( autolistHidden ) { showOptions( input ); } @@ -235,7 +235,7 @@ var componentName = "wb-datalist", return false; // Enter key - } else if ( which === 13) { + } else if ( which === 13 ) { span = link.getElementsByTagName( "span" ); // .al-val @@ -336,7 +336,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " keydown click break; case "keydown": - if ( !(event.ctrlKey || event.metaKey ) ) { + if ( !( event.ctrlKey || event.metaKey ) ) { return keyboardHandlerInput( which, event ); } break; @@ -361,7 +361,7 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent + " keydown click * so returning true allows for events to always continue */ return true; -}); +} ); $document.on( "keydown click vclick touchstart", ".wb-al a, .wb-al span", function( event ) { var link = event.target, @@ -370,7 +370,7 @@ $document.on( "keydown click vclick touchstart", ".wb-al a, .wb-al span", functi switch ( eventType ) { case "keydown": - if ( !(event.ctrlKey || event.metaKey ) ) { + if ( !( event.ctrlKey || event.metaKey ) ) { return keyboardHandlerAutolist( which, link ); } break; @@ -384,7 +384,7 @@ $document.on( "keydown click vclick touchstart", ".wb-al a, .wb-al span", functi } break; } -}); +} ); // Handle focus and resize events $document.on( "focusin txt-rsz.wb win-rsz-width.wb win-rsz-height.wb", function( event ) { @@ -412,9 +412,9 @@ $document.on( "focusin txt-rsz.wb win-rsz-width.wb win-rsz-height.wb", function( } } } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/polyfills/datalist/demo/datalist_dynamic.js b/src/polyfills/datalist/demo/datalist_dynamic.js index 34234249fec..01b8d9e7111 100644 --- a/src/polyfills/datalist/demo/datalist_dynamic.js +++ b/src/polyfills/datalist/demo/datalist_dynamic.js @@ -2,7 +2,7 @@ * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW) * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; var $document = wb.doc, @@ -12,17 +12,17 @@ var $document = wb.doc, $document.on( "change", pluginSelector, function( event ) { var componentName = event.target.value; - $( this ).trigger({ + $( this ).trigger( { type: "ajax-fetch.wb", fetch: { url: encodeURI( "https://api.github.com/repos/wet-boew/wet-boew/issues?labels=Plugin: " + componentName ), dataType: wb.ielt10 ? "jsonp" : "json", jsonp: wb.ielt10 ? "callback" : null } - }); + } ); issueInput.get( 0 ).value = ""; -}); +} ); $document.on( "ajax-fetched.wb", pluginSelector, function( event ) { var dataList = $( "#" + issueInput.attr( "list" ) ), @@ -46,6 +46,6 @@ $document.on( "ajax-fetched.wb", pluginSelector, function( event ) { dataList.append( options ); issueInput.trigger( "wb-update.wb-datalist" ); -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/polyfills/datepicker/datepicker.js b/src/polyfills/datepicker/datepicker.js index e5d69d65f43..a939292a1b7 100644 --- a/src/polyfills/datepicker/datepicker.js +++ b/src/polyfills/datepicker/datepicker.js @@ -5,7 +5,7 @@ * @author @pjackson28 */ -(function( $, window, document, wb ) { +( function( $, window, document, wb ) { "use strict"; /* @@ -82,7 +82,7 @@ var componentName = "wb-date", toggle( $container.attr( "aria-controls" ) ); } - }); + } ); // Disable the tabbing of all the links when calendar is hidden $container.find( "a" ).attr( "tabindex", "-1" ); @@ -214,7 +214,7 @@ var componentName = "wb-date", // TODO: Replace with CSS animation $container .slideDown( "fast" ) - .attr( "aria-hidden", "false"); + .attr( "aria-hidden", "false" ); $( "#" + fieldId + "-picker-toggle" ) .attr( "title", closeLabel ) .children( ".wb-inv" ) @@ -277,7 +277,7 @@ var componentName = "wb-date", var pad = wb.string.pad; return format .replace( "DD", pad( day, 2 ) ) - .replace( "D", day) + .replace( "D", day ) .replace( "MM", pad( month, 2 ) ) .replace( "M", month ) .replace( "YYYY", year ) @@ -304,7 +304,7 @@ $document.on( "click vclick touchstart focusin", function( event ) { return false; } } -}); +} ); $document.on( "keydown displayed.wb-cal", "#" + containerName, function( event, year, month, $days, day ) { var $container = $( this ), @@ -349,7 +349,7 @@ $document.on( "keydown displayed.wb-cal", "#" + containerName, function( event, } } } -}); +} ); $document.on( "click", ".picker-toggle", function( event ) { event.preventDefault(); @@ -363,7 +363,7 @@ $document.on( "click", ".picker-toggle", function( event ) { toggle( pickerId.substring( 0, pickerId.indexOf( "-picker-toggle" ) ) ); return false; } -}); +} ); $document.on( "click", ".cal-days a", function( event ) { var which = event.which, @@ -389,9 +389,9 @@ $document.on( "click", ".cal-days a", function( event ) { return false; } -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, document, wb ); +} )( jQuery, window, document, wb ); diff --git a/src/polyfills/details/details.js b/src/polyfills/details/details.js index 8bbd6acb14e..75353617eb6 100644 --- a/src/polyfills/details/details.js +++ b/src/polyfills/details/details.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -93,9 +93,9 @@ $document.on( "click keydown toggle." + componentName, selector, function( event * so returning true allows for events to always continue */ return true; -}); +} ); // Add the timer poke to initialize the plugin wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/polyfills/jawsariafixes/jawsariafixes.js b/src/polyfills/jawsariafixes/jawsariafixes.js index c23aa50cd1c..e34c7357794 100644 --- a/src/polyfills/jawsariafixes/jawsariafixes.js +++ b/src/polyfills/jawsariafixes/jawsariafixes.js @@ -10,7 +10,7 @@ * Jaws WAI-ARIA fixes */ -(function( $ ) { +( function( $ ) { "use strict"; var heading, i, id, node, headings = $( "h1, h2, h3, h4, h5, h6" ).get(), @@ -42,4 +42,4 @@ heading.setAttribute( "role", "heading" ); heading.setAttribute( "aria-level", heading.nodeName.substring( 1 ) ); } -}( jQuery )); +} )( jQuery ); diff --git a/src/polyfills/meter/demo/meter.js b/src/polyfills/meter/demo/meter.js index c606a0840a6..8216c86f80d 100644 --- a/src/polyfills/meter/demo/meter.js +++ b/src/polyfills/meter/demo/meter.js @@ -3,7 +3,7 @@ * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ /*jshint unused: false*/ -(function( $, wb ) { +( function( $, wb ) { "use strict"; wb.doc.on( "click vclick", "#increaseMeter, #decreaseMeter", function( event ) { @@ -21,6 +21,6 @@ wb.doc.on( "click vclick", "#increaseMeter, #decreaseMeter", function( event ) { // Update the visuals $elm.trigger( "wb-update.wb-meter" ); -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/polyfills/meter/meter.js b/src/polyfills/meter/meter.js index 3b0625ea37e..0cce967f242 100644 --- a/src/polyfills/meter/meter.js +++ b/src/polyfills/meter/meter.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @nschonni */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -111,12 +111,12 @@ var componentName = "wb-meter", } // Set defaults as per HTML5 spec - $elm.attr({ + $elm.attr( { min: min, max: max, value: value, title: $elm.attr( "title" ) || value - }).trigger( "wb-updated." + componentName ); + } ).trigger( "wb-updated." + componentName ); }; // Bind the events of the polyfill @@ -132,9 +132,9 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent, selector, functi } else { init( event ); } -}); +} ); // Add the timer poke to initialize the polyfill wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/polyfills/progress/demo/progress.js b/src/polyfills/progress/demo/progress.js index 82d8e357748..b2bd6dc3f09 100644 --- a/src/polyfills/progress/demo/progress.js +++ b/src/polyfills/progress/demo/progress.js @@ -3,7 +3,7 @@ * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ /*jshint unused: false*/ -(function( $, wb ) { +( function( $, wb ) { "use strict"; wb.doc.on( "click vclick", "#updateProgress", function() { @@ -18,6 +18,6 @@ wb.doc.on( "click vclick", "#updateProgress", function() { // Update the visuals $elm.trigger( "wb-update.wb-progress" ); -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb ); diff --git a/src/polyfills/progress/progress.js b/src/polyfills/progress/progress.js index 125cfe2ee24..b33daaafc3f 100644 --- a/src/polyfills/progress/progress.js +++ b/src/polyfills/progress/progress.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -44,7 +44,7 @@ var componentName = "wb-progress", progress = function( elm ) { var $elm = $( elm ), $progress = $elm.children( ".progress, .undef" ), - $span = $elm.children(".wb-inv"), + $span = $elm.children( ".wb-inv" ), ariaValueMax = 1.0, ariaValueNow, $progressbar; @@ -68,11 +68,11 @@ var componentName = "wb-progress", $progressbar = $progress.children( ".progress-bar" ); $progressbar.css( "width", ( ( ariaValueNow / ariaValueMax ) * 100 ) + "%" ) - .attr({ + .attr( { "aria-valuemin": 0, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow - }); + } ); $span.detach(); $span.appendTo( $progressbar ); @@ -97,9 +97,9 @@ $document.on( "timerpoke.wb " + initEvent + " " + updateEvent, selector, functi } else { init( event ); } -}); +} ); // Add the timer poke to initialize the polyfill wb.add( selector ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/polyfills/slider/demo/slider.js b/src/polyfills/slider/demo/slider.js index 5a12dbcc374..4cc018426c9 100644 --- a/src/polyfills/slider/demo/slider.js +++ b/src/polyfills/slider/demo/slider.js @@ -2,7 +2,7 @@ * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW) * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ -(function( $, document, wb ) { +( function( $, document, wb ) { "use strict"; var currentValueString = document.documentElement.lang === "fr" ? @@ -15,7 +15,7 @@ $document.on( "change", "#html5shim-1, #html5shim-2", function( event ) { document .getElementById( event.target.id + "-out" ) .innerHTML = "(" + currentValueString + " " + this.value + ")"; -}); +} ); $document.one( "timerpoke.wb", function() { $slider = $( "" ); @@ -23,7 +23,7 @@ $document.one( "timerpoke.wb", function() { setTimeout( function() { $slider.get( 0 ).value = 85; $slider.trigger( "wb-update.wb-slider" ); - }, 2000); -}); + }, 2000 ); +} ); -})( jQuery, document, wb ); +} )( jQuery, document, wb ); diff --git a/src/polyfills/slider/slider_wrapper.js b/src/polyfills/slider/slider_wrapper.js index 788b2050d4f..32227f0581d 100644 --- a/src/polyfills/slider/slider_wrapper.js +++ b/src/polyfills/slider/slider_wrapper.js @@ -3,7 +3,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @LaurentGoderre */ -(function( $, window, wb ) { +( function( $, window, wb ) { "use strict"; /* @@ -36,14 +36,14 @@ var componentName = "wb-slider", window.fdSlider.createSlider( { inp: eventTarget, html5Shim: true - }); + } ); // Allows listening for input and change at the document level for IE < 9 if ( wb.ielt9 ) { $eventTarget = $( eventTarget ); $eventTarget.on( "input change", function( event ) { $eventTarget.closest( "[class^='wb-'], body" ).trigger( event ); - }); + } ); } // Identify that initialization has completed @@ -68,6 +68,6 @@ wb.doc.on( initEvent + " " + updateEvent, selector, function( event ) { } } } -}); +} ); -})( jQuery, window, wb ); +} )( jQuery, window, wb ); diff --git a/src/polyfills/svg/svg.js b/src/polyfills/svg/svg.js index 76153c3ba0e..d5ce9053c93 100644 --- a/src/polyfills/svg/svg.js +++ b/src/polyfills/svg/svg.js @@ -4,7 +4,7 @@ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html * @author @pjackson28 */ -(function( $ ) { +( function( $ ) { "use strict"; var $svgObjects = $( "object[data$='.svg']" ), @@ -26,4 +26,4 @@ for ( i = 0; i !== len; i += 1 ) { $svg.attr( "src", $svg.attr( "src" ).replace( ".svg", ".png" ) ); } -})( jQuery ); +} )( jQuery ); diff --git a/src/test.js b/src/test.js index e6d8f36cefe..28c760ed44c 100644 --- a/src/test.js +++ b/src/test.js @@ -10,27 +10,27 @@ wb.doc.on( "wb-ready.wb", function() { runner.on( "end", function() { window.mochaResults = runner.stats; window.mochaResults.reports = failedTests; - }); + } ); - runner.on( "fail", logFailure); + runner.on( "fail", logFailure ); - function logFailure(test, err) { + function logFailure( test, err ) { - var flattenTitles = function(test) { + var flattenTitles = function( test ) { var titles = []; - while (test.parent.title) { - titles.push(test.parent.title); + while ( test.parent.title ) { + titles.push( test.parent.title ); test = test.parent; } return titles.reverse(); }; - failedTests.push({ + failedTests.push( { name: test.title, result: false, message: err.message, stack: err.message + "\n" + err.stack || "", titles: flattenTitles( test ) - }); + } ); } -}); +} ); diff --git a/theme/theme.js b/theme/theme.js index b9668388ce7..5ecbb962079 100644 --- a/theme/theme.js +++ b/theme/theme.js @@ -2,7 +2,7 @@ * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW) * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html */ -(function( $, wb ) { +( function( $, wb ) { "use strict"; /* @@ -66,6 +66,6 @@ $document.on( "xxsmallview.wb xsmallview.wb smallview.wb mediumview.wb largeview onXLargeView(); break; } -}); +} ); -})( jQuery, wb ); +} )( jQuery, wb );