[Pkg-mozext-commits] [automatic-save-folder] 96/133: Add: - Add an option for Firefox 7.0.1+ to memorize last folder on a site-by-site basis (default 7.0.1 behavior) Changes: - Change how to check privateBrowsing and import DownloadLastDir at the same time for FF3.5+
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 cdf9bc82442c7f03746479b55083de43d7a07f3b
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date: Thu Oct 20 15:21:31 2011 +0000
Add:
- Add an option for Firefox 7.0.1+ to memorize last folder
on a site-by-site basis (default 7.0.1 behavior)
Changes:
- Change how to check privateBrowsing and import DownloadLastDir at
the same time for FF3.5+
git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@103 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
content/asf.js | 23 +++++++++++++++++++++--
content/asf_download.js | 4 ++++
content/asf_right_click.js | 19 ++++++-------------
content/options.xul | 6 +++++-
defaults/preferences/asf.js | 3 ++-
locale/cs/asf.dtd | 1 +
locale/en-US/asf.dtd | 1 +
locale/fr/asf.dtd | 1 +
locale/it/asf.dtd | 1 +
locale/ru/asf.dtd | 1 +
locale/sv-SE/asf.dtd | 1 +
11 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/content/asf.js b/content/asf.js
index 5e799db..853421c 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -410,18 +410,20 @@ var automatic_save_folder = {
asf_toggleradio: function () {
+ var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
var select_last_radio = document.getElementById("asf-last-radio");
var select_choose_radio = document.getElementById("asf-choose-radio");
var select_folder_input = document.getElementById("asf-default-folder");
var select_folder_btn = document.getElementById("asf-select-folder");
var select_keeptemp_chk = document.getElementById("asf-keeptemp-check");
- var variable_mode = document.getElementById("asf-variablemode");
+ var useSiteBySiteSavePath = document.getElementById("asf-useSiteBySiteSavePath");
if(select_last_radio.selected == true)
{
select_folder_input.disabled = true;
select_folder_btn.disabled = true;
select_keeptemp_chk.disabled = true;
+ useSiteBySiteSavePath.disabled = false;
}
if(select_choose_radio.selected == true)
@@ -430,6 +432,18 @@ var automatic_save_folder = {
this.asf_variablemode();
select_folder_btn.disabled = false;
select_keeptemp_chk.disabled = false;
+ useSiteBySiteSavePath.checked = false;
+ useSiteBySiteSavePath.disabled = true;
+ }
+
+ if(this.firefoxversion < 7.01)
+ {
+ useSiteBySiteSavePath.hidden = true;
+
+ }
+ if (instantApply) // bug with sub-options status set by javascript
+ {
+ this.asf_saveoptions();
}
},
@@ -949,7 +963,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";
}
@@ -1734,6 +1752,7 @@ var automatic_save_folder = {
this.prefManager.setBoolPref("extensions.asf.viewpathselect", document.getElementById("asf-viewpathselect").checked);
this.prefManager.setBoolPref("extensions.asf.rightclicktimeout", document.getElementById("asf-rightclicktimeout").checked);
this.prefManager.setBoolPref("extensions.asf.dialogacceptFiltered", document.getElementById("asf-dialogacceptFiltered").checked);
+ this.prefManager.setBoolPref("extensions.asf.useSiteBySiteSavePath", document.getElementById("asf-useSiteBySiteSavePath").checked);
},
diff --git a/content/asf_download.js b/content/asf_download.js
index 4f70350..61f48fb 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -254,6 +254,10 @@ Copyright (C) 2007-2011 Éric Cassar (Cyan).
{
lastpath = defaultfolder;
}
+ if (this.firefoxversion >= 7.01 && this.prefManager.getBoolPref("extensions.asf.useSiteBySiteSavePath") == true)
+ {
+ lastpath = gDownloadLastDir.getFile(this.current_uri).path;
+ }
this.set_savepath(lastpath);
}
}
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index ca3f8ff..0ca5f31 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -103,13 +103,12 @@ var automatic_save_folder = {
var prefManager = this.prefManager;
// Check if the user is in PrivateBrowsing mode.
- try
+ if (this.versionChecker.compare(this.appInfo.version, "3.5") >= 0) //not working on FF2 and 3.0
{
var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
.getService(Components.interfaces.nsIPrivateBrowsingService);
this.inPrivateBrowsing = pbs.privateBrowsingEnabled;
- }
- catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
+ Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
}
// Check if there is any filter in list
@@ -304,6 +303,10 @@ var automatic_save_folder = {
{
lastpath = defaultfolder;
}
+ if (this.firefoxversion >= 7.01 && this.prefManager.getBoolPref("extensions.asf.useSiteBySiteSavePath") == true)
+ {
+ lastpath = gDownloadLastDir.getFile(this.current_uri).path;
+ }
this.set_savepath(lastpath);
}
}
@@ -359,10 +362,6 @@ var automatic_save_folder = {
{
if (this.inPrivateBrowsing && directory)
{
- if (typeof(gDownloadLastDir) == "undefined") // if not loaded yet
- {
- Components.utils.import("resource://gre/modules/DownloadLastDir.jsm");
- }
gDownloadLastDir.file = directory;
}
else
@@ -375,12 +374,6 @@ var automatic_save_folder = {
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;
diff --git a/content/options.xul b/content/options.xul
index b812faa..9c762ff 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -54,6 +54,7 @@
<preference id="asf_autoCheckBetaUpdate" name="extensions.asf.autoCheckBetaUpdate" type="bool"/>
<preference id="asf_showExportButton" name="extensions.asf.showExportButton" type="bool"/>
<preference id="asf_suggestAllPossibleFolders" name="extensions.asf.suggestAllPossibleFolders" type="bool"/>
+ <preference id="asf_useSiteBySiteSavePath" name="extensions.asf.useSiteBySiteSavePath" type="bool"/>
</preferences>
<menupopup id="contextpopup">
<menuitem label="&asf.top.popup;" oncommand="automatic_save_folder.move('top');"/>
@@ -155,7 +156,10 @@
<groupbox flex="0">
<caption label="&asf.default.label;"/>
<radiogroup id="radio-savetype" align="left" preference="asf_savetype">
- <radio id="asf-last-radio" value="0" label="&asf.lastselected.label;" oncommand="automatic_save_folder.asf_toggleradio()"/>
+ <hbox>
+ <radio id="asf-last-radio" value="0" label="&asf.lastselected.label;" oncommand="automatic_save_folder.asf_toggleradio()"/>
+ <checkbox id="asf-useSiteBySiteSavePath" preference="asf_useSiteBySiteSavePath" label="&asf.useSiteBySiteSavePath.label;" />
+ </hbox>
<hbox>
<radio id="asf-choose-radio" value="1" label="&asf.defaultfolder.label;" oncommand="automatic_save_folder.asf_toggleradio()"/>
<textbox id="asf-default-folder" width="350" ondblclick="automatic_save_folder.browsedir('asf-default-folder')"/>
diff --git a/defaults/preferences/asf.js b/defaults/preferences/asf.js
index 5d5d0b1..ca67dbf 100644
--- a/defaults/preferences/asf.js
+++ b/defaults/preferences/asf.js
@@ -32,4 +32,5 @@ pref("extensions.asf at mangaheart.org.description", "chrome://asf/locale/asf.prope
pref("extensions.asf.autoCheckBetaUpdate", false);
pref("extensions.asf.exportFolder", "");
pref("extensions.asf.showExportButton", false);
- pref("extensions.asf.suggestAllPossibleFolders", false);
\ No newline at end of file
+ pref("extensions.asf.suggestAllPossibleFolders", false);
+ pref("extensions.asf.useSiteBySiteSavePath", false); // new feature since Firefox 7.0.1
\ No newline at end of file
diff --git a/locale/cs/asf.dtd b/locale/cs/asf.dtd
index 4146ca9..f801b4a 100644
--- a/locale/cs/asf.dtd
+++ b/locale/cs/asf.dtd
@@ -26,6 +26,7 @@
<!-- Filters tab - bottom -->
<!ENTITY asf.default.label "Pokud soubor nevyhovuje žádnému filtru, uložit do:">
<!ENTITY asf.lastselected.label "Naposledy použité složky">
+<!ENTITY asf.useSiteBySiteSavePath.label "Memorize on a site-by-site basis.">
<!ENTITY asf.defaultfolder.label "Této složky:">
<!ENTITY asf.selectfolder.label "Vybrat…">
<!ENTITY asf.keeptemp.label "Použít poslední složku, je-li soubor ze stejné domény jako naposledy stažený soubor.">
diff --git a/locale/en-US/asf.dtd b/locale/en-US/asf.dtd
index c0dae6a..d3e3a3a 100644
--- a/locale/en-US/asf.dtd
+++ b/locale/en-US/asf.dtd
@@ -29,6 +29,7 @@
<!-- Filters tab - bottom -->
<!ENTITY asf.default.label "If the file doesn't match any filter, save to:">
<!ENTITY asf.lastselected.label "The last folder">
+<!ENTITY asf.useSiteBySiteSavePath.label "Memorize on a site-by-site basis.">
<!ENTITY asf.defaultfolder.label "This folder: ">
<!ENTITY asf.selectfolder.label "Select...">
<!ENTITY asf.keeptemp.label "Use the last folder if the file is from the same hosted domain than the previously downloaded file.">
diff --git a/locale/fr/asf.dtd b/locale/fr/asf.dtd
index 4c88ca4..b255463 100644
--- a/locale/fr/asf.dtd
+++ b/locale/fr/asf.dtd
@@ -29,6 +29,7 @@
<!-- Filters tab - bottom -->
<!ENTITY asf.default.label "Dossier d'enregistrement lorsqu'aucun filtre n'est trouvé :">
<!ENTITY asf.lastselected.label "Le dernier dossier utilisé">
+<!ENTITY asf.useSiteBySiteSavePath.label "Mémoriser site par site.">
<!ENTITY asf.defaultfolder.label "Ce dossier : ">
<!ENTITY asf.selectfolder.label "Sélectionner...">
<!ENTITY asf.keeptemp.label "Utiliser le dernier dossier si le téléchargement provient du même domaine d'hébergement que le précédent fichier.">
diff --git a/locale/it/asf.dtd b/locale/it/asf.dtd
index a56d21e..71473d8 100644
--- a/locale/it/asf.dtd
+++ b/locale/it/asf.dtd
@@ -29,6 +29,7 @@
<!-- preference bottom -->
<!ENTITY asf.default.label "Cartella per salvare il file se nessun filtro corrisponde:">
<!ENTITY asf.lastselected.label "Ultima cartella">
+<!ENTITY asf.useSiteBySiteSavePath.label "Memorize on a site-by-site basis.">
<!ENTITY asf.defaultfolder.label "Cartella: ">
<!ENTITY asf.selectfolder.label "Seleziona...">
<!ENTITY asf.keeptemp.label "Usa l'ultima cartella se il file viene dallo stesso dominio dell'ultimo file scaricato.">
diff --git a/locale/ru/asf.dtd b/locale/ru/asf.dtd
index b98fbb2..81619d1 100644
--- a/locale/ru/asf.dtd
+++ b/locale/ru/asf.dtd
@@ -29,6 +29,7 @@
<!-- Filters tab - bottom -->
<!ENTITY asf.default.label "Если файл не соответствует ни одному фильтру сохранить в:">
<!ENTITY asf.lastselected.label "Последняя папка">
+<!ENTITY asf.useSiteBySiteSavePath.label "Memorize on a site-by-site basis.">
<!ENTITY asf.defaultfolder.label "Эта папка: ">
<!ENTITY asf.selectfolder.label "Выбрать...">
<!ENTITY asf.keeptemp.label "Используйте последнюю папку при загрузке файла с того же домена что и последний загруженный файл.">
diff --git a/locale/sv-SE/asf.dtd b/locale/sv-SE/asf.dtd
index 06d0c09..37a42b6 100644
--- a/locale/sv-SE/asf.dtd
+++ b/locale/sv-SE/asf.dtd
@@ -29,6 +29,7 @@
<!-- Filters tab - bottom -->
<!ENTITY asf.default.label "Om filen inte matchar något filter, spara till:">
<!ENTITY asf.lastselected.label "Den senaste mappen">
+<!ENTITY asf.useSiteBySiteSavePath.label "Memorize on a site-by-site basis.">
<!ENTITY asf.defaultfolder.label "Den här mappen: ">
<!ENTITY asf.selectfolder.label "Välj...">
<!ENTITY asf.keeptemp.label "Använd den senaste mappen om filen kommer ifrån samma värddomän som den föregående nerladdade filen.">
--
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