您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork pagina colorata
当前为
// ==UserScript== // @name Greasy Fork Theme figuccio // @namespace https://greasyfork.org/users/237458 // @description Greasy Fork pagina colorata // @include https*://*greasyfork.org* // @include https*://sleazyfork.org* // @version 1.6 // @noframes // @author figuccio // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @match *://greasyfork.org/*/script_versions/new* // @match *://greasyfork.org/*/scripts/*/versions/new* // @require https://gitcdn.link/repo/fuzetsu/userscripts/b38eabf72c20fa3cf7da84ecd2cefe0d4a2116be/wait-for-elements/wait-for-elements.js // @run-at document-start // @grant GM_openInTab // @grant GM_xmlhttpRequest // @icon https://www.google.com/s2/favicons?domain=greasyfork.org // @license MIT // ==/UserScript== window.onload = function() { var currentColor = 'violet'; setInterval(function() { document.body.style.backgroundColor = currentColor; currentColor = currentColor === '#28768e75' ? '#008000ab' : '#28768e75'; }, 10000); }; //colore parte centrale GM_addStyle('.script-list{background-color:#d4c515d1!important;}'); //mostra risultato per tutte le lingue if (document.URL == "https://greasyfork.org/it/scripts") window.location.href = "https://greasyfork.org/it/scripts?filter_locale=0"; if (document.URL == "https://sleazyfork.org/it/scripts" ) window.location.href = "https://sleazyfork.org/it/scripts?filter_locale=0"; /////////////autoclick casella editor checkbox (() => { 'use strict'; waitForElems({ sel: '#enable-source-editor-code', stop: true, onmatch(checkbox) { checkbox.click(); } }); })(); ////////////////scorrimento pagine senza ricarica/////////// (function() { 'use strict'; var webType, curSite = {SiteTypeID: 0}; // Siti web attualmente supportati const websiteList = ['greasyfork.org' ]; if (GM_getValue('menu_disable') == null){GM_setValue('menu_disable', [])}; if (GM_getValue('menu_discuz_thread_page') == null){GM_setValue('menu_discuz_thread_page', true)}; // Registra menu script if (menu_disable('check')) { // Se il sito web attuale esiste già nell'elenco vietato GM_registerMenuCommand('❎ Disabilitato (fare clic per abilitare il sito Web corrente)', function(){menu_disable('del')}); return } else { if (websiteList.indexOf(location.host) > -1) { webType = 1 // Altri siti } else if (document.querySelector('meta[name="author"][content*="Discuz!"], meta[name="generator"][content*="Discuz!"]') || document.getElementById('ft') && document.getElementById('ft').textContent.indexOf('Discuz!') > -1) { webType = 2 // Tutti i forum Discuz! } else if (document.getElementById('flarum-loading')) { webType = 3 // Tutti i forum di Flarum } else { GM_registerMenuCommand('❌Il sito web attuale non supporta temporaneamente [clicca per richiedere supporto]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/419215/feedback', {active: true,insert: true,setParent: true});}); return } GM_registerMenuCommand('✅ Abilitato (fare clic per disabilitare il sito Web corrente)', function(){menu_disable('add')}); if (webType === 2) { GM_registerMenuCommand(`${GM_getValue('menu_discuz_thread_page')?'✅':'❎'} 帖子内自动翻页 (仅 Discuz! 论坛)`, function(){menu_switch(GM_getValue('menu_discuz_thread_page'), 'menu_discuz_thread_page', 'Discuz! 论坛帖子内翻页')}); } } let DBSite = { greasyfork: { SiteTypeID: 0, pager: { type: 1, nextLink: '//a[@class="next_page"][@href]', pageElement: 'css;ol#browse-script-list > li', HT_insert: ['css;ol#browse-script-list', 3], replaceE: 'css;.pagination', scrollDelta: 1000 } }, greasyfork_feedback: { SiteTypeID: 0, pager: { type: 1, nextLink: '//a[@class="next_page"][@href]', pageElement: 'css;.script-discussion-list > div', HT_insert: ['css;.script-discussion-list', 3], replaceE: 'css;.pagination', scrollDelta: 1500 } }, greasyfork_discussions: { SiteTypeID: 0, pager: { type: 1, nextLink: '//a[@class="next_page"][@href]', pageElement: 'css;.discussion-list > div', HT_insert: ['css;.discussion-list', 3], replaceE: 'css;.pagination', scrollDelta: 1000 } }, fitgirl: { SiteTypeID: 0, pager: { type: 1, nextLink: '//a[@class="next page-numbers"][@href]', pageElement: 'css;article[id^="post-"]', HT_insert: ['css;nav.navigation.paging-navigation', 1], replaceE: 'css;nav.navigation.paging-navigation', scrollDelta: 2000 } } }; // Genera SiteTypeID generateID(); /////////////////////////////////////////// // <Altri siti> if (webType === 1) { switch (location.host) { case 'greasyfork.org': // < GreasyFork > if (location.pathname.indexOf('/scripts') + 8 === location.pathname.length) { curSite = DBSite.greasyfork; } else if (location.pathname.lastIndexOf('/feedback') + 9 === location.pathname.length) { curSite = DBSite.greasyfork_feedback; } else if (location.pathname.lastIndexOf('/discussions') + 12 === location.pathname.length) { curSite = DBSite.greasyfork_discussions; } break; } // < Tutti i forum Discuz! > } else if (webType === 2) { if (location.pathname.indexOf('.html') > -1) { // Determina se si tratta di una pagina web statica (fine di .html) if (location.pathname.indexOf('forum') > -1) { // Elenco dei post in ogni sezione if (document.getElementById('autopbn')) { // Determina se è presente un pulsante [Pagina successiva] curSite = DBSite.discuz_forum; } else { curSite = DBSite.discuz_guide; } } else if (location.pathname.indexOf('thread') > -1) { // 帖子内 if (GM_getValue('menu_discuz_thread_page')) { curSite = DBSite.discuz_thread; hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮 } } else if(location.pathname.indexOf('search') > -1) { // 搜索结果 curSite = DBSite.discuz_search; } } else { if (location.search.indexOf('mod=forumdisplay') > -1) { // 各版块帖子列表 if (document.getElementById('autopbn')) { // 判断是否有 [下一页] 按钮 curSite = DBSite.discuz_forum; } else { curSite = DBSite.discuz_guide; } } else if (location.search.indexOf('mod=viewthread') > -1) { // 帖子内 if (GM_getValue('menu_discuz_thread_page')) { curSite = DBSite.discuz_thread; hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮 } } else if (location.search.indexOf('mod=guide') > -1) { // 导读帖子列表 curSite = DBSite.discuz_guide; } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复 curSite = DBSite.discuz_youspace; } else if (location.search.indexOf('mod=collection') > -1) { // 淘贴列表 curSite = DBSite.discuz_collection; } else if (location.pathname.indexOf('search') > -1) { // 搜索结果 curSite = DBSite.discuz_search; } else { // 考虑到部分论坛的部分板块帖子列表 URL 是自定义的 curSite = DBSite.discuz_forum; } } // < 所有 Flarum 论坛 > } else if (webType === 3) { curSite = DBSite.flarum; } curSite.pageUrl = ''; // URL successivo pageLoading(); //Volta pagina automatica e senza interruzioni //Nascondi il pulsante [Pagina successiva] nel post (Forum Discuz!) function hidePgbtn() { document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}'; } // La funzione di pre-inserimento di Dux (carica immagine) function dux_beforeFunction(pageElems) { pageElems.forEach(function (one) { let now = one.querySelector('img.thumb[data-src]') if (now) { now.setAttribute('src', now.dataset.src) } }); return pageElems } // Funzione di pre-inserimento di 58pic (carica immagine) function _58pic_beforeFunction(pageElems) { let is_one = document.querySelector('.qtw-card.place-box.is-one'); if (is_one && is_one.style.display != 'none') { is_one.setAttribute('style', 'display: none;') } pageElems.forEach(function (one) { let now = one.querySelector('img.lazy') if (now && now.getAttribute('src') != now.dataset.original) { now.setAttribute('src', now.dataset.original) now.setAttribute('style', 'display: block;') } }); return pageElems } //La funzione di pre-inserimento di 游民星空攻略 (rimuovi il testo in fondo alla pagina successiva "per altri contenuti correlati: xxx") function gamersky_gl_beforeFunction(pageElems) { pageElems.forEach(function (one) { if (one.tagName === 'P' && one.textContent.indexOf('更多相关内容请关注') > -1) { one.style.display = 'none'; } }); return pageElems } // iao.su 的插入前函数(加载图片) function iao_su_beforeFunction(pageElems) { pageElems.forEach(function (one) { let now = one.getElementsByClassName('post-card')[0] if (now) { now.getElementsByClassName('blog-background')[0].style.backgroundImage = 'url("' + now.getElementsByTagName('script')[0].textContent.split("'")[1] + '")'; } }); return pageElems } // funzione di pre-inserimento di iplaysoft (carica immagine) function iplaysoft_postslist_beforeFunction(pageElems) { pageElems.forEach(function (one) { let now = one.querySelector('img.lazyload') if (now && !now.src) { now.setAttribute('src', now.dataset.src) now.setAttribute('srcset', now.dataset.src) now.setAttribute('class', 'lazyloaded') } }); return pageElems } // alphacoders_art 的插入前函数(图片结构调整) function alphacoders_art_beforeFunction(pageElems) { pageElems.forEach(function (one) { one.setAttribute('style','float: left'); }); return pageElems } // alphacoders_art(图片结构调整) function alphacoders_art_beforeFunction_0() { let pageElems1 = document.querySelectorAll('.container-masonry > div') document.querySelector('.container-masonry').style.height = 'auto' pageElems1.forEach(function (one) { one.setAttribute('style','float: left'); }); } // gufengmh8 function gufengmh8_functionNext() { if (curSite.pageUrl) { // 如果已经有下一页的 URL 则直接获取 getPageElems(curSite.pageUrl) } else { let pageElems = document.querySelector(curSite.pager.pageElement.replace('css;', '')); // 寻找数据所在元素 if (pageElems) { let comicUrl, nextId; pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历 //console.log(one) if (one.indexOf('comicUrl') > -1) { // 下一页 URL 前半部分 comicUrl = one.split('"')[1]; } else if (one.indexOf('nextChapterData') > -1) { // 下一页 URL 的后半部分 ID nextId = one.split('"id":')[1].split(',')[0]; } }) if (comicUrl && nextId && nextId != 'null') { // 组合到一起就是下一页 URL curSite.pageUrl = comicUrl + nextId + '.html' //console.log(curSite.pageUrl) getPageElems(curSite.pageUrl); // 访问下一页 URL 获取 } } } } // gufengmh8 function gufengmh8_functionAdd(pageElems) { if (pageElems) { curSite.pageUrl = ''; // 留空后,下一页 URL 依然交给 gufengmh8_function 函数获取(方便点) pageElems = pageElems[0]; //console.log(pageElems) let chapterImages, chapterPath; //console.log(pageElems.textContent) document.querySelector(curSite.pager.pageElement.replace('css;', '')).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL(gufengmh8_function 函数) pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历 //console.log(one) if (one.indexOf('chapterImages') > -1) { // 图片文件名数组 chapterImages = one.replace(/^.+\[/, '').replace(']', '').replaceAll('"', '').split(',') } else if (one.indexOf('chapterPath') > -1) { // 图片文件路径 chapterPath = one.split('"')[1]; } else if (one.indexOf('pageTitle') > -1) { // 网页标题 window.document.title = one.split('"')[1]; // 修改当前网页标题为下一页的标题 } }) if (chapterImages && chapterPath) { let _img = ''; chapterImages.forEach(function (one2){ // 遍历图片文件名数组,组合为 img 标签 _img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">' //console.log('https://res.xiaoqinre.com/' + chapterPath + one2) }) document.querySelector(curSite.pager.HT_insert[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.HT_insert[1]), _img); // 将 img 标签插入到网页中 } } } // Volta pagina automatica e senza interruzioni function pageLoading() { if (curSite.SiteTypeID > 0) { windowScroll(function (direction, e) { if (direction === 'down') { // 下滑才准备翻页 let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop, scrollHeight = window.innerHeight || document.documentElement.clientHeight, scrollDelta = curSite.pager.scrollDelta; if (curSite.pager.type === 3) { // 翻页类型 3 let scrollElement = document.querySelector(curSite.pager.scrollElement); //console.log(scrollElement.offsetTop - (scrollTop + scrollHeight), scrollDelta, curSite.SiteTypeID) if (scrollElement.offsetTop - (scrollTop + scrollHeight) <= scrollDelta) { if (curSite.SiteTypeID === SiteType.GAMERSKY_GL) curSite.pager.scrollDelta -= 800 // 游民星空 gl 的比较奇葩,需要特殊处理下 ShowPager.loadMorePage(); } } else { if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollDelta) { if (curSite.pager.type === 2) { // 翻页类型 2 if (curSite.SiteTypeID > 0) { // 如果指定了间隔时间,那么就依靠这个判断时间到了没有~ let autopbn = document.querySelector(curSite.pager.nextLink); if (autopbn) { // 寻找下一页链接 if (!curSite.pager.nextText) { // 如果没有指定 nextText 就直接点击 autopbn.click(); } else if (autopbn.textContent.indexOf(curSite.pager.nextText) > -1){ // 如果指定了 nextText 就需要判断后再点击(避免已经在加载了,还重复点击) autopbn.click(); } // 对于没有按钮文字变化的按钮,可以手动指定间隔时间 if (curSite.pager.intervals) { let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0; setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) } } } } else if (curSite.pager.type === 1) { // 翻页类型 1 ShowPager.loadMorePage(); } else if (curSite.pager.type === 4) { // 翻页类型 4 if (curSite.SiteTypeID > 0) { curSite.pager.functionNext(); if (curSite.pager.intervals) { let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0; setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) } } } } } } }); } } // Abilita/disabilita (sito web attuale) function menu_disable(type) { switch(type) { case 'check': if(check()) return true return false break; case 'add': add(); break; case 'del': del(); break; } function check() { // Restituisce vero se c'è, falso se non c'è let list = GM_getValue('menu_disable'); // 读取网站列表 if (list.indexOf(location.host) === -1) return false // 不存在返回假 return true } function add() { if (check()) return let list = GM_getValue('menu_disable'); // 读取网站列表 list.push(location.host); // 追加网站域名 GM_setValue('menu_disable', list); // 写入配置 location.reload(); // 刷新网页 } function del() { if (!check()) return let list = GM_getValue('menu_disable'), // 读取网站列表 index = list.indexOf(location.host); list.splice(index, 1); // 删除网站域名 GM_setValue('menu_disable', list); // 写入配置 location.reload(); // 刷新网页 } } // Interruttore del menu function menu_switch(menu_status, Name, Tips) { if (menu_status === true){ GM_setValue(`${Name}`, false); }else{ GM_setValue(`${Name}`, true); } location.reload(); }; // 生成 ID function generateID() { let num = 0 for (let val in DBSite) { DBSite[val].SiteTypeID = num = num + 1; } } // 类型 4 专用 function getPageElems(url) { GM_xmlhttpRequest({ url: url, method: 'GET', timeout: 5000, onload: function (response) { try { var newBody = ShowPager.createDocumentByString(response.responseText); let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody); if (pageElems.length >= 0) { curSite.pager.functionAdd(pageElems) } } catch (e) { console.log(e); } } }); } // Inserisci posizione function addTo(num) { switch (num) { case 1: return 'beforebegin' break; case 2: return 'afterbegin' break; case 3: return 'beforeend' break; case 4: return 'afterend' break; } } // Evento barra di scorrimento function windowScroll(fn1) { var beforeScrollTop = document.documentElement.scrollTop, fn = fn1 || function () {}; setTimeout(function () { // 延时执行,避免刚载入到页面就触发翻页事件 window.addEventListener('scroll', function (e) { var afterScrollTop = document.documentElement.scrollTop, delta = afterScrollTop - beforeScrollTop; if (delta == 0) return false; fn(delta > 0 ? 'down' : 'up', e); beforeScrollTop = afterScrollTop; }, false); }, 1000) } //Modificato da https://greasyfork.org/scripts/14178, https://github.com/machsix/Super-preloader var ShowPager = { getFullHref: function (e) { if(e == null) return ''; 'string' != typeof e && (e = e.getAttribute('href')); var t = this.getFullHref.a; return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href; }, createDocumentByString: function (e) { if (e) { if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml'); var t; try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {} if (t) return t; if (document.implementation.createHTMLDocument) { t = document.implementation.createHTMLDocument('ADocument'); } else { try {((t = document.cloneNode(!1)).appendChild(t.importNode(document.documentElement, !1)), t.documentElement.appendChild(t.createElement('head')), t.documentElement.appendChild(t.createElement('body')));} catch (e) {} } if (t) { var r = document.createRange(), n = r.createContextualFragment(e); r.selectNodeContents(document.body); t.body.appendChild(n); for (var a, o = { TITLE: !0, META: !0, LINK: !0, STYLE: !0, BASE: !0}, i = t.body, s = i.childNodes, c = s.length - 1; c >= 0; c--) o[(a = s[c]).nodeName] && i.removeChild(a); return t; } } else console.error('没有找到要转成 DOM 的字符串'); }, loadMorePage: function () { if (curSite.pager) { let curPageEle = getElementByXpath(curSite.pager.nextLink); var url = this.getFullHref(curPageEle); //console.log(`${url} ${curPageEle} ${curSite.pageUrl}`); if (url === '') return; if (curSite.pageUrl === url) return;// 避免重复加载相同的页面 curSite.pageUrl = url; // 读取下一页的数据 curSite.pager.startFilter && curSite.pager.startFilter(); GM_xmlhttpRequest({ url: url, method: 'GET', timeout: 5000, onload: function (response) { try { console.log('最终 URL:' + response.finalUrl, '返回内容:' + newBody) var newBody = ShowPager.createDocumentByString(response.responseText); let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody), toElement = getAllElements(curSite.pager.HT_insert[0])[0]; //console.log(curSite.pager.pageElement, pageElems) if (pageElems.length >= 0) { // 如果有插入前函数就执行函数 if (curSite.function && curSite.function.before) { if (curSite.function.parameter) { // 如果指定了参数 pageElems = curSite.function.before(curSite.function.parameter); } else { pageElems = curSite.function.before(pageElems); } } // 插入位置 let addTo1 = addTo(curSite.pager.HT_insert[1]); // 插入新页面元素 pageElems.forEach(function (one) { toElement.insertAdjacentElement(addTo1, one); }); // 替换待替换元素 try { let oriE = getAllElements(curSite.pager.replaceE); let repE = getAllElements(curSite.pager.replaceE, newBody, newBody); if (oriE.length === repE.length) { for (var i = 0; i < oriE.length; i++) { oriE[i].outerHTML = repE[i].outerHTML; } } } catch (e) { console.log(e); } // 如果有插入后函数就执行函数 if (curSite.function && curSite.function.after) { if (curSite.function.parameter) { // 如果指定了参数 curSite.function.after(curSite.function.parameter); }else{ curSite.function.after(); } } } } catch (e) { console.log(e); } } }); } }, }; function getElementByCSS(css, contextNode = document) { return contextNode.querySelector(css); } function getAllElementsByCSS(css, contextNode = document) { return [].slice.call(contextNode.querySelectorAll(css)); } function getElementByXpath(xpath, contextNode, doc = document) { contextNode = contextNode || doc; try { const result = doc.evaluate(xpath, contextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); // 应该总是返回一个元素节点 return result.singleNodeValue && result.singleNodeValue.nodeType === 1 && result.singleNodeValue; } catch (err) { throw new Error(`Invalid xpath: ${xpath}`); } } function getAllElementsByXpath(xpath, contextNode, doc = document) { contextNode = contextNode || doc; const result = []; try { const query = doc.evaluate(xpath, contextNode, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < query.snapshotLength; i++) { const node = query.snapshotItem(i); // 如果是 Element 节点 if (node.nodeType === 1) result.push(node); } } catch (err) { throw new Error(`无效 Xpath: ${xpath}`); } return result; } function getAllElements(selector, contextNode = undefined, doc = document, win = window, _cplink = undefined) { if (!selector) return []; contextNode = contextNode || doc; if (typeof selector === 'string') { if (selector.search(/^css;/i) === 0) { return getAllElementsByCSS(selector.slice(4), contextNode); } else { return getAllElementsByXpath(selector, contextNode, doc); } } else { const query = selector(doc, win, _cplink); if (!Array.isArray(query)) { throw new Error('getAllElements 返回错误类型'); } else { return query; } } } })(); //scrool dark var meta = document.createElement('meta'); meta.name = "color-scheme"; meta.content = "light dark"; document.getElementsByTagName('head')[0].appendChild(meta); // titolo degli script normalmente e rosso //GM_addStyle('.script-link, .user-link{color:blue!important;}'); //colore nero descrizione script necessario perche se no lo scroll dark lo fara vedere bianco e non si vedra GM_addStyle('body, input, select {color:black!important;}');