Update jrh.user.js
This commit is contained in:
25
jrh.user.js
25
jrh.user.js
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name JRH: JoyReactor Helper
|
||||
// @description Улучшаем JoyReactor
|
||||
// @version 2.2.3
|
||||
// @version 2.3
|
||||
// @author DmitriyMX
|
||||
// @downloadURL https://gitlab.com/DmitriyMX/joyreactor-helper/raw/master/userscript.js
|
||||
// @updateURL https://gitlab.com/DmitriyMX/joyreactor-helper/raw/master/userscript.js
|
||||
@@ -11,23 +11,22 @@
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
|
||||
const reactorDomain = 'joy.reactor.cc';
|
||||
|
||||
function getKnownReactorDomains() {
|
||||
return ['reactor.cc', 'joyreactor.cc', 'pornreactor.cc'];
|
||||
const domainAliaces = {
|
||||
"joy.reactor.cc": ['reactor.cc', 'joyreactor.cc'],
|
||||
"pornreactor.cc": [],
|
||||
}
|
||||
|
||||
/**
|
||||
* Исправляет внутренние ссылки "реактора"
|
||||
*/
|
||||
function fixReactorLinks() {
|
||||
getKnownReactorDomains().forEach(domain => {
|
||||
domainAliaces[document.domain].forEach(domain => {
|
||||
document.querySelectorAll('a[href^="http://' + domain + '/"]').forEach(elm => {
|
||||
elm.href = elm.href.replace('http://' + domain + '/', 'http://' + reactorDomain + '/');
|
||||
elm.href = elm.href.replace('http://' + domain + '/', 'http://' + document.domain + '/');
|
||||
});
|
||||
|
||||
document.querySelectorAll('a[href^="//' + domain + '/"]').forEach(elm => {
|
||||
elm.href = elm.href.replace('//' + domain + '/', '//' + reactorDomain + '/');
|
||||
elm.href = elm.href.replace('//' + domain + '/', '//' + document.domain + '/');
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -83,8 +82,14 @@ function collapseTreeComments() {
|
||||
}
|
||||
|
||||
function isPostPage() {
|
||||
return document.URL.match(/http?:\/\/joy\.reactor\.cc\/post/) !== null
|
||||
|| document.URL.match(/http?:\/\/pornreactor\.cc\/post/) !== null
|
||||
for (var domain of Object.keys(domainAliaces)) {
|
||||
let regexp = new RegExp("http?:\/\/" + domain.replace(/\./g, '\\.') + "\/post")
|
||||
if (document.URL.match(regexp) !== null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user