User:YFdyh000/qSig.js

维基百科,自由的百科全书

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

if ((wgNamespaceNumber % 2 || wgNamespaceNumber==4)
 && document.URL.match(/&action=(edit|submit)/))
{
$(function(){
    var wpSave = document.getElementById('wpSave');
    if (!wpSave) return;
    
/*    if (window.sigText) //change normal sig button as well
        mwEditButtons[9].tagOpen = sigText;
    else 
*/
         sigText = '--~~\~~';
    
    //create button
    var btn = document.createElement('input');
    btn.type='button'; btn.value = '~';
    btn.onclick = function(){ insertTags(sigText,'','') };
    btn.style.marginRight = '4px'; 
    btn.title = '写下您的签名';
    if (window.sigAccessKey){
        btn.accessKey = sigAccessKey;
        btn.title += ' [' + tooltipAccessKeyPrefix + btn.accessKey + ']';
    }
    wpSave.parentNode.insertBefore(btn, wpSave);
    
    //for 'Wikipedia:' namespace: Sig is ok on Forum pages, on all others put it after Save button
    if ( wgNamespaceNumber == 4 )
/*    && ( !wgTitle.match('^(Village pump [(]|Reference desk/|Deletion review/|Articles for deletion/|Templates for deletion/|.*noticeboard.*|Requests for (adminship|checkuser|arbitration|feedback|page protection|mediation)|Bot requests|Help desk|Editor review|Adminship survey|Cleanup|Miscellany for deletion|New contributors\' help page|Media copyright questions)')  ) ) */
    {
        wpSave.parentNode.insertBefore(btn, wpSave.nextSibling);
//        return; //avoid warning below
    }
    
    //warn if saving without signature 
    wpSave.onclick = function(){
    if (document.editform.wpTextbox1.value.indexOf('~\~~') >= 0 )
        return true
    else 
        return confirm('您确定不签名吗?')
    }
})
}