Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8439
ready.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 11:59 PM
2014-11-21 23:59:59 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
ready.diff
View Options
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js
===================================================================
--- trunk/phase3/resources/mediawiki/mediawiki.util.js (revision 109783)
+++ trunk/phase3/resources/mediawiki/mediawiki.util.js (working copy)
@@ -277,6 +277,21 @@
*/
$content: null,
+ /*
+ * @var jQuery.Callback
+ * A jQuery.Callbacks object that fires every time $content is updated
+ *
+ * @example Bind a custom callback function
+ * mw.util.callback.add( function () {
+ * console.log( 'There are ' + mw.util.$content.find( 'a' ).length + ' links in the text.' );
+ * });
+ *
+ * @example Fire the callback functions after changing the content
+ * mw.util.$content.html( 'new content' );
+ * mw.util.callback.fire();
+ */
+ callback: jQuery.Callbacks( 'memory' ),
+
/**
* Add a link to a portlet menu on the page, such as:
*
Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
===================================================================
--- trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js (revision 109783)
+++ trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js (working copy)
@@ -1,27 +1,32 @@
-jQuery( document ).ready( function( $ ) {
-
- /* Initialize utilities (messageBoxNew, profile, tooltip access keys, TOC etc.) */
- mw.util.init();
-
- /* Emulate placeholder if not supported by browser */
- if ( !( 'placeholder' in document.createElement( 'input' ) ) ) {
- $( 'input[placeholder]' ).placeholder();
- }
-
- /* Enable makeCollapsible */
- $( '.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();
-
- /* Add accesskey hints to the tooltips */
- mw.util.updateTooltipAccessKeys();
-
-} );
+( function ( $, mw ) {
+ mw.util.callback.add( function () {
+ /* Enable makeCollapsible */
+ $( '.mw-collapsible' ).makeCollapsible();
+
+ /* Lazy load jquery.tablesorter */
+ if ( $( 'table.sortable' ).length ) {
+ mw.loader.using( 'jquery.tablesorter', function() {
+ $( 'table.sortable' ).tablesorter();
+ });
+ }
+ });
+
+ $( document ).ready( function () {
+ /* Initialize utilities (messageBoxNew, profile, tooltip access keys, TOC etc.) */
+ mw.util.init();
+
+ /* Emulate placeholder if not supported by browser */
+ if ( !( 'placeholder' in document.createElement( 'input' ) ) ) {
+ $( 'input[placeholder]' ).placeholder();
+ }
+
+ /* Enable CheckboxShiftClick */
+ $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick();
+
+ /* Add accesskey hints to the tooltips */
+ mw.util.updateTooltipAccessKeys();
+
+ /* Fire the callbacks for the first time */
+ mw.util.callback.fire();
+ });
+} )( jQuery, mediaWiki );
Index: trunk/phase3/resources/Resources.php
===================================================================
--- trunk/phase3/resources/Resources.php (revision 109783)
+++ trunk/phase3/resources/Resources.php (working copy)
@@ -852,7 +852,7 @@
'scripts' => 'common/preview.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
'localBasePath' => $GLOBALS['wgStyleDirectory'],
- 'dependencies' => 'mediawiki.legacy.wikibits',
+ 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.util' ),
),
'mediawiki.legacy.protect' => array(
'scripts' => 'common/protect.js',
Index: trunk/phase3/skins/common/preview.js
===================================================================
--- trunk/phase3/skins/common/preview.js (revision 109783)
+++ trunk/phase3/skins/common/preview.js (working copy)
@@ -49,6 +49,7 @@
loadSpinner.remove();
$( mw ).trigger( 'LivePreviewDone', [copyElements] );
+ mw.util.callback.fire();
} );
};
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7959
Default Alt Text
ready.diff (3 KB)
Attached To
Mode
T35711: mw.util.$content is undefined in MediaWiki:Common.js
Attached
Detach File
Event Timeline
Log In to Comment