mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Opera to Phone v1.3.2 (bug fixes)
This commit is contained in:
2
third_party/operatophone/config.xml
vendored
2
third_party/operatophone/config.xml
vendored
@@ -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.1">
|
<widget xmlns="http://www.w3.org/ns/widgets" id="https://addons.opera.com/addons/extensions/details/opera-to-phone/" version="1.3.2">
|
||||||
<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_64.png"/>
|
<icon src="icon_64.png"/>
|
||||||
|
|||||||
@@ -3,13 +3,15 @@
|
|||||||
// @include https://*
|
// @include https://*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
var ACTION_CAPTURE_SELECTION = 'capture_selection';
|
if ( window.location === window.parent.location) {
|
||||||
var ACTION_SEND_PAGE = 'send_to_phone';
|
|
||||||
var ACTION_CLOSE_TAB = 'close_tab';
|
|
||||||
|
|
||||||
var currentUrl = document.location.href;
|
var ACTION_CAPTURE_SELECTION = 'capture_selection';
|
||||||
|
var ACTION_SEND_PAGE = 'send_to_phone';
|
||||||
|
var ACTION_CLOSE_TAB = 'close_tab';
|
||||||
|
|
||||||
opera.extension.addEventListener( 'message', function( message ) {
|
var currentUrl = document.location.href;
|
||||||
|
|
||||||
|
opera.extension.addEventListener( 'message', function( message ) {
|
||||||
if( message.data.action === ACTION_CAPTURE_SELECTION ) {
|
if( message.data.action === ACTION_CAPTURE_SELECTION ) {
|
||||||
var pageInfo = {
|
var pageInfo = {
|
||||||
action: ACTION_SEND_PAGE,
|
action: ACTION_SEND_PAGE,
|
||||||
@@ -28,9 +30,9 @@ opera.extension.addEventListener( 'message', function( message ) {
|
|||||||
}
|
}
|
||||||
opera.extension.postMessage( pageInfo );
|
opera.extension.postMessage( pageInfo );
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
function findAndReplace(searchText, replacement, searchNode) {
|
function findAndReplace(searchText, replacement, searchNode) {
|
||||||
if (!searchText || typeof replacement === 'undefined') {
|
if (!searchText || typeof replacement === 'undefined') {
|
||||||
// Throw error here if you want...
|
// Throw error here if you want...
|
||||||
return;
|
return;
|
||||||
@@ -63,8 +65,8 @@ function findAndReplace(searchText, replacement, searchNode) {
|
|||||||
parent.insertBefore(frag, currentNode);
|
parent.insertBefore(frag, currentNode);
|
||||||
parent.removeChild(currentNode);
|
parent.removeChild(currentNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.addEventListener( 'DOMContentLoaded', function() {
|
window.addEventListener( 'DOMContentLoaded', function() {
|
||||||
if( currentUrl.match( /^http[s]?:\/\/www\.google\.com\/accounts\/ServiceLogin\?(.*)?ahname=Chrome\+to\+Phone(.*)?$/i ) ) {
|
if( currentUrl.match( /^http[s]?:\/\/www\.google\.com\/accounts\/ServiceLogin\?(.*)?ahname=Chrome\+to\+Phone(.*)?$/i ) ) {
|
||||||
// Opera log in message so users know what they are logging in to.
|
// Opera log in message so users know what they are logging in to.
|
||||||
findAndReplace('Chrome', 'Opera', document.body);
|
findAndReplace('Chrome', 'Opera', document.body);
|
||||||
@@ -73,4 +75,6 @@ window.addEventListener( 'DOMContentLoaded', function() {
|
|||||||
action: ACTION_CLOSE_TAB
|
action: ACTION_CLOSE_TAB
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user