aboutsummaryrefslogtreecommitdiffstats
path: root/scripts-greasemonkey/twitter_to_nitter.user.js
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2020-07-05 16:54:17 -0500
committerJesús <heckyel@hyperbola.info>2020-07-05 16:54:17 -0500
commitcca78b770c0cd23727985ac1f4ecc5d35fc51774 (patch)
treed997de9edc2d2f09d0ba3f53810433018fa28973 /scripts-greasemonkey/twitter_to_nitter.user.js
parentf2c9969b12da6493f9fcba75e747a2b402d637ab (diff)
downloadbook-cca78b770c0cd23727985ac1f4ecc5d35fc51774.tar.lz
book-cca78b770c0cd23727985ac1f4ecc5d35fc51774.tar.xz
book-cca78b770c0cd23727985ac1f4ecc5d35fc51774.zip
scripts-greasemonkey: Improve log message
* fix change indent-spaces: 4 to 2
Diffstat (limited to 'scripts-greasemonkey/twitter_to_nitter.user.js')
-rw-r--r--scripts-greasemonkey/twitter_to_nitter.user.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/scripts-greasemonkey/twitter_to_nitter.user.js b/scripts-greasemonkey/twitter_to_nitter.user.js
index e0e3e44..b712246 100644
--- a/scripts-greasemonkey/twitter_to_nitter.user.js
+++ b/scripts-greasemonkey/twitter_to_nitter.user.js
@@ -13,7 +13,7 @@
// @exclude /^http(s|)://(www[.]|)nitter[.]nixnet[.]xyz/.*$/
// @exclude /^http(s|)://(www[.]|)nitter[.]drycat[.]fr/.*$/
// @exclude /^http(s|)://(www[.]|)tw[.]openalgeria[.]org/.*$/
-// @version 0.1.3
+// @version 0.1.4
// @grant none
// @license GPL version 3 or any later version::: https://www.gnu.org/licenses/gpl-3.0.html
// ==/UserScript==
@@ -23,24 +23,22 @@
let instance = 'nitter.net';
// Console Style - Debug
-let consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
+const consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
+const name = GM_info.script.name;
+const version = GM_info.script.version;
+const log = (...args) => console.log('%cUSERSCRIPT | %s %s | %s', consoleCSS, name, version, ...args);
// Do the actual rewrite
function rewriteLinks() {
- for (let i = 0; i < document.links.length; i++) {
- let elem = document.links[i];
- if (elem.href.match(/http(s|):\/\/(mobile[.]|www[.]|)twitter[.]com\/(#!\/)?(.*$)/i)) {
- elem.href='https://' + instance + '/' + RegExp.$4;
- }
+ for (let i = 0; i < document.links.length; i++) {
+ let elem = document.links[i];
+ if (elem.href.match(/http(s|):\/\/(mobile[.]|www[.]|)twitter[.]com\/(#!\/)?(.*$)/i)) {
+ elem.href='https://' + instance + '/' + RegExp.$4;
}
- statuscheck()
-}
-
-function statuscheck(){
- // Console Feedback
- console.log("%cUSERSCRIPT | " + GM_info.script.name + " " + GM_info.script.version + " | successfully initialized", consoleCSS);
+ }
+ log('successfully initialized');
}
window.addEventListener('load', () => {
- rewriteLinks();
+ rewriteLinks();
});