“User:Bhsd/minerva.js”的版本间差异

删除1,155字节 、​ 2021年3月30日 (二) 04:36
无编辑摘要
标签移动版网页编辑 移动版编辑
// 拆分自[[Special:Mypage/common.js]],不可使用ES6语法
"use strict";
/*global mw, $, VConsole*/
mw.gadgets = mw.gadgets || {};
mw.loader.using( 'jquery.client' ).then(function() {
if ($.client.profile().name == 'firefox') {
mw.gadgets.stickyHeading = $.extend(mw.gadgets.stickyHeading, {mode: 'desktop'});
mw.hook( 'wikipage.content' ).add(function($content) {
console.log('Hook: wikipage.content, Firefox开始移除粘性章节标题');
 
mw.loader.using( 'mediawiki.util' ).then(function() {
// console
if (mw.util.getParamValue( 'vconsole' )) {
mw.loader.getScript( 'https://cdn.jsdelivr.net/npm/vconsole@3.3.4/dist/vconsole.min.js' )
.then(function() {
new VConsole(); // jshint ignore: line
$('#__vconsole').one('click', function() {
$('.vc-cmd-input').replaceWith( $('<textarea>', {class: 'vc-cmd-input'}) );
$('#__vc_log_default').on('click', '.vc-item-code', function() {
const $this = $(this);
$this.text( $this.html() );
});
});
});
}
else {
$('<div>', {id: "__vconsole", html: $('<div>', {class: "vc-switch", text: "vConsole"})}).insertAfter( 'body' )
.click(function() {
mw.loader.using( 'mediawiki.Uri' ).then(function() {
const uri = new mw.Uri();
uri.query.vconsole = 1;
location.href = uri.toString();
});
});
}
 
const nsid = mw.config.get( 'wgNamespaceNumber' ),
specialPage = mw.config.get( 'wgCanonicalSpecialPageName' ),
16,874

个编辑