Opera to Phone v1.3.4

This commit is contained in:
rich.tibbett
2011-01-25 17:38:51 +00:00
parent 9ae51e9ccd
commit cc5a68a7e7
2 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget xmlns="http://www.w3.org/ns/widgets" id="https://addons.opera.com/addons/extensions/details/opera-to-phone/" version="1.3.3"> <widget xmlns="http://www.w3.org/ns/widgets" id="https://addons.opera.com/addons/extensions/details/opera-to-phone/" version="1.3.4">
<name>Opera to Phone</name> <name>Opera to Phone</name>
<access origin="https://chrometophone.appspot.com"/> <access origin="https://chrometophone.appspot.com"/>
<icon src="icon_64x64.png"/> <icon src="icon_64x64.png"/>

View File

@@ -5,7 +5,7 @@
<script type="text/javascript" src="send_logic.js"></script> <script type="text/javascript" src="send_logic.js"></script>
<script> <script>
var UIItemProperties = { // options for the button var UIItemProperties = { // options for the button
disabled: false, disabled: true,
title: "Opera to Phone", title: "Opera to Phone",
icon: "icon_18x18.png", icon: "icon_18x18.png",
popup: { popup: {
@@ -74,6 +74,28 @@ function onMessage( message ) {
} }
opera.extension.addEventListener( 'message' , onMessage, false ); opera.extension.addEventListener( 'message' , onMessage, false );
function enableButton() {
var tab = opera.extension.tabs.getFocused();
if (tab) {
operaBtn.disabled = false;
}
else {
operaBtn.disabled = true;
}
}
//Enable the button when a tab is ready.
opera.extension.addEventListener( 'connect', function() {
enableButton();
}, false );
opera.extension.tabs.addEventListener( 'focus', function() {
enableButton();
}, false );
opera.extension.tabs.addEventListener( 'blur', function() {
enableButton();
}, false );
</script> </script>
</head> </head>
<body> <body>