mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Minor adjustments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Copyright 2010 Alfonso Martínez de Lizarrondo & Patrick O'Reilly
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -23,8 +23,8 @@ sendtophone.init = function()
|
||||
this.prefs.setBoolPref( "installedButton", true ) ;
|
||||
}
|
||||
|
||||
document.getElementById("contentAreaContextMenu")
|
||||
.addEventListener("popupshowing", function (e){ sendtophone.showFirefoxContextMenu(e); }, false);
|
||||
document.getElementById("contentAreaContextMenu").
|
||||
addEventListener("popupshowing", function (e){ sendtophone.showFirefoxContextMenu(e); }, false);
|
||||
}
|
||||
|
||||
sendtophone.installToolbarButton = function()
|
||||
@@ -129,7 +129,7 @@ sendtophone.doDrop = function(event)
|
||||
var dt = event.dataTransfer;
|
||||
var types = dt.types;
|
||||
var supportedTypes = ["application/x-moz-file", "text/x-moz-url", "text/uri-list", "text/plain"];
|
||||
types = supportedTypes.filter(function (value) types.contains(value));
|
||||
types = supportedTypes.filter(function (value) {return types.contains(value)});
|
||||
|
||||
event.preventDefault();
|
||||
switch (types[0])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Copyright 2010 Alfonso Martínez de Lizarrondo & Patrick O'Reilly
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -111,16 +111,17 @@ var sendtophone = {
|
||||
var images = gBrowser.contentDocument.getElementsByTagName( "img" );
|
||||
|
||||
// 0: search and prompt, 1: search and launch automatically, 2: don't search
|
||||
var pref = this.prefs.getIntPref("SearchQR")
|
||||
var pref = this.prefs.getIntPref("SearchQR");
|
||||
if (pref!=2)
|
||||
{
|
||||
var QRs = [];
|
||||
for( var i=0; i<images.length; i++)
|
||||
{
|
||||
var data = this.detectQR( images[i].src );
|
||||
if (data)
|
||||
var imgData = this.detectQR( images[i].src );
|
||||
if (imgData)
|
||||
QRs.push({data: data, img: images[i]});
|
||||
}
|
||||
|
||||
if (QRs.length==1)
|
||||
{
|
||||
var data = QRs[0].data;
|
||||
@@ -257,13 +258,13 @@ var sendtophone = {
|
||||
// https://developer.mozilla.org/en/using_the_clipboard
|
||||
// Access Clipboard
|
||||
var clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
|
||||
if (!clip) return false;
|
||||
if (!clip) return;
|
||||
|
||||
if (!clip.hasDataMatchingFlavors(["text/unicode"], 1, clip.kGlobalClipboard))
|
||||
return false;
|
||||
return;
|
||||
|
||||
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
|
||||
if (!trans) return false;
|
||||
if (!trans) return;
|
||||
trans.addDataFlavor("text/unicode");
|
||||
|
||||
// Get the data
|
||||
|
||||
@@ -31,10 +31,16 @@ function addFile(upload)
|
||||
gUploadsView.appendChild( dl );
|
||||
}
|
||||
|
||||
function checkPendingUploads()
|
||||
var checkTimerEvent =
|
||||
{
|
||||
if (gUploadsView.children.length==0)
|
||||
window.close();
|
||||
notify: function(timer)
|
||||
{
|
||||
if (sendtophoneUploadsManager.isWindowNeeded())
|
||||
{
|
||||
if (gUploadsView.children.length==0)
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelUpload(item)
|
||||
@@ -66,7 +72,9 @@ let gUploadListener = {
|
||||
|
||||
// If no more pending uploads, close the tab.
|
||||
// Use a 0 ms timeout to avoid flicker while compress -> upload a folder
|
||||
window.setTimeout( checkPendingUploads, 0);
|
||||
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
checkTimer.initWithCallback(checkTimerEvent, 0, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ function initShowTest()
|
||||
return;
|
||||
|
||||
// Now it is time to create the timer...
|
||||
showTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
showTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
showTimer.initWithCallback(showTimerEvent, 400, Ci.nsITimer.TYPE_REPEATING_SLACK);
|
||||
}
|
||||
|
||||
@@ -235,9 +235,9 @@ function cancelShowTimer()
|
||||
|
||||
// https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Reusing_tabs
|
||||
function openAndReuseOneTabPerURL(url) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var browserEnumerator = wm.getEnumerator("navigator:browser");
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator);
|
||||
var browserEnumerator = wm.getEnumerator("navigator:browser");
|
||||
|
||||
// Check each browser instance for our URL
|
||||
var found = false;
|
||||
|
||||
Reference in New Issue
Block a user