User:Kimchi.sg/simple.js

出自維基百科,自由嘅百科全書

注意:喺儲存之後,你可能要先略過你嘅瀏覽器快取去睇到更改。Mozilla / Firefox / Safari: 㩒住Shift掣再撳重新載入,又或者㩒Ctrl-Shift-R(喺蘋果Mac中㩒Cmd-Shift-R掣); IE: 㩒住Ctrl掣再撳重新整理,又或者㩒Ctrl-F5掣; Konqueror: 就咁以撳個重載掣,又或者㩒F5Opera嘅用戶可能需要先喺工具→喜好設定之中清佢哋嘅快取。

// [[User:Lupin/popups.js]] - please include this line 

document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// Options are explained at [[Wikipedia:Tools/Navigation_popups]]
popupFixDabs=true;
popupFixRedirs=true;

/* Force add edit summary */

function addForceSummary()
{
    if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
    if(/&section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = forceSummary;
}

function forceSummary()
{
    if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
    {
        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
        if(r == null) { return false; }
        document.forms.editform.wpSummary.value = r;
    }
    return true;
}

addOnloadHook(addForceSummary);