r93664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93663‎ | r93664 | r93665 >
Date:22:13, 1 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
Port 'editondblclick' js to ResourceLoader.
- Fixes (bug 27894) Move 'editondblclick' event listener down from body to
div#bodyContent
- Patch by Nik <niknyby@gmail.com>
- Changes since patch:
* Moved from OutputPage->headElement (where the bodyAttr-hack used to be) to addDefaultModules where other additions live
* Added dependency on 'mediawiki.util', it must be initialized before mw.util.$content can be used
* Whitespace conventions
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js (added) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -28,7 +28,9 @@
2929 * $wgUploadNavigationUrl should be used for file redlinks if
3030 $wgUploadMissingFileUrl is not set. The first was used for this
3131 until the second was introduced in 1.17.
32 -* (bug 25355) Parser generates edit section links for special pages
 32+* (bug 25355) Parser generates edit section links for special pages.
 33+* (bug 27894) Move 'editondblclick' event listener down from body to
 34+ div#bodyContent.
3335
3436 === API changes in 1.19 ===
3537 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/OutputPage.php
@@ -2250,13 +2250,6 @@
22512251
22522252 $bodyAttrs = array();
22532253
2254 - # Crazy edit-on-double-click stuff
2255 - if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
2256 - $editUrl = $this->getTitle()->getLocalUrl( $sk->editUrlOptions() );
2257 - $bodyAttrs['ondblclick'] = "document.location = '" .
2258 - Xml::escapeJsString( $editUrl ) . "'";
2259 - }
2260 -
22612254 # Classes for LTR/RTL directionality support
22622255 $bodyAttrs['class'] = "mediawiki $userdir sitedir-$sitedir";
22632256
@@ -2312,6 +2305,11 @@
23132306 $this->addModules( 'mediawiki.action.view.rightClickEdit' );
23142307 }
23152308
 2309+ # Crazy edit-on-double-click stuff
 2310+ if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
 2311+ $this->addModules( 'mediawiki.action.view.dblClickEdit' );
 2312+ }
 2313+
23162314 if ( $wgUseAJAXCategories ) {
23172315 global $wgAJAXCategoriesNamespaces;
23182316
Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js
@@ -0,0 +1,12 @@
 2+/**
 3+ * This module enables double-click-to-edit functionality
 4+ */
 5+jQuery( document ).ready( function( $ ) {
 6+ var url = $( '#ca-edit a' ).attr( 'href' );
 7+ if ( url ) {
 8+ mw.util.$content.dblclick( function( e ) {
 9+ e.preventDefault();
 10+ window.location = url;
 11+ } );
 12+ }
 13+} );
Index: trunk/phase3/resources/Resources.php
@@ -479,6 +479,10 @@
480480 'styles' => 'resources/mediawiki.action/mediawiki.action.history.diff.css',
481481 'group' => 'mediawiki.action.history',
482482 ),
 483+ 'mediawiki.action.view.dblClickEdit' => array(
 484+ 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js',
 485+ 'dependencies' => 'mediawiki.util',
 486+ ),
483487 'mediawiki.action.view.metadata' => array(
484488 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.metadata.js',
485489 'messages' => array(
Index: trunk/phase3/CREDITS
@@ -134,6 +134,7 @@
135135 * Nakon
136136 * Nathan Larson
137137 * nephele
 138+* Nik
138139 * Nikolaos S. Karastathis
139140 * Olaf Lenz
140141 * Paul Copperman

Status & tagging log