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

删除1,387字节 、​ 2023年2月1日 (星期三)
无编辑摘要
无编辑摘要
无编辑摘要
标签手工回退
 
(未显示同一用户的10个中间版本)
第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="测试">');
 
function codeQueryInsert(code){
    $('textarea #wpTextbox1').insertAtCaret(code);
}
 
(function ($) {
"use strict";
    $.fn.extend({
        insertAtCaret : function (myValue) {
            var $t = $(this)[0];
            if (document.selection) {
                this.focus();
                var sel = document.selection.createRange();
                sel.text = myValue;
                this.focus();
            } else
                if ($t.selectionStart || $t.selectionStart == '0') {
                    var startPos = $t.selectionStart;
                    var endPos = $t.selectionEnd;
                    var scrollTop = $t.scrollTop;
                    $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
                    this.focus();
                    $t.selectionStart = startPos + myValue.length;
                    $t.selectionEnd = startPos + myValue.length;
                    $t.scrollTop = scrollTop;
                } else {
                    this.value += myValue;
                    this.focus();
                }
        }
    });
})(jQuery);