Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
To contact staff directly or to report bugs, please use Special:Contact.
If one wanted to configure some JavaScript so that it would always first check if there was a piece of code in the wiki source, and if it is not present, plug it in on edit, how would one do that? For instance, when someone goes to "action=edit", check if the text box has "fooBar, Quok.", and if it doesn't, add it to the end of the page. What would the JavaScript for this look like? (sorry, every time I try scripting, I phail...) TimerootT • C • E 09:50, 30 June 2009 (UTC)
- As starting point:
if (wgAction == 'edit' || wgAction == 'submit') { $(appendWikiText); } function appendWikiText(){ var tb = document.getElementById('wpTextbox1'); var text = "fooBar, Quok."; if (tb && tb.value.indexOf(text) == -1) { tb.value += text; } }
- --Ciencia Al Poder (talk) -WikiDex 18:18, 30 June 2009 (UTC)