forked from Christoph142/modern-scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (33 loc) · 1.48 KB
/
index.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
<!DOCTYPE HTML>
<html>
<head>
<title>modern scroll</title>
<script type="text/javascript" src="strings.js">/* localization */</script>
<script>
opera.extension.onmessage = function(event){
if(event.data == "update") opera.extension.broadcastMessage("update");
else if(event.data == "show_contextmenu") show_contextmenu();
else if(event.data == "hide_contextmenu") hide_contextmenu();
else if(event.data == "contextmenu_show_when_update"){ show_contextmenu(); hide_contextmenu(); }
else if(event.data == "reset_contextmenu"){
if(opera.contexts.menu.item(0)) opera.contexts.menu.item(0).title = strings["contextmenu_hide"];
}
}
hide_contextmenu();
show_contextmenu();
function show_contextmenu(){ // if contextmenu is not set to "never visible":
if(widget.preferences.contextmenu_show_when != "1" && !opera.contexts.menu.item(0)){
opera.contexts.menu.addItem(opera.contexts.menu.createItem({title:strings["contextmenu_hide"],icon:"images/contextmenu.png"}));
opera.contexts.menu.onclick = function(){
opera.contexts.menu.item(0).title =
opera.contexts.menu.item(0).title==strings["contextmenu_show"] ? strings["contextmenu_hide"] : strings["contextmenu_show"];
}
}
}
function hide_contextmenu(){ // if contextmenu is not set to "always visible":
if(widget.preferences.contextmenu_show_when != "3" && opera.contexts.menu.item(0))
if(opera.contexts.menu.item(0).title == strings["contextmenu_hide"]) opera.contexts.menu.removeItem(0);
}
</script>
</head>
</html>