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