您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Helper Script to create Custom pages on Furaffinitiy
当前为
此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/476762/1260198/Furaffinity-Custom-Pages.js
- // ==UserScript==
- // @name Furaffinity-Custom-Pages
- // @namespace Violentmonkey Scripts
- // @grant none
- // @version 1.0.2
- // @author Midori Dragon
- // @description Helper Script to create Custom pages on Furaffinitiy
- // @icon https://www.furaffinity.net/themes/beta/img/banners/fa_logo.png?v2
- // @homepageURL https://greasyfork.org/de/scripts/476762-furaffinity-custom-pages
- // @supportURL https://greasyfork.org/de/scripts/476762-furaffinity-custom-pages/feedback
- // @license MIT
- // ==/UserScript==
- // jshint esversion: 8
- (() => {
- const customPagesAll = [];
- class CustomPage extends EventTarget {
- constructor(parameterName, pageUrl) {
- super();
- this.parameterName = parameterName;
- this.url = pageUrl;
- customPagesAll.push(this);
- }
- static checkCustomPagesOpened() {
- for (const customPage of customPagesAll) {
- customPage.checkPageOpened();
- }
- }
- pageOpened(parameterValue, openedPage) {
- const customData = new CustomData();
- customData.parameterValue = parameterValue;
- customData.document = openedPage;
- const event = new CustomEvent("pageOpened", { detail: customData });
- this.dispatchEvent(event);
- }
- isPageOpened() {
- const url = window.location.toString();
- if (this.pageUrl && !url.includes(this.pageUrl)) return false;
- const parameter = extractParameterFromURL(url, this.parameterName);
- if (parameter && parameter.key == this.parameterName) return true;
- return false;
- }
- getPageParameterValue() {
- const url = window.location.toString();
- const parameter = extractParameterFromURL(url, this.parameterName);
- if (parameter) return parameter.value;
- }
- checkPageOpened() {
- if (this.isPageOpened()) this.pageOpened(this.getPageParameterValue(), document);
- }
- }
- class CustomData {
- constructor() {
- this.parameterValue;
- this.document;
- }
- removeDocumentSiteContent() {
- const siteContent = this.document.getElementById("site-content");
- if (siteContent) siteContent.remove();
- return siteContent;
- }
- }
- function extractParameterFromURL(url, parameterName) {
- if (!url || !parameterName) return null;
- const parts = url.split("?");
- if (parts.length > 1) {
- const params = parts[1].split("&");
- for (const param of params) {
- const [key, value] = param.split("=");
- if (key === parameterName) return { key, value: decodeURIComponent(value) };
- }
- }
- return null;
- }
- window.FACustomPage = CustomPage;
- })();