[Pkg-mozext-commits] [automatic-save-folder] 94/133: Add: + Compatibility with Firefox 7.0.1 new saving style.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch wip
in repository automatic-save-folder.

commit d4158b836e7cc202f47d49054ec494a7a23778ed
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sun Oct 9 11:00:17 2011 +0000

    Add:
    + Compatibility with Firefox 7.0.1 new saving style.
    
    Remove:
    - Removed the beta checking for non beta releases. (This version is a quick fix
      to be released soon, not a real beta).
    
    Changes:
    * Changed the way the tabs are read from right-click script to add protocol back
      to the URL checking string (tabs are hiding "http://" from the tab's URL since
      Firefox 7.0.1, but not other protocols like https).
    * Prevent closing the save dialog if the preferences dialog is still open.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@101 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js                         |  4 +-
 content/asf_download.js                | 23 ++++++++++--
 content/asf_right_click.js             | 67 +++++++++++++++++++++++++---------
 content/common.dtd                     |  2 +-
 content/help/about.xhtml               |  6 ++-
 content/options.xul                    |  4 +-
 content/overlay_unknownContentType.xul |  6 +--
 install.rdf                            |  2 +-
 locale/cs/about.dtd                    |  4 ++
 locale/en-US/about.dtd                 |  4 ++
 locale/fr/about.dtd                    |  4 ++
 locale/it/about.dtd                    |  4 ++
 locale/ru/about.dtd                    |  4 ++
 locale/sv-SE/about.dtd                 |  6 ++-
 14 files changed, 108 insertions(+), 32 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index b1f93dc..5e799db 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -55,7 +55,7 @@ var automatic_save_folder = {
 		this.asf_treeSelected(); // set the button to disabled state because no filter is selected when openning
 		this.asf_toggleradio(); // set the radio choice to the right place
 		this.asf_variablemode(); // check if variable mode is on or off, and change mode if needed
-		if(this.prefManager.getBoolPref("extensions.asf.autoCheckBetaUpdate")) this.checkBetaVersion(true); // Check the latest available (beta) version
+		// if(this.prefManager.getBoolPref("extensions.asf.autoCheckBetaUpdate")) this.checkBetaVersion(true); // Check the latest available (beta) version
 		
 		// Resize the preferences window to match the localization needs.
 		// I don't know why width, or css width are not working, so let's use a script to resize the preferences window on load.
@@ -1754,13 +1754,13 @@ var automatic_save_folder = {
 	asf_close: function() {
 		
 		//close the options	
-		window.close();
 		if (window.opener.location == "chrome://mozapps/content/downloads/unknownContentType.xul") // if the option is opened from the saving window
 		{
 			window.opener.automatic_save_folder.main();		// rescan the filters to set the good folder
 			window.opener.automatic_save_folder.check_uCTOption();
 			window.opener.sizeToContent(); // can create a bug, but it should not be noticed by the user. see https://bugzilla.mozilla.org/show_bug.cgi?id=439323
 		}
+		window.close();
 		window.opener.focus;
 	}
 	
diff --git a/content/asf_download.js b/content/asf_download.js
index 666f750..095efdb 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -1,6 +1,6 @@
 /* ***** BEGIN LICENSE BLOCK *****
 Automatic Save Folder
-Copyright (C) 2007-2010 Éric Cassar (Cyan).
+Copyright (C) 2007-2011 Éric Cassar (Cyan).
 			  2009 Ted Gifford - Dynamic variable capturing
 
     "Automatic Save Folder" is free software: you can redistribute it and/or modify
@@ -33,6 +33,7 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 		inPrivateBrowsing: false,
 		matching_filters: new Array(),
 		matching_folders: new Array(),
+		current_uri: "", // FF7.0.1 use a new per uri saved folder.
 		
 	main: function () {
 
@@ -86,9 +87,11 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 			currentDomain = domain;
 			currentURL = fileURL;
 		}
+		
+		if (this.firefoxversion >= 7.01) this.current_uri = currentDomain.replace(/^.*:\/\//g,'');
+		
 		var domain_testOrder = prefManager.getCharPref("extensions.asf.domainTestOrder");
 		if (this.trim(domain_testOrder) == "") domain_testOrder = "1,5";
-		
 		var message = "These data will be used to verify the filters :\nFilename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n1 - File's domain:\t"+domain+"\n2 - File's URL:\t\t"+fileURL+"\n3 - Full file's URL:\t"+fileURLAndFilename+"\n4 - Tab's domain:\t"+currentDomain+"\n5 - Tab's URL:\t\t"+currentURL;
 		if (!this.inPrivateBrowsing) this.console_print(message);
 		// debug : show the full downloaded link  http://abc.xyz/def/file.ext
@@ -399,6 +402,16 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 			}
 			
 		}
+		
+		if (this.firefoxversion >= 7.01)
+		{
+			// Firefox 7.0.1 use a new feature to memorize last used folder on a site-by-site basis.
+			// Replace the memorized folder for the current website's URI.
+			var uri = this.current_uri;
+			// var file = gDownloadLastDir.getFile(uri);
+			// alert("uri="+uri+"\noldpath ="+file.path+"\nnewpath ="+directory.path);
+			gDownloadLastDir.setFile(uri, directory);
+		}
 	},
 	
 	
@@ -1100,7 +1113,11 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 
 	checkFirefoxVersion: function() {
 		
-		if (this.versionChecker.compare(this.appInfo.version, "4.0b1") >= 0)
+		if (this.versionChecker.compare(this.appInfo.version, "7.0.1") >= 0)
+		{
+			this.firefoxversion = "7.01";
+		}
+		else if (this.versionChecker.compare(this.appInfo.version, "4.0b1") >= 0)
 		{
 			this.firefoxversion = "4";
 		}
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 7c62e7e..ca3f8ff 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -36,6 +36,7 @@ var automatic_save_folder = {
 	result: "", // print_r result
 	previousASFVersion: "",
 	currentASFVersion : "",
+	current_uri: "", // FF7.0.1 use a new per uri saved folder.
 	
 	rightclick_init: function() {
 		if (!asf_rightclick_loaded) 
@@ -116,31 +117,41 @@ var automatic_save_folder = {
 				
 				
 			// load the domain and the filename of the saved file
+			var tBrowser = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+						.getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").getBrowser();
+			var tabLocation = tBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
 			var filename = aFpP.fileInfo.fileName; // filename or tab's name if no filename specified.
-			if (typeof(aFpP.fileInfo.uri.fileName) != "undefined") // if the download is from an URL
-			{
-				var domain = 					aFpP.fileInfo.uri.scheme+"://"+aFpP.fileInfo.uri.host;
-				var	domainWithoutProtocol =    	aFpP.fileInfo.uri.host;
-				var fileURL = 					aFpP.fileInfo.uri.prePath+aFpP.fileInfo.uri.directory; 
-				var fileURLAndFilename=			aFpP.fileInfo.uri.prePath+aFpP.fileInfo.uri.path;
-				var currentDomain = document.getElementById("urlbar").value; // look for the current website URL in the DOM.
-					currentDomain = currentDomain.match(/^(.*?:\/\/)?.*?[^\/]+/);
-					currentDomain = currentDomain[0];
-				var currentURL = document.getElementById("urlbar").value;
+
+			var domain = 					aFpP.fileInfo.uri.scheme+"://"+aFpP.fileInfo.uri.host;
+			var	domainWithoutProtocol =    	aFpP.fileInfo.uri.host;
+			var fileURL = 					aFpP.fileInfo.uri.prePath+aFpP.fileInfo.uri.directory; 
+			var fileURLAndFilename=			aFpP.fileInfo.uri.prePath+aFpP.fileInfo.uri.path;
 			
+			var currentDomain, currentURL = "";
+			try
+			{
+				currentDomain = 	tabLocation.protocol + "//" + tabLocation.host; // look for the current website URL in the DOM.
+				currentURL = 		tabLocation.href; // look for the current website URL in the DOM.
 			}
-			else //  If the saved data is not from an URL (example : Abduction! add-on)
+			catch (e) // if there is no data (The tab is closed or it's a script redirection), use the file's data.
+			{
+				currentDomain = domain;
+				currentURL = fileURL;
+			}
+			
+			if (typeof(aFpP.fileInfo.uri.fileName) == "undefined") //  If the saved data is not from an URL (example : old Abduction! add-on)
 			{
-				var domain = document.getElementById("urlbar").value;
-					domain = domain.match(/^(.*?:\/\/)?.*?[^\/]+/);
-					domain = domain[0];
+				var domain = currentDomain;
 				var domainWithoutProtocol =  domain.replace(/^.*:\/\//g,'');  // remove the protocol name from the domain
 				var fileURL = "";
 				var fileURLAndFilename = domain+"/"+filename;
-				var currentDomain = domain;
-				var currentURL = document.getElementById("urlbar").value;
 			}
-			var message = "These data will be used to verify the filters :\nFilename:\t\t"+filename +"\n1 - File's domain:\t"+domain+"\n2 - File's URL:\t\t"+fileURL+"\n3 - Full file's URL:\t"+fileURLAndFilename+"\n4 - Tab's domain:\t"+currentDomain+"\n5 - Tab's URL:\t\t"+currentURL;
+			
+			if (this.firefoxversion >= 7.01) this.current_uri = currentDomain.replace(/^.*:\/\//g,'');
+			
+			var domain_testOrder = prefManager.getCharPref("extensions.asf.domainTestOrder");
+			if (this.trim(domain_testOrder) == "") domain_testOrder = "1,5";
+			var message = "These data will be used to verify the filters :\nFilename:\t\t"+filename+"\nDomain test order:\t"+domain_testOrder+"\n1 - File's domain:\t"+domain+"\n2 - File's URL:\t\t"+fileURL+"\n3 - Full file's URL:\t"+fileURLAndFilename+"\n4 - Tab's domain:\t"+currentDomain+"\n5 - Tab's URL:\t\t"+currentURL;
 			if (!this.inPrivateBrowsing) this.console_print(message);
 			
 			
@@ -361,6 +372,22 @@ var automatic_save_folder = {
 					this.saveUnicodeString("browser.download.dir", directory.path);
 			}
 		}
+		
+		if (this.firefoxversion >= 7.01)
+		{
+			
+			if (typeof(gDownloadLastDir) == "undefined") // if not loaded yet
+			{
+				Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
+			}
+				
+			// Firefox 7.0.1 use a new feature to memorize last used folder on a site-by-site basis.
+			// Replace the memorized folder for the current website's URI.
+			var uri = this.current_uri;
+			// var file = gDownloadLastDir.getFile(uri);
+			// alert("uri="+uri+"\noldpath ="+file.path+"\nnewpath ="+directory.path);
+			gDownloadLastDir.setFile(uri, directory);
+		}
 	},
 	
 	
@@ -743,7 +770,11 @@ var automatic_save_folder = {
 	
 	checkFirefoxVersion: function() {
 		
-		if (this.versionChecker.compare(this.appInfo.version, "4.0b1") >= 0)
+		if (this.versionChecker.compare(this.appInfo.version, "7.0.1") >= 0)
+		{
+			this.firefoxversion = "7.01";
+		}
+		else if (this.versionChecker.compare(this.appInfo.version, "4.0b1") >= 0)
 		{
 			this.firefoxversion = "4";
 		}
diff --git a/content/common.dtd b/content/common.dtd
index 0e981b4..6f7e795 100644
--- a/content/common.dtd
+++ b/content/common.dtd
@@ -1,5 +1,5 @@
 <!-- Current version -->
-<!ENTITY asf.version "1.0.2">
+<!ENTITY asf.version "1.0.3b">
 
 <!ENTITY about.translators "
 - cs : Stanislav Horáček<br />
diff --git a/content/help/about.xhtml b/content/help/about.xhtml
index 5ce9c75..4884daa 100644
--- a/content/help/about.xhtml
+++ b/content/help/about.xhtml
@@ -8,7 +8,7 @@
 ]>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!-- ***** BEGIN LICENSE BLOCK *****
-	Copyright 2007-2010 Éric Cassar (Cyan)
+	Copyright 2007-2011 Éric Cassar (Cyan)
 
     This file is part of "Automatic Save Folder".
     You may find the license in the LICENSE file
@@ -34,6 +34,10 @@
 ! &about.fix; 
 
 
+<strong>&about.version.title; 1.0.3 :</strong> (2011 10 09)
+&about.version.103;
+
+
 <strong>&about.version.title; 1.0.2 :</strong> (2011 03 26)
 &about.version.102;
 
diff --git a/content/options.xul b/content/options.xul
index 9b8962a..b812faa 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- ***** BEGIN LICENSE BLOCK *****
-	Copyright 2007-2010 Éric Cassar (Cyan)
+	Copyright 2007-2011 Éric Cassar (Cyan)
 
     This file is part of "Automatic Save Folder".
     You may find the license in the LICENSE file
@@ -261,7 +261,7 @@
 										</hbox>
 									</radiogroup>
 							</groupbox>
-							<groupbox><caption label="&asf.option.groupbox.checkUpdate.label;" />
+							<groupbox style="display:none;"><caption label="&asf.option.groupbox.checkUpdate.label;" />
 								<hbox>
 									<button id="asf-checkBetaUpdate" label="&asf.checkBetaUpdate.button;" oncommand="automatic_save_folder.checkBetaVersion();"/>
 									<description id="asf-betaVersionAvailable" hidden="true">&asf.betaVersionAvailable.label;</description>
diff --git a/content/overlay_unknownContentType.xul b/content/overlay_unknownContentType.xul
index 787b72d..54fb5f8 100644
--- a/content/overlay_unknownContentType.xul
+++ b/content/overlay_unknownContentType.xul
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- ***** BEGIN LICENSE BLOCK *****
-	Copyright 2007-2010 Éric Cassar (Cyan)
+	Copyright 2007-2011 Éric Cassar (Cyan)
 
     This file is part of "Automatic Save Folder".
     You may find the license in the LICENSE file
@@ -32,8 +32,8 @@
 		</radiogroup>
 		<separator class="thin"/>
 		<hbox>
-			<image src="chrome://asf/skin/add.png" onclick="window.openDialog('chrome://asf/content/options.xul','asf_option','chrome, centerscreen, resizable=yes, dialog=no, modal=no');" />
-			<description onclick="window.openDialog('chrome://asf/content/options.xul','asf_option','chrome, centerscreen, resizable=yes, dialog=no, modal=no');">&asf.addedit.label;</description>
+			<image src="chrome://asf/skin/add.png" onclick="window.openDialog('chrome://asf/content/options.xul','asf_option','chrome, centerscreen, resizable=yes, dialog=no, modal=yes');" />
+			<description onclick="window.openDialog('chrome://asf/content/options.xul','asf_option','chrome, centerscreen, resizable=yes, dialog=no, modal=yes');">&asf.addedit.label;</description>
 		</hbox>	
 	</vbox>
 
diff --git a/install.rdf b/install.rdf
index b7ff842..a7ebc3f 100644
--- a/install.rdf
+++ b/install.rdf
@@ -100,7 +100,7 @@
 			<Description>
 				<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
 				<em:minVersion>1.5</em:minVersion>
-				<em:maxVersion>4.0.*</em:maxVersion>
+				<em:maxVersion>7.*</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 	</Description>
diff --git a/locale/cs/about.dtd b/locale/cs/about.dtd
index 7496b5b..3cc1295 100644
--- a/locale/cs/about.dtd
+++ b/locale/cs/about.dtd
@@ -23,6 +23,10 @@
 <!ENTITY about.version.title "Verze">
 
 <!-- Keep the newline intact as it uses the < pre > tag, keep the 2 beginning spaces to create indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1: Compatibility with the new Last Saved Path feature (Now memorized on a site-by-site basis).
+- Removed beta checking feature on non beta releases.
+* Prevent closing the save dialog if the preferences dialog is still open.">
+
 <!ENTITY about.version.102 "+ Přidána možnost změnit akci v možnostech automatického stahování.
 + Je-li nainstalováno rozšíření DownThemAll!, na novém panelu možností lze nastavení posílání složky určené AUS do dTa!.
 + Přidána možnost výběru, zda u filtrů záleží, nebo nezáleží na velikosti písmen.
diff --git a/locale/en-US/about.dtd b/locale/en-US/about.dtd
index d0c0868..d2104ed 100644
--- a/locale/en-US/about.dtd
+++ b/locale/en-US/about.dtd
@@ -23,6 +23,10 @@
 <!ENTITY about.version.title "Version">
 
 <!-- Keep the newline intact as it uses the < pre > tag, keep the 2 beginning spaces to create indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1: Compatibility with the new Last Saved Path feature (Now memorized on a site-by-site basis).
+- Removed beta checking feature on non beta releases.
+* Prevent closing the save dialog if the preferences dialog is still open.">
+
 <!ENTITY about.version.102 "+ Added an option to force the action when using the automatic download option.
 + If DownThemAll! add-on is installed, a new option's tab is available to send ASF target path to dTa!.
 + Added an option to select if the filters are case sensitive or insensitive.
diff --git a/locale/fr/about.dtd b/locale/fr/about.dtd
index f8f612b..e9625d3 100644
--- a/locale/fr/about.dtd
+++ b/locale/fr/about.dtd
@@ -23,6 +23,10 @@
 <!ENTITY about.version.title "Version">
 
 <!-- Conserver les retours à la ligne car le tag < pre > est utilisé, gardez les deux espaces en début de ligne pour l'indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1 : Compatible avec la nouvelle fonction concernant le dernier chemin d'enregistrement (Maintenant mémorisé site par site).
+- Suppression de la recherche d'une nouvelle version béta pour les versions non béta.
+* Empêche la fermeture de la fenêtre de sauvegarde si la fenêtre de préférence est encore ouverte.">
+
 <!ENTITY about.version.102 "+ Ajout d'une option permettant de forcer l'action à effectuer lorsque l'enregistrement automatique est sélectionné.
 + Si l'extension DownThemAll! est installée, un nouvel onglet d'options est disponible permettant d'envoyer le dossier de destination d'ASF à dTa!.
 + Ajout d'une option permettant de choisir si les filtres sont sensibles ou insensibles à la casse.
diff --git a/locale/it/about.dtd b/locale/it/about.dtd
index a479e05..f1d5430 100644
--- a/locale/it/about.dtd
+++ b/locale/it/about.dtd
@@ -23,6 +23,10 @@
 <!ENTITY about.version.title "Versione">
 
 <!-- Keep the newline intact as it uses the < pre > tag, keep the 2 beginning spaces to create indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1: Compatibility with the new Last Saved Path feature (Now memorized on a site-by-site basis).
+- Removed beta checking feature on non beta releases.
+* Prevent closing the save dialog if the preferences dialog is still open.">
+
 <!ENTITY about.version.102 "+ Added an option to force the action when using the automatic download option.
 + If DownThemAll! add-on is installed, a new option's tab is available to send ASF target path to dTa!.
 + Added an option to select if the filters are case sensitive or insensitive.
diff --git a/locale/ru/about.dtd b/locale/ru/about.dtd
index 8a4784a..ad5fef6 100644
--- a/locale/ru/about.dtd
+++ b/locale/ru/about.dtd
@@ -23,6 +23,10 @@
 <!ENTITY about.version.title "Версия">
 
 <!-- Keep the newline intact as it uses the < pre > tag, keep the 2 beginning spaces to create indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1: Compatibility with the new Last Saved Path feature (Now memorized on a site-by-site basis).
+- Removed beta checking feature on non beta releases.
+* Prevent closing the save dialog if the preferences dialog is still open.">
+
 <!ENTITY about.version.102 "+ Добавлена опция выбора действия для автоматического сохранения.
 + Если установлено расширение DownThemAll!, доступны новые опции для настройки взаимодействия с ним.
 + Настройки обработки регистра в фильтрах.
diff --git a/locale/sv-SE/about.dtd b/locale/sv-SE/about.dtd
index 2304786..d9dad77 100644
--- a/locale/sv-SE/about.dtd
+++ b/locale/sv-SE/about.dtd
@@ -22,7 +22,11 @@
 <!ENTITY about.fix "Korrigerat">
 <!ENTITY about.version.title "Version">
 
-<!-- Keep the newline intact as it uses the < pre > tag, keep the 2 begining spaces to create indentation -->
+<!-- Keep the newline intact as it uses the < pre > tag, keep the 2 beginning spaces to create indentation -->
+<!ENTITY about.version.103 "+ Firefox 7.0.1: Compatibility with the new Last Saved Path feature (Now memorized on a site-by-site basis).
+- Removed beta checking feature on non beta releases.
+* Prevent closing the save dialog if the preferences dialog is still open.">
+
 <!ENTITY about.version.102 "+ Lade till ett alternativ att tvinga åtgärdsvalet när det automatiska nerladdningsalternativet används.
 + Om tillägget DownThemAll! är installerat blir en ny alternativflik tillgänglig för att kunna skicka ASF:s målsökväg till dTa!.
 + Lade till ett alternativ att välja huruvida filter skall vara skiftlägeskänsliga eller inte.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/automatic-save-folder.git



More information about the Pkg-mozext-commits mailing list