mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Removed video code.
Added counter for repeat on 400 error Removed file upload URL ProxyURL set to use upload URL by default with fallback to proxyURL
This commit is contained in:
@@ -84,7 +84,7 @@ sendtophone.onOptionsShowing= function(popup)
|
|||||||
sendtophone.showFirefoxContextMenu = function(event) {
|
sendtophone.showFirefoxContextMenu = function(event) {
|
||||||
// show or hide the menuitem based on what the context menu is on
|
// show or hide the menuitem based on what the context menu is on
|
||||||
// see http://kb.mozillazine.org/Adding_items_to_menus
|
// see http://kb.mozillazine.org/Adding_items_to_menus
|
||||||
var mediaURL = gContextMenu.imageURL || gContextMenu.mediaURL;
|
var mediaURL = gContextMenu.mediaURL;
|
||||||
|
|
||||||
gContextMenu.showItem("context-sendtophone-link", gContextMenu.onLink);
|
gContextMenu.showItem("context-sendtophone-link", gContextMenu.onLink);
|
||||||
gContextMenu.showItem("context-sendtophone-image", false);
|
gContextMenu.showItem("context-sendtophone-image", false);
|
||||||
@@ -103,10 +103,11 @@ sendtophone.showFirefoxContextMenu = function(event) {
|
|||||||
else
|
else
|
||||||
gContextMenu.showItem("context-sendtophone-image", true);
|
gContextMenu.showItem("context-sendtophone-image", true);
|
||||||
}
|
}
|
||||||
|
/* TBC
|
||||||
if(mediaURL.match(/.(webm|mp4|m4v)$/i)){
|
if(mediaURL.match(/.webm$/i)){
|
||||||
gContextMenu.showItem("context-sendtophone-video", true);
|
gContextMenu.showItem("context-sendtophone-video", true);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
gContextMenu.showItem("context-sendtophone-text", gContextMenu.isTextSelected ||
|
gContextMenu.showItem("context-sendtophone-text", gContextMenu.isTextSelected ||
|
||||||
(gContextMenu.onTextInput && gContextMenu.target.selectionEnd > gContextMenu.target.selectionStart) );
|
(gContextMenu.onTextInput && gContextMenu.target.selectionEnd > gContextMenu.target.selectionStart) );
|
||||||
|
|||||||
@@ -73,17 +73,17 @@ var sendtophone = {
|
|||||||
break;
|
break;
|
||||||
case 'image':
|
case 'image':
|
||||||
title = gContextMenu.target.title || gContextMenu.target.alt;
|
title = gContextMenu.target.title || gContextMenu.target.alt;
|
||||||
url = gContextMenu.imageURL || gContextMenu.mediaURL;
|
url = gContextMenu.mediaURL;
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
title = gContextMenu.target.title || gContextMenu.target.alt;
|
title = gContextMenu.target.title || gContextMenu.target.alt;
|
||||||
url = gContextMenu.imageURL || gContextMenu.mediaURL;
|
url = gContextMenu.mediaURL;
|
||||||
if(!title)
|
if(!title)
|
||||||
title=this.getString("videoTitle");
|
title=this.getString("videoTitle");
|
||||||
break;
|
break;
|
||||||
case 'qr':
|
case 'qr':
|
||||||
title = gContextMenu.target.title || gContextMenu.target.alt;
|
title = gContextMenu.target.title || gContextMenu.target.alt;
|
||||||
url = gContextMenu.imageURL;
|
url = gContextMenu.mediaURL;
|
||||||
|
|
||||||
var data = this.detectQR(url);
|
var data = this.detectQR(url);
|
||||||
if (this.validURI(data))
|
if (this.validURI(data))
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
pref("extensions.sendtophone.installedButton", false);
|
pref("extensions.sendtophone.installedButton", false);
|
||||||
pref("extensions.sendtophone.appUrl", "https://chrometophone.appspot.com");
|
pref("extensions.sendtophone.appUrl", "https://chrometophone.appspot.com");
|
||||||
|
|
||||||
pref("extensions.sendtophone.proxyUrl", "http://foxtophone.com/?ml=");
|
pref("extensions.sendtophone.proxyUrl", "http://foxtophone.com/");
|
||||||
pref("extensions.sendtophone.fileServerUrl", "http://martinezdelizarrondo.com/sendtophone.php");
|
pref("extensions.sendtophone.fileServerUrl", "");
|
||||||
pref("extensions.sendtophone.fileUploadMaxKb", 50000);
|
pref("extensions.sendtophone.fileUploadMaxKb", 50000);
|
||||||
pref("extensions.sendtophone.SearchQR", 0); // 0: search and prompt, 1: search and launch automatically, 2: don't search
|
pref("extensions.sendtophone.SearchQR", 0); // 0: search and prompt, 1: search and launch automatically, 2: don't search
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ var sendtophoneCore = {
|
|||||||
loggedInUrl : "http://code.google.com/p/chrometophone/logo?login",
|
loggedInUrl : "http://code.google.com/p/chrometophone/logo?login",
|
||||||
loggedOutUrl : "http://code.google.com/p/chrometophone/logo?logout",
|
loggedOutUrl : "http://code.google.com/p/chrometophone/logo?logout",
|
||||||
apkUrl : "http://code.google.com/p/chrometophone/wiki/AndroidApp",
|
apkUrl : "http://code.google.com/p/chrometophone/wiki/AndroidApp",
|
||||||
|
retryCount : 0,
|
||||||
|
|
||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
@@ -134,7 +135,8 @@ var sendtophoneCore = {
|
|||||||
if (req.status==500 && body.substr(0,27) =="ERROR (Unable to send link)"){
|
if (req.status==500 && body.substr(0,27) =="ERROR (Unable to send link)"){
|
||||||
sendtophoneCore.openTab( "http://www.foxtophone.com/status500/" );
|
sendtophoneCore.openTab( "http://www.foxtophone.com/status500/" );
|
||||||
}
|
}
|
||||||
else if (req.status==400){
|
else if (req.status==400&&this.retryCount<4){
|
||||||
|
this.retryCount++;
|
||||||
this.processXHR(this.sendUrl, 'POST', this.pendingMessage, this.processSentData);
|
this.processXHR(this.sendUrl, 'POST', this.pendingMessage, this.processSentData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,9 +194,10 @@ var sendtophoneCore = {
|
|||||||
if (!(/^(https?):/i).test( url ))
|
if (!(/^(https?):/i).test( url ))
|
||||||
{
|
{
|
||||||
// Rewrite the URI so it's send first to the proxy
|
// Rewrite the URI so it's send first to the proxy
|
||||||
var proxyUrl = this.prefs.getCharPref( "proxyUrl" );
|
var proxyUrl;
|
||||||
|
this.prefs.getCharPref( "fileServerUrl" ) ? proxyUrl = this.prefs.getCharPref( "fileServerUrl" ) :proxyUrl = this.prefs.getCharPref( "proxyUrl" );
|
||||||
if (proxyUrl)
|
if (proxyUrl)
|
||||||
url = proxyUrl + encodeURIComponent( url);
|
url = proxyUrl + "?ml=" + encodeURIComponent( url);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = 'title=' + encodeURIComponent(title) +
|
var data = 'title=' + encodeURIComponent(title) +
|
||||||
@@ -211,6 +214,7 @@ var sendtophoneCore = {
|
|||||||
if (body.substring(0, 2) == 'OK')
|
if (body.substring(0, 2) == 'OK')
|
||||||
{
|
{
|
||||||
delete this.pendingMessage;
|
delete this.pendingMessage;
|
||||||
|
this.retryCount=0;
|
||||||
this.popupNotification(this.getString("InfoSent"));
|
this.popupNotification(this.getString("InfoSent"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user