r98137 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98136‎ | r98137 | r98138 >
Date:15:18, 26 September 2011
Author:catrope
Status:old (Comments)
Tags:
Comment:
1.17wmf1: Add mediawiki.page.startup to 1.17wmf1 so I can use the client-nojs and client-js classes, which are required for the MoodBar updates
Modified paths:
  • /branches/wmf/1.17wmf1/includes/OutputPage.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/Resources.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/jquery/jquery.js (modified) (history)
  • /branches/wmf/1.17wmf1/resources/mediawiki.page (added) (history)
  • /branches/wmf/1.17wmf1/resources/mediawiki.page/mediawiki.page.startup.js (added) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/OutputPage.php
@@ -1686,6 +1686,7 @@
16871687 // Add base resources
16881688 $this->addModules( array( 'mediawiki.legacy.wikibits' ) );
16891689 $this->addModules( array( 'mediawiki.util' ) );
 1690+ $this->addModules( array( 'mediawiki.page.startup' ) );
16901691
16911692 // Add various resources if required
16921693 if ( $wgUseAjax ) {
@@ -2261,7 +2262,7 @@
22622263 $sk->setupUserCss( $this );
22632264
22642265 $lang = wfUILang();
2265 - $ret = Html::htmlHeader( array( 'lang' => $lang->getCode(), 'dir' => $lang->getDir() ) );
 2266+ $ret = Html::htmlHeader( array( 'lang' => $lang->getCode(), 'dir' => $lang->getDir(), 'class' => 'client-nojs' ) );
22662267
22672268 if ( $this->getHTMLTitle() == '' ) {
22682269 $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
Property changes on: branches/wmf/1.17wmf1/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
22692270 Merged /trunk/phase3/includes/OutputPage.php:r95318,97962,98006
Index: branches/wmf/1.17wmf1/resources/jquery/jquery.js
@@ -6237,4 +6237,16 @@
62386238 // Expose jQuery to the global object
62396239 window.jQuery = window.$ = jQuery;
62406240
 6241+// HACK
 6242+jQuery.fn.prop = jQuery.fn.attr;
 6243+var oldData = jQuery.fn.data;
 6244+jQuery.fn.data = function( key, value ) {
 6245+ if ( value === undefined ) {
 6246+ return this.attr( 'data-' + key ) || oldData( key, value );
 6247+ } else {
 6248+ return oldData( key, value );
 6249+ }
 6250+};
 6251+
 6252+
62416253 })(window);
Index: branches/wmf/1.17wmf1/resources/Resources.php
@@ -356,6 +356,13 @@
357357 'mediawiki.action.view.rightClickEdit' => array(
358358 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js',
359359 ),
 360+ 'mediawiki.page.startup' => array(
 361+ 'scripts' => 'resources/mediawiki.page/mediawiki.page.startup.js',
 362+ 'dependencies' => array(
 363+ 'jquery.client',
 364+ ),
 365+ 'position' => 'top',
 366+ ),
360367 'mediawiki.special.preferences' => array(
361368 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js',
362369 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css',
Property changes on: branches/wmf/1.17wmf1/resources/Resources.php
___________________________________________________________________
Modified: svn:mergeinfo
363370 Merged /trunk/phase3/resources/Resources.php:r97962,98006
Index: branches/wmf/1.17wmf1/resources/mediawiki.page/mediawiki.page.startup.js
@@ -0,0 +1,17 @@
 2+( function( $ ) {
 3+
 4+ mw.page = {};
 5+
 6+ /* Client profile classes for <html> */
 7+
 8+ var prof = $.client.profile();
 9+ $( 'html' )
 10+ .addClass(
 11+ 'client-' + prof.name
 12+ + ' client-' + prof.name + '-' + prof.versionBase
 13+ + ' client-' + prof.layout
 14+ + ' client-' + prof.platform
 15+ + ' client-js' )
 16+ .removeClass( 'client-nojs' );
 17+
 18+} )( jQuery );
Property changes on: branches/wmf/1.17wmf1/resources/mediawiki.page/mediawiki.page.startup.js
___________________________________________________________________
Added: svn:eol-style
119 + native

Sign-offs

UserFlagDate
Krinkleinspected20:45, 26 September 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r981451.17wmf1: Fix stupid bug in r98137: wrapper around $.fn.data didn't preserve ...catrope17:24, 26 September 2011

Comments

#Comment by Catrope (talk | contribs)   15:20, 26 September 2011
+// HACK
+jQuery.fn.prop = jQuery.fn.attr;
+var oldData = jQuery.fn.data;
+jQuery.fn.data = function( key, value ) {
+	if ( value === undefined ) {
+		return this.attr( 'data-' + key ) || oldData( key, value );
+	} else {
+		return oldData( key, value );
+	}
+};
+
+

I committed this file by accident. These are back-compat hacks to let code written for jQuery 1.6 work with jQuery 1.4. I know this is a dirty hack, but 1.17wmf1 is gonna die in a matter of weeks so I have no problem messing it up some more.

Status & tagging log