forked from gingerbeardman/Beautipedia.safariextension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globalpage.html
45 lines (40 loc) · 1.51 KB
/
globalpage.html
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
<!DOCTYPE HTML>
<html>
<head>
<title>global page</title>
<script type="text/javascript">
function respondToMessage(event) {
if(event.name === "getSettings") {
var settings, settingsArray;
settingsArray = new Array();
settings = safari.extension.settings;
settingsArray[0] = settings.displayMlLinksDiv;
settingsArray[1] = settings.linkColor;
settingsArray[2] = settings.textIndent;
settingsArray[3] = settings.enableFLS;
settingsArray[4] = settings.otherLang;
settingsArray[5] = settings.fixedMenu;
event.target.page.dispatchMessage("settings", settingsArray);
//secure wikipedia page stops at "event.target.page" with a message of an undefined value
}
}
function settingChanged(event) {
if ((event.key == "enableFLS") && (event.newValue == true)) {
alert("Beautipedia has only been tested in English. It may not look correct in certain languages. Some languages may not even have a counterpart for the English article.");
}
for (x = 0; x < safari.application.browserWindows.length; ++x) {
for (y = 0; y < safari.application.browserWindows[x].tabs.length; ++y) {
var page = safari.application.browserWindows[x].tabs[y].page;
if (!page)
continue;
page.dispatchMessage("change", event);
}
}
}
safari.application.addEventListener("message", respondToMessage, false);
safari.extension.settings.addEventListener("change", settingChanged,false);
</script>
</head>
<body>
</body>
</html>