添加的内容 删除的内容
imported>Wr 无编辑摘要 |
imported>Wr 无编辑摘要 |
||
第1行: | 第1行: | ||
// 调用 MediaWiki 的 OOUI 每年只弹出一次提示, 使用 SonicpediaAlertValue Cookies 进行判定 |
|||
// SonicpediaAlertValue=0即代表 |
|||
function setCookie(alertValue,value){ |
|||
var Days = 365; |
|||
var exp = new Date(); |
|||
exp.setTime(exp.getTime() + Days*24*60*60*1000); |
|||
document.cookie = alertValue + "="+ escape (value) + ";expires=" + exp.toGMTString(); |
|||
} |
|||
function getCookie(alertValue){ |
|||
var arr,reg=new RegExp("(^| )"+alertValue+"=([^;]*)(;|$)"); |
|||
if(arr=document.cookie.match(reg)) |
|||
return unescape(arr[2]); |
|||
else |
|||
return null; |
|||
} |
|||
// https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki#Gadgets |
|||
mw.loader.using( 'oojs-ui-core', 'oojs-ui-windows' ).done( function(){ |
|||
if (getCookie("SonicpediaAlertValue")==0){ |
|||
return null; |
|||
} |
|||
else { |
|||
// Use the verbose option to communicate a long message. |
|||
var messageDialog = new OO.ui.MessageDialog(); |
|||
// Create and append window manager |
|||
var windowManager = new OO.ui.WindowManager(); |
|||
$( 'body' ).append( windowManager.$element ); |
|||
// Add the dialog to the window manager |
|||
windowManager.addWindows( [ messageDialog ] ); |
|||
// Configure the message dialog when it is opened with the window manager’s openWindow() method. |
|||
windowManager.openWindow( messageDialog, { |
|||
title: '欢迎来到索尼克百科!', |
|||
message: '索尼克百科 Sonicpedia 是刺猬索尼克中文百科全书,欢迎任何人在这里新建或者编辑 Wiki 内容!如果您不适应默认的简体中文,请在:子菜单中或者在您的索尼克百科账号 "参数设置" 中选择您偏好的的中文变体。Gotta Go Fast!\n注意: 本网站需要使用 Cookies 且仅用于身份验证! 使用本网站时必须遵守中国法律,严禁发布违反<a href="https://sonicpedia.org.cn/wiki/Sonicpedia:规定" target="_href">Sonicpedia:规定</a>的内容。', |
|||
verbose: true, |
|||
actions: [ |
|||
{ |
|||
action: 'accept', |
|||
label: '了解', |
|||
flags: 'primary' |
|||
} |
|||
] |
|||
}); |
|||
setCookie("SonicpediaAlertValue","0"); |
|||
} |
|||
}); |
|||
/* 调用 ImageMap 工具 */ |
/* 调用 ImageMap 工具 */ |
||
if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { |
if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { |
2022年4月25日 (一) 13:28的版本
/* 调用 ImageMap 工具 */
if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') {
mw.loader.load('//imagemapedit.toolforge.org/ime.js');
}
/*剧透按钮*/
var spofr = document.getElementById('spoiler'); //内容大框
var spo = document.getElementById('spoilercon'); //剧透内容
var spobut = document.getElementById('spoilerbut'); //剧透按钮
/*检测显示或隐藏状态,并交给按钮显示*/
if (spo.style.display == 'block') {
var sposta = 'block';
spobut.innerHTML = "隐藏"
} else {
var sposta = 'none';
spobut.innerHTML = "显示"
}
var spoheight = spo.clientHeight; //检测高度
var spostartclick //定义检测按钮是否在执行过程被重复按下
spobut.onclick = function() {
/*检测是否重复点击*/
if (spostartclick == true) {
console.log('用户重复点击按钮')
} else {
spostartclick = true; //禁止重复点击
/*隐藏或显示*/
if (sposta == 'block') {
spofr.style.overflow = 'hidden'
spofr.style.maxHeight = '21px'
spo.style.opacity = '0';
spobut.innerHTML = "显示"
setTimeout(
function() {
spo.style.display = 'none';
sposta = "none";
spostartclick = false //可以点击
}, 1000)
} else {
spo.style.display = 'block';
sposta = 'block';
spobut.innerHTML = "隐藏"
spofr.style.maxHeight = (spo.clientHeight + 37 + 'px');
spo.style.opacity = '100';
setTimeout(function() {
spostartclick = false; //可以点击
}, 1000)
}
}
}