[Pkg-mozext-commits] [automatic-save-folder] 75/133: Fix : - Filter's highlight when falling back to current URL wasn't working. - dTa integration improvement, and compatibility for future dTa2.x (Tested on nightly builds from 20010714) - Locales bug

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:54 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 7f2b79b1e2ba1059262ab9ef872c461171f17fa7
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Wed Jul 14 13:10:32 2010 +0000

    Fix :
    - Filter's highlight when falling back to current URL wasn't working.
    - dTa integration improvement, and compatibility for future dTa2.x
       (Tested on nightly builds from 20010714)
    - Locales bug
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@81 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js             | 48 +++++++++++------------
 content/asf_download.js    | 96 ++++++++++++++++++++++++++++++++++++----------
 content/asf_right_click.js | 15 +++-----
 content/common.dtd         |  2 +-
 locale/en-US/about.dtd     |  2 +-
 locale/fr/about.dtd        |  4 +-
 locale/it/about.dtd        |  2 +-
 locale/ru/about.dtd        |  2 +-
 8 files changed, 109 insertions(+), 62 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index 9171dcd..d85fd77 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -570,7 +570,7 @@ var automatic_save_folder = {
 			var uCT = window.opener.document.getElementById("unknownContentType");
 			try
 			{
-				var currentURL = uCT.parentNode.defaultView.opener.location.host;
+				var currentURL = uCT.parentNode.defaultView.opener.location;
 			}
 			catch(e) // If direct link (copy/past to URLbar, or open from another application), no Tab's URL is returned.
 			{
@@ -890,8 +890,8 @@ var automatic_save_folder = {
 	DownloadSort_isEnabled: function() {
 		// Check for Download sort add-on, if enabled return true. 
 		
-		if (this.firefoxversion >= 4)
-		{
+			
+		// Starting from Firefox 4.x, a new addon manager must be use, but it doesn't work :
 			/*
 			var DownloadSort = false;
 			Components.utils.import("resource://gre/modules/AddonManager.jsm");
@@ -904,24 +904,22 @@ var automatic_save_folder = {
 			return DownloadSort;
 			*/
 			
-			// let's use the same method than Firefox 3, but it doesn't detect enabled state in real time anymore
-			// Firefox need to be restarted for addon state to takes effect.
+		// So let's use the same method than Firefox 3
+		// Firefox need to be restarted for addon state to takes effect.
+		if (this.firefoxversion >= 4)
+		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledAddons");
-			var dsort_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
-			var DownloadSort = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DownloadSort >= 0) return true;
 		}
-		
-		// (works only on 3.x)
 		if (this.firefoxversion == 3)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledItems");
-			var dsort_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
-			var DownloadSort = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DownloadSort >= 0) return true;
 		}
+
+		var addon_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
+		var DownloadSort = enabledItems.indexOf(addon_GUUID,0);
+			
+		if (DownloadSort >= 0) return true;
+
 		return false;
 	},
 
@@ -932,21 +930,21 @@ var automatic_save_folder = {
 		if (this.firefoxversion >= 4)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledAddons");
-			var dsort_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
-			var DTA = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DTA >= 0) return true;
 		}
-		
-		//(works only on 3.x)
 		if (this.firefoxversion == 3)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledItems");
-			var dsort_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
-			var DTA = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DTA >= 0) return true;
 		}
+
+		var addon_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
+		var DTA = enabledItems.indexOf(addon_GUUID,0);
+		if (DTA >= 0) return true;
+		
+		//Same but for beta, nighly release of dTa
+		var addon_GUUID = "dta at downthemall.net";
+		var DTA = enabledItems.indexOf(addon_GUUID,0);
+		if (DTA >= 0) return true;
+		
 		return false;
 	},
 
diff --git a/content/asf_download.js b/content/asf_download.js
index 2664386..f1d26af 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -229,15 +229,22 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 				var forceRadioTo = this.prefManager.getCharPref("extensions.asf.dialogForceRadioTo");
 				var dta_ASFtoDTA_isActive = this.prefManager.getBoolPref("extensions.asf.dta_ASFtoDTA_isActive");
 				if (!this.DownThemAll_isEnabled() && (forceRadioTo == "downthemall" || forceRadioTo == "turbodta")) forceRadioTo = "save"; // default to "Save File" if DTA is uninstalled.
-				if (this.DownThemAll_isEnabled() && (!dta_ASFtoDTA_isActive) && (forceRadioTo == "turbodta")) forceRadioTo = "downthemall"; // default to "DownThemAll" if DTA is installed but extension.dta.directory is empty.
-				//if (this.DownThemAll_isEnabled() && (dta_ASFtoDTA_isActive) && document.getElementById("tdta").hidden == true) forceRadioTo = "downthemall"; // default to "downthemall" if DTA is installed, extension.dta.directory is empty, but ASF just set data.
+				if (this.DownThemAll_isEnabled() && (!dta_ASFtoDTA_isActive) && (document.getElementById("tdta").hidden == true) && (forceRadioTo == "turbodta")) forceRadioTo = "downthemall"; // default to "DownThemAll" if DTA is installed but extension.dta.directory is empty.
 				radioSavemode.selectedItem = document.getElementById(forceRadioTo);
 				//alert(document.getElementById("turbodta").selected);
 			}
 			
 			if (this.DownThemAll_isEnabled() && (document.getElementById("downthemall").selected || document.getElementById("turbodta").selected))
 			{
-				DTA_SaveAs.dialogAccepted();
+				if (typeof (DTA_SaveAs) != "undefined") // dTa 1.x
+				{
+					DTA_SaveAs.dialogAccepted();
+				}
+				else // dTa 2.x
+				{
+					window.close();
+					this.DTA_acceptDownload(document.getElementById("turbodta").selected);
+				}
 			}
 			else
 			{
@@ -1036,21 +1043,21 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 		if (this.firefoxversion >= 4)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledAddons");
-			var dsort_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
-			var DTA = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DTA >= 0) return true;
 		}
-		
-		//(works only on 3.x)
 		if (this.firefoxversion == 3)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledItems");
-			var dsort_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
-			var DTA = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DTA >= 0) return true;
 		}
+		
+		var addon_GUUID = "{DDC359D1-844A-42a7-9AA1-88A850A938A8}";
+		var DTA = enabledItems.indexOf(addon_GUUID,0);
+		if (DTA >= 0) return true;
+		
+		//Same but for beta, nighly release of dTa
+		var addon_GUUID = "dta at downthemall.net";
+		var DTA = enabledItems.indexOf(addon_GUUID,0);
+		if (DTA >= 0) return true;
+		
 		return false;
 	},
 
@@ -1066,13 +1073,13 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 		}
 		if (dta_sendMethod == "add")
 		{
-			if(dta_pathArray.length >0)
+			if (dta_pathArray[0] == "")
 			{
-				dta_pathArray.unshift(asf_saveFolder);
+				dta_pathArray.splice(0, 1, asf_saveFolder);
 			}
-			else 
+			else
 			{
-				dta_pathArray.splice(0, 1, asf_saveFolder );
+				dta_pathArray.unshift(asf_saveFolder);
 			}
 		}
 		this.DTA_saveDirectory(dta_pathArray);
@@ -1102,19 +1109,19 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 		dta_directory = dta_directory.join("\", \"");
 		dta_directory = "[\"" + dta_directory + "\"]";
 		
-		return this.saveUnicodeString("extensions.dta.directory", dta_directory);	
+		return this.saveUnicodeString("extensions.dta.directory", dta_directory);
 	},
 
 
 	DTA_setTurboDtaList: function () {
 		var dta_pathArray = this.DTA_readDirectory();
-		var processTurboDTA = !document.getElementById("tdta").hidden;
+		var history = this.prefManager.getIntPref("extensions.dta.history");
 		var tdtalist = document.getElementById("tdtalist");
 		var dta_sendMethod = this.prefManager.getCharPref("extensions.asf.dta_sendMethod");
 		//alert(tdtalist._list.menupopup.children[0].boxObject.element.attributes[0].value);
 		
-		// rename menuitems labels		
-		if (processTurboDTA)
+		// rename menuitems labels if there is any
+		if (typeof (tdtalist._list.menupopup.children[0]) == "object")
 		{
 			if (dta_sendMethod == "replace")
 			{
@@ -1124,6 +1131,17 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 			
 			if (dta_sendMethod == "add")
 			{
+			
+				// If menulist < history size, add a new menuitem
+				if (tdtalist._list.menupopup.children.length < history)
+				{ 
+					var menuitem = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem');
+					menuitem.setAttribute('label', dta_pathArray[tdtalist._list.menupopup.children.length]);
+					menuitem.setAttribute('crop', 'center');
+					menuitem.setAttribute('value', dta_pathArray[tdtalist._list.menupopup.children.length]);
+					tdtalist._list.menupopup.appendChild(menuitem);
+				}
+				
 				for (var i = 0 ; i < tdtalist._list.menupopup.children.length ; i++)
 				{
 					if (this.systemslash == "\\") dta_pathArray[i] = dta_pathArray[i].replace(/\\\\/g, "\\");
@@ -1131,6 +1149,17 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 				}
 			}
 		}
+		else // or create a new menuitem
+		{
+			var menuitem = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem');
+			menuitem.setAttribute('label', dta_pathArray[0]);
+			menuitem.setAttribute('crop', 'center');
+			menuitem.setAttribute('value', dta_pathArray[0]);
+			tdtalist._list.menupopup.appendChild(menuitem);
+			tdtalist._list.selectedIndex = 0;
+			document.getElementById("tdta").hidden = false;
+			document.getElementById("turbodta").disabled = false;
+		}
 	},
 
 
@@ -1146,6 +1175,31 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 	},
 
 
+	// from dTa 2.x
+	DTA_acceptDownload: function(turbo) {
+	// New function used by dTa to save files.
+	// Accepting the save dialog auomatically doesn't work when dTa is selected.
+	// dTa2.x use an eventListener to detect dialogaccept and send data to dTa.
+	// this function is a copy from dTa source
+	
+		let url = dialog.mLauncher.source;
+		let referrer;
+		try 
+		{
+			referrer = dialog.mContext.QueryInterface(Components.interfaces.nsIWebNavigation).currentURI.spec;
+		}
+		catch(ex)
+		{
+			referrer = url.spec;
+		}
+		let ml = DTA.getLinkPrintMetalink(url);
+		url = new DTA.URL(ml ? ml : url);
+	
+		DTA.saveSingleLink(window, turbo, url, referrer, "");
+		let de = document.documentElement;
+	},
+
+
 	// Inspired from DTA
 	addFinalSlash: function(string) {
 		if (string.length == 0)
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 50183e7..8c44acc 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -713,21 +713,16 @@ var automatic_save_folder = {
 		if (this.firefoxversion >= 4)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledAddons");
-			var dsort_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
-			var DownloadSort = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DownloadSort >= 0) return true;
 		}
-		
-		// (works only on 3.x)
 		if (this.firefoxversion == 3)
 		{
 			var enabledItems = this.prefManager.getCharPref("extensions.enabledItems");
-			var dsort_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
-			var DownloadSort = enabledItems.indexOf(dsort_GUUID,0);
-			
-			if (DownloadSort >= 0) return true;
 		}
+
+		var addon_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
+		var DownloadSort = enabledItems.indexOf(addon_GUUID,0);
+		if (DownloadSort >= 0) return true;
+	
 		return false;
 	},
 	
diff --git a/content/common.dtd b/content/common.dtd
index 95859bf..ee79bc9 100644
--- a/content/common.dtd
+++ b/content/common.dtd
@@ -1,2 +1,2 @@
 <!-- Current version -->
-<!ENTITY asf.version "1.0.2b Rev80">
\ No newline at end of file
+<!ENTITY asf.version "1.0.2b Rev81">
\ No newline at end of file
diff --git a/locale/en-US/about.dtd b/locale/en-US/about.dtd
index 1beb634..c00323c 100644
--- a/locale/en-US/about.dtd
+++ b/locale/en-US/about.dtd
@@ -27,7 +27,7 @@
 + 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.
 + New options related to Graphical User Interface.
-+ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">
diff --git a/locale/fr/about.dtd b/locale/fr/about.dtd
index cde2151..222debe 100644
--- a/locale/fr/about.dtd
+++ b/locale/fr/about.dtd
@@ -23,11 +23,11 @@
 <!ENTITY about.version.title "Version">
 
 <!-- Conserver les retour à la ligne car le tag < pre > est utilisé, gardez les deux espaces en début de ligne pour l'indentation -->
-<!ENTITY about.version.102 "+ Ajout d'une option permettant de forcer le choix de l'action a effectuer lorsque l'enregistrement automatique est sélectionné.
+<!ENTITY about.version.102 "+ Ajout d'une option permettant de forcer le choix de l'action à effectuer lorsque l'enregistrement automatique est sélectionné.
 + Si l'extension DownThemAll est installée, un nouvel onglet d'option est disponible permetant 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.
 + Nouvelles options concernant l'interface graphique.
-+ Ajout de la fonction Copie lors d'un Drag&Drop (ex. drag+Ctrl sur Windows).
++ Ajout de la fonction Copie lors d'un Drag&Drop (ex. drag+Ctrl sur Windows).
 ! Correction du script permettant de rajouter les slashs aux expressions régulières si le filtre contient déjà un slash aux extrémités.
 ! Correction d'un bug où les données d'un lien direct entré dans la barre d'adresse ou initialisé par un autre programme n'étaient pas lu correctement, empêchant d'afficher la liste des filtres lorsque la fenêtre de préférences était ouverte à partir du lien "+ Ajouter ou éditer un filtre" de la fenêtre d'enregistrement. (Merci à MrCOLOMBO)
 ! ASF utilise maintenant l'URL complète du site courant au lieu de son domaine lorsque qu'aucun filtre n'est trouvé. (Le clic-droit utilisait déjà l'URL complète).">
diff --git a/locale/it/about.dtd b/locale/it/about.dtd
index 176a3ca..201811a 100644
--- a/locale/it/about.dtd
+++ b/locale/it/about.dtd
@@ -27,7 +27,7 @@
 + 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.
 + New options related to Graphical User Interface.
-+ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">
diff --git a/locale/ru/about.dtd b/locale/ru/about.dtd
index 30c1cbc..a90a08b 100644
--- a/locale/ru/about.dtd
+++ b/locale/ru/about.dtd
@@ -27,7 +27,7 @@
 + 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.
 + New options related to Graphical User Interface.
-+ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">

-- 
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