mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-15 21:55:36 +07:00
@@ -24,38 +24,26 @@
|
||||
(function (window) {
|
||||
"use strict";
|
||||
|
||||
function injectFunction(func) {
|
||||
function injectFunction() {
|
||||
var ele = document.createElement('script');
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
|
||||
ele.type = 'text/javascript';
|
||||
ele.textContent = '(' + func + ')();';
|
||||
ele.textContent = "Object.defineProperty(window, 'rwt', {" +
|
||||
" value: function() { return false; }," +
|
||||
" writable: false," +
|
||||
" configurable: false" +
|
||||
"});";
|
||||
|
||||
s.parentNode.insertBefore(ele, s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable the url rewrite function
|
||||
*/
|
||||
function disableURLRewrite() {
|
||||
function inject_init() {
|
||||
/* Define the url rewrite function */
|
||||
Object.defineProperty(window, 'rwt', {
|
||||
value: function() { return true; },
|
||||
writable: false, // set the property to read-only
|
||||
configurable: false
|
||||
});
|
||||
}
|
||||
|
||||
injectFunction(inject_init);
|
||||
}
|
||||
|
||||
/*
|
||||
* The main entry
|
||||
*/
|
||||
function main()
|
||||
{
|
||||
disableURLRewrite();
|
||||
injectFunction();
|
||||
|
||||
document.addEventListener('mouseover', function (event) {
|
||||
var a = event.target, depth = 1;
|
||||
@@ -65,9 +53,12 @@
|
||||
}
|
||||
|
||||
if (a && a.tagName == 'A') {
|
||||
a.removeAttribute('onmousedown');
|
||||
var clone = a.cloneNode(true);
|
||||
a.parentNode.replaceChild(clone, a);
|
||||
try {
|
||||
a.removeAttribute('data-cthref');
|
||||
delete a.dataset.cthref;
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user