|
查看“︁MediaWiki:Gadget-darkmode.js”︁的源代码
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您可以查看和复制此页面的源代码。
/**
* Toggle for dark mode
*
* @author [[User:Jayden]]
* @see Based on https://runescape.wiki/w/MediaWiki:Gadget-skinTogglesNew.js
*/
;(function ($, mw) {
var DARK_COOKIE = 'darkmode',
THEME_COOKIE = 'theme',
isUsingDarkmode = $.cookie(THEME_COOKIE) === 'dark' || ($.cookie(THEME_COOKIE) == null && $.cookie(DARK_COOKIE) === 'true'),
isMobile = mw.config.get('wgMFMode') !== null,
portletLink;
var conv = require('ext.gadget.HanAssist').conv;
$(function () {
$.cookie(THEME_COOKIE, isUsingDarkmode ? 'dark' : 'light', { expires: 365, path: '/' });
portletLink = mw.util.addPortletLink(
( isMobile ? 'p-navigation' : 'p-personal' ),
'',
( isMobile ? conv({ hans: '切换深色模式', hant: '切換深色模式' }) : '' ),
000
1:0