Matmarex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/49364
Change subject: (bug 41729) [DRAFT] display editsection links next to headings
......................................................................
(bug 41729) [DRAFT] display editsection links next to headings
This requires various minor changes in various parts of MediaWiki, and being
extra careful about cached rendered pages' HTML.
Fun fact: editsection links are not made in Parser. They're made in Linker, in
Skin, *and* in ParserOutput.
* change the HTML of pages to move the link itself from the beginning of the
heading (before <span class="mw-headline">) to the end of the heading (after
the span) [in Linker]
* change the class from .editsection to .mw-editsection; first because we can,
and secondly because this makes it much easier to properly handle cached
renders (by just detecting the old class) [in Skin]
* ensure everything that should support both classes supports both classes
[PARTIALLY DONE]
* implement styles for the new look for all the skins and print stylesheets
[NOT DONE]
* implement a script to make old cached renders look the same as new ones [NOT
DONE]
Change-Id: I6a6c12a90de3604012420b20c1f520e0ece170ab
---
M includes/Linker.php
M includes/Skin.php
M includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
M resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
M skins/common/commonPrint.css
M skins/common/shared.css
M skins/common/wikiprintable.css
M skins/modern/print.css
8 files changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/64/49364/1
diff --git a/includes/Linker.php b/includes/Linker.php
index 4555398..5dad8bb 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -1723,8 +1723,8 @@
*/
public static function makeHeadline( $level, $attribs, $anchor, $html,
$link, $legacyAnchor = false ) {
$ret = "<h$level$attribs"
- . $link
. " <span class=\"mw-headline\"
id=\"$anchor\">$html</span>"
+ . $link
. "</h$level>";
if ( $legacyAnchor !== false ) {
$ret = "<div id=\"$legacyAnchor\"></div>$ret";
diff --git a/includes/Skin.php b/includes/Skin.php
index 723ede4..6379049 100644
--- a/includes/Skin.php
+++ b/includes/Skin.php
@@ -1533,14 +1533,14 @@
# DoEditSectionLink: it can't change the brackets or
the span.)
$result = wfMessage( 'editsection-brackets'
)->rawParams( $result )
->inLanguage( $lang )->escaped();
- return "<span class=\"editsection\">$result</span>";
+ return "<span class=\"mw-editsection\">$result</span>";
}
# Add the brackets and the span, and *then* run the nice new
hook, with
# clean and non-redundant arguments.
$result = wfMessage( 'editsection-brackets' )->rawParams( $link
)
->inLanguage( $lang )->escaped();
- $result = "<span class=\"editsection\">$result</span>";
+ $result = "<span class=\"mw-editsection\">$result</span>";
wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section,
$tooltip, &$result, $lang ) );
return $result;
diff --git a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
index bdb240e..43f81d0 100644
--- a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
+++ b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
@@ -78,7 +78,7 @@
$rules[] = "#toc { display: none; }\n";
}
if ( !$options['editsection'] ) {
- $rules[] = ".editsection { display: none; }\n";
+ $rules[] = ".mw-editsection, .editsection {
display: none; }\n";
}
if ( $options['editfont'] !== 'default' ) {
// Double-check that $options['editfont']
consists of safe characters only
diff --git a/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
b/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
index 61d9d15..0e85fd9 100644
--- a/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
+++ b/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
@@ -8,7 +8,7 @@
// Don't use the ":has:(.editsection a)" selector because it performs
very bad.
// http://jsperf.com/jq-1-7-2-vs-jq-1-8-1-performance-of-mw-has/2
$( document ).on( 'contextmenu', 'h1, h2, h3, h4, h5, h6', function ( e
) {
- var $edit = $( this ).find( '.editsection a' );
+ var $edit = $( this ).find( '.mw-editsection a, .editsection a'
);
if ( !$edit.length ) {
return;
}
diff --git a/skins/common/commonPrint.css b/skins/common/commonPrint.css
index 6cb213f..61d3456 100644
--- a/skins/common/commonPrint.css
+++ b/skins/common/commonPrint.css
@@ -111,6 +111,7 @@
div.top,
div#column-one,
#colophon,
+.mw-editsection,
.editsection,
.toctoggle,
.tochidden,
diff --git a/skins/common/shared.css b/skins/common/shared.css
index 1fe750e..3ce8422 100644
--- a/skins/common/shared.css
+++ b/skins/common/shared.css
@@ -1084,7 +1084,7 @@
z-index: 99;
}
-.editsection, .toctoggle {
+.mw-editsection, .editsection, .toctoggle {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
diff --git a/skins/common/wikiprintable.css b/skins/common/wikiprintable.css
index 95fcfef..f5650b5 100644
--- a/skins/common/wikiprintable.css
+++ b/skins/common/wikiprintable.css
@@ -32,6 +32,7 @@
#logo,
#footer,
#siteNotice,
+.mw-editsection,
.editsection,
.toctoggle {
display: none;
diff --git a/skins/modern/print.css b/skins/modern/print.css
index 8278410..6e0f8b3 100644
--- a/skins/modern/print.css
+++ b/skins/modern/print.css
@@ -3,6 +3,7 @@
#p-personal,
#jump-to-nav,
#footer,
+.mw-editsection,
span.editsection,
.noprint {
display: none;
--
To view, visit https://gerrit.wikimedia.org/r/49364
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a6c12a90de3604012420b20c1f520e0ece170ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits