MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第20行: | 第20行: | ||
}); | }); | ||
// | // 用户颜色、图标、状态、师徒、昵称、里程碑、公告、植物/僵尸筛选 主逻辑 | ||
$(function () { | $(function () { | ||
// ==================== 动态注入彩虹样式 ==================== | // ==================== 动态注入彩虹样式 ==================== | ||
| 第35行: | 第35行: | ||
// ==================== 配置区 ==================== | // ==================== 配置区 ==================== | ||
var mentorList = ['愤怒的郎朗', 'Yuyaabc', '虚位以待', '知更鸟头号粉丝', '凌玥']; | var mentorList = ['愤怒的郎朗', 'Yuyaabc', '虚位以待', '知更鸟头号粉丝', '凌玥']; | ||
var newbieEditThreshold = 25; | var newbieEditThreshold = 25; | ||
var milestoneThresholds = [10, 50, 100, 500, 1000, 2500, 5000, 10000, 20000, 50000]; | var milestoneThresholds = [10, 50, 100, 500, 1000, 2500, 5000, 10000, 20000, 50000]; | ||
// ==================== 辅助函数 ==================== | // ==================== 辅助函数 ==================== | ||
| 第50行: | 第50行: | ||
} | } | ||
function getLevelIcons(editcount) { | function getLevelIcons(editcount) { | ||
var totalStars = Math.floor(editcount / 100); | var totalStars = Math.floor(editcount / 100); | ||
if (totalStars === 0) return ''; | if (totalStars === 0) return ''; | ||
var crowns = Math.floor(totalStars / 125); | var crowns = Math.floor(totalStars / 125); | ||
var remaining = totalStars % 125; | var remaining = totalStars % 125; | ||
var suns = Math.floor(remaining / 25); | var suns = Math.floor(remaining / 25); | ||
remaining %= 25; | remaining %= 25; | ||
var moons = Math.floor(remaining / 5); | var moons = Math.floor(remaining / 5); | ||
var stars = remaining % 5; | var stars = remaining % 5; | ||
| 第84行: | 第83行: | ||
} | } | ||
function getTitleByEditcount(ec) { | function getTitleByEditcount(ec) { | ||
if (ec >= 10000) return '🐉 神话'; | if (ec >= 10000) return '🐉 神话'; | ||
| 第125行: | 第123行: | ||
}); | }); | ||
var batchSize = 50; | var batchSize = 50; | ||
var batches = []; | var batches = []; | ||
| 第164行: | 第161行: | ||
if (typeof ec !== 'undefined') { | if (typeof ec !== 'undefined') { | ||
updateLevelIcons($this, ec); | updateLevelIcons($this, ec); | ||
var isInsideCard = $this.closest('.citizen-menu_card-content, .citizen-userMenu').length > 0; | var isInsideCard = $this.closest('.citizen-menu_card-content, .citizen-userMenu').length > 0; | ||
if (!isInsideCard) { | if (!isInsideCard) { | ||
| 第181行: | 第177行: | ||
}); | }); | ||
$fresh.each(function () { | $fresh.each(function () { | ||
if (isUserLink(this)) { | if (isUserLink(this)) { | ||
| 第340行: | 第335行: | ||
css: { | css: { | ||
position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', | position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', | ||
background: 'rgba(0,0,0,0.5)', 'z-index': | background: 'rgba(0,0,0,0.5)', 'z-index': 99998, | ||
display: 'flex', 'align-items': 'center', 'justify-content': 'center' | display: 'flex', 'align-items': 'center', 'justify-content': 'center' | ||
} | } | ||
| 第523行: | 第518行: | ||
// ==================== 版本更新公告弹窗 ==================== | // ==================== 版本更新公告弹窗 ==================== | ||
function checkUpdateNotice() { | function checkUpdateNotice() { | ||
var $versionEl = $('.update-version'); | var $versionEl = $('.update-version'); | ||
if ($versionEl.length === 0) return; | if ($versionEl.length === 0) return; | ||
var currentVersion = $versionEl.text().trim(); | var currentVersion = $versionEl.text().trim(); | ||
if (!currentVersion) return; | if (!currentVersion) return; | ||
var dismissedVersion = localStorage.getItem('mw_update_dismissed'); | var dismissedVersion = localStorage.getItem('mw_update_dismissed'); | ||
if (dismissedVersion !== currentVersion) { | if (dismissedVersion !== currentVersion) { | ||
var $overlay = $('<div>', { | var $overlay = $('<div>', { | ||
css: { | css: { | ||
| 第553行: | 第544行: | ||
}); | }); | ||
// | // 公告内容写死在 JS 里,不再从页面抓取 | ||
var $content = $('. | var $content = $('<div>').css({'text-align':'left','font-size':'14px'}).html( | ||
'<div style="text-align:center;font-size:18px;font-weight:bold;margin-bottom:5px;">【植物大战僵尸杂交版0.21.1版本更新公告】</div>' + | |||
'<div style="text-align:center;font-size:12px;color:#888;margin-bottom:15px;">版本发布日期:2026年5月28号</div>' + | |||
'<a href="https://www.bilibili.com/opus/1205860786222661650" target="_blank">【杂交版0.21版本更新】</a><br><br>' + | |||
'电脑(Windows)版链接:<a href="https://pan.quark.cn/s/267f26cf135a" target="_blank">https://pan.quark.cn/s/267f26cf135a</a><br>' + | |||
'其他版本:<a href="https://pan.quark.cn/s/bda6d7134daf" target="_blank">https://pan.quark.cn/s/bda6d7134daf</a><br><br>' + | |||
'<span style="color:red;font-weight:bold;">此版本修复了0.21的100+bug</span>' | |||
); | |||
var $closeBtn = $('<button>', { | var $closeBtn = $('<button>', { | ||
text: '我知道了', | text: '我知道了', | ||
| 第566行: | 第563行: | ||
}, | }, | ||
click: function() { | click: function() { | ||
localStorage.setItem('mw_update_dismissed', currentVersion); | localStorage.setItem('mw_update_dismissed', currentVersion); | ||
$overlay.fadeOut(300, function() { $(this).remove(); }); | $overlay.fadeOut(300, function() { $(this).remove(); }); | ||
| 第576行: | 第572行: | ||
$('body').append($overlay); | $('body').append($overlay); | ||
$overlay.on('click', function(e) { | $overlay.on('click', function(e) { | ||
if ($(e.target).is($overlay)) { | if ($(e.target).is($overlay)) { | ||
| 第585行: | 第580行: | ||
} | } | ||
// | // 延迟执行,确保页面完全加载 | ||
checkUpdateNotice(); | setTimeout(function() { | ||
checkUpdateNotice(); | |||
}, 500); | |||
}); // 结束主 $(function () { ... }) | }); // 结束主 $(function () { ... }) | ||
2026年6月5日 (五) 12:29的版本
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
// 自动加载 MediaWiki:Footer 页面内容,并插入到每个页面底部
$(document).ready(function() {
const namespace = mw.config.get('wgNamespaceNumber');
const action = mw.config.get('wgAction');
if (namespace !== 0 || action !== 'view') {
return;
}
fetch("/api.php?action=parse&page=MediaWiki:Footer&format=json")
.then(res => res.json())
.then(data => {
if (data.parse && data.parse.text) {
const html = data.parse.text['*'];
$('#mw-content-text').append('<div class="global-footer">' + html + '</div>');
}
});
});
// 用户颜色、图标、状态、师徒、昵称、里程碑、公告、植物/僵尸筛选 主逻辑
$(function () {
// ==================== 动态注入彩虹样式 ====================
var rainbowStyle = document.createElement('style');
rainbowStyle.textContent =
'.rainbow-user {' +
'font-weight: bold;' +
'background: repeating-linear-gradient(90deg, red 0px, orange 10px, yellow 20px, green 30px, blue 40px, indigo 50px, violet 60px);' +
'-webkit-background-clip: text;' +
'-webkit-text-fill-color: transparent;' +
'background-clip: text;' +
'}';
document.head.appendChild(rainbowStyle);
// ==================== 配置区 ====================
var mentorList = ['愤怒的郎朗', 'Yuyaabc', '虚位以待', '知更鸟头号粉丝', '凌玥'];
var newbieEditThreshold = 25;
var milestoneThresholds = [10, 50, 100, 500, 1000, 2500, 5000, 10000, 20000, 50000];
// ==================== 辅助函数 ====================
function getUserName(link) {
var $span = $(link).find('span').first();
if ($span.length) return $span.text().trim();
return $(link).text().trim();
}
function isUserLink(link) {
return $(link).is('a.mw-userlink') || $(link).find('span').length > 0;
}
function getLevelIcons(editcount) {
var totalStars = Math.floor(editcount / 100);
if (totalStars === 0) return '';
var crowns = Math.floor(totalStars / 125);
var remaining = totalStars % 125;
var suns = Math.floor(remaining / 25);
remaining %= 25;
var moons = Math.floor(remaining / 5);
var stars = remaining % 5;
var icons = '';
if (crowns > 0) icons += '👑'.repeat(crowns);
if (suns > 0) icons += '☀️'.repeat(suns);
if (moons > 0) icons += '🌙'.repeat(moons);
if (stars > 0) icons += '⭐'.repeat(stars);
return icons;
}
function updateLevelIcons($link, editcount) {
var iconStr = getLevelIcons(editcount);
var $iconSpan = $link.next('.user-level-icons');
if (iconStr === '') {
$iconSpan.remove();
return;
}
if ($iconSpan.length === 0) {
$iconSpan = $('<span class="user-level-icons"></span>');
$link.after($iconSpan);
}
$iconSpan.text(iconStr);
}
function getTitleByEditcount(ec) {
if (ec >= 10000) return '🐉 神话';
if (ec >= 5000) return '👑 传奇';
if (ec >= 2500) return '🏆 大师';
if (ec >= 1000) return '💎 专家';
if (ec >= 500) return '🔥 资深';
if (ec >= 100) return '⭐ 活跃';
if (ec >= 50) return '🌳 入门';
if (ec >= 10) return '🌿 新手';
return '🌱 萌新';
}
function addTitleTag($link, editcount) {
if ($link.data('title-tag-added')) return;
$link.data('title-tag-added', true);
var title = getTitleByEditcount(editcount);
var $tag = $('<span class="user-title-tag">' + title + '</span>');
$link.after($tag);
}
// ==================== 核心:颜色 + 图标 + 状态 + 师徒 + 昵称 ====================
function colorizeAndStatus($links) {
if ($links.length === 0) return;
var $fresh = $links.filter(function () {
return !$(this).data('user-status-processed');
});
if ($fresh.length === 0) return;
var users = [];
$fresh.each(function () {
var name = getUserName(this);
if (name && users.indexOf(name) === -1) users.push(name);
});
if (users.length === 0) return;
$fresh.each(function () {
$(this).data('user-status-processed', true);
});
var batchSize = 50;
var batches = [];
for (var i = 0; i < users.length; i += batchSize) {
batches.push(users.slice(i, i + batchSize));
}
var processBatch = function (batch) {
var api = new mw.Api();
return api.get({
action: 'query',
list: 'users',
ususers: batch.join('|'),
usprop: 'editcount'
}).then(function (data) {
var classMap = {};
var editCountMap = {};
if (data.query && data.query.users) {
data.query.users.forEach(function (u) {
var ec = u.editcount || 0;
editCountMap[u.name] = ec;
if (ec >= 5000) classMap[u.name] = 'rainbow-user';
else if (ec >= 2500) classMap[u.name] = 'gold-user';
else if (ec >= 1000) classMap[u.name] = 'platinum-user';
else if (ec >= 500) classMap[u.name] = 'silver-user';
else if (ec >= 1) classMap[u.name] = 'bronze-user';
});
}
$fresh.each(function () {
var $this = $(this);
var name = getUserName(this);
var cls = classMap[name];
if (cls) {
$this.removeClass('bronze-user silver-user platinum-user gold-user rainbow-user');
$this.addClass(cls);
}
var ec = editCountMap[name];
if (typeof ec !== 'undefined') {
updateLevelIcons($this, ec);
var isInsideCard = $this.closest('.citizen-menu_card-content, .citizen-userMenu').length > 0;
if (!isInsideCard) {
addTitleTag($this, ec);
}
}
});
});
};
var colorPromise = $.Deferred().resolve();
batches.forEach(function (batch) {
colorPromise = colorPromise.then(function () {
return processBatch(batch);
});
});
$fresh.each(function () {
if (isUserLink(this)) {
var isInsideCard = $(this).closest('.citizen-menu_card-content, .citizen-userMenu').length > 0;
if (!isInsideCard) {
var username = getUserName(this);
addStatusDot($(this), username);
addMentorTag($(this), username);
}
}
});
}
// ==================== 状态圆点 ====================
function addStatusDot($link, username) {
if ($link.data('status-dot-added')) return;
$link.data('status-dot-added', true);
var $dot = $('<span class="user-status-dot status-offline" title="离线"></span>');
$link.after($dot);
var cacheKey = 'mw_user_status_' + mw.config.get('wgDBname') + '_' + username;
var cached = localStorage.getItem(cacheKey);
var now = Date.now();
if (cached) {
try {
var data = JSON.parse(cached);
if (now - data.timestamp < 5 * 60 * 1000) {
updateDotStyle($dot, data.lastEditTime);
return;
}
} catch (e) {}
}
var api = new mw.Api();
api.get({
action: 'query',
list: 'usercontribs',
ucuser: username,
uclimit: 1,
ucprop: 'timestamp'
}).then(function (data) {
var lastEditTime = null;
if (data.query && data.query.usercontribs && data.query.usercontribs.length > 0) {
lastEditTime = data.query.usercontribs[0].timestamp;
}
localStorage.setItem(cacheKey, JSON.stringify({
lastEditTime: lastEditTime,
timestamp: now
}));
updateDotStyle($dot, lastEditTime);
}).fail(function () {});
}
function updateDotStyle($dot, lastEditTime) {
if (!lastEditTime) {
$dot.attr('title', '离线');
$dot.removeClass('status-online status-away').addClass('status-offline');
return;
}
var last = new Date(lastEditTime).getTime();
var diffMinutes = (Date.now() - last) / 60000;
if (diffMinutes < 15) {
$dot.attr('title', '在线(15分钟内活跃)');
$dot.removeClass('status-offline status-away').addClass('status-online');
} else if (diffMinutes < 60) {
$dot.attr('title', '近期活跃(1小时内)');
$dot.removeClass('status-offline status-online').addClass('status-away');
} else {
$dot.attr('title', '离线');
$dot.removeClass('status-online status-away').addClass('status-offline');
}
}
// ==================== 师徒标签 ====================
function addMentorTag($link, username) {
if ($link.data('mentor-tag-added')) return;
if ($link.next('.user-tag').length) return;
var $tag;
if (mentorList.indexOf(username) !== -1) {
$link.data('mentor-tag-added', true);
$tag = $('<span class="user-tag user-tag-mentor">导师</span>');
$link.after($tag);
return;
}
if ($link.data('newbie-tag-checked')) return;
$link.data('newbie-tag-checked', true);
var cacheKey = 'mw_newbie_check_' + mw.config.get('wgDBname') + '_' + username;
var cached = localStorage.getItem(cacheKey);
var now = Date.now();
if (cached) {
try {
var data = JSON.parse(cached);
if (now - data.timestamp < 60 * 60 * 1000) {
if (data.editcount <= newbieEditThreshold) {
$tag = $('<span class="user-tag user-tag-newbie">新手</span>');
$link.after($tag);
}
return;
}
} catch (e) {}
}
var api = new mw.Api();
api.get({
action: 'query',
list: 'users',
ususers: username,
usprop: 'editcount'
}).then(function (data) {
var editcount = 0;
if (data.query && data.query.users && data.query.users.length > 0) {
editcount = data.query.users[0].editcount || 0;
}
localStorage.setItem(cacheKey, JSON.stringify({
editcount: editcount,
timestamp: now
}));
if (editcount <= newbieEditThreshold) {
if ($link.next('.user-tag-newbie').length === 0) {
$tag = $('<span class="user-tag user-tag-newbie">新手</span>');
$link.after($tag);
}
}
}).fail(function () {});
}
// ==================== 编辑里程碑弹窗 ====================
var currentUser = mw.config.get('wgUserName');
if (currentUser) {
var api = new mw.Api();
api.get({
action: 'query',
list: 'users',
ususers: currentUser,
usprop: 'editcount'
}).then(function(data) {
var editcount = 0;
if (data.query && data.query.users && data.query.users.length > 0) {
editcount = data.query.users[0].editcount || 0;
}
var achievedMilestone = null;
milestoneThresholds.forEach(function(m) {
if (editcount >= m) achievedMilestone = m;
});
if (achievedMilestone) {
var storageKey = 'mw_milestone_shown_' + currentUser + '_' + achievedMilestone;
if (!localStorage.getItem(storageKey)) {
localStorage.setItem(storageKey, '1');
var $overlay = $('<div>', {
css: {
position: 'fixed', top: 0, left: 0, width: '100%', height: '100%',
background: 'rgba(0,0,0,0.5)', 'z-index': 99998,
display: 'flex', 'align-items': 'center', 'justify-content': 'center'
}
});
var $box = $('<div>', {
css: {
background: '#fff', 'border-radius': '12px', padding: '30px 40px',
'text-align': 'center', 'box-shadow': '0 4px 20px rgba(0,0,0,0.3)',
'max-width': '400px', width: '80%', position: 'relative'
}
});
var $title = $('<h2>', {
text: '🎉 恭喜!',
css: { 'margin-bottom': '15px', 'font-size': '24px', color: '#333' }
});
var $msg = $('<p>', {
text: '你已达到 ' + achievedMilestone + ' 次编辑!',
css: { 'font-size': '18px', 'margin-bottom': '25px', color: '#555' }
});
var $btn = $('<button>', {
text: '太棒了!',
css: {
background: '#4CAF50', color: '#fff', border: 'none',
padding: '10px 30px', 'border-radius': '8px', 'font-size': '16px', cursor: 'pointer'
},
click: function() {
$overlay.fadeOut(300, function() { $(this).remove(); });
}
});
$box.append($title, $msg, $btn);
$overlay.append($box);
$('body').append($overlay);
}
}
}).fail(function() {});
}
// ==================== 用户链接处理器启动 ====================
var linkSelector = 'a.mw-userlink, .citizen-menu_card-content a, .citizen-userMenu a';
colorizeAndStatus($(linkSelector));
var observer = new MutationObserver(function () {
colorizeAndStatus($(linkSelector));
});
observer.observe(document.body, {
childList: true,
subtree: true
});
setInterval(function () {
colorizeAndStatus($(linkSelector));
}, 3000);
// ==================== 植物卡片筛选 ====================
if ($('#pf-name').length) {
var $cards = $('.pvzhe-card');
var $name = $('#pf-name');
var $sunMax = $('#pf-sun-max');
var $cdMax = $('#pf-cd-max');
var $type = $('#pf-type');
var $reset = $('#pf-reset');
function filterPlants() {
var name = $name.val().toLowerCase();
var sunRaw = $sunMax.val().trim();
var cdRaw = $cdMax.val().trim();
var sunTarget = sunRaw !== '' ? parseFloat(sunRaw) : null;
var cdTarget = cdRaw !== '' ? parseFloat(cdRaw) : null;
var type = $type.val();
$cards.each(function () {
var $card = $(this);
var n = $card.find('.pvzhe-card-name').text().toLowerCase();
var sun = parseFloat($card.data('sun')) || 0;
var cd = parseFloat($card.data('cooldown')) || 0;
var t = ($card.data('type') || '').toString();
var show = true;
if (name && n.indexOf(name) === -1) show = false;
if (sunTarget !== null && sun !== sunTarget) show = false;
if (cdTarget !== null && cd !== cdTarget) show = false;
if (type) {
var cardTypes = t.split(',').map(function (s) { return s.trim(); });
if (cardTypes.indexOf(type) === -1) show = false;
}
$card.toggleClass('hidden-card', !show);
});
}
$name.on('input', filterPlants);
$sunMax.on('input keyup', filterPlants);
$cdMax.on('input keyup', filterPlants);
$type.on('change', filterPlants);
$reset.on('click', function () {
$name.val('');
$sunMax.val('');
$cdMax.val('');
$type.val('');
filterPlants();
});
}
// ==================== 僵尸卡片筛选 ====================
function getArmorArray(healthStr) {
if (!healthStr || healthStr.indexOf('+') === -1) return [];
var armorPart = healthStr.split('+')[0].trim();
return armorPart.split(',').map(function(s) { return s.trim(); });
}
function extractHealth(healthStr) {
var matches = healthStr.match(/\d+/g);
if (matches && matches.length > 0) {
return parseFloat(matches[matches.length - 1]) || 0;
}
return 0;
}
if ($('#zf-name').length) {
var $zcards = $('.pvzhe-card');
var $zname = $('#zf-name');
var $healthMin = $('#zf-health-min');
var $armor = $('#zf-armor');
var $speed = $('#zf-speed');
var $ztype = $('#zf-type');
var $zreset = $('#zf-reset');
function filterZombies() {
var name = $zname.val().toLowerCase();
var healthRaw = $healthMin.val().trim();
var healthTarget = healthRaw !== '' ? parseFloat(healthRaw) : null;
var armor = $armor.val();
var speed = $speed.val();
var type = $ztype.val();
$zcards.each(function () {
var $card = $(this);
var n = $card.find('.pvzhe-card-name').text().toLowerCase();
var t = ($card.data('type') || '').toString();
var s = ($card.data('speed') || '').toString();
var healthStr = ($card.data('health') || '').toString();
var health = extractHealth(healthStr);
var armors = getArmorArray(healthStr);
var show = true;
if (name && n.indexOf(name) === -1) show = false;
if (healthTarget !== null && health !== healthTarget) show = false;
if (armor === 'none') {
if (armors.length > 0) show = false;
} else if (armor) {
if (armors.indexOf(armor) === -1) show = false;
}
if (speed) {
var cardSpeeds = s.split(',').map(function (v) { return v.trim(); });
if (cardSpeeds.indexOf(speed) === -1) show = false;
}
if (type) {
var cardTypes = t.split(',').map(function (v) { return v.trim(); });
if (cardTypes.indexOf(type) === -1) show = false;
}
$card.toggleClass('hidden-card', !show);
});
}
$zname.on('input', filterZombies);
$healthMin.on('input keyup', filterZombies);
$armor.on('change', filterZombies);
$speed.on('change', filterZombies);
$ztype.on('change', filterZombies);
$zreset.on('click', function () {
$zname.val('');
$healthMin.val('');
$armor.val('');
$speed.val('');
$ztype.val('');
filterZombies();
});
}
// ==================== 版本更新公告弹窗 ====================
function checkUpdateNotice() {
var $versionEl = $('.update-version');
if ($versionEl.length === 0) return;
var currentVersion = $versionEl.text().trim();
if (!currentVersion) return;
var dismissedVersion = localStorage.getItem('mw_update_dismissed');
if (dismissedVersion !== currentVersion) {
var $overlay = $('<div>', {
css: {
position: 'fixed', top: 0, left: 0, width: '100%', height: '100%',
background: 'rgba(0,0,0,0.6)', 'z-index': 99999,
display: 'flex', 'align-items': 'center', 'justify-content': 'center'
}
});
var $box = $('<div>', {
css: {
background: '#fff', 'border-radius': '12px', padding: '30px',
'max-width': '500px', width: '85%', 'max-height': '80vh',
'overflow-y': 'auto', 'box-shadow': '0 8px 30px rgba(0,0,0,0.4)',
position: 'relative'
}
});
// 公告内容写死在 JS 里,不再从页面抓取
var $content = $('<div>').css({'text-align':'left','font-size':'14px'}).html(
'<div style="text-align:center;font-size:18px;font-weight:bold;margin-bottom:5px;">【植物大战僵尸杂交版0.21.1版本更新公告】</div>' +
'<div style="text-align:center;font-size:12px;color:#888;margin-bottom:15px;">版本发布日期:2026年5月28号</div>' +
'<a href="https://www.bilibili.com/opus/1205860786222661650" target="_blank">【杂交版0.21版本更新】</a><br><br>' +
'电脑(Windows)版链接:<a href="https://pan.quark.cn/s/267f26cf135a" target="_blank">https://pan.quark.cn/s/267f26cf135a</a><br>' +
'其他版本:<a href="https://pan.quark.cn/s/bda6d7134daf" target="_blank">https://pan.quark.cn/s/bda6d7134daf</a><br><br>' +
'<span style="color:red;font-weight:bold;">此版本修复了0.21的100+bug</span>'
);
var $closeBtn = $('<button>', {
text: '我知道了',
css: {
display: 'block', margin: '20px auto 0',
background: '#4CAF50', color: '#fff', border: 'none',
padding: '10px 30px', 'border-radius': '8px',
'font-size': '16px', cursor: 'pointer'
},
click: function() {
localStorage.setItem('mw_update_dismissed', currentVersion);
$overlay.fadeOut(300, function() { $(this).remove(); });
}
});
$box.append($content, $closeBtn);
$overlay.append($box);
$('body').append($overlay);
$overlay.on('click', function(e) {
if ($(e.target).is($overlay)) {
$overlay.fadeOut(300, function() { $(this).remove(); });
}
});
}
}
// 延迟执行,确保页面完全加载
setTimeout(function() {
checkUpdateNotice();
}, 500);
}); // 结束主 $(function () { ... })