跳转到内容

User:Willy1018/tidy-font-bug.js

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

这是本页的一个历史版本,由Willy1018留言 | 贡献2023年6月4日 (日) 16:20 建立内容为“function font_queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } } return null; } //Add a 'font edit' tab if(mw.config.get('wgArticleId') != 0 ) { $( function fontEditButton() { mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'…”的新页面)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
function font_queryString(p) {
    var re = RegExp('[&?]' + p + '=([^&]*)');
    var matches;
    if (matches = re.exec(document.location)) {
        try { 
            return decodeURI(matches[1]);
        } catch (e) { }
    }
    return null;
}

//Add a 'font edit' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function fontEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',font:true}),
                       'font to span',
                       'p-font',
                       'font edit7');
    }
)}

if(mw.config.get('wgAction') == 'edit' && font_queryString('font') == 'true') {
    $(function font() {
        var myContent = document.getElementById('wpTextbox1').value;

        myContent = myContent.replace(/<font color="(.*?)">(.*?)<\/font>/gi,'<span class="$1">$2</span>');
        

        if(document.getElementById('wpTextbox1').value != myContent) {
           document.getElementById('wpTextbox1').value=myContent;
           document.getElementById('wpSummary').value='font [[Special:LintErrors/tidy-font-bug|lint]]';
           document.getElementById('wpMinoredit').checked = true;
        }



    }
)}