MediaWiki:DeleteJStorage.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at MediaWiki:DeleteJStorage. |
/**
* Deletes the local storage of jStorage
* for debugging and issue resolution
* after prompting
*
* jshint valid
**/
/*jshint curly:false*/
mw.loader.using('jquery.ui', function() {
// This script should only run on one page to prevent confusion and abuse
if (mw.config.get('wgPageName') !== 'Commons:User_scripts/Delete_jStorage') return;
$('<div>').text("Are you sure you want to delete data saved for " + wgSiteName + " from your browser's local storage? WARNING: This will delete settings for VisualFileChange and other tools that are saved in your browser. Make sure you back them up before or save them under your user account.").dialog({
title: "Delete data saved for " + mw.config.get('wgSiteName'),
modal: true,
buttons: {
'Yes': function() {
localStorage.removeItem('jStorage');
localStorage.removeItem('jStorage_update');
alert("Done. Data removed. You have to reload all pages to see effects.");
$(this).dialog('close').remove();
},
'No/Cancel': function() {
$(this).dialog('close').remove();
}
}
});
});