MediaWiki talk:Gadget-editDropdown.js

Latest comment: 6 months ago by Lucas Werkmeister in topic Revised markup for Vector changes (2023 edition)

Broken edit

$caEdit.children('span:first') returns a jQuery with no elements. Consequently, some links can't be attached. This breaks User:Rillke/SVGedit.js, User:Majora/LicenseReview.js and User:Rillke/bigChunkedUpload.js in Vector skin (Monobook users continue get the links as always in the tools section of the side bar). The edit tab markup has changed. It is now:

<li id="ca-edit" class="collapsible"><a href="/w/index.php?title=File:Test.svg&amp;action=edit" title="Edit this page [Alt+Shift+e]" accesskey="e">Edit</a></li>

As a interim solution, you might either

mw.libs.commons.ui.isEditDropdownCompat = function () {
-	var client = $.client.profile();
-	return ('vector' === mw.config.get('skin') && 
-		!('msie' === client.name && client.versionBase < 8) && 
-		(mw.user.options.get('userjs-sm-ed-dropdown') !== '0'));
+	return false;
};

This will make the links go to the toolbox in all skins. Or (with slightly broken rendering and accessibility):

	// Create the drop-down and append it to our menu
	$('<div>', {
		'class': 'menu'
	}).append($ul).appendTo($editMenu);

	// Finally add our menu to the edit-button
-	$caEdit.children('span:first')[addMethod]($editMenu);
+	$caEdit[addMethod]($editMenu);

	// If we are on file pages, prefill the menu with the "upload a new version"-link
	var $reUpload = $('#mw-imagepage-reupload-link');

I would favour the second one, but it's a management (aka admin) decision. -- Rillke(q?) 10:38, 1 November 2019 (UTC)Reply

  Done Also patched the style to fix the rendering. The accessibility... not so obvious how to easily fix it --Zhuyifei1999 (talk) 17:22, 1 November 2019 (UTC)Reply

"vector-menu-heading" for h3 edit

{{Ep}} MediaWiki:Gadget-LicenseReview.js has some strange behavior on 1.38.0-wmf.25, this patch will fix this problem. L68, please change the following code:

	// Wrap link into H3
	var $link = $caEdit.children('a').first();
	$('<h3>')
		.append($link)
		.appendTo($editMenu);

to this like:

	// Wrap link into H3
	var $link = $caEdit.children('a').first();
	$('<h3>', {
		'class': 'vector-menu-heading'        
	}).append($link)
	  .appendTo($editMenu);

Thanks. Stang 08:25, 10 March 2022 (UTC)Reply

  Done --Lucas Werkmeister (talk) 21:45, 10 March 2022 (UTC)Reply

Revised markup for Vector changes (2023 edition) edit

{{Ep}} Vector menu markup seems to have changed again, causing display oddness with bigChunkedUpload.js active, so editDropdown.js needs to be updated similarly:

	// Wrap link into H3
	var $link = $caEdit.children('a').first();
	$('<h3>', { 'class': 'vector-menu-heading', 'style': 'display: block;' })
		.append($link)
		.appendTo($editMenu);

Needs to change into something like:

	// Add link to edit menu
    $caEdit.children('a').first()
        .appendTo($editMenu);

IOW, the <h3 class="vector-menu-heading"></h3> wrapper is now no longer used and causes glitches when present. I haven't checked any other editDropdown.js clients but I assume they have the same problem. --Xover (talk) 08:21, 19 August 2023 (UTC)Reply

  Done --Lucas Werkmeister (talk) 18:58, 30 September 2023 (UTC)Reply
Return to "Gadget-editDropdown.js" page.