[Pkg-mozext-commits] [automatic-save-folder] 07/133: Change/Fix : Added ability to use Firefox InstantApply option. (previously based on Linux OS detection)

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 620771540f062e8c079d2f84bcb57a8a1e5c09fe
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Wed Aug 19 22:16:41 2009 +0000

    Change/Fix :
    Added ability to use Firefox InstantApply option.
    (previously based on Linux OS detection)
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@7 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js         | 28 +++++++++++++---------------
 content/asf_addedit.js | 16 +++++++---------
 2 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index 4b8aad9..c8075f6 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -25,8 +25,7 @@ var automatic_save_folder = {
 
 		versionChecker: Components.classes["@mozilla.org/xpcom/version-comparator;1"]
 	                               .getService(Components.interfaces.nsIVersionComparator),
-								   
-	
+		
 	asf_load: function () {
 		
 		var firefoxversion = "";
@@ -264,6 +263,7 @@ var automatic_save_folder = {
 
 	// Code from captain.at, modified by Cyan (CASSAR Eric)
 	move: function (direction) {
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
 		var treename = "asf-filterList";
 		
 		var tree = document.getElementById(treename);
@@ -310,10 +310,9 @@ var automatic_save_folder = {
 		}
 		
 		
-		//needed for linux (and Mac ?): autosaved when moving filters
-		if (navigator.appVersion.indexOf("Win")!=-1) { } // = Windows
-		else
-		{ 
+		//autosave when moving filters
+		if (instantApply)
+		{
 			//save the filters
 			this.asf_savefilters();
 		}
@@ -337,7 +336,7 @@ var automatic_save_folder = {
 		idx = parent.childNodes.length-1; 
 		tree.view.selection.select(idx);
 		for (var i = idx ; i > originidx ; i--) // move the new copy 1 line above the original item
-		{										// so the filter auto-saving process for linux (present in the move() function) works
+		{										// so the filter auto-saving process for instantApply (present in the move() function) works
 			this.move("up");					// even if the user duplicate the bottom filter, it will move from 1 step
 		}
 		return false;
@@ -345,6 +344,7 @@ var automatic_save_folder = {
 	
 	
 	asf_delete: function () {
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
 		var filter = document.getElementById('asf-filterList');
 		var rules = document.getElementById('asf-filterChilds');
 		if (filter.view.selection.count > 0) 
@@ -355,10 +355,9 @@ var automatic_save_folder = {
 				rules.removeChild(rules.childNodes[i]);
 			}
 		}
-		//needed for linux (and Mac ?): autosaved when moving filters
-		if (navigator.appVersion.indexOf("Win")!=-1) { } // = Windows
-		else
-		{ 
+
+		if (instantApply)
+		{
 			//save the filters
 			this.asf_savefilters();
 		}
@@ -391,11 +390,10 @@ var automatic_save_folder = {
 			document.getElementById("asf-default-folder").value = asf_url;
 		}
 		
-		//needed for linux (and Mac ?): autosaved when changing folder
-		if (navigator.appVersion.indexOf("Win")!=-1) { } // = Windows, then do nothing
-		else
+		//needed to save unicode paths using instantApply
+		if (instantApply)
 		{
-			//save the default folder right after editing, no need to click the accept button.
+			//save the default folder right after editing
 			var default_folder = document.getElementById("asf-default-folder").value;
 			this.saveUnicodeString("extensions.asf.defaultfolder", default_folder);
 		}
diff --git a/content/asf_addedit.js b/content/asf_addedit.js
index 4188c75..563842c 100644
--- a/content/asf_addedit.js
+++ b/content/asf_addedit.js
@@ -285,7 +285,7 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 	// ADD new filter in tree
 	//
 	asf_add: function () {
-
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
 	// get the domain
 	//
 		var domain_radio = document.getElementById('radio-addedit-domain');
@@ -390,11 +390,10 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 			filter.focus();
 			window.close();
 			
-			//needed for linux (and Mac ?): autosaved when editing filters
-			if (navigator.appVersion.indexOf("Win")!=-1) { } // = Windows
-			else
+			//autosave when adding a filter
+			if (instantApply)
 			{
-			//save the filters
+				//save the filters
 				window.opener.automatic_save_folder.asf_savefilters();
 			}
 		}
@@ -402,7 +401,7 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 
 
 	asf_edit: function () {
-		
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
 	// get the domain
 	// 
 		var domain_radio = document.getElementById('radio-addedit-domain');
@@ -493,9 +492,8 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
 			tree.focus();
 			window.close();
 			
-			//needed for linux (and Mac ?): autosaved when editing filters
-			if (navigator.appVersion.indexOf("Win")!=-1) { } // = Windows
-			else
+			//autosave when editing a filter
+			if (instantApply)
 			{
 			//save the filters
 				window.opener.automatic_save_folder.asf_savefilters();

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