From: Happy-melon Date: Sat, 5 Mar 2011 17:06:42 +0000 (+0000) Subject: Follow-up r83280; looks like I accidentally deprecated a piece of legacy JS :D X-Git-Tag: 1.31.0-rc.0~31628 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=968340d3107b43e11fc789508b6f2cee46e1cd7c;p=lhc%2Fweb%2Fwiklou.git Follow-up r83280; looks like I accidentally deprecated a piece of legacy JS :D --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 56577f6176..5a0fbaed4e 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -54,7 +54,6 @@ * TODO: Document 'section' / 'subsection' stuff */ class HTMLForm { - static $jsAdded = false; # A mapping of 'type' inputs onto standard HTMLFormField subclasses static $typeMappings = array( @@ -160,14 +159,9 @@ class HTMLForm { /** * Add the HTMLForm-specific JavaScript, if it hasn't been * done already. + * @deprecated @since 1.18 load modules with ResourceLoader instead */ - static function addJS() { - if ( self::$jsAdded ) return; - - global $wgOut; - - $wgOut->addModules( 'mediawiki.legacy.htmlform' ); - } + static function addJS() { } /** * Initialise a new Object for the field @@ -202,9 +196,6 @@ class HTMLForm { throw new MWException( "You must call setTitle() on an HTMLForm" ); } - // FIXME shouldn't this be closer to displayForm() ? - self::addJS(); - # Load data from the request. $this->loadData(); } diff --git a/resources/Resources.php b/resources/Resources.php index 13065c8c27..7d4f50e4e6 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -544,12 +544,6 @@ return array( 'localBasePath' => "{$GLOBALS['IP']}/skins", 'dependencies' => 'mediawiki.legacy.wikibits', ), - 'mediawiki.legacy.htmlform' => array( - 'scripts' => 'common/htmlform.js', - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => "{$GLOBALS['IP']}/skins", - 'dependencies' => 'mediawiki.legacy.wikibits', - ), 'mediawiki.legacy.IEFixes' => array( 'scripts' => 'common/IEFixes.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], @@ -581,7 +575,7 @@ return array( 'scripts' => 'common/prefs.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => "{$GLOBALS['IP']}/skins", - 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ), + 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.htmlform' ), ), 'mediawiki.legacy.preview' => array( 'scripts' => 'common/preview.js', diff --git a/skins/common/htmlform.js b/skins/common/htmlform.js deleted file mode 100644 index 9e91017ea0..0000000000 --- a/skins/common/htmlform.js +++ /dev/null @@ -1,36 +0,0 @@ -// Find select-or-other fields. -addOnloadHook( function() { - var fields = getElementsByClassName( document, 'select', 'mw-htmlform-select-or-other' ); - - for( var i = 0; i < fields.length; i++ ) { - var select = fields[i]; - - addHandler( select, 'change', htmlforms.selectOrOtherSelectChanged ); - - // Use a fake 'e' to update it. - htmlforms.selectOrOtherSelectChanged( { 'target': select } ); - } -} ); - -window.htmlforms = { - 'selectOrOtherSelectChanged' : function( e ) { - var select; - if ( !e ) { - e = window.event; - } - if ( e.target ) { - select = e.target; - } else if ( e.srcElement ) { - select = e.srcElement; - } - if ( select.nodeType == 3 ) { // defeat Safari bug - select = select.parentNode; - } - - var id = select.id; - var textbox = document.getElementById( id + '-other' ); - - textbox.disabled = ( select.value != 'other' ); - } -}; -