r76972 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76971‎ | r76972 | r76973 >
Date:22:02, 18 November 2010
Author:krinkle
Status:ok
Tags:
Comment:
renaming mediawiki.specials to mediawiki.special (matches the Special-pagename and the 'singlular' convention)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/mediawiki.special (added) (history)
  • /trunk/phase3/resources/mediawiki.specials (deleted) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialPreferences.php
@@ -53,7 +53,7 @@
5454 }
5555
5656 $wgOut->addModules( 'mediawiki.legacy.prefs' );
57 - $wgOut->addModules( 'mediawiki.specials.preferences' );
 57+ $wgOut->addModules( 'mediawiki.special.preferences' );
5858
5959 if ( $wgRequest->getCheck( 'success' ) ) {
6060 $wgOut->wrapWikiMsg(
Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -363,7 +363,7 @@
364364 $wgOut->setRobotPolicy( 'noindex,nofollow' );
365365 // add javascript specific to special:search
366366 $wgOut->addModules( 'mediawiki.legacy.search' );
367 - $wgOut->addModules( 'mediawiki.specials.search' );
 367+ $wgOut->addModules( 'mediawiki.special.search' );
368368 }
369369
370370 /**
Index: trunk/phase3/resources/Resources.php
@@ -337,12 +337,12 @@
338338 'mediawiki.advanced.rightclickedit' => new ResourceLoaderFileModule( array(
339339 'scripts' => 'resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js',
340340 ) ),
341 - 'mediawiki.specials.preferences' => new ResourceLoaderFileModule( array(
342 - 'scripts' => 'resources/mediawiki.specials/mediawiki.specials.preferences.js',
343 - 'styles' => 'resources/mediawiki.specials/mediawiki.specials.preferences.css',
 341+ 'mediawiki.special.preferences' => new ResourceLoaderFileModule( array(
 342+ 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js',
 343+ 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css',
344344 ) ),
345 - 'mediawiki.specials.search' => new ResourceLoaderFileModule( array(
346 - 'scripts' => 'resources/mediawiki.specials/mediawiki.specials.search.js',
 345+ 'mediawiki.special.search' => new ResourceLoaderFileModule( array(
 346+ 'scripts' => 'resources/mediawiki.special/mediawiki.special.search.js',
347347 ) ),
348348 'mediawiki.action.history' => new ResourceLoaderFileModule( array(
349349 'scripts' => 'resources/mediawiki.action/mediawiki.action.history.js',
Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.preferences.js
@@ -0,0 +1,127 @@
 2+/*
 3+ * JavaScript for Special:Preferences
 4+ */
 5+
 6+$( '#prefsubmit' ).attr( 'id', 'prefcontrol' );
 7+$( '#preferences' )
 8+ .addClass( 'jsprefs' )
 9+ .before( $( '<ul id="preftoc"></ul>' ) )
 10+ .children( 'fieldset' )
 11+ .hide()
 12+ .addClass( 'prefsection' )
 13+ .children( 'legend' )
 14+ .addClass( 'mainLegend' )
 15+ .each( function( i ) {
 16+ $(this).parent().attr( 'id', 'prefsection-' + i );
 17+ if ( i === 0 ) {
 18+ $(this).parent().show();
 19+ }
 20+ $( '#preftoc' ).append(
 21+ $( '<li></li>' )
 22+ .addClass( i === 0 ? 'selected' : null )
 23+ .append(
 24+ $( '<a></a>')
 25+ .text( $(this).text() )
 26+ .attr( 'href', '#prefsection-' + i )
 27+ .mousedown( function( e ) {
 28+ $(this).parent().parent().find( 'li' ).removeClass( 'selected' );
 29+ $(this).parent().addClass( 'selected' );
 30+ e.preventDefault();
 31+ return false;
 32+ } )
 33+ .click( function( e ) {
 34+ $( '#preferences > fieldset' ).hide();
 35+ $( '#prefsection-' + i ).show();
 36+ e.preventDefault();
 37+ return false;
 38+ } )
 39+ )
 40+ );
 41+ } );
 42+
 43+// Lame tip to let user know if its email is valid. See bug 22449
 44+$( '#mw-input-emailaddress' )
 45+ .keyup( function () {
 46+ if( $( "#mw-emailaddress-validity" ).length == 0 ) {
 47+ $(this).after( '<label for="mw-input-emailaddress" id="mw-emailaddress-validity"></label>' );
 48+ }
 49+ var isValid = wfValidateEmail( $(this).val() );
 50+ var class_to_add = isValid ? 'valid' : 'invalid';
 51+ var class_to_remove = isValid ? 'invalid' : 'valid';
 52+ $( '#mw-emailaddress-validity' )
 53+ .text( isValid ? 'Looks valid' : 'Valid address required!' )
 54+ .addClass( class_to_add )
 55+ .removeClass( class_to_remove );
 56+ } );
 57+
 58+/**
 59+ * Validate a string as representing a valid e-mail address
 60+ * according to HTML5 specification. Please note the specification
 61+ * does not validate a domain with one character.
 62+ *
 63+ * FIXME: should be moved to a JavaScript validation module.
 64+ */
 65+wfValidateEmail = function( mailtxt ) {
 66+ if( mailtxt == '' ) { return null; }
 67+
 68+ /**
 69+ * HTML 5 define a string as valid e-mail address if it matches
 70+ * the ABNF :
 71+ * 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str )
 72+ * With:
 73+ * - atext : defined in RFC 5322 section 3.2.3
 74+ * - ldh-str : defined in RFC 1034 section 3.5
 75+ *
 76+ * (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68):
 77+ */
 78+
 79+ /**
 80+ * First, define the RFC 5322 'atext' which is pretty easy :
 81+ * atext = ALPHA / DIGIT / ; Printable US-ASCII
 82+ "!" / "#" / ; characters not including
 83+ "$" / "%" / ; specials. Used for atoms.
 84+ "&" / "'" /
 85+ "*" / "+" /
 86+ "-" / "/" /
 87+ "=" / "?" /
 88+ "^" / "_" /
 89+ "`" / "{" /
 90+ "|" / "}" /
 91+ "~"
 92+ */
 93+ var rfc5322_atext = "a-z0-9!#$%&'*+-/=?^_`{|}—~" ;
 94+
 95+ /**
 96+ * Next define the RFC 1034 'ldh-str'
 97+ * <domain> ::= <subdomain> | " "
 98+ * <subdomain> ::= <label> | <subdomain> "." <label>
 99+ * <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
 100+ * <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
 101+ * <let-dig-hyp> ::= <let-dig> | "-"
 102+ * <let-dig> ::= <letter> | <digit>
 103+ */
 104+ var rfc1034_ldh_str = "a-z0-9-" ;
 105+
 106+ var HTML5_email_regexp = new RegExp(
 107+ // start of string
 108+ '^'
 109+ +
 110+ // User part which is liberal :p
 111+ '[' + rfc5322_atext + '\\.' + ']' + '+'
 112+ +
 113+ // "apostrophe"
 114+ '@'
 115+ +
 116+ // Domain first part
 117+ '[' + rfc1034_ldh_str + ']+'
 118+ +
 119+ // Second part and following are separated by a dot
 120+ '(\\.[' + rfc1034_ldh_str + ']+)+'
 121+ +
 122+ // End of string
 123+ '$',
 124+ // RegExp is case insensitive
 125+ 'i'
 126+ );
 127+ return mailtxt.match( HTML5_email_regexp );
 128+};
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.specials.preferences.js
___________________________________________________________________
Added: svn:eol-style
1129 + native
Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.search.js
@@ -0,0 +1,8 @@
 2+/*
 3+ * JavaScript for Specical:Search
 4+ */
 5+
 6+// Emulate HTML5 autofocus behavior in non HTML5 compliant browsers
 7+if ( !( 'autofocus' in document.createElement( 'input' ) ) ) {
 8+ $( 'input[autofocus]' ).focus();
 9+}
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.specials.search.js
___________________________________________________________________
Added: svn:eol-style
110 + native
Index: trunk/phase3/resources/mediawiki.special/mediawiki.specials.preferences.css
@@ -0,0 +1,21 @@
 2+#mw-emailaddress-validity {
 3+ padding: 2px 1em;
 4+}
 5+body.ltr #mw-emailaddress-validity {
 6+ border-bottom-right-radius:0.8em;
 7+ border-top-right-radius:0.8em;
 8+}
 9+body.rtl #mw-emailaddress-validity {
 10+ border-bottom-left-radius:0.8em;
 11+ border-top-left-radius:0.8em;
 12+}
 13+#mw-emailaddress-validity.valid {
 14+ border: 1px solid #80FF80;
 15+ background-color: #C0FFC0;
 16+ color: black;
 17+}
 18+#mw-emailaddress-validity.invalid {
 19+ border: 1px solid #FF8080;
 20+ background-color: #FFC0C0;
 21+ color: black;
 22+}
Property changes on: trunk/phase3/resources/mediawiki.special/mediawiki.specials.preferences.css
___________________________________________________________________
Added: svn:eol-style
123 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r76974Follow-up on r76972, renaming files inside the folder accordinglykrinkle22:04, 18 November 2010

Status & tagging log