mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Added context menu item for QR codes generated by the Google Charts API
Changed title to Fox To Phone and updated icon asset.
This commit is contained in:
@@ -87,6 +87,9 @@ sendtophone.showFirefoxContextMenu = function(event) {
|
||||
// see http://kb.mozillazine.org/Adding_items_to_menus
|
||||
gContextMenu.showItem("context-sendtophone-link", gContextMenu.onLink);
|
||||
gContextMenu.showItem("context-sendtophone-image", gContextMenu.onImage);
|
||||
var qrPat1=/^http:\/\/chart.apis.google.com\/chart\?/;
|
||||
var qrPat2=/cht=qr/;
|
||||
gContextMenu.showItem("context-sendtophone-qrimage", (gContextMenu.onImage & qrPat1.test(gContextMenu.imageURL) && qrPat2.test(gContextMenu.imageURL)));
|
||||
gContextMenu.showItem("context-sendtophone-text", gContextMenu.isTextSelected ||
|
||||
(gContextMenu.onTextInput && gContextMenu.target.selectionEnd > gContextMenu.target.selectionStart) );
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
accesskey="&sendtophoneContextImage.accesskey;"
|
||||
insertafter="context-sendimage"
|
||||
oncommand="sendtophone.onMenuItemCommand(event, 'image')"/>
|
||||
<menuitem id="context-sendtophone-qrimage" label="&sendtophoneContextQrImage.label;"
|
||||
class="menuitem-iconic"
|
||||
accesskey="&sendtophoneContextQrImage.accesskey;"
|
||||
insertafter="context-sendimage"
|
||||
oncommand="sendtophone.onMenuItemCommand(event, 'qr')"/>
|
||||
|
||||
<menuitem id="context-sendtophone-text" label="&sendtophoneContextText.label;"
|
||||
class="menuitem-iconic"
|
||||
accesskey="&sendtophoneContextText.accesskey;"
|
||||
|
||||
@@ -54,29 +54,33 @@ var sendtophone = {
|
||||
title = gContextMenu.target.title || gContextMenu.target.alt;
|
||||
url = gContextMenu.imageURL;
|
||||
selection = '';
|
||||
break;
|
||||
case 'qr':
|
||||
title = gContextMenu.target.title || gContextMenu.target.alt;
|
||||
url = gContextMenu.imageURL;
|
||||
|
||||
// Detect images of QR codes generated by the Google Charts API
|
||||
// Extract the URI if valid and sendtophone
|
||||
var qrPref = this.prefs.getBoolPref( "qrlink" ) ;
|
||||
var chartType="cht=qr";
|
||||
var chartLink="chl=";
|
||||
var chartUrl="http://chart.apis.google.com/chart?";
|
||||
if(!url.indexOf(chartUrl)&&url.match(chartType)&&qrPref){
|
||||
qrUrl=url.replace(chartUrl, '');
|
||||
qrArray = qrUrl.split("&");
|
||||
var chartLink=/^chl=/;
|
||||
var chartUrl=/^http:\/\/chart.apis.google.com\/chart\?/;
|
||||
|
||||
url=url.replace(chartUrl, '');
|
||||
qrArray = url.split("&");
|
||||
for(qrI=0;qrI<qrArray.length;qrI++){
|
||||
if(!qrArray[qrI].indexOf(chartLink)){
|
||||
if(chartLink.test(qrArray[qrI])){
|
||||
//Decode and Unescape any URL encoded in the QR Image Link
|
||||
qrUrl=decodeURI(unescape(qrArray[qrI].replace(chartLink, '')));
|
||||
if(this.validURI(qrUrl)){
|
||||
url=qrUrl;
|
||||
url=decodeURI(unescape(qrArray[qrI].replace(chartLink, '')));
|
||||
if(this.validURI(url)){
|
||||
url=url;
|
||||
}
|
||||
}
|
||||
}
|
||||
//If the QR Image has no title text, give it one.
|
||||
|
||||
if(!title){
|
||||
title=this.strings.getString("qrTitle");
|
||||
}
|
||||
}
|
||||
selection = '';
|
||||
break;
|
||||
case 'text':
|
||||
title = "Selection";
|
||||
@@ -147,6 +151,11 @@ var sendtophone = {
|
||||
return url.match("http://maps\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?[/?].*") || url.match("http://www\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?/maps.*");
|
||||
},
|
||||
|
||||
validURI: function(uri)
|
||||
{
|
||||
return (/^(https?|market|tel|sms(to)?|mms(to)?|mailto|ftp):/i).test( uri );
|
||||
},
|
||||
|
||||
initPopup: function()
|
||||
{
|
||||
var fileServerUrl = this.prefs.getCharPref( "fileServerUrl" );
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!ENTITY sendtophoneToolbarButton.label "Send to Phone">
|
||||
<!ENTITY sendtophoneToolbarButton.label "Fox to Phone">
|
||||
<!ENTITY sendtophoneToolbarButton.tooltip "Send this page to your Android Phone">
|
||||
<!ENTITY sendtophoneContext.label "Send this link to Android">
|
||||
<!ENTITY sendtophoneContext.accesskey "A">
|
||||
@@ -16,3 +16,5 @@
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -16,3 +16,5 @@
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "E">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Enviar carpeta...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "C">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Enviar imagen QR a Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
@@ -12,5 +12,9 @@
|
||||
<!ENTITY sendtophoneContextLogout.accesskey "L">
|
||||
<!ENTITY sendtophoneOptions.title "Send to Phone Preferences">
|
||||
<!ENTITY sendtophoneProtocols.label "Protocols">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send file...">
|
||||
<!ENTITY sendtophoneContextSendFile.label "Send files...">
|
||||
<!ENTITY sendtophoneContextSendFile.accesskey "S">
|
||||
<!ENTITY sendtophoneContextSendFolder.label "Send folder...">
|
||||
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
|
||||
<!ENTITY sendtophoneContextQrImage.label "Send decoded QR Link to Android">
|
||||
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
|
||||
|
||||
BIN
third_party/firefox_sendtophone/chrome/skin/icon.png
vendored
BIN
third_party/firefox_sendtophone/chrome/skin/icon.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.3 KiB |
@@ -12,7 +12,5 @@ pref("extensions.sendtophone.protocols.mms", false); // conflicts with http://en
|
||||
pref("extensions.sendtophone.protocols.mmsto", true);
|
||||
pref("extensions.sendtophone.protocols.tel", true);
|
||||
|
||||
pref("extensions.sendtophone.qrlink", true);
|
||||
|
||||
// https://developer.mozilla.org/en/Localizing_extension_descriptions
|
||||
pref("extensions.sendtophone@martinezdelizarrondo.com.description", "chrome://sendtophone/locale/overlay.properties");
|
||||
|
||||
2
third_party/firefox_sendtophone/install.rdf
vendored
2
third_party/firefox_sendtophone/install.rdf
vendored
@@ -3,7 +3,7 @@
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>sendtophone@martinezdelizarrondo.com</em:id>
|
||||
<em:type>2</em:type>
|
||||
<em:name>Send To Phone</em:name>
|
||||
<em:name>Fox To Phone</em:name>
|
||||
<em:version>1.1</em:version>
|
||||
<em:creator>Alfonso & Patrick</em:creator>
|
||||
<em:description>Send links to your Android 2.2 phone using the new C2DM service. Based on the ChromeToPhone extension.</em:description>
|
||||
|
||||
Reference in New Issue
Block a user