Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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.
/* global mw */mw.loader.using(['mediawiki.user'],function(){"use strict";// List of options which will be not output in restricted mode. Add options containing personal data to this list.// Testing! Not all options which should be here are.varblacklist=["watchlisttoken","pagetriage-lastuse","rcfilters-saved-queries","rcfilters-wl-saved-queries"];// Alternative whitelist-based system:/** var whitelist = ["monobook-responsive", "globaluserpage", "minordefault"]; */varconfig=mw.config.get(['wgNamespaceNumber','wgTitle','skin']);functionfilterBlacklist(key,value){if(blacklist.includes(key)){returnundefined;}else{returnvalue;}}functionexportOptionsForm(){varbodyContent=(config.skin==="cologneblue"?"article":"bodyContent");document.getElementsByTagName("h1")[0].textContent="Export user options";document.title="Export user options";document.getElementById(bodyContent).innerHTML='<div>'+'<form id="wpExportUserOptions" name="wpExportUserOptions">'+'<p>This page allows convenient export of your user preferences in JSON format.</p>'+'<p>You can choose whether to export a restricted set of preferences (unlikely to contain personal data) or all preferences. '+'Before sharing the output of this page you should check that no data you do not wish to share is included.</p>'+'<input type="radio" name="personalchoice" value="restricted" id="wpExportUserOptionsRadioRestricted" checked="true">'+'<label for="wpExportUserOptionsRadioRestricted">Restricted</label>'+'<br>'+'<input type="radio" name="personalchoice" value="all" id="wpExportUserOptionsRadioAll">'+'<label for="wpExportUserOptionsRadioAll">All</label>'+'<br>'+'<input type="submit" value="Export">'+'</form>'+'</div>'+'<br><hr>'+'<div id="wpExportUserOptionsOutput">'+'<p>Output will appear here.</p>'+'</div>';document.getElementById("wpExportUserOptions").addEventListener("submit",function(f){f.preventDefault();if(document.getElementById("wpExportUserOptionsRadioAll").checked){document.getElementById("wpExportUserOptionsOutput").innerHTML='<pre>'+JSON.stringify(mw.user.options.values,null,'\t')+'</pre>';}elseif(document.getElementById("wpExportUserOptionsRadioRestricted").checked){document.getElementById("wpExportUserOptionsOutput").innerHTML='<pre>'+JSON.stringify(mw.user.options.values,filterBlacklist,'\t')+'</pre>';// Alternative whitelist-based system:/** document.getElementById("wpExportUserOptionsOutput").innerHTML = '<pre>' + JSON.stringify(mw.user.options.values, whitelist, '\t') + '</pre>'; */}});}if(config.wgNamespaceNumber===-1&&config.wgTitle.toLowerCase()==="exportuseroptions"){exportOptionsForm();}});