打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

微件:沙盒:修订间差异

来自NMWiki
 
(未显示同一用户的6个中间版本)
第1行: 第1行:
<includeonly>
<includeonly>
<script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
$(function() {
$(function() {
     if (document.cookie.includes('accept_time=True')) {
     if (document.cookie.includes('age_rank_accept=True')) {
         return;
         return;
     }
     }
     mw.loader.using('oojs-ui').then(function() {
     mw.loader.using('oojs-ui').then(function() {
        var server = mw.config.get('wgServer');
         const dialog = new OO.ui.MessageDialog();
         const dialog = new OO.ui.MessageDialog();
         const windowManager = new OO.ui.WindowManager();
         const windowManager = new OO.ui.WindowManager();
第12行: 第12行:
         windowManager.addWindows([dialog]);
         windowManager.addWindows([dialog]);
         const message = $('<div>')
         const message = $('<div>')
             .append('警告,本页面含有<!--{$agerank|escape:'html'}-->内容。');
             .append('警告,本页面含有R15内容。');
         windowManager.openWindow(dialog, {
         windowManager.openWindow(dialog, {
             title: '年龄分级警告',
             title: '年龄分级警告',
第18行: 第18行:
             actions: [{
             actions: [{
                 action: 'accept',
                 action: 'accept',
                 label: '我不在意且1天内不再提示',
                 label: '我不在意任何年龄分级且 1 天内不再提示',
                flags: 'primary'
 
             }, {
             }, {
                 action: 'return',
                 action: 'return',
                 label: '返回主页',
                 label: '返回上一页',
             }]
             }]
         }).closed.then(function(data) {
         }).closed.then(function(data) {
             if (data && data.action === 'accept') {
             if (data.action === 'accept') {
                 const date = new Date();
                 const date = new Date();
                 date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
                 date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
                 const expires = "expires=" + date.toUTCString();
                 const expires = "expires=" + date.toUTCString();
                 document.cookie = "accept_time=True;" + expires + ";path=/";
                 document.cookie = "age_rank_accept=True;" + expires + ";path=/";


             } else if (data && data.action === 'return') {
             } else if (data.action === 'return') {
                 window.location.href = server;
                 history.back();
             }
             }
         });
         });

2026年3月24日 (二) 13:39的最新版本