-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWME Forum Sig Char Limit.js
44 lines (43 loc) · 1.32 KB
/
WME Forum Sig Char Limit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ==UserScript==
// @name WME Forum Sig Char Counter
// @namespace Dude495
// @version 2018.10.16.01
// @description Adds the character limit counter to your forum signature box.
// @author Dude495
// @include /^https:\/\/.*\.waze\.com\/forum\/.*
// ==/UserScript==
(function() {
'use strict';
const sigbox = $('#signature')[0];
const tl = document.createElement("LABEL");
tl.id = 'CHARLIMIT';
function charlimit() {
var charcount = sigbox.textLength;
const mbox = $('#message-box');
const tdiv = document.createElement('div');
tdiv.id = 'TBOX';
$('#message').after(tdiv);
tl.innerHTML = charcount + '/400';
tdiv.after(mbox);
mbox.after(tl);
};
function update() {
var charcount = sigbox.textLength;
if (charcount <= 400) {
tl.style.color = "black";
tl.innerHTML = charcount + '/400';
} else {
tl.style.color = "red";
tl.innerHTML = charcount + '/400';
}
};
function bootstrap(tries = 1) {
if (/mode=signature/.test(location.href)) {
charlimit();
setInterval(update, 100)
} else if (tries < 1000) {
setTimeout(function () {bootstrap(tries++);}, 200);
}
}
bootstrap();
})();