User:Ilmari Karonen/signcheck.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.

// CHECK THAT I'VE REMEMBERED TO SIGN TALK PAGES: <pre><nowiki>
 
addOnloadHook(function () {
    if (!document.title.match(/^Editing ([a-z]+ )talk:/i) || !document.editform) return;
    var oldOnclick = document.editform.wpSave.onclick;
    document.editform.wpSave.onclick = function () {
        if (oldOnclick && !oldOnclick.apply(this, arguments)) return false;
        if (document.editform.wpTextbox1.value.match(/~{3}/)) return true;
        return confirm("You have not signed your name. Save anyway?");
    };
});
 
// </nowiki></pre>