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:
patrick.oreilly
2010-08-15 01:34:55 +00:00
parent 8271b5f0df
commit 903dde3cf1
4 changed files with 16 additions and 11 deletions

View File

@@ -84,7 +84,7 @@ sendtophone.onOptionsShowing= function(popup)
sendtophone.showFirefoxContextMenu = function(event) {
// show or hide the menuitem based on what the context menu is on
// 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-image", false);
@@ -103,10 +103,11 @@ sendtophone.showFirefoxContextMenu = function(event) {
else
gContextMenu.showItem("context-sendtophone-image", true);
}
if(mediaURL.match(/.(webm|mp4|m4v)$/i)){
/* TBC
if(mediaURL.match(/.webm$/i)){
gContextMenu.showItem("context-sendtophone-video", true);
}
*/
gContextMenu.showItem("context-sendtophone-text", gContextMenu.isTextSelected ||
(gContextMenu.onTextInput && gContextMenu.target.selectionEnd > gContextMenu.target.selectionStart) );

View File

@@ -73,17 +73,17 @@ var sendtophone = {
break;
case 'image':
title = gContextMenu.target.title || gContextMenu.target.alt;
url = gContextMenu.imageURL || gContextMenu.mediaURL;
url = gContextMenu.mediaURL;
break;
case 'video':
title = gContextMenu.target.title || gContextMenu.target.alt;
url = gContextMenu.imageURL || gContextMenu.mediaURL;
url = gContextMenu.mediaURL;
if(!title)
title=this.getString("videoTitle");
break;
case 'qr':
title = gContextMenu.target.title || gContextMenu.target.alt;
url = gContextMenu.imageURL;
url = gContextMenu.mediaURL;
var data = this.detectQR(url);
if (this.validURI(data))

View File

@@ -1,8 +1,8 @@
pref("extensions.sendtophone.installedButton", false);
pref("extensions.sendtophone.appUrl", "https://chrometophone.appspot.com");
pref("extensions.sendtophone.proxyUrl", "http://foxtophone.com/?ml=");
pref("extensions.sendtophone.fileServerUrl", "http://martinezdelizarrondo.com/sendtophone.php");
pref("extensions.sendtophone.proxyUrl", "http://foxtophone.com/");
pref("extensions.sendtophone.fileServerUrl", "");
pref("extensions.sendtophone.fileUploadMaxKb", 50000);
pref("extensions.sendtophone.SearchQR", 0); // 0: search and prompt, 1: search and launch automatically, 2: don't search

View File

@@ -26,6 +26,7 @@ var sendtophoneCore = {
loggedInUrl : "http://code.google.com/p/chrometophone/logo?login",
loggedOutUrl : "http://code.google.com/p/chrometophone/logo?logout",
apkUrl : "http://code.google.com/p/chrometophone/wiki/AndroidApp",
retryCount : 0,
init: function()
{
@@ -134,7 +135,8 @@ var sendtophoneCore = {
if (req.status==500 && body.substr(0,27) =="ERROR (Unable to send link)"){
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);
}
else
@@ -192,9 +194,10 @@ var sendtophoneCore = {
if (!(/^(https?):/i).test( url ))
{
// 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)
url = proxyUrl + encodeURIComponent( url);
url = proxyUrl + "?ml=" + encodeURIComponent( url);
}
var data = 'title=' + encodeURIComponent(title) +
@@ -211,6 +214,7 @@ var sendtophoneCore = {
if (body.substring(0, 2) == 'OK')
{
delete this.pendingMessage;
this.retryCount=0;
this.popupNotification(this.getString("InfoSent"));
return;
}