User talk:Billinghurst/common.js
Jump to navigation
Jump to search
To try at PROMPT a point in time[edit]
- example
function replace(s, r) {
if (!s) { var s = prompt("Search regexp?"); } if(s) { if (!r) { var r = prompt("Replace regexp?"); } if(!r && r != ) return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); }
}
Commons, not meta.[edit]
Hi, if you are wondering why nothing happens, ... you have to correct the link
- mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Rillke/forWikisource.js&action=raw&ctype=text/javascript');
-- Rillke (talk) 16:53, 2 May 2012 (UTC)
- It adds a purge-tab. But let's keep the discussion on Commons ;-) -- Rillke (talk) 16:56, 2 May 2012 (UTC)
- <laugh>Fair point. It was very well past pumpkin hour; and I was dealing matters from all over, and I guess that I had made a mistake somewhere. Thanks. <facepalm> — billinghurst sDrewth 22:19, 2 May 2012 (UTC)
For an extra if statement in the addbuttons[edit]
… try to declare the extra button in an outside variable, with the condition, then insert the resultant component be it null or code. — billinghurst sDrewth 14:32, 29 August 2013 (UTC)
var buttons = [ /* all you buttons go here */ ];
if ( foo ) { buttons.push( /* One more button */ ); }
mw.toolbar.addButtons( buttons )