Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/70751


Change subject: Bug 49208: Make sure the edit link chooses the correct section
......................................................................

Bug 49208: Make sure the edit link chooses the correct section

Change-Id: I6a9eb693c580f06e1ff3b4d228a9338bfb50f7e2
---
M includes/Resources.php
M includes/formatters/MobileFormatter.php
A javascripts/common/application-beta.js
M javascripts/common/history-alpha.js
M javascripts/modules/editor/editor.js
M less/common/mf-hacks.less
M stylesheets/common/mf-hacks.css
7 files changed, 38 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/51/70751/1

diff --git a/includes/Resources.php b/includes/Resources.php
index 32c093e..68129ce 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -263,6 +263,7 @@
                        'mobile.stable.common',
                ),
                'scripts' => array(
+                       'javascripts/common/application-beta.js',
                        'javascripts/common/history-beta.js',
                        'javascripts/views/page.js',
                ),
diff --git a/includes/formatters/MobileFormatter.php 
b/includes/formatters/MobileFormatter.php
index af8e3a6..06ae333 100644
--- a/includes/formatters/MobileFormatter.php
+++ b/includes/formatters/MobileFormatter.php
@@ -21,8 +21,6 @@
                '#search', // remove search form element from Special:Search
                'div.sister-project',
                'div.magnify',
-               '.editsection', // FIXME: deprecate in favour of mw-editsection
-               '.mw-editsection', // Edit links in section headings
                'span.t',
                '.portal',
                '#protected-icon',
diff --git a/javascripts/common/application-beta.js 
b/javascripts/common/application-beta.js
new file mode 100644
index 0000000..a21d180
--- /dev/null
+++ b/javascripts/common/application-beta.js
@@ -0,0 +1,18 @@
+( function( M, $ ) {
+
+       function deParam( url ) {
+               var args = url.split( '?' ), qs = args[1] || '',
+                       params = {};
+               if ( qs ) {
+                       qs.split( '&' ).map( function( p ) {
+                               p = p.split( '=' );
+                               params[ p[0] ] = p[1];
+                       } );
+               }
+               return params;
+       }
+       $.extend( M, {
+               deParam: deParam
+       } );
+
+}( mw.mobileFrontend, jQuery ) );
diff --git a/javascripts/common/history-alpha.js 
b/javascripts/common/history-alpha.js
index d1b551e..31a45c4 100644
--- a/javascripts/common/history-alpha.js
+++ b/javascripts/common/history-alpha.js
@@ -15,14 +15,8 @@
                 * @return {String} the new absolute or relative url
                 */
        function updateQueryStringParameter( url, key, value ) {
-               var args = url.split( '?' ), qs = args[1] || '',
-                       params = {};
-               if ( qs ) {
-                       qs.split( '&' ).map( function( p ) {
-                               p = p.split( '=' );
-                               params[ p[0] ] = p[1];
-                       } );
-               }
+               var args = url.split( '?' ),
+                       params = M.deParam( url );
                params[key] = value;
                return args[0] + '?' + $.param( params );
        }
diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 7f49804..c139f34 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -35,11 +35,13 @@
                        addEditButton( 1, '#ca-edit' );
                }
 
-               $( '.section_heading' ).each( function( i ) {
-                       // Avoid Bug 49780
-                       // FIXME: Addressing bug 40678 will render this 
unnecessary
-                       if ( $( this ).attr( 'id' ) !== 'section_language' ) {
-                               addEditButton( i + 1, this );
+               $( '.mw-editsection' ).each( function() {
+                       // FIXME [ParserOutput]: This is nasty
+                       var editHref = $( this ).find( 'a' ).attr( 'href' ),
+                               section = M.deParam( editHref ).section;
+                       if ( section ) {
+                               addEditButton( section, $( this ).parent() );
+                               $( this ).remove();
                        }
                } );
        }
diff --git a/less/common/mf-hacks.less b/less/common/mf-hacks.less
index 04c5de2..910ddf6 100644
--- a/less/common/mf-hacks.less
+++ b/less/common/mf-hacks.less
@@ -73,3 +73,9 @@
                }
        }
 }
+
+// FIXME: [ParserOutput] This enables bug 49208
+.editsection,
+.mw-editsection {
+       display: none;
+}
diff --git a/stylesheets/common/mf-hacks.css b/stylesheets/common/mf-hacks.css
index 05d6e41..6cf0811 100644
--- a/stylesheets/common/mf-hacks.css
+++ b/stylesheets/common/mf-hacks.css
@@ -60,3 +60,7 @@
 ul.gallery li.gallerybox > div > div.thumb {
   width: auto !important;
 }
+.editsection,
+.mw-editsection {
+  display: none;
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/70751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a9eb693c580f06e1ff3b4d228a9338bfb50f7e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to