Tacsipacsi added a comment.
In T340859#9766876 <https://phabricator.wikimedia.org/T340859#9766876>, @Sjoerddebruin wrote: > (it doesn't function anyway on mobile). But it //does// function on desktop Minerva, not to mention other skins like Timeless and Modern, on which you also disabled it <https://www.wikidata.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=2143585334>. A more proper fix would be removing both `|skins=` and `|dependencies=` from MediaWiki:Gadgets-definition, and doing the following change to the JS file: @@ -4,16 +4,18 @@ * @see [[MediaWiki:Gadget-DuplicateReferences.css]] * @author Bene* */ -( function ( $, mw, wb ) { - 'use strict'; +$( () => { +'use strict'; - if ( !mw.config.exists( 'wbEntityId' ) || - !mw.config.get( 'wbIsEditView' ) || - !mw.config.get( 'wgIsProbablyEditable' ) - ) { - return; - } +if ( !mw.config.exists( 'wbEntityId' ) || + !mw.config.get( 'wbIsEditView' ) || + !mw.config.get( 'wgIsProbablyEditable' ) || + document.body.classList.contains( 'mw-mf' ) // see [[phab:T299772]] +) { + return; +} +mw.loader.using( 'wikibase.ui.entityViewInit' ).then( () => { switch ( mw.config.get( 'wgUserLanguage' ) ) { default: case 'en': @@ -340,25 +342,23 @@ ); } - $( function () { - addCopyLinks( '.wikibase-statementview' ); - - // remove [copy] when entering edit mode to avoid clashes - $( document ) - .on( 'snakviewafterstartediting', function ( e ) { - setTimeout( function () { - $( e.target ).find( '.wikibase-referenceview-heading' ).find( '.wikibase-copytoolbar-container' ).remove(); - // show existing items - $( e.target ).find( '.wikibase-referenceview-heading' ).find( '.wikibase-toolbar-item' ).show(); - }, 50 ); - } ) - .on( 'snakviewafterstopediting', function ( e ) { - var element = $( e.target ).parents( '.wikibase-statementview' ); - // ugly hack but there seems to be no proper event to add this - setTimeout( function () { - addCopyLinks( element ); - }, 50 ); - } ); - } ); + addCopyLinks( '.wikibase-statementview' ); -} )( jQuery, mediaWiki, wikibase ); + // remove [copy] when entering edit mode to avoid clashes + $( document ) + .on( 'snakviewafterstartediting', function ( e ) { + setTimeout( function () { + $( e.target ).find( '.wikibase-referenceview-heading' ).find( '.wikibase-copytoolbar-container' ).remove(); + // show existing items + $( e.target ).find( '.wikibase-referenceview-heading' ).find( '.wikibase-toolbar-item' ).show(); + }, 50 ); + } ) + .on( 'snakviewafterstopediting', function ( e ) { + var element = $( e.target ).parents( '.wikibase-statementview' ); + // ugly hack but there seems to be no proper event to add this + setTimeout( function () { + addCopyLinks( element ); + }, 50 ); + } ); +} ); +} ); This checks for MobileFrontend usage rather than skin (using the `mw-mf` body class introduced in T299772 <https://phabricator.wikimedia.org/T299772>), so the gadget is usable on desktop using any skin (including Minerva), but disabled and doesn’t cause issues on mobile using any skin (including e.g. Vector). I tested it by running from the console and clicking on the copy button (but not pasting it anywhere to avoid doing edits). As expected, it doesn’t appear on mobile, appears on desktop, and throws no errors on either platform. TASK DETAIL https://phabricator.wikimedia.org/T340859 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Sjoerddebruin, Tacsipacsi Cc: LucasWerkmeister, Sjoerddebruin, Michael, Lydia_Pintscher, Tacsipacsi, Jdlrobson, Nikki, Lucas_Werkmeister_WMDE, Aklapper, Masumrezarock100, PAC2, Danny_Benjafield_WMDE, S8321414, Astuthiodit_1, hubaishan, karapayneWMDE, Invadibot, Lectrician1, maantietaja, ItamarWMDE, Akuckartz, Dringsim, Nandana, lucamauri, Lahi, Gq86, GoranSMilovanovic, QZanden, KimKelting, dachary, LawExplorer, _jensen, rosalieper, Scott_WUaS, Myst, Wikidata-bugs, aude, Ricordisamoa, Mbch331
_______________________________________________ Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org