http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100161
Revision: 100161 Author: reedy Date: 2011-10-18 21:06:23 +0000 (Tue, 18 Oct 2011) Log Message: ----------- Trim trailing whitespace Modified Paths: -------------- trunk/extensions/Contest/resources/contest.contestant.pager.js trunk/extensions/Contest/resources/contest.special.contests.js trunk/extensions/Contest/resources/contest.special.editcontest.js trunk/extensions/Contest/resources/contest.special.signup.js trunk/extensions/Contest/resources/contest.special.submission.js trunk/extensions/Contest/resources/contest.special.welcome.js trunk/extensions/Contest/resources/jquery.contestChallenges.js trunk/extensions/Contest/resources/jquery.contestSubmission.js Modified: trunk/extensions/Contest/resources/contest.contestant.pager.js =================================================================== --- trunk/extensions/Contest/resources/contest.contestant.pager.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.contestant.pager.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,19 +1,19 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ -(function( $, mw ) { - +(function( $, mw ) { + $( document ).ready( function() { $( '.contestant-row' ).click( function() { window.location = $( this ).attr( 'data-contestant-target' ); } ); - + } ); -})( window.jQuery, window.mediaWiki ); \ No newline at end of file +})( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/contest.special.contests.js =================================================================== --- trunk/extensions/Contest/resources/contest.special.contests.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.special.contests.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,7 +1,7 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ @@ -24,12 +24,12 @@ failCallback( mw.msg( 'contest-special-delete-failed' ) ); } } - ); + ); } - + $( '.contest-delete' ).click( function() { $this = $( this ); - + if ( confirm( mw.msg( 'contest-special-confirm-delete' ) ) ) { deleteContest( { @@ -39,7 +39,7 @@ function() { $this.closest( 'tr' ).slideUp( 'slow', function() { $( this ).remove(); - + if ( $( '.contests-table tr' ).length < 2 ) { $( '.contests-table' ).remove(); $( '.contests-title' ).remove(); @@ -53,5 +53,5 @@ } return false; } ); - -} ); })( window.jQuery, window.mediaWiki ); \ No newline at end of file + +} ); })( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/contest.special.editcontest.js =================================================================== --- trunk/extensions/Contest/resources/contest.special.editcontest.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.special.editcontest.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,85 +1,85 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ (function( $, mw ) { - + function addChallengeToRemove( id ) { if ( !isNaN( id ) ) { var currentVal = $( '#delete-challenges' ).val(); - + var currentIds = currentVal !== '' ? currentVal.split( '|' ) : []; currentIds.push( id ); - + $( '#delete-challenges' ).val( currentIds.join( '|' ) ); } } - + $.fn.mwChallenge = function( options ) { - + var _this = this; var $this = $( this ); this.options = options; - + this.titleInput = null; this.textInput = null; this.deleteButton = null; - + this.remove = function() { addChallengeToRemove( $this.attr( 'data-challenge-id' ) ); - + $tr = $this.closest( 'tr' ); $tr.slideUp( 'fast', function() { $tr.remove(); } ); }; - + this.init = function() { $this.html( '' ); - + this.titleInput = $( '<input />' ).attr( { 'type': 'text', 'name': 'contest-challenge-' + $this.attr( 'data-challenge-id' ), 'size': 45 } ).val( $this.attr( 'data-challenge-title' ) ); - - $this.append( + + $this.append( $( '<div />' ).html( $( '<label />' ) .text( mw.msg( 'contest-edit-challenge-title' ) ) .attr( 'for', 'contest-challenge-' + $this.attr( 'data-challenge-id' ) ) ).append( ' ' ).append( this.titleInput ) ); - + this.onelineInput = $( '<input />' ).attr( { 'type': 'text', 'name': 'challenge-oneline-' + $this.attr( 'data-challenge-id' ), 'size': 45, 'style': 'margin-top: 3px' } ).val( $this.attr( 'data-challenge-oneline' ) ); - - $this.append( + + $this.append( $( '<div />' ).html( $( '<label />' ) .text( mw.msg( 'contest-edit-challenge-oneline' ) ) .attr( { 'for': 'contest-oneline-' + $this.attr( 'data-challenge-id' ) } ) ).append( ' ' ).append( this.onelineInput ) ); - + this.textInput = $( '<textarea />' ).attr( { 'name': 'challenge-text-' + $this.attr( 'data-challenge-id' ) } ).val( $this.attr( 'data-challenge-text' ) ); - - $this.append( + + $this.append( $( '<div />' ).html( $( '<label />' ) .text( mw.msg( 'contest-edit-challenge-text' ) ) .attr( 'for', 'challenge-text-' + $this.attr( 'data-challenge-id' ) ) ).append( '<br />' ).append( this.textInput ) ); - + this.deleteButton = $( '<button />' ) .button( { 'label': mw.msg( 'contest-edit-delete' ) } ) .click( function() { @@ -88,23 +88,23 @@ return false; } } ); - + $this.append( this.deleteButton ); }; - + this.init(); - + return this; - + }; - + var newNr = 0; var $table = null; - + function getNewChallengeMessage() { return mw.msg( 'contest-edit-add-' + ( $( '.contest-challenge-input' ).size() === 0 ? 'first' : 'another' ) ); } - + function addChallenge( challenge ) { $challenge = $( '<div />' ).attr( { 'class': 'contest-challenge-input', @@ -113,46 +113,46 @@ 'data-challenge-text': challenge.text, 'data-challenge-oneline': challenge.oneline } ); - + $tr = $( '<tr />' ); - + $tr.append( $( '<td />' ) ); - + $tr.append( $( '<td />' ).html( $challenge ).append( '<hr />' ) ); - + $( '.add-new-challenge' ).before( $tr ); - + $challenge.mwChallenge(); } - + $( document ).ready( function() { $( '#cancelEdit' ).click( function() { window.location = $( this ).attr( 'target-url' ); } ); - + $table = $( '#contest-name-field' ).closest( 'tbody' ); - + $( '#bodyContent' ).find( '[type="submit"]' ).button(); - + $table.append( '<tr><td colspan="2"><hr /></td></tr>' ); - + $addNew = $( '<button />' ).button( { 'label': getNewChallengeMessage() } ).click( function() { addChallenge( { 'id': 'new-' + newNr++ , 'title': '', 'text': '' } ); - + $( this ).button( { 'label': getNewChallengeMessage() } ); - + return false; } ); - + $table.append( $( '<tr />' ).attr( 'class', 'add-new-challenge' ).html( $( '<td />' ) ).append( $( '<td />' ).html( $addNew ) ) ); - + $table.append( '<tr><td colspan="2"><hr /></td></tr>' ); - + $( '.contest-challenge' ).each( function( index, domElement ) { $this = $( domElement ); addChallenge( { @@ -162,12 +162,12 @@ 'oneline': $this.attr( 'data-challenge-oneline' ), } ); } ); - + $( '#contest-edit-end' ).datetimepicker( { minDate: new Date(), dateFormat: 'yy-mm-dd' } ); - + } ); - + })( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/contest.special.signup.js =================================================================== --- trunk/extensions/Contest/resources/contest.special.signup.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.special.signup.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,30 +1,30 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ -(function( $, mw ) { - +(function( $, mw ) { + $( document ).ready( function() { var contestConfig = mw.config.get( 'ContestConfig' ); - + $( '.mw-htmlform-submit' ).button(); - + $rules = $( '#contest-rules' ); - + $div = $( '<div />' ).attr( { 'style': 'display:none' } ).html( $( '<div />' ).attr( { 'id': 'contest-rules-div' } ).html( contestConfig['rules_page'] ) ); - + $a = $( "label[for='contest-rules']" ).find( 'a' ); $a.attr( { 'href': '#contest-rules-div' } ); - + $rules.closest( 'td' ).append( $div ); - + $a.fancybox( { 'width' : '85%', 'height' : '85%', @@ -33,7 +33,7 @@ 'type' : 'inline', 'autoDimensions': false } ); - + } ); })( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/contest.special.submission.js =================================================================== --- trunk/extensions/Contest/resources/contest.special.submission.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.special.submission.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,19 +1,19 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ -(function( $, mw ) { - +(function( $, mw ) { + $( document ).ready( function() { $( '.mw-htmlform-submit' ).button(); - + $( '.contest-submission' ).contestSubmission(); - + } ); -})( window.jQuery, window.mediaWiki ); \ No newline at end of file +})( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/contest.special.welcome.js =================================================================== --- trunk/extensions/Contest/resources/contest.special.welcome.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/contest.special.welcome.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,32 +1,32 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ -(function( $, mw ) { - +(function( $, mw ) { + $( document ).ready( function() { $( '#contest-challenges' ).contestChallenges( mw.config.get( 'ContestChallenges' ), mw.config.get( 'ContestConfig' ) ); - + $rules = $( '#contest-rules' ); - + $div = $( '<div />' ).attr( { 'style': 'display:none' } ).html( $( '<div />' ).attr( { 'id': 'contest-rules-div' } ).html( $rules.attr( 'data-rules' ) ) ); - + // TODO: fix very ugly message construction. $a = $( '<a />' ).text( mw.msg( 'contest-welcome-rules-link' ) ).attr( { 'href': '#contest-rules-div' } ); $p = $( '<p />' ).text( mw.msg( 'contest-welcome-rules' ) + ' ' ).append( $a ).append( '.' ); - + $rules.html( $p ).append( $div ); - + $a.fancybox( { 'width' : '85%', 'height' : '85%', Modified: trunk/extensions/Contest/resources/jquery.contestChallenges.js =================================================================== --- trunk/extensions/Contest/resources/jquery.contestChallenges.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/jquery.contestChallenges.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,21 +1,21 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ ( function ( $, mw ) { $.fn.contestChallenges = function( challenges, config ) { - + this.challenges = challenges; this.config = config; - + var _this = this; var $this = $( this ); - + this.challengesList = null; - + this.addChallenge = function( challenge ) { this.challengesList .append( @@ -76,25 +76,25 @@ ) ); } - + this.initChallenges = function() { this.challengesList = $( '<ul />' ).attr( 'id', 'contest-challenges-list' ); - + for ( var i in this.challenges ) { this.addChallenge( this.challenges[i] ); } }; - + this.init = function() { $this.html( $( '<h3 />' ).text( mw.msg( 'contest-welcome-select-header' ) ) ); - + this.initChallenges(); - + $this.append( this.challengesList ); }; - + this.init(); - + return this; - + }; } )( window.jQuery, window.mediaWiki ); Modified: trunk/extensions/Contest/resources/jquery.contestSubmission.js =================================================================== --- trunk/extensions/Contest/resources/jquery.contestSubmission.js 2011-10-18 20:54:03 UTC (rev 100160) +++ trunk/extensions/Contest/resources/jquery.contestSubmission.js 2011-10-18 21:06:23 UTC (rev 100161) @@ -1,13 +1,13 @@ /** * JavasSript for the Contest MediaWiki extension. * @see https://www.mediawiki.org/wiki/Extension:Contest - * + * * @licence GNU GPL v3 or later * @author Jeroen De Dauw <jeroendedauw at gmail dot com> */ (function( $, mw ) { - + /** * Regex text escaping function. * Borrowed from http://simonwillison.net/2006/Jan/20/escape/ @@ -15,42 +15,42 @@ RegExp.escape = function( text ) { if ( !arguments.callee.sRE ) { var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; - arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); + arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); } return text.replace(arguments.callee.sRE, '\\$1'); } - + $.fn.contestSubmission = function() { var _this = this; var $this = $( this ); - + this.config = {}; this.status = {}; - + this.input = null; this.label = null; - + this.getValue = function() { return this.input.val(); } - + this.getDomains = function() { return this.config.domains; }; - + this.validate = function() { var domains = _this.getDomains(); - + for ( var i = domains.length - 1; i >= 0; i-- ) { var regex = new RegExp( "^https?://(([a-z0-9]+)\\.)?" + RegExp.escape( domains[i] ) + "/(.*)?$", "gi" ); if ( regex.test( this.getValue() ) ) { return true; } } - + return false; }; - + this.showStatus = function() { if ( _this.status.valid ) { _this.input.removeClass( 'error' ); @@ -59,16 +59,16 @@ _this.input.addClass( 'error' ); } }; - + this.onValueChanged = function() { _this.status.valid = _this.validate(); _this.showStatus(); }; - + this.setup = function() { var message = $this.attr( 'data-value' ) === '' ? 'contest-submission-new-submission' : 'contest-submission-current-submission'; var domainLinks = []; - + for ( var i = this.config.domains.length - 1; i >= 0; i-- ) { var link = $( '<a />' ).text( this.config.domains[i] ).attr( { 'href': 'http://' + this.config.domains[i], @@ -76,16 +76,16 @@ } ); domainLinks.push( $( '<div />' ).html( link ).html() ); } - + var links = $( '<span />' ).html( '' ); - + this.label = $( '<label style="display:block" />' ).attr( { 'for': this.config.name, } ).text( mw.msg( message ) ).append( $( '<br />' ), mw.msg( 'contest-submission-domains', domainLinks.join( ', ' ) ) ); - + this.input = $( '<input />' ).attr( { 'type': 'text', 'value': $this.attr( 'data-value' ), @@ -93,23 +93,23 @@ 'size': 45, 'id': this.config.name } ); - + this.html( this.label ); this.append( this.input ); - + this.input.keyup( this.onValueChanged ); }; - + this.getConfig = function() { this.config.name = $this.attr( 'data-name' ); this.config.domains = $this.attr( 'data-domains' ).split( '|' ); }; - + this.getConfig(); this.setup(); this.onValueChanged(); - + return this; }; - -})( window.jQuery, window.mediaWiki ); \ No newline at end of file + +})( window.jQuery, window.mediaWiki ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs