Magic Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger

显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383

当前为 2022-09-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Magic Userscript+ : Show Site All UserJS
  3. // @name:zh Magic Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
  4. // @name:zh-CN Magic Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
  5. // @name:zh-TW Magic Userscript+ : 顯示當前網站所有可用的UserJS腳本 Jaeger
  6. // @name:ja Magic Userscript+ : 現在のサイトの利用可能なすべてのUserJSスクリプトを表示するJaeger
  7. // @name:ru-RU Magic Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
  8. // @name:ru Magic Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
  9. // @description Show current site all UserJS, the easier way to install UserJs for Tampermonkey.
  10. // @description:zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
  11. // @description:zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
  12. // @description:zh-TW 顯示當前網站的所有可用UserJS(Tampermonkey)腳本,交流QQ群:104267383
  13. // @description:ja 現在のサイトで利用可能なすべてのUserJS(Tampermonkey)スクリプトを表示します。
  14. // @description:ru-RU Показывает пользовательские скрипты (UserJS) для сайта. Легкий способ установить пользовательские скрипты для Tampermonkey.
  15. // @description:ru Показывает пользовательские скрипты (UserJS) для сайта. Легкий способ установить пользовательские скрипты для Tampermonkey.
  16. // @author Magic <magicoflolis@tuta.io>
  17. // @version 3.5.15
  18. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=
  19. // @supportURL https://github.com/magicoflolis/Userscript-Plus/issues/new
  20. // @namespace https://github.com/magicoflolis/Userscript-Plus
  21. // @homepageURL https://github.com/magicoflolis/Userscript-Plus
  22. // @license MIT
  23. // @connect greasyfork.org
  24. // @connect sleazyfork.org
  25. // @connect cdn.jsdelivr.net
  26. // @include *
  27. // @exclude *://paypal.com/*
  28. // @exclude *://mega.nz
  29. // @exclude *://*.alipay.com/*
  30. // @exclude *://*bank.*/*
  31. // @exclude *://*perfectmoney.*/*
  32. // @exclude *://*stripe.com/*
  33. // @exclude *://*ica.yandex.com/*
  34. // @exclude *://*authorize.net/*
  35. // @exclude *://*2checkout.com/*
  36. // @exclude *://192.168*
  37. // @exclude *://127.0.0*
  38. // @exclude *://router.*.*/*
  39. // @exclude *://gitlab.com/*
  40. // @exclude *://10.0.0*
  41. // @exclude *://*skrill.com/*
  42. // @exclude *://*zalo.me/*
  43. // @exclude *://pay.amazon.*/*
  44. // @exclude *://*.opayo.co.uk/*
  45. // @exclude *://*.payza.org/*
  46. // @exclude *://*.bluesnap.com/*
  47. // @exclude *://securionpay.com/*
  48. // @exclude *://*.unionpayintl.*/*
  49. // @exclude *://*.99bill.com/*
  50. // @exclude *://*.yeepay.com/*
  51. // @exclude *://*payoneer.com/*
  52. // @exclude *://*myetherwallet.com/*
  53. // @exclude *://bitpay.com/*
  54. // @exclude *://*.*/login
  55. // @exclude *://*.*/join
  56. // @exclude *://*.*/signin
  57. // @exclude *://*.*/signup
  58. // @exclude *://*.*/sign-up
  59. // @exclude *://*.*/cart
  60. // @exclude *://*.*.gov/*
  61. // @exclude *://*.*/password_reset
  62. // @exclude *://*.*/checkout*
  63. // @exclude *://*.*/settings/*
  64. // @exclude *://*.*/options/*
  65. // @exclude *://*.*.*/login
  66. // @exclude *://*.*.*/join
  67. // @exclude *://*.*.*/signin
  68. // @exclude *://*.*.*/signup
  69. // @exclude *://*.*.*/sign-up
  70. // @exclude *://*.*.*/cart
  71. // @exclude *://*.*.*/checkout*
  72. // @exclude *://*.*.*/settings/*
  73. // @exclude *://*.*.*/options/*
  74. // @exclude *://*.*.*.gov/*
  75. // @exclude *://*.*.*/password_reset
  76. // @grant GM_xmlhttpRequest
  77. // @grant GM_openInTab
  78. // @compatible chrome
  79. // @compatible firefox
  80. // @compatible edge
  81. // @compatible opera
  82. // @compatible safari
  83. // @noframes
  84. // @run-at document-end
  85. // ==/UserScript==
  86.  
  87. /**
  88. * Enable built-in "Greasyfork Search with Sleazyfork Results include"
  89. * 启用内置"使用 Sleazyfork 搜索"结果包括"
  90. * 組み込みの「スライジーフォークの結果を含む脂っこく検索」を有効にする
  91. * Включить встроенный "Greasyfork Поиск с Sleazyfork Результаты включают"
  92. * https://greasyfork.org/scripts/23840
  93. */
  94. const sleazyfork_redirect = true, // 'true' to enable, 'false' to disable
  95. /**
  96. * Injected stylesheet
  97. * https://github.com/magicoflolis/Userscript-Plus/tree/master/src/sass
  98. */
  99. main_css = `magic-userjs{cursor:default}magic-userjs *{line-height:normal}.hidden{display:none !important;z-index:-1 !important}.main{position:fixed;height:492px;margin-left:1rem;margin-right:1rem;bottom:1rem;right:1rem;background:#495060 !important;color:#fff !important;border:1px solid rgba(0,0,0,0);border-radius:10px;font-size:14px !important;font-family:arial,sans-serif !important}.main:not(.hidden){z-index:100000000000000020 !important;display:grid !important}.main *:not(magicuserjs-a,magicuserjs-btn,count-frame,.counterframe,.count){background:#495060 !important;color:#fff !important}.counterframe{border-radius:100%;padding:.5%;width:25px !important;height:25px !important}.count{background:rgba(0,0,0,0)}.mainframe{background:#495060 !important;color:#fff !important;border:2px solid rgba(0,0,0,0);border-radius:100%;padding:.5% !important;position:fixed;bottom:1rem;right:1rem;width:25px !important;height:25px !important}.mainframe:not(.hidden){z-index:100000000000000020 !important;display:block}count-frame{border:2px solid rgba(0,0,0,0);font-size:16px;font-weight:400;display:block;text-align:center}count-frame{line-height:normal !important;width:auto !important;height:auto !important}.magicuserjs-header{display:flex;gap:10px;border-bottom:1px solid #fff;border-top-left-radius:10px;border-top-right-radius:10px;height:fit-content;padding:10px;font-size:1em;justify-content:space-between}.magicuserjs-body{overflow-y:scroll;overflow-x:hidden;scrollbar-color:#fff #2e323d;scrollbar-width:thin;border:1px solid rgba(0,0,0,0);border-bottom-left-radius:10px;border-bottom-right-radius:10px}.magicuserjs-eframe,.frame{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;font-size:1em}.frame{border-bottom:1px solid #fff}@media screen and (max-width: 580px){.frame{display:flow-root !important;height:fit-content !important}}.frame:not(.sf) magicuserjs-a{color:#00b7ff !important}.frame:not(.sf) magicuserjs-btn{color:#fff;background-color:#2d8cf0;border-color:#2d8cf0}.frame.sf magicuserjs-a{color:#ed3f14 !important}.frame.sf magicuserjs-btn{background-color:#ed3f14 !important;border-color:#ed3f14 !important}.magicuserjs-name{font-size:inherit !important;display:grid;margin-left:1%;margin-top:.67em;margin-bottom:.67em}.magicuserjs-name span{font-size:.8em !important}.magicuserjs-eframe{margin-right:1%;margin-top:.67em;margin-bottom:.67em}@media screen and (max-width: 580px){.magicuserjs-eframe{height:fit-content !important}}.magicuserjs-uframe{display:grid;grid-auto-flow:column;grid-gap:1em}magic-btn{font-style:normal;font-weight:400;font-variant:normal;text-transform:none;text-rendering:auto;border:1px solid #fff;font-size:16px;border-radius:4px;line-height:1;padding:6px 15px;width:fit-content}magic-column{display:flex;gap:10px}magic-btn svg{fill:#fff;width:12px;height:12px}.searcher{border:1px solid #fff;border-radius:4px;line-height:1;width:170px;outline:0px !important}magicuserjs-btn{font-size:12px;border-radius:3px;font-style:normal;padding:6px 15%;font-weight:400;font-variant:normal;line-height:21px}magicuserjs-a,magicuserjs-btn,.mainbtn,.mainframe,magic-btn{cursor:pointer !important}.magicuserjs-uframe,.magicuserjs-daily,.magicuserjs-updated,.install,.magicuserjs-homepage,.magicuserjs-fver,.magicuserjs-fdesc{width:fit-content;height:fit-content}`;
  100.  
  101. (() => {
  102. const log = (...msg) => console.log('[%cUserJS%c] %cDBG', 'color: rgb(29, 155, 240);', '', 'color: rgb(255, 212, 0);', ...msg),
  103. err = (...msg) => {console.error('[%cUserJS%c] %cERROR', 'color: rgb(29, 155, 240);', '', 'color: rgb(249, 24, 128);', ...msg)};
  104.  
  105. let checkGMSupport = typeof GM !== 'undefined' || typeof VM !== 'undefined',
  106. MU = {};
  107.  
  108. if(checkGMSupport) {
  109. MU = {
  110. // getValue: GM_getValue,
  111. // setValue: GM_setValue,
  112. openInTab: GM_openInTab,
  113. xmlhttpRequest: GM_xmlhttpRequest,
  114. };
  115. };
  116.  
  117. let langs = {
  118. en: {
  119. daily: 'Daily Installs',
  120. close: 'No longer show',
  121. search: 'Search',
  122. searcher: 'Title | Description | Author...',
  123. install: 'Install',
  124. issue: 'New Issue',
  125. version: 'Version',
  126. updated: 'Last Updated',
  127. legacy: 'Legacy',
  128. },
  129. es: {
  130. daily: 'Instalaciones diarias',
  131. close: 'Ya no se muestra',
  132. search: 'Busque en',
  133. searcher: 'Título | Descripción | Autor...',
  134. install: 'Instalar',
  135. issue: 'Nueva edición',
  136. version: 'Versión',
  137. updated: 'Última actualización',
  138. legacy: 'Legado',
  139. },
  140. ru: {
  141. daily: 'Ежедневные установки',
  142. close: 'Больше не показывать',
  143. search: 'Поиск',
  144. searcher: 'Название | Описание | Автор...',
  145. install: 'Установите',
  146. issue: 'Новый выпуск',
  147. version: 'Версия',
  148. updated: 'Последнее обновление',
  149. legacy: 'Наследие',
  150. },
  151. ja: {
  152. daily: 'デイリーインストール',
  153. close: '表示されなくなりました',
  154. search: '検索',
  155. searcher: 'タイトル|説明|著者...',
  156. install: 'インストール',
  157. issue: '新刊のご案内',
  158. version: 'バージョン',
  159. updated: '最終更新日',
  160. legacy: 'レガシー',
  161. },
  162. fr: {
  163. daily: 'Installations quotidiennes',
  164. close: 'Ne plus montrer',
  165. search: 'Recherche',
  166. searcher: 'Titre | Description | Auteur...',
  167. install: 'Installer',
  168. issue: 'Nouveau numéro',
  169. version: 'Version',
  170. updated: 'Dernière mise à jour',
  171. legacy: 'Héritage',
  172. },
  173. zh: {
  174. daily: '日常安装',
  175. close: '不再显示',
  176. search: '搜索',
  177. searcher: '标题|描述|作者...',
  178. install: '安装',
  179. issue: '新问题',
  180. version: '版本',
  181. updated: '最后更新',
  182. legacy: '遗产',
  183. },
  184. },
  185. sitegfcount = 0,
  186. sitesfcount = 0,
  187. lang = langs[navigator.language.split('-')[0] ?? 'en'];
  188.  
  189. const win = self ?? window,
  190. doc = win.document,
  191. /** Can create various elements */
  192. make = (element,cname,attrs = {}) => {
  193. let el = doc.createElement(element);
  194. cname ? (el.className = cname) : false;
  195. if(attrs) {for(let key in attrs) {el[key] = attrs[key]}};
  196. return el;
  197. },
  198. ifram = make('iframe','', {
  199. src: 'about:blank',
  200. style: `position: fixed;
  201. bottom: 1rem;
  202. right: 1rem;
  203. height: 525px;
  204. width: 90%;
  205. margin-left: 1rem;
  206. margin-right: 1rem;
  207. z-index: 100000000000000020 !important;
  208. `
  209. }),
  210. container = make('magic-userjs');
  211. if(container.attachShadow) {
  212. container.attachShadow({ mode: 'open' });
  213. doc.body.append(container);
  214. } else {
  215. doc.body.append(ifram);
  216. ifram.onload = () => {
  217. ifram.contentDocument.body.append(container);
  218. if(container.attachShadow) {
  219. container.attachShadow({ mode: 'open' });
  220. } else {
  221. ifram.contentDocument.body.setAttribute('style','background-color: black;color: white;');
  222. ifram.contentDocument.body.innerHTML = '[ERROR] Unsupported { attachShadow }... yeah still need to work on that :)';
  223. delay(5000).then(() => {
  224. ifram.remove()
  225. })
  226. };
  227. };
  228. }
  229.  
  230. const qs = (element, selector) => {
  231. selector = selector ?? doc ?? doc.body;
  232. return selector.querySelector(element);
  233. },
  234. shA = (element) => {
  235. return container.shadowRoot.querySelectorAll(element);
  236. },
  237. estr = (str) => str === null || str.trim() === '',
  238. delay = ms => new Promise(resolve => setTimeout(resolve, ms)),
  239. fetchURL = async (url,method = 'GET',responseType = 'json',params = {}) => {
  240. try {
  241. return new Promise((resolve, reject) => {
  242. if(checkGMSupport) {
  243. MU.xmlhttpRequest({
  244. method: method,
  245. url,
  246. responseType,
  247. ...params,
  248. onprogress: p => log(`Progress: ${p.loaded} / ${p.total}`),
  249. onerror: e => reject(e),
  250. onload: (r) => {
  251. if(r.status !== 200) reject(`${r.status} ${url}`);
  252. resolve(r.response);
  253. },
  254. });
  255. } else {
  256. fetch(url, {
  257. method: method,
  258. ...params,
  259. }).then((response) => {
  260. if(!response.ok) reject(response);
  261. if(responseType.includes('json')) {
  262. resolve(response.json());
  263. } else if(responseType.includes('text')) {
  264. resolve(response.text());
  265. } else if(responseType.includes('blob')) {
  266. resolve(response.blob());
  267. };
  268. resolve(response);
  269. });
  270. }
  271. });
  272. } catch (error) {err(error);}
  273. },
  274. sleazy = () => {
  275. let otherSite = /greasyfork\.org/.test(document.location.hostname) ? 'sleazyfork' : 'greasyfork';
  276. return qs('span.sign-in-link') ? /scripts\/\d+/.test(document.location.href) ? !qs('#script-info') && (otherSite == 'greasyfork' || qs('div.width-constraint>section>p>a')) ? location.href = location.href.replace(/\/\/([^.]+\.)?(greasyfork|sleazyfork)\.org/, '//$1' + otherSite + '.org') : false : false : false;
  277. },
  278. openpage = (url) => {
  279. if(checkGMSupport) {
  280. MU.openInTab(url, {
  281. active: true,
  282. insert: true,
  283. });
  284. } else {
  285. let dwnbtn = make('a','magicuserjs-dwnbtn', {
  286. href: url,
  287. target: '_blank',
  288. rel: 'noopener',
  289. });
  290. dwnbtn.click();
  291. dwnbtn.remove();
  292. }
  293. },
  294. countsite = async () => {
  295. try {
  296. if(!container.attachShadow) return false;
  297. let host = location.hostname.split('.').splice(-2).join('.'),
  298. gfCount = await fetchURL(`https://greasyfork.org/scripts/by-site/${host}.json`),
  299. sfCount = await fetchURL(`https://sleazyfork.org/scripts/by-site/${host}.json`),
  300. siteujs = [],
  301. main = make('magic-userjs','main hidden'),
  302. usercss = make('style', 'primary-stylesheet', {innerHTML: main_css,}),
  303. tbody = make('magic-userjs','magicuserjs-body'),
  304. header = make('magic-userjs','magicuserjs-header'),
  305. mainframe = make('magic-userjs','mainframe', {
  306. onclick: (e) => {
  307. e.preventDefault();
  308. main.classList.remove('hidden');
  309. mainframe.classList.add('hidden');
  310. }
  311. }),
  312. mainbtn = make('count-frame','mainbtn', {
  313. innerHTML: '0',
  314. }),
  315. searcher = make('input','searcher hidden', {
  316. autocomplete: 'off',
  317. spellcheck: false,
  318. type: 'text',
  319. placeholder: lang.searcher,
  320. oninput: (e) => {
  321. e.preventDefault();
  322. let v = e.target.value;
  323. if(!estr(v)) {
  324. let reg = new RegExp(v,'gi');
  325. for(let ujs of shA('.frame')) {
  326. let m = ujs.children[0],
  327. n = ujs.children[1],
  328. final = m.textContent.match(reg) || n.textContent.match(reg) || [];
  329. if(final.length === 0) {
  330. ujs.classList.add('hidden');
  331. } else {
  332. ujs.classList.remove('hidden');
  333. };
  334. };
  335. } else {
  336. for(let ujs of shA('.frame')) {
  337. ujs.classList.remove('hidden')
  338. };
  339. };
  340. },
  341. }),
  342. searchbtn = make('magic-btn','search', {
  343. title: lang.search,
  344. innerHTML: `<svg viewBox='0 0 487.95 487.95'><g><path d='M481.8,453l-140-140.1c27.6-33.1,44.2-75.4,44.2-121.6C386,85.9,299.5,0.2,193.1,0.2S0,86,0,191.4s86.5,191.1,192.9,191.1 c45.2,0,86.8-15.5,119.8-41.4l140.5,140.5c8.2,8.2,20.4,8.2,28.6,0C490,473.4,490,461.2,481.8,453z M41,191.4 c0-82.8,68.2-150.1,151.9-150.1s151.9,67.3,151.9,150.1s-68.2,150.1-151.9,150.1S41,274.1,41,191.4z'/></g></svg>`,
  345. onclick: (e) => {
  346. e.preventDefault();
  347. searcher.classList.toggle('hidden');
  348. }
  349. }),
  350. closebtn = make('magic-btn','close', {
  351. title: lang.close,
  352. innerHTML: 'X',
  353. onclick: (e) => {
  354. e.preventDefault();
  355. main.classList.add('hidden');
  356. mainframe.classList.remove('hidden');
  357. delay(10000).then(() => {
  358. mainframe.classList.add('hidden');
  359. ifram.setAttribute('style','display:none;');
  360. })
  361. }
  362. }),
  363. countframe = make('magic-column'),
  364. gfcountframe = make('magic-userjs', 'counterframe', {
  365. style: 'background: #00b7ff;'
  366. }),
  367. sfcountframe = make('magic-userjs', 'counterframe', {
  368. style: 'background: #ed3f14;'
  369. }),
  370. gfcounter = make('count-frame','count', {
  371. title: 'https://greasyfork.org',
  372. }),
  373. sfcounter = make('count-frame','count', {
  374. title: 'https://sleazyfork.org',
  375. }),
  376. btnframe = make('magic-column', 'btnframe'),
  377. btnhome = make('magic-btn','github', {
  378. title: 'GitHub',
  379. innerHTML: `<svg viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>`,
  380. onclick: (e) => {
  381. e.preventDefault();
  382. openpage('https://github.com/magicoflolis/Userscript-Plus');
  383. }
  384. }),
  385. btnissue = make('magic-btn','issue', {
  386. title: lang.issue,
  387. innerHTML: `<svg viewBox="0 0 24 24"><path fill="none" stroke="#ffff" stroke-width="2" d="M23,20 C21.62,17.91 20,17 19,17 M5,17 C4,17 2.38,17.91 1,20 M19,9 C22,9 23,6 23,6 M1,6 C1,6 2,9 5,9 M19,13 L24,13 L19,13 Z M5,13 L0,13 L5,13 Z M12,23 L12,12 L12,23 L12,23 Z M12,23 C8,22.9999998 5,20.0000002 5,16 L5,9 C5,9 8,6.988 12,7 C16,7.012 19,9 19,9 C19,9 19,11.9999998 19,16 C19,20.0000002 16,23.0000002 12,23 L12,23 Z M7,8 L7,6 C7,3.24 9.24,1 12,1 C14.76,1 17,3.24 17,6 L17,8"/></svg>`,
  388. onclick: (e) => {
  389. e.preventDefault();
  390. openpage('https://github.com/magicoflolis/Userscript-Plus/issues/new');
  391. }
  392. }),
  393. btngreasy = make('magic-btn','greasy', {
  394. title: 'Greasy Fork',
  395. innerHTML: `<svg viewBox="0 0 510.4 510.4"><g><path d="M505.2,80c-6.4-6.4-16-6.4-22.4,0l-89.6,89.6c-1.6,1.6-6.4,3.2-12.8,1.6c-4.8-1.6-9.6-3.2-14.4-6.4L468.4,62.4 c6.4-6.4,6.4-16,0-22.4c-6.4-6.4-16-6.4-22.4,0L343.6,142.4c-3.2-4.8-4.8-9.6-4.8-12.8c-1.6-6.4-1.6-11.2,1.6-12.8L430,27.2 c6.4-6.4,6.4-16,0-22.4c-6.4-6.4-16-6.4-22.4,0L290.8,121.6c-16,16-20.8,40-14.4,62.4l-264,256c-16,16-16,43.2,0,59.2 c6.4,6.4,16,11.2,27.2,11.2c11.2,0,22.4-4.8,30.4-12.8L319.6,232c8,3.2,16,4.8,24,4.8c16,0,32-6.4,44.8-17.6l116.8-116.8 C511.6,96,511.6,86.4,505.2,80z M46,475.2c-3.2,3.2-9.6,3.2-14.4,0c-3.2-3.2-3.2-9.6,1.6-12.8l257.6-249.6c0,0,1.6,1.6,1.6,3.2 L46,475.2z M316.4,192c-14.4-14.4-16-35.2-4.8-48c4.8,11.2,11.2,22.4,20.8,32c9.6,9.6,20.8,16,32,20.8 C351.6,208,329.2,206.4,316.4,192z"/></g></svg>`,
  396. onclick: (e) => {
  397. e.preventDefault();
  398. openpage('https://greasyfork.org/scripts/421603');
  399. }
  400. }),
  401. btnlegacy = make('magic-btn','legacy', {
  402. title: lang.legacy,
  403. innerHTML: `<svg viewBox="0 0 510.4 510.4"><g><path d="M505.2,80c-6.4-6.4-16-6.4-22.4,0l-89.6,89.6c-1.6,1.6-6.4,3.2-12.8,1.6c-4.8-1.6-9.6-3.2-14.4-6.4L468.4,62.4 c6.4-6.4,6.4-16,0-22.4c-6.4-6.4-16-6.4-22.4,0L343.6,142.4c-3.2-4.8-4.8-9.6-4.8-12.8c-1.6-6.4-1.6-11.2,1.6-12.8L430,27.2 c6.4-6.4,6.4-16,0-22.4c-6.4-6.4-16-6.4-22.4,0L290.8,121.6c-16,16-20.8,40-14.4,62.4l-264,256c-16,16-16,43.2,0,59.2 c6.4,6.4,16,11.2,27.2,11.2c11.2,0,22.4-4.8,30.4-12.8L319.6,232c8,3.2,16,4.8,24,4.8c16,0,32-6.4,44.8-17.6l116.8-116.8 C511.6,96,511.6,86.4,505.2,80z M46,475.2c-3.2,3.2-9.6,3.2-14.4,0c-3.2-3.2-3.2-9.6,1.6-12.8l257.6-249.6c0,0,1.6,1.6,1.6,3.2 L46,475.2z M316.4,192c-14.4-14.4-16-35.2-4.8-48c4.8,11.2,11.2,22.4,20.8,32c9.6,9.6,20.8,16,32,20.8 C351.6,208,329.2,206.4,316.4,192z"/></g></svg>`,
  404. onclick: (e) => {
  405. e.preventDefault();
  406. openpage('https://cdn.jsdelivr.net/gh/magicoflolis/Userscript-Plus@master/archive/magic-userjs.user.js');
  407. }
  408. }),
  409. createjs = (ujs, issleazy) => {
  410. let frame = make('magic-userjs',`frame ${issleazy ? 'sf' : ''}`),
  411. fname = make('magic-userjs','magicuserjs-name'),
  412. ftitle = make('magicuserjs-a','magicuserjs-homepage', {
  413. title: ujs.name,
  414. innerHTML: ujs.name,
  415. onclick: (e) => {
  416. e.preventDefault();
  417. openpage(ujs.url);
  418. }
  419. }),
  420. fver = make('magic-userjs','magicuserjs-fver', {
  421. innerHTML: `${lang.version}: ${ujs.version}`,
  422. }),
  423. fdesc = make('magic-userjs','magicuserjs-fdesc', {
  424. title: ujs.description,
  425. innerHTML: ujs.description,
  426. }),
  427. eframe = make('magic-userjs','magicuserjs-eframe'),
  428. uframe = make('magic-userjs','magicuserjs-uframe'),
  429. fdaily = make('magic-userjs','magicuserjs-daily', {
  430. title: lang.daily,
  431. innerHTML: ujs.daily_installs,
  432. }),
  433. fupdated = make('magic-userjs','magicuserjs-updated', {
  434. title: lang.updated,
  435. innerHTML: new Intl.DateTimeFormat(navigator.language).format(new Date(ujs.code_updated_at)),
  436. }),
  437. fdwn = make('magicuserjs-btn','install', {
  438. title: `${lang.install} '${ujs.name}'`,
  439. innerHTML: lang.install,
  440. onclick: async (e) => {
  441. e.preventDefault();
  442. openpage(ujs.code_url);
  443. },
  444. });
  445. for(let u of ujs.users) {
  446. let user = make('magicuserjs-a','magicuserjs-euser', {
  447. innerHTML: u.name,
  448. onclick: (e) => {
  449. e.preventDefault();
  450. openpage(u.url);
  451. },
  452. });
  453. uframe.append(user);
  454. };
  455. eframe.append(uframe,fdaily,fupdated,fdwn);
  456. fname.append(ftitle,fver,fdesc);
  457. frame.append(fname,eframe);
  458. tbody.append(frame);
  459. };
  460. gfcountframe.append(gfcounter);
  461. sfcountframe.append(sfcounter);
  462. countframe.append(gfcountframe,sfcountframe);
  463. btnframe.append(searcher,searchbtn,btnissue,btnhome,btngreasy,btnlegacy,closebtn);
  464. header.append(countframe,btnframe);
  465. main.append(header,tbody);
  466. mainframe.append(mainbtn);
  467. container.shadowRoot.append(usercss,mainframe,main);
  468. for(let ujs of gfCount) {
  469. if(ujs.deleted) continue;
  470. siteujs.push(
  471. {
  472. url: ujs,
  473. sleazy: false,
  474. },
  475. );
  476. sitegfcount++;
  477. };
  478. for(let ujs of sfCount) {
  479. if(ujs.deleted) continue;
  480. siteujs.push(
  481. {
  482. url: ujs,
  483. sleazy: true,
  484. },
  485. );
  486. sitesfcount++;
  487. };
  488. for(let ujs of siteujs) {
  489. createjs(ujs.url,ujs.sleazy);
  490. };
  491. if(sitegfcount > sitesfcount) {
  492. mainbtn.innerHTML = sitegfcount
  493. } else {
  494. mainbtn.innerHTML = sitesfcount
  495. };
  496. gfcounter.innerHTML = sitegfcount;
  497. sfcounter.innerHTML = sitesfcount;
  498. delay(10000).then(() => {
  499. if(!mainframe.classList.contains('hidden')) {
  500. mainframe.classList.add('hidden');
  501. ifram.setAttribute('style','display:none;');
  502. };
  503. });
  504. } catch(error) {err(error)}
  505. };
  506.  
  507. if(/greasyfork\.org/.test(doc.location.hostname) && sleazyfork_redirect) {
  508. sleazy()
  509. };
  510.  
  511. if (doc.readyState == 'complete') {
  512. countsite();
  513. } else {
  514. win.addEventListener('load', countsite);
  515. };
  516. })();