http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90605
Revision: 90605
Author: krinkle
Date: 2011-06-22 21:27:12 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
New mediawiki.page modules
First step towards cleaning up mw.util.init and removing bugus dependancies on
mediawiki.util which are just added there in order to load them on every page
and do something on-load.
Introducing mediawiki.page.startup (in the head) and mediawiki.page.ready (on
the bottom)
Moved the following to them:
* document.ready from jquery.cient
-- Shouldn't have been in the plugin itself in the first place
* jquery.placeholder
* jquery.makeCollapsible
* mediawiki.action.view.tablesorting
* jquery.checkboxShiftClick
(This also solves part of bug 26799)
Modified Paths:
--------------
trunk/phase3/includes/OutputPage.php
trunk/phase3/resources/Resources.php
trunk/phase3/resources/jquery/jquery.client.js
trunk/phase3/resources/mediawiki/mediawiki.util.js
trunk/phase3/tests/qunit/index.html
Added Paths:
-----------
trunk/phase3/resources/mediawiki.page/
trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js
Removed Paths:
-------------
trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js
Modified: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php 2011-06-22 21:07:48 UTC (rev
90604)
+++ trunk/phase3/includes/OutputPage.php 2011-06-22 21:27:12 UTC (rev
90605)
@@ -2359,7 +2359,12 @@
$wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest;
// Add base resources
- $this->addModules( array( 'mediawiki.user', 'mediawiki.util',
'mediawiki.action.view.tablesorting' ) );
+ $this->addModules( array(
+ 'mediawiki.user',
+ 'mediawiki.util',
+ 'mediawiki.page.startup',
+ 'mediawiki.page.ready',
+ ) );
if ( $wgIncludeLegacyJavaScript ){
$this->addModules( 'mediawiki.legacy.wikibits' );
}
Modified: trunk/phase3/resources/Resources.php
===================================================================
--- trunk/phase3/resources/Resources.php 2011-06-22 21:07:48 UTC (rev
90604)
+++ trunk/phase3/resources/Resources.php 2011-06-22 21:27:12 UTC (rev
90605)
@@ -448,16 +448,28 @@
'jquery.cookie',
),
),
+ 'mediawiki.page.startup' => array(
+ 'scripts' =>
'resources/mediawiki.page/mediawiki.page.startup.js',
+ 'dependencies' => array(
+ 'jquery.client',
+ ),
+ 'position' => 'top',
+ ),
+ 'mediawiki.page.ready' => array(
+ 'scripts' => 'resources/mediawiki.page/mediawiki.page.ready.js',
+ 'dependencies' => array(
+ 'jquery.checkboxShiftClick',
+ 'jquery.makeCollapsible',
+ 'jquery.placeholder',
+ ),
+ ),
'mediawiki.util' => array(
'scripts' => 'resources/mediawiki/mediawiki.util.js',
'dependencies' => array(
- 'jquery.checkboxShiftClick',
'jquery.client',
'jquery.cookie',
'jquery.messageBox',
- 'jquery.makeCollapsible',
'jquery.mwPrototypes',
- 'jquery.placeholder',
),
),
'mediawiki.libs.jpegmeta' => array(
@@ -482,9 +494,6 @@
'scripts' =>
'resources/mediawiki.action/mediawiki.action.view.metadata.js',
'messages' => array( 'metadata-expand', 'metadata-collapse' ),
),
- 'mediawiki.action.view.tablesorting' => array(
- 'scripts' =>
'resources/mediawiki.action/mediawiki.action.view.tablesorting.js',
- ),
'mediawiki.action.watch.ajax' => array(
'scripts' =>
'resources/mediawiki.action/mediawiki.action.watch.ajax.js',
'messages' => array(
Modified: trunk/phase3/resources/jquery/jquery.client.js
===================================================================
--- trunk/phase3/resources/jquery/jquery.client.js 2011-06-22 21:07:48 UTC
(rev 90604)
+++ trunk/phase3/resources/jquery/jquery.client.js 2011-06-22 21:27:12 UTC
(rev 90605)
@@ -202,14 +202,4 @@
return true;
}
};
-
- $( document ).ready( function() {
- var profile = $.client.profile();
- $( 'html' )
- .addClass( 'client-' + profile.name )
- .addClass( 'client-' + profile.name + '-' +
profile.versionBase )
- .addClass( 'client-' + profile.layout )
- .addClass( 'client-' + profile.platform );
- } );
-
} )( jQuery );
Modified: trunk/phase3/resources/mediawiki/mediawiki.util.js
===================================================================
--- trunk/phase3/resources/mediawiki/mediawiki.util.js 2011-06-22 21:07:48 UTC
(rev 90604)
+++ trunk/phase3/resources/mediawiki/mediawiki.util.js 2011-06-22 21:27:12 UTC
(rev 90605)
@@ -57,14 +57,6 @@
mw.util.tooltipAccessKeyPrefix
= 'alt-shift-';
}
- /* Enable CheckboxShiftClick */
- $(
'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick();
-
- /* Emulate placeholder if not supported
by browser */
- if ( !( 'placeholder' in
document.createElement( 'input' ) ) ) {
- $( 'input[placeholder]'
).placeholder();
- }
-
/* Fill $content var */
if ( $( '#bodyContent' ).length ) {
// Vector, Monobook, Chick etc.
@@ -86,9 +78,6 @@
mw.util.$content = $(
'#content' );
}
- /* Enable makeCollapse */
- $( '.mw-collapsible'
).makeCollapsible();
-
/* Table of Contents toggle */
var $tocContainer = $( '#toc' ),
$tocTitle = $( '#toctitle' ),
Deleted:
trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js
===================================================================
---
trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js
2011-06-22 21:07:48 UTC (rev 90604)
+++
trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js
2011-06-22 21:27:12 UTC (rev 90605)
@@ -1,9 +0,0 @@
-// Lazy load jquery.tablesorter
-
-( function( $ ) {
- if ( $( 'table.sortable' ).length ) {
- mw.loader.using( 'jquery.tablesorter', function() {
- $( 'table.sortable' ).tablesorter();
- } );
- }
-} )( jQuery );
\ No newline at end of file
Added: trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
===================================================================
--- trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
(rev 0)
+++ trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
2011-06-22 21:27:12 UTC (rev 90605)
@@ -0,0 +1,21 @@
+jQuery( document ).ready( function( $ ) {
+
+ /* Emulate placeholder if not supported by browser */
+ if ( !( 'placeholder' in document.createElement( 'input' ) ) ) {
+ $( 'input[placeholder]' ).placeholder();
+ }
+
+ /* Enable makeCollapse */
+ $( '.mw-collapsible' ).makeCollapsible();
+
+ /* Lazy load jquery.tablesorter */
+ if ( $( 'table.sortable' ).length ) {
+ mw.loader.using( 'jquery.tablesorter', function() {
+ $( 'table.sortable' ).tablesorter();
+ });
+ }
+
+ /* Enable CheckboxShiftClick */
+ $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick();
+
+} );
Property changes on:
trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js
===================================================================
--- trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js
(rev 0)
+++ trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js
2011-06-22 21:27:12 UTC (rev 90605)
@@ -0,0 +1,13 @@
+( function( $ ) {
+
+ /* Client profile classes for <html> */
+
+ var prof = $.client.profile();
+ $( 'html' ).addClass(
+ 'client-' + prof.name
+ + ' client-' + prof.name + '-' + prof.versionBase
+ + ' client-' + prof.layout
+ + ' client-' + prof.platform
+ );
+
+} )( jQuery );
Property changes on:
trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/phase3/tests/qunit/index.html
===================================================================
--- trunk/phase3/tests/qunit/index.html 2011-06-22 21:07:48 UTC (rev 90604)
+++ trunk/phase3/tests/qunit/index.html 2011-06-22 21:27:12 UTC (rev 90605)
@@ -16,17 +16,20 @@
<script src="../../resources/jquery/jquery.js"></script>
<script src="../../resources/mediawiki/mediawiki.js"></script>
- <!-- MW: mediawiki.user|mediawiki.util -->
+ <!-- MW: mediawiki.page.startup -->
+ <script
src="../../resources/mediawiki.page/mediawiki.page.startup.js"></script>
+ <script src="../../resources/jquery/jquery.client.js"></script>
+
+ <!-- MW: mediawiki.user|mediawiki.util|mediawiki.page.ready -->
<script src="../../resources/mediawiki/mediawiki.user.js"></script>
- <script
src="../../resources/jquery/jquery.checkboxShiftClick.js"></script>
- <script src="../../resources/jquery/jquery.client.js"></script>
<script src="../../resources/jquery/jquery.cookie.js"></script>
+ <script src="../../resources/mediawiki/mediawiki.util.js"></script>
<script
src="../../resources/jquery/jquery.messageBox.js"></script>
+ <script
src="../../resources/jquery/jquery.mwPrototypes.js"></script>
+ <script
src="../../resources/mediawiki.page/mediawiki.page.ready.js"></script>
+ <script
src="../../resources/jquery/jquery.checkboxShiftClick.js"></script>
<script
src="../../resources/jquery/jquery.makeCollapsible.js"></script>
- <script
src="../../resources/jquery/jquery.mwPrototypes.js"></script>
<script
src="../../resources/jquery/jquery.placeholder.js"></script>
- <script
src="../../resources/jquery/jquery.tablesorter.js"></script>
- <script src="../../resources/mediawiki/mediawiki.util.js"></script>
<!-- MW: user.options -->
<script>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs