|
|
| (未显示3个用户的24个中间版本) |
| 第87行: |
第87行: |
| $(".mw-mmv-image").off("click")[0].addEventListener("click", function(e) { | | $(".mw-mmv-image").off("click")[0].addEventListener("click", function(e) { |
| if ($(e.target).is("img")) { | | if ($(e.target).is("img")) { |
| window.open($(e.target).attr("src").replace(/(www\.hmoegirl\.com\/common\/)thumb\/([a-z\d]+\/[a-z\d]+\/)([^/]+)\/\d+px-\3/i, "$1$2$3"), "_blank").focus(); | | window.open($(e.target).attr("src").replace(/(www\.hmoegirl\.info\/common\/)thumb\/([a-z\d]+\/[a-z\d]+\/)([^/]+)\/\d+px-\3/i, "$1$2$3"), "_blank").focus(); |
| e.preventDefault(); | | e.preventDefault(); |
| e.stopPropagation(); | | e.stopPropagation(); |
| 第143行: |
第143行: |
| //重复文件列表函数 | | //重复文件列表函数 |
| function duplicatedFileList() { | | function duplicatedFileList() { |
| if (window.location.href.indexOf("title") === -1) { window.location.replace("http://www.hmoegirl.com/index.php?title=Special:ListDuplicatedFiles&limit=500&offset=0"); } | | if (window.location.href.indexOf("title") === -1) { window.location.replace("http://www.hmoegirl.info/index.php?title=Special:ListDuplicatedFiles&limit=500&offset=0"); } |
| $("#mw-content-text .mw-spcontent ol").attr("id", | | $("#mw-content-text .mw-spcontent ol").attr("id", |
| "picOl"); | | "picOl"); |
| 第162行: |
第162行: |
| "[[分类:即将删除的页面]]", | | "[[分类:即将删除的页面]]", |
| "[[category:即将删除的页面]]", | | "[[category:即将删除的页面]]", |
| "全家暴",
| |
| "开发票", | | "开发票", |
| "男科",
| |
| "老虎机",
| |
| "傻逼",
| |
| "弱智",
| |
| "智障",
| |
| "支那", | | "支那", |
| "zhina", | | "zhina", |
| 第285行: |
第279行: |
| container.append("您虽然无权编辑本页面,但您可以点击右侧按钮在本页的讨论页提出编辑请求,让可以编辑的人代为编辑:"); | | container.append("您虽然无权编辑本页面,但您可以点击右侧按钮在本页的讨论页提出编辑请求,让可以编辑的人代为编辑:"); |
| $("<span/>").addClass("newComment").text("提出编辑请求").on("click", function() { | | $("<span/>").addClass("newComment").text("提出编辑请求").on("click", function() { |
| window.open("https://www.hmoegirl.com/index.php?action=edit&preload=Template:编辑请求/comment&preloadtitle=编辑请求 - " + mw.config.get("wgUserName") + "§ion=new&title=" + talkpage, "_blank"); | | window.open("https://www.hmoegirl.info/index.php?action=edit&preload=Template:编辑请求/comment&preloadtitle=编辑请求 - " + mw.config.get("wgUserName") + "§ion=new&title=" + talkpage, "_blank"); |
| }).appendTo(container); | | }).appendTo(container); |
| $("#mw-content-text").children(".wikiEditor-ui:first, textarea[readonly]:first").before("<hr>").before(container); | | $("#mw-content-text").children(".wikiEditor-ui:first, textarea[readonly]:first").before("<hr>").before(container); |
| 第337行: |
第331行: |
| }); | | }); |
| }, 200); | | }, 200); |
| /* 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";
| |
| $(function () {
| |
| var defaultStyle = {
| |
| purple: {
| |
| labelColor: " ", //anti check
| |
| labelBackgroundColor: "#9070c0",
| |
| labelBorderColor: "#b090e0 #7050a0 #9070c0 #b090e0",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBorderColor: "#9070c0",
| |
| textBackgroundColor: "#f0edf5",
| |
| textPadding: "1em",
| |
| },
| |
| green: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#75c045",
| |
| labelBorderColor: "#90d060 #60b030 #75c045 #90d060",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBorderColor: "#75c045 #60b030 #60b030 #75c045",
| |
| textBackgroundColor: "#f5fffa",
| |
| textPadding: "1em",
| |
| },
| |
| red: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#FF0000",
| |
| labelBorderColor: "#FF8888 #CC0000 #FF0000 #FF8888",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBorderColor: "#FF0000 #CC0000 #CC0000 #FF0000",
| |
| textBackgroundColor: "#fffafa",
| |
| textPadding: "1em",
| |
| },
| |
| blue: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#5b8dd6",
| |
| labelBorderColor: "#88abde #3379de #5b8dd6 #88abde",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBackgroundColor: "#f0f8ff",
| |
| textBorderColor: "#5b8dd6 #3379de #3379de #5b8dd6",
| |
| textPadding: "1em",
| |
| },
| |
| yellow: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#ffe147",
| |
| labelBorderColor: "#ffe977 #ffd813 #ffe147 #ffe977",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBackgroundColor: "#fffce8",
| |
| textBorderColor: "#ffe147 #ffd813 #ffd813 #ffe147",
| |
| textPadding: "1em",
| |
| },
| |
| orange: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#ff9d42",
| |
| labelBorderColor: "#ffac5d #ff820e #ff9d42 #ffac5d",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBackgroundColor: "#ffeedd",
| |
| textBorderColor: "#ff9d42 #ff820e #ff820e #ff9d42",
| |
| textPadding: "1em",
| |
| },
| |
| black: {
| |
| labelColor: " ",
| |
| labelBackgroundColor: "#7f7f7f",
| |
| labelBorderColor: "#999999 #4c4c4c #7f7f7f #999999",
| |
| labelPadding: ".2em .3em .2em .3em",
| |
| textBackgroundColor: "#e5e5e5",
| |
| textBorderColor: "#7f7f7f #4c4c4c #4c4c4c #7f7f7f",
| |
| textPadding: "1em",
| |
| },
| |
| };
| |
| var sides = {
| |
| top: {
| |
| className: "tabLabelTop",
| |
| labelColorSide: "top",
| |
| labelBorderSide: ["left", "right"],
| |
| labelColorSideReverse: "bottom",
| |
| dividerSizeType: "height"
| |
| },
| |
| bottom: {
| |
| className: "tabLabelBottom",
| |
| labelColorSide: "bottom",
| |
| labelBorderSide: ["left", "right"],
| |
| labelColorSideReverse: "top",
| |
| dividerSizeType: "height"
| |
| },
| |
| left: {
| |
| className: "tabLabelLeft",
| |
| labelColorSide: "left",
| |
| labelBorderSide: ["top", "bottom"],
| |
| labelColorSideReverse: "right",
| |
| dividerSizeType: "width"
| |
| },
| |
| right: {
| |
| className: "tabLabelRight",
| |
| labelColorSide: "right",
| |
| labelBorderSide: ["top", "bottom"],
| |
| labelColorSideReverse: "left",
| |
| dividerSizeType: "width"
| |
| }
| |
| };
| |
| var truthy = ["1", "on", "true", "yes"];
| |
| $("body").addClass("tab");
| |
| function getOwnPropertyNamesLength(obj) {
| |
| return Object.getOwnPropertyNames(obj).length;
| |
| }
| |
| function toLowerFirstCase(str) {
| |
| return str.substring(0, 1).toLowerCase() + str.substring(1);
| |
| }
| |
| function toUpperFirstCase(str) {
| |
| return str.substring(0, 1).toUpperCase() + str.substring(1);
| |
| }
| |
| mw.hook("wikipage.content").add(function () {
| |
| $(".Tabs").each(function () {
| |
| if ($(this).children(".TabLabel")[0]) {
| |
| return true;
| |
| }
| |
| var self = $(this),
| |
| classList = Array.from(this.classList).filter(function (n) {
| |
| return n in defaultStyle;
| |
| }),
| |
| data = $.extend({
| |
| labelPadding: "2px",
| |
| labelBorderColor: "#aaa",
| |
| labelColor: "green",
| |
| labelBackgroundColor: $("#content").css("background-color"),
| |
| textPadding: "20px 30px",
| |
| textBorderColor: "#aaa",
| |
| textBackgroundColor: "white",
| |
| defaultTab: 1,
| |
| }, classList[0] ? defaultStyle[classList[0]] || {} : {}, this.dataset || {}),
| |
| tabLabel = self.append('<div class="TabLabel"></div>').children(".TabLabel"),
| |
| tabDivider = self.append('<div class="TabDivider"></div>').children(".TabDivider"),
| |
| tabContent = self.append('<div class="TabContent"></div>').children(".TabContent"),
| |
| labelPadding = data.labelPadding,
| |
| labelColor = data.labelColor,
| |
| styleSheet = {
| |
| label: {},
| |
| text: {},
| |
| },
| |
| labelSide = data.labelSide in sides ? data.labelSide : "top",
| |
| side = sides[labelSide],
| |
| labelColorSideReverse = truthy.includes(data.labelColorSideReverse),
| |
| dividerSize = parseInt(data.dividerSize),
| |
| defaultTab = parseInt(data.defaultTab);
| |
| if(labelSide==="top"){
| |
| tabLabel.after(tabDivider);
| |
| tabDivider.after(tabContent);
| |
| }else if(labelSide==="bottom"){
| |
| tabContent.after(tabDivider);
| |
| tabDivider.after(tabLabel);
| |
| }
| |
| if (!isNaN(dividerSize) && dividerSize > 0) {
| |
| self.find(".TabDivider")[side.dividerSizeType](dividerSize);
| |
| }
| |
| var labelColorName = toUpperFirstCase(labelColorSideReverse ? side.labelColorSideReverse : side.labelColorSide);
| |
| self.addClass(side.className);
| |
| if (labelColorSideReverse) {
| |
| self.addClass("reverse");
| |
| }
| |
| self.children(".Tab").each(function () {
| |
| if ($(this).children(".TabLabelText").text().replace(/\s/g, "").length || $(this).children(".TabLabelText").children().length) {
| |
| $(this).children(".TabLabelText").appendTo(tabLabel);
| |
| $(this).children(".TabContentText").appendTo(self.children(".TabContent"));
| |
| }
| |
| $(this).remove();
| |
| });
| |
| if (isNaN(defaultTab) || defaultTab <= 0 || defaultTab > tabLabel.children(".TabLabelText").length) {
| |
| defaultTab = 1;
| |
| }
| |
| tabLabel.children(".TabLabelText").on("click", function () {
| |
| var label = $(this);
| |
| label.addClass("selected").siblings().removeClass("selected").css({
| |
| "border-color": "transparent",
| |
| "background-color": "inherit",
| |
| });
| |
| tabContent.children(".TabContentText").eq(tabLabel.children(".TabLabelText").index(label)).addClass("selected").siblings().removeClass("selected").removeAttr("style");
| |
| if (getOwnPropertyNamesLength(styleSheet.label) > 0) {
| |
| label.css(styleSheet.label);
| |
| }
| |
| }).eq(defaultTab - 1).click();
| |
| if (labelPadding) {
| |
| tabLabel.children(".TabLabelText").css("padding", labelPadding);
| |
| }
| |
| ["labelBorderColor", "labelBackgroundColor", "textPadding", "textBorderColor", "textBackgroundColor"].forEach(function (n) {
| |
| var target = /^label/.test(n) ? "label" : "text",
| |
| key = toLowerFirstCase(n.replace(target, ""));
| |
| styleSheet[target][key] = data[n];
| |
| });
| |
| if (labelColor) {
| |
| styleSheet.label["border" + labelColorName + "Color"] = labelColor;
| |
| } else if (styleSheet.label.borderColor) {
| |
| styleSheet.label["border" + labelColorName + "Color"] = "green";
| |
| }
| |
| tabLabel.find(".selected").click();
| |
| if (getOwnPropertyNamesLength(styleSheet.text) > 0) {
| |
| tabContent.css(styleSheet.text);
| |
| }
| |
| if (data.autoWidth === "yes") {
| |
| self.addClass("AutoWidth");
| |
| }
| |
| if (data.float === "left") {
| |
| self.addClass("FloatLeft");
| |
| }
| |
| if (data.float === "right") {
| |
| self.addClass("FloatRight");
| |
| }
| |
|
| |
| });
| |
| });
| |
| });
| |
| //图片地址
| |
| mw.loader.using("mediawiki.Uri").then(function () {
| |
| setInterval(function () {
| |
| $(document.querySelectorAll('img[src*="//img.moegirl.org/"]:not(.org-changed), img[src*="//commons.moegirl.org/"]:not(.org-changed)')).each(function (_, ele) {
| |
| try {
| |
| var url = new mw.Uri(ele.src);
| |
| if (["img.moegirl.org", "commons.moegirl.org"].includes(url.host)) {
| |
| url.host += ".cn";
| |
| ele.src = url;
| |
| }
| |
| ele.classList.add("org-changed");
| |
| } catch (e) { }
| |
| });
| |
| }, 200);
| |
| });
| |
| //修正hash跳转错误 | | //修正hash跳转错误 |
| if ($(".mw-collapsible")[0]) { | | if ($(".mw-collapsible")[0]) { |
| 第575行: |
第340行: |
| }); | | }); |
| } | | } |
| $(window).on("load", function () {
| |
| //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); //立即执行匿名函数并传递原始变量以防止冲突 | | })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 |
| // </nowiki> | | // </nowiki> |