|
1 | 1 | // ==UserScript== |
2 | | -// @version 7.6.8 |
| 2 | +// @version 7.6.9 |
3 | 3 | // @name Magic Userscript+ : Show Site All UserJS |
4 | 4 | // @name:ar Magic Userscript+: عرض جميع ملفات UserJS |
5 | 5 | // @name:de Magic Userscript+ : Website anzeigen Alle UserJS |
|
88 | 88 | console.error('[%cMagic Userscript+%c] %cERROR','color: rgb(29, 155, 240);','','color: rgb(249, 24, 128);', `MIME type is not a document, got "${document.contentType || ''}"`); |
89 | 89 | } |
90 | 90 | if (!(typeof userjs === 'object' && userjs.UserJS)) return; |
91 | | -{ |
92 | | - /** Native implementation exists */ |
93 | | - const excludePolicy = [ |
94 | | - 'outlook.office.com' |
95 | | - ]; |
96 | | - const hostname = location?.hostname || ''; |
97 | | - if (window.trustedTypes && window.trustedTypes.createPolicy && !hostname.includes(excludePolicy)) window.trustedTypes.createPolicy('default', { createHTML: (string) => string, createScript: (string) => string, createScriptURL: (string) => string }); |
98 | | -} |
99 | 91 | /** [i18n directory](https://github.com/magicoflolis/Userscript-Plus/tree/master/src/_locales) */ |
100 | 92 | const translations = { |
101 | 93 | 'ar': { |
@@ -2075,12 +2067,12 @@ const DEFAULT_CONFIG = { |
2075 | 2067 | { |
2076 | 2068 | enabled: true, |
2077 | 2069 | name: 'greasyfork', |
2078 | | - query: encodeURIComponent('https://greasyfork.org/scripts/by-site/{host}.json?language=all') |
| 2070 | + query: encodeURIComponent('https://api.greasyfork.org/scripts/by-site/{host}.json?language=all') |
2079 | 2071 | }, |
2080 | 2072 | { |
2081 | 2073 | enabled: false, |
2082 | 2074 | name: 'sleazyfork', |
2083 | | - query: encodeURIComponent('https://sleazyfork.org/scripts/by-site/{host}.json?language=all') |
| 2075 | + query: encodeURIComponent('https://api.sleazyfork.org/scripts/by-site/{host}.json?language=all') |
2084 | 2076 | }, |
2085 | 2077 | { |
2086 | 2078 | enabled: false, |
@@ -5913,6 +5905,29 @@ const loadDOM = (onDomReady) => { |
5913 | 5905 | }; |
5914 | 5906 |
|
5915 | 5907 | const init = async (prefix = 'Config') => { |
| 5908 | + if (typeof window === 'undefined') { |
| 5909 | + return; |
| 5910 | + } |
| 5911 | + if (typeof window.trustedTypes !== 'undefined') { |
| 5912 | + /** |
| 5913 | + * Delay `trustedTypes.createPolicy` creation |
| 5914 | + */ |
| 5915 | + const toDelay = [ |
| 5916 | + /** Microsoft Outlook */ |
| 5917 | + 'outlook' |
| 5918 | + ].join('|'); |
| 5919 | + const delayReg = new RegExp(toDelay, 'gi'); |
| 5920 | + if (delayReg.test(url.hostname)) { |
| 5921 | + await new Promise((resolve) => _self.setTimeout(resolve, 1000)); |
| 5922 | + } |
| 5923 | + if (isNull(window.trustedTypes.defaultPolicy)) { |
| 5924 | + window.trustedTypes.createPolicy('default', { |
| 5925 | + createHTML: (string) => string, |
| 5926 | + createScript: (string) => string, |
| 5927 | + createScriptURL: (string) => string |
| 5928 | + }); |
| 5929 | + } |
| 5930 | + } |
5916 | 5931 | const stored = await StorageSystem.getValue(prefix, DEFAULT_CONFIG); |
5917 | 5932 | cfg = { |
5918 | 5933 | ...DEFAULT_CONFIG, |
|
0 commit comments