LLWiki正在建设中,欢迎加入我们

“MediaWiki:Gadget-inspect.js”的版本间差异

跳转到导航 跳转到搜索
添加10字节 、​ 2021年1月9日 (六) 11:09
无编辑摘要
autocomplete = isGadget('autocomplete') ? function(e) {
if (![9, 27].includes( e.keyCode )) { return; } // tab和esc
var ns, $cursor, newBeforebefore;
const cursorActivity = function() {
const newCursor = editor.getCursor(),
return;
}
newBeforebefore = newLine.slice(0, newCursor.ch);
updateHints();
},
updateHints = mw.util.debounce(500, function() {
$cursor = $wrapper.find( '.CodeMirror-cursor' );
const prefix = newBeforebefore.match( regexps[ns] )[1];
return mw.timedQuery(api, {list: 'prefixsearch', psnamespace: ns, pssearch: prefix},
wgULS('前缀相符的页面', '前綴相符的頁面')).then(function(r) {
$hints.html( r.query.prefixsearch.map(function(ele) {
return $('<div>', {text: ele.title.slice( nsPrefixes[ns].length + 1 )});
}) ).show().position({my: 'left top', of: $cursor, within: $wrapper, collision: 'fit'}).show();
if ($hints.children().length === 0) { $hints.append( $noHint ); }
}, function() { stop(); });
const cursor = editor.getCursor(),
line = editor.getLine( cursor.line ),
before = line.slice(0, cursor.ch),
after = line.slice( cursor.ch );
before = line.slice(0, cursor.ch),;
if (regexps[10].test( before )) { ns = 10; }
else if (regexps[828].test( before )) { ns = 828; }
else { return; }
mw.notify(wgULS('开启自动补全提示。', '開啟自動補全提示。'), {tag: 'autocomplete'});
updateHints();
editor.on('cursorActivity', cursorActivity);
} : function() {};
e.preventDefault();
// 使用jquery.ui让菜单总是落在CodeMirror内,此时slideDown效果不生效
$dropdown.show().position({my: 'left top', of: e, within: $wrapper, collision: 'fit'}).show();
}).on('keydown', '.CodeMirror', autocomplete ).resizable( {handles: 'w', minWidth: 350} );
$('body').click(function() { $dropdown.slideUp('fast'); });
16,874

个编辑

导航菜单