-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGlobals.js
61 lines (48 loc) · 2.2 KB
/
Globals.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Constant fields:
const POSTS_PER_PAGE = 50;
AddMessageHistoryButton();
ErrorPage();
// Global page mods:
function AddMessageHistoryButton() {
const getting = browser.storage.local.get('messagehistory');
getting.then(function (result) {
const history = result.messagehistory;
if (history !== true) return;
const menubar = document.querySelector('.menubar');
const bookmarks = menubar.querySelector('#bookmarks');
const messageHistoryButton = document.createElement('a');
messageHistoryButton.href = '/history.php';
messageHistoryButton.id = 'messageHistory';
messageHistoryButton.innerHTML = 'Message History';
if (bookmarks === null) return;
bookmarks.insertBefore(document.createTextNode(' | '), bookmarks.firstChild);
bookmarks.insertBefore(messageHistoryButton, bookmarks.firstChild);
});
}
function ErrorPage() {
if (document.body.style.backgroundImage.indexOf('errorlinks.png') == -1)
return;
var carbonationError = document.createElement('div');
carbonationError.style.top = '40%';
carbonationError.style.left = '40%';
carbonationError.style.position = 'absolute';
var errorMessage = document.createElement('a');
errorMessage.href = '/history.php';
errorMessage.id = 'historyLink';
errorMessage.innerHTML = 'Browse Message History';
var newMessage = document.createElement('a');
newMessage.href = '/postmsg.php?tag=LUE';
newMessage.id = 'newMessageLink';
newMessage.innerHTML = 'Post New Message';
var irc = document.createElement('a');
irc.href = 'https://qchat.rizon.net/?channels=ETI';
irc.target = '_blank';
irc.id = 'ircLink';
irc.innerHTML = 'Come chat on IRC while ETI is down!';
carbonationError.insertBefore(irc, carbonationError.firstChild);
carbonationError.insertBefore(document.createElement('br'), carbonationError.firstChild);
carbonationError.insertBefore(newMessage, carbonationError.firstChild);
carbonationError.insertBefore(document.createElement('br'), carbonationError.firstChild);
carbonationError.insertBefore(errorMessage, carbonationError.firstChild);
document.body.appendChild(carbonationError);
}