[Pkg-mozext-commits] [automatic-save-folder] 09/133: Change : Sort the pathlist alphabetically on saving windows, make them unique and working with dynamic variables.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:47 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 9dbd2d3b8208b6d3fa2dd2be4dac4ba6952afd5e
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Thu Aug 20 15:52:15 2009 +0000

    Change :
    Sort the pathlist alphabetically on saving windows, make them unique and working with dynamic variables.
    
    Fix :
    Forgot one file from Italian localization on previous rev.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@9 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf_download.js | 35 +++++++++++++++++++++++++----------
 locale/it-IT/asf.dtd    |  3 ---
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/content/asf_download.js b/content/asf_download.js
index 717b733..eace9db 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -511,9 +511,20 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 		
 	},
 
+	indexInArray: function (arr,val){
+		val = val.replace(/\\/g,'\\\\');
+		var test_regexp = new RegExp("^"+val+"$");
+		var data = "";
+		for(var i=0;i<arr.length;i++) 
+		{
+			if(test_regexp.test(arr[i])) return i;
+		}
+		return -1;
+	} ,
 
 	read_all_filterpath: function() {
-		
+		var ASF = automatic_save_folder; // ASF is just a shortcut to automatic_save_folder
+		var variable_mode = ASF.prefManager.getBoolPref("extensions.asf.variablemode");
 		var list = document.getElementById('asf_folder_list');
 		var menupopup = document.createElement('menupopup');
 		
@@ -528,11 +539,24 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 		}
 		
 		// Write each path to the menupopup
+		var pathlist = new Array();
+		pathlist[0] = this.loadUnicodeString("extensions.asf.defaultfolder");
+		var j = 0;
 		for (var i = 0; i < nbrfilters; i++)
 		{
 		// read the filter number x
 		path = this.loadUnicodeString("extensions.asf.filters"+ i +".folder");
 		
+		if ( ASF.indexInArray(pathlist, path) < 0) { pathlist[++j]= path;}
+		}
+		
+		var pathlist_sort_alpha = true;   // let the user choose in next release.
+		if (pathlist_sort_alpha) pathlist.sort(); 
+		
+		for (var i = 0; i < pathlist.length; i++)
+		{
+		path = pathlist[i];
+		path = variable_mode == true? ASF.createfolder(path) : path; 
 		var menuitem = document.createElement('menuitem');
 		menuitem.setAttribute('label', path);
 		menuitem.setAttribute('crop', 'center');
@@ -541,15 +565,6 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 		menupopup.appendChild(menuitem);
 		}
 		
-		// Add the default folder
-		var defaultfolder = this.loadUnicodeString("extensions.asf.defaultfolder");
-		var menuitem = document.createElement('menuitem');
-		menuitem.setAttribute('label', defaultfolder);
-		menuitem.setAttribute('crop', 'center');
-		menuitem.setAttribute('value', defaultfolder);
-		menuitem.setAttribute('oncommand', "automatic_save_folder.asf_select_savepath(this)");
-		menupopup.appendChild(menuitem);
-		
 		// Populate the path list into the menu
 		list.appendChild(menupopup);
 		
diff --git a/locale/it-IT/asf.dtd b/locale/it-IT/asf.dtd
index 385eb5a..fd1c878 100644
--- a/locale/it-IT/asf.dtd
+++ b/locale/it-IT/asf.dtd
@@ -27,9 +27,6 @@
 <!ENTITY asf.selectfolder.label "Seleziona...">
 <!ENTITY asf.keeptemp.label "Usa l'ultima cartella se il file viene dallo stesso dominio dell'ultimo file scaricato.">
 
-<!-- preference file pickup -->
-<!ENTITY asf.selectfolder.pickup "Seleziona la cartella predefinita se nessun filtro corrisponde">
-
 <!-- popup -->
 <!ENTITY asf.top.popup "Sposta su">
 <!ENTITY asf.copy.popup "Duplica">

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