用户:Sheep-realms/common.js:修订间差异

删除1,837字节 、​ 2023年2月1日 (星期三)
无编辑摘要
无编辑摘要
无编辑摘要
标签手工回退
 
(未显示同一用户的7个中间版本)
第16行: 第16行:
     };
     };
}
}
/* 右上角添加强制刷新 */
$('#p-personal ul').append('<li><a href="?action=purge">强制刷新</a><li>');


/* 高亮标记巡查按钮 */
/* 高亮标记巡查按钮 */
$('#mw-diff-ntitle4 span').css('background-color', '#4AC74F');
// $('#mw-diff-ntitle4 span').css('background-color', '#4AC74F');
$('#mw-diff-ntitle4 span').css('color', '#4AC74F');
// $('#mw-diff-ntitle4 span').css('color', '#4AC74F');
$('#mw-diff-ntitle4 span a').css('color', '#FFF');
// $('#mw-diff-ntitle4 span a').css('color', '#FFF');
 
/* 测试 */
$('.editButtons').after('<div id="edit-bottom-tools"></div>');
$('#edit-bottom-tools').append('<input type="button" value="测试" onclick="codeQueryInsert(1)">');
 
function codeQueryInsert(code){
    $('textarea #wpTextbox1').position(code);
}
 
$.fn.extend({
    position:function( value ){
        var elem = this[0];
            if (elem&&(elem.tagName=="TEXTAREA"||elem.type.toLowerCase()=="text")) {
              if($.browser.msie){
                      var rng;
                      if(elem.tagName == "TEXTAREA"){
                            rng = event.srcElement.createTextRange();
                            rng.moveToPoint(event.x,event.y);
                      }else{
                            rng = document.selection.createRange();
                      }
                      if( value === undefined ){
                        rng.moveStart("character",-event.srcElement.value.length);
                        return  rng.text.length;
                      }else if(typeof value === "number" ){
                        var index=this.position();
                        index>value?( rng.moveEnd("character",value-index)):(rng.moveStart("character",value-index))
                        rng.select();
                      }
                }else{
                    if( value === undefined ){
                        return elem.selectionStart;
                      }else if(typeof value === "number" ){
                        elem.selectionEnd = value;
                        elem.selectionStart = value;
                      }
                }
            }else{
                if( value === undefined )
                  return undefined;
            }
    }
})