|
|
| 第356行: |
第356行: |
| } | | } |
| })(); | | })(); |
| function r18Warning() {
| |
| var content = $('<div id="x18"><div id="x18Context"><div id="x18Title"><div id="x18Icon"></div></div><div class="x18Button"></div></div></div><div class="x18-page-warning" style="position:fixed;top: 0px;left: 0px;z-index:2"><a href="/Mainpage" title="点此返回主页"><img alt="点此返回主页" src="https://img.moegirl.org/common/d/d3/%E6%9C%AC%E6%96%87%E4%B8%8D%E9%80%82%E5%90%88%E6%9C%AA%E6%88%90%E5%B9%B4%E4%BA%BA%E6%B5%8F%E8%A7%88.png" width="227" height="83"></a></div>');
| |
| if (window.localStorage.getItem('x18') !== 1) { //如果没有x18记录
| |
| $('body').css('overflow', 'hidden'); //禁止滚屏
| |
| $('#mw-content-text').css({
| |
| 'opacity': 0,
| |
| 'transition': 'opacity 0.37s linear'
| |
| }); //禁止偷看并加点动画
| |
| content.prependTo('body').find('.x18Button').append('<div id="x18Yes">是</div><div id="x18No" class="x18Button">否</div>')
| |
| .end().find('#x18Title').append('你是否已年满十八岁?')
| |
| .end().delay(400).queue(function() {
| |
| $(this).css({
| |
| 'opacity': 1,
| |
| 'transition': 'opacity 0.37s linear'
| |
| }); //显示警告信息并加点动画
| |
| $(this).dequeue();
| |
| });
| |
| $('#x18Yes').bind('click', function() {
| |
| window.localStorage.setItem('x18', true); //记录x18
| |
| $('#mw-content-text').css('opacity', 1).delay(400).queue(function() {
| |
| $(this).removeAttr('style'); //显示内容
| |
| $(this).dequeue();
| |
| });
| |
| $("#x18").css('opacity', 0).delay(400).queue(function() {
| |
| $('body').removeAttr('style'); //允许滚屏
| |
| $(this).remove(); //移除警告信息
| |
| $(this).dequeue();
| |
| });
| |
| });
| |
| $('#x18No').bind('click', function() {
| |
| window.location.replace(window.location.origin + '/' + mw.config.get('wgMainPageTitle')); //不给你看
| |
| });
| |
| } else $("#x18").remove(); //如果有x18记录
| |
| $('.x18-page-warning').appendTo('.mw-panel');
| |
| }
| |
| $(function() {
| |
| if (mw.config.get('wgMainPageTitle') !== mw.config.get('wgPageName') && mw.config.get('wgNamespaceNumber') === 0) r18Warning();
| |
| })();
| |
| })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 | | })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 |
| // </nowiki> | | // </nowiki> |