|
|
| (未显示4个用户的49个中间版本) |
| 第1行: |
第1行: |
| | /* 放置于这里的JavaScript将同时应用于桌面端和移动端 */ |
| /* Tabs */ | | /* Tabs */ |
| /* eslint-disable no-var */
| |
| /* eslint-disable no-magic-numbers */
| |
| /* global OO, mediaWiki, jQuery */
| |
| /* eslint-disable comma-dangle */
| |
| /* eslint-disable prefer-arrow-callback */
| |
| /* eslint-disable no-var */
| |
| "use strict"; | | "use strict"; |
| $(function () { | | $(function () { |
| 第213行: |
第208行: |
| }); | | }); |
| }); | | }); |
| //图片地址
| | //图片地址 |
| mw.loader.using("mediawiki.Uri").then(function () {
| | mw.loader.using("mediawiki.Uri").then(function () { |
| setInterval(function () {
| | setInterval(function () { |
| $(document.querySelectorAll('img[src*="//img.moegirl.org/"]:not(.org-changed), img[src*="//commons.moegirl.org/"]:not(.org-changed)')).each(function (_, ele) {
| | $(document.querySelectorAll('img[src*="//img.moegirl.org/"]:not(.org-changed), img[src*="//commons.moegirl.org/"]:not(.org-changed)')).each(function (_, ele) { |
| try {
| | try { |
| var url = new mw.Uri(ele.src);
| | var url = new mw.Uri(ele.src); |
| if (["img.moegirl.org", "commons.moegirl.org"].includes(url.host)) {
| | if (["img.moegirl.org", "commons.moegirl.org"].includes(url.host)) { |
| url.host += ".cn";
| | url.host = "hmoegirl.info"; |
| ele.src = url;
| | ele.src = url; |
| }
| | } |
| ele.classList.add("org-changed");
| | ele.classList.add("org-changed"); |
| } catch (e) { }
| | } catch (e) { } |
| });
| |
| }, 200);
| |
| }); | | }); |
| $(window).on("load", function () {
| | }, 200); |
| //R18警告
| | }); |
| function r18Warning() { | |
| var content = $('<div id="x18"><div id="x18Context"><div id="x18Title"><div id="x18Icon"></div></div><div class="x18Button"></div></div></div>');
| |
| if (!window.localStorage.getItem('x18')) { //如果没有x18记录
| |
| $('body').css('overflow', 'hidden'); //禁止滚屏
| |
| $('#mw-content-text').css({
| |
| 'opacity': 0
| |
| });
| |
| //禁止偷看
| |
| 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
| |
| }); //显示警告信息
| |
| $(this).dequeue();
| |
| });
| |
| $('#x18Yes').on('click', function() {
| |
| window.localStorage.setItem('x18', true); //记录x18
| |
| $('#mw-content-text').css('opacity', 1).removeAttr('style'); //显示内容
| |
| $("#x18").remove(); //移除警告信息
| |
| $('body').removeAttr('style'); //允许滚屏
| |
| });
| |
| $('#x18No').on('click', function() {
| |
| window.location.replace(window.location.origin + '/' + mw.config.get('wgMainPageTitle')); //不给你看
| |
| });
| |
| } else $("#x18").remove(); //如果有x18记录
| |
| }
| |
| $(function() {
| |
| r18Warning();
| |
| });
| |
| });
| |
| })();
| |
| })(jQuery, mediaWiki);
| |