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.
// var autoLocalTimeStamps = false; // importScript('User:Splarka/timestamplocalizer.js');// ----------------------------------------------------------// START Timestamp localizer by Splarka (experimental)// ----------------------------------------------------------// This crazy script iterates over all text nodes in the // content area and attempts to switch signature-generated// UTC timestamps with a version in your local time.addOnloadHook(function(){if(mw.config.get('wgAction')=='edit'||mw.config.get('wgAction')=='submit')return//DO NOT WANTif(window.autoLocalTimeStamps=='true'){//autoloadlocalTimeStamps();}else{//give a button insteadmw.util.addPortletLink('p-cactions','javascript:localTimeStamps()','Localize timestamps','ca-local','This will attempt to convert all timestamps on the page to your local time');}});functionlocalTimeStamps(){findTextNodes(changeTimeStamp,document.getElementById('bodyContent'));}functionchangeTimeStamp(obj){varpattern=/\d\d\:\d\d\, \d{1,2} \w{1,30} \d{4} \(UTC\)/;while(obj.nodeValue.search(pattern)!=-1){vardat=''+obj.nodeValue.match(pattern);varhour=''+dat.match(/\d\d\:\d\d\, /)hour=hour.replace(/\,/,'');dat=dat.replace(/\d\d\:\d\d\, /,'');dat=dat.replace(/ \(UTC\)/,' '+hour+' UTC');varts=newDate(dat);ts.setTime(ts.getTime());obj.nodeValue=obj.nodeValue.replace(pattern,ts.toString());}}// General text-node finder/magic/functioner// * iterates over childnodes of obj// * if obj is text, perform func() on it// * if obj has childnodes, call self recursivelyfunctionfindTextNodes(func,obj){if(obj.nodeType==3){func(obj);}vari=0;while(obj.childNodes[i]){findTextNodes(func,obj.childNodes[i]);i++;}}// ----------------------------------------------------------// END Timestamp localizer// ----------------------------------------------------------