Jump to content

User:PrimeHunter/Safemode edit.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Add a "Safemode edit" sidebar link to edit the current page with safemode=1 added.
   This disables user js, css and gadgets per https://phabricator.wikimedia.org/T152169.
   Changes in the edit box and elsewhere will be lost.
   safemode=1 will disappear on "Show preview" and "Show changes"
   Install with this in your [[Special:MyPage/common.js]]:

   importScript('User:PrimeHunter/Safemode edit.js'); // Linkback: [[User:PrimeHunter/Safemode edit.js]]
*/

$( document ).ready( function() {
  mw.util.addPortletLink(
    'p-tb',
    location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'action=edit&safemode=1',
    'Safemode edit',
    't-safemodeedit',
    'Edit this page without user js, css and gadgets (discards anything you have entered)'
  );
});