User:Microchip08/dyk.js

From Simple English Wikipedia, the free encyclopedia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
adapted from http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/warn.js
Versions 1.0-2.0 in history of [[:en:User:Sceptre/monobook.js]]... I think <nowiki>
*/
$( function() {
if (wgPageName == Template talk:Did you know)
  {
  if (wgAction == edit) {
    mw.util.addPortletLink('p-tb', 'javascript:dyk()', 'Evaluate DYK');
  }
}


function dyk()
{
    var txt = document.editform.wpTextbox1;
var prefix = DYK
var type = prompt("What are you closing this as?", "yes");
var msgtext = "{{subst:"+prefix+type+"}} ~~~~";
var summary = "Evaluating hook as "+type ;
    document.editform.wpSummary.value = summary;
    document.editform.wpMinoredit.checked = true;
    if(txt.value.length > 0) txt.value += '\n';
    txt.value += msgtext;
}
/*
</nowiki>
*/