[Pkg-mozext-commits] [automatic-save-folder] 50/133: change : - automatically set the selection on the first matching filter if opened from saving window. - remove the color if the selection is on a colored row Add : added view scrolling when moving a filter with the buttons up/down (not working with move to top/bottom). Fix : week number was two days earlier.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:51 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 510490e66fba9a42343b6f9fc059260de6cee881
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sat Jan 30 20:50:54 2010 +0000

    change :
    - automatically set the selection on the first matching filter if opened from
      saving window.
    - remove the color if the selection is on a colored row
    Add : added view scrolling when moving a filter with the buttons up/down
         (not working with move to top/bottom).
    Fix : week number was two days earlier.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@50 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js          | 25 +++++++++++++++++--------
 content/asf_download.js |  2 +-
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index fd1475b..3ff33ae 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -118,7 +118,7 @@ var automatic_save_folder = {
 		}
 		
 		// set the row's color
-		this.set_row_color();
+		this.set_row_color(true);
 	},
 
 
@@ -194,7 +194,7 @@ var automatic_save_folder = {
 	},
 
 
-	set_row_color: function () {
+	set_row_color: function (FirstTime) {
 	
 		if (window.opener.location == "chrome://mozapps/content/downloads/unknownContentType.xul")
 		{
@@ -208,6 +208,7 @@ var automatic_save_folder = {
 			var maxidx = tree.view.rowCount;
 			var use_currentURL = document.getElementById("asf-usecurrenturl").checked;
 			var dom, fil, fol, act, color, dom_regexp, file_regexp ;
+			var found = false;
 			
 			for ( var idx = 0; idx < maxidx ; idx++)
 			{
@@ -234,10 +235,17 @@ var automatic_save_folder = {
 				color = (act == true ? "FilterTestPass" : "FilterTestFail");
 				var currentitem = tree.treeBoxObject.view.getItemAtIndex(idx);
 				
-				
 				if (dom_regexp && file_regexp)
 				{
 					currentitem.firstChild.setAttribute('properties', color); 
+					
+					// Autoselect the first matching filter.
+					if (FirstTime && !found)
+					{
+						tree.view.selection.select(idx);
+						tree.treeBoxObject.ensureRowIsVisible(idx);
+						found = true;
+					}
 				}
 				else
 				{
@@ -246,11 +254,11 @@ var automatic_save_folder = {
 			}
 			
 			// enable this to remove the color of the selected item (but works only with mouse-click, not keyboard arrows)
-			// if(tree.currentIndex > -1)
-			// {
-			// 	currentitem = tree.view.getItemAtIndex(tree.currentIndex);
-			// 	currentitem.firstChild.removeAttribute('properties');
-			// }
+			if(tree.currentIndex > -1)
+			{
+				currentitem = tree.view.getItemAtIndex(tree.currentIndex);
+				currentitem.firstChild.removeAttribute('properties');
+			}
 		}
 	},
 
@@ -557,6 +565,7 @@ var automatic_save_folder = {
 			}
 		}
 		
+		tree.treeBoxObject.ensureRowIsVisible(idx);
 		
 		//autosave when moving filters
 		if (instantApply)
diff --git a/content/asf_download.js b/content/asf_download.js
index 1c782ee..15ebf6a 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -338,7 +338,7 @@ Copyright (C) 2007-2010 Éric Cassar (Cyan).
 		Date.prototype.getWeek = function() // Add the getWeek() function do date()
 		{
 			var onejan = new Date(this.getFullYear(),0,1);
-			var week = Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
+			var week = Math.ceil((((this - onejan) / 86400000) + onejan.getDay()-1)/7);
 			if (onejan.getDay() > 4) week--;  // if the first week does not contain a thrusday, it's not the first week (and return as week 0)
 			return week;
 		}

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