[Pkg-mozext-commits] [automatic-save-folder] 17/133: Change : Added a proper option to fall back to the current website URL checking if the hosted domain doesn't match the filter's domain.
David Prévot
taffit at moszumanska.debian.org
Mon Apr 27 20:33:48 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 5d38971f12788a34da1ea6f8d1a528cb6271264f
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date: Tue Oct 6 20:39:52 2009 +0000
Change :
Added a proper option to fall back to the current website URL checking if the hosted domain doesn't match the filter's domain.
git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@17 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
content/asf_download.js | 26 ++++++++------------------
content/asf_right_click.js | 9 +++++----
content/options.xul | 2 ++
defaults/preferences/asf.js | 3 ++-
locale/en-US/asf.dtd | 1 +
locale/fr-FR/asf.dtd | 1 +
locale/it-IT/asf.dtd | 1 +
locale/it-IT/to translate.txt | 2 +-
8 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/content/asf_download.js b/content/asf_download.js
index 29a5e7b..0ff0bc0 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -122,16 +122,18 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
dom_regexp = false ; // reset the matching string for the "for" loop
file_regexp = false ; // same as above
// Check the domain
- dom_regexp = ASF.test_regexp(filters[i][0], "source"); // hosted Domain
+ dom_regexp = ASF.test_regexp(filters[i][0], domain); // hosted Domain
- // Check the referer domain name if hosted domain checking returned false. In next releases, will be a proper option
- if (dom_regexp == false)
+ // Check the current website URL if hosted domain checking returned false.
+ if (!dom_regexp && use_currentURL)
{
- dom_regexp = ASF.test_regexp(filters[i][0], "referer"); // check the filter domain with the Referer domain only if the hosted domain doesn't match
+ var uCT = document.getElementById("unknownContentType");
+ var currentURL = uCT.parentNode.defaultView.opener.location.host; // look for the current website URL in the DOM.
+ dom_regexp = ASF.test_regexp(filters[i][0], currentURL); // check the filter domain with the current website URL only if the hosted domain doesn't match
}
// Check the filename
- file_regexp = ASF.test_regexp(filters[i][1], "location"); // Filename
+ file_regexp = ASF.test_regexp(filters[i][1], filename); // Filename
// debug
// alert ("i = "+i+"\n domain match = "+dom_regexp+"\n file match = "+file_regexp);
@@ -637,20 +639,8 @@ Copyright (C) 2007-2009 Eric Cassar (Cyan).
}
},
- test_regexp: function (filters, input) {
+ test_regexp: function (filters, string) {
- // input can be "source" for domain name, "location" for file name, ...
- if ( (input == "source") || (input == "location") )
- {
- var string = document.getElementById(input).value ;
- }
- // ... or "referer" for referer's domain name (the place where the link is, and not the file)
- else // if (input == "referer")
- {
- var uCT = document.getElementById("unknownContentType");
- var string = uCT.parentNode.defaultView.opener.location.host; // look for the referer host name in the DOM.
- }
-
// Steps :
// 1 - Check if the filter is a regular expression
// 2 - if not regexp : add the backslah to special characters and .* to the start and end of the string to convert it into a regexp form
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 1fddee5..07278db 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -292,6 +292,7 @@ var automatic_save_folder = {
var tempdomain = ASF.loadUnicodeString("extensions.asf.tempdomain");
var variable_mode = prefManager.getBoolPref("extensions.asf.variablemode");
var dialogaccept = prefManager.getBoolPref("extensions.asf.dialogaccept");
+ var use_currentURL = prefManager.getBoolPref("extensions.asf.usecurrenturl");
// If variable/Advanced mode is ON, let's check the variables and replace to create the new defaultfolder
if (variable_mode == true)
@@ -342,11 +343,11 @@ var automatic_save_folder = {
// Check the domain
dom_regexp = ASF.test_regexp(filters[i][0], domain); // hosted Domain
- // Check the referer domain name if hosted domain checking returned false. In next releases, will be a proper option
- if (dom_regexp == false)
+ // Check the current website URL if hosted domain checking returned false.
+ if (!dom_regexp && use_currentURL)
{
- var referer = document.getElementById("urlbar").value;
- dom_regexp = ASF.test_regexp(filters[i][0], referer); // check the filter domain with the Referer domain only if the hosted domain doesn't match
+ var currentURL = document.getElementById("urlbar").value;
+ dom_regexp = ASF.test_regexp(filters[i][0], currentURL); // check the filter domain with the current website URL only if the hosted domain doesn't match
}
// Check the filename
diff --git a/content/options.xul b/content/options.xul
index 91e979a..c0571b1 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -30,6 +30,7 @@
<preference id="asf_variablemode" name="extensions.asf.variablemode" type="bool"/>
<preference id="asf_dialogaccept" name="extensions.asf.dialogaccept" type="bool"/>
<preference id="asf_rightclick" name="extensions.asf.rightclick" type="bool"/>
+ <preference id="asf_usecurrenturl" name="extensions.asf.usecurrenturl" type="bool"/>
</preferences>
<menupopup id="contextpopup">
<menuitem label="&asf.top.popup;" oncommand="automatic_save_folder.move('top');"/>
@@ -108,6 +109,7 @@
<separator class="thin"/>
<checkbox id="asf-lasdir" preference="asf_lastdir" label="&asf.lastdir.bool;"/>
<checkbox id="asf-dialogaccept" preference="asf_dialogaccept" label="&asf.dialogaccept.bool;"/>
+ <checkbox id="asf-usecurrenturl" preference="asf_usecurrenturl" label="&asf.usecurrenturl.bool;"/>
<checkbox id="asf-viewdloption" preference="asf_viewdloption" label="&asf.viewdloption.bool;" oncommand="automatic_save_folder.toggle_options();"/>
<hbox><description value=" " /><description id="asf-viewdloptiondesc" >&asf.viewdloption.label;</description></hbox>
<hbox><description value=" " /><checkbox id="asf-viewpathselect" preference="asf_viewpathselect" label="&asf.viewpathselect.bool;"/></hbox>
diff --git a/defaults/preferences/asf.js b/defaults/preferences/asf.js
index 26c16b7..69f64f1 100644
--- a/defaults/preferences/asf.js
+++ b/defaults/preferences/asf.js
@@ -15,4 +15,5 @@ pref("extensions.asf at mangaheart.org.description", "chrome://asf/locale/asf.prope
// does only affect the user if useDownloadDir = true ---- if "always ask the destination folder" is selected in FF options, it has no effect on the user.
pref("browser.download.folderList", 2);
pref("extensions.asf.dialogaccept", false);
- pref("extensions.asf.rightclick", true);
\ No newline at end of file
+ pref("extensions.asf.rightclick", true);
+ pref("extensions.asf.usecurrenturl", false);
\ No newline at end of file
diff --git a/locale/en-US/asf.dtd b/locale/en-US/asf.dtd
index 9688a2a..d225beb 100644
--- a/locale/en-US/asf.dtd
+++ b/locale/en-US/asf.dtd
@@ -43,6 +43,7 @@
<!ENTITY asf.rightclick.bool "Activate the filtering on the Right-Click menu 'Save link as...'">
<!ENTITY asf.rightclick.label "Note: Activating the filtering on this menu prevent Firefox to read the file's target name if it is from a redirection download.
Temporarily disable this feature if you want Firefox to read the filename provided by the header. Only files from a redirection download have this problem, for direct download links leave this option checked.

This option doesn't disable the filtering on the menus 'Save image as...' nor 'Save as... (Ctrl+S)'.">
<!ENTITY asf.rightclick.DSort.label "Download sort extension has been detected. 
Automatic Save Folder's right-click feature will not work until you disable Download Sort in your Add-on manager.">
+<!ENTITY asf.usecurrenturl.bool "Use the current website URL to verify the filter's domain if the hosted domain doesn't match.">
<!-- Dynamics tab-->
<!ENTITY asf.dynamics.label "Dynamic folders">
diff --git a/locale/fr-FR/asf.dtd b/locale/fr-FR/asf.dtd
index 4b7aed0..c1d7699 100644
--- a/locale/fr-FR/asf.dtd
+++ b/locale/fr-FR/asf.dtd
@@ -43,6 +43,7 @@
<!ENTITY asf.rightclick.bool "Activer le filtrage sur le menu clic-droit 'Enregistrer la cible du lien sous...'.">
<!ENTITY asf.rightclick.label "Note : Activer le filtrage sur ce menu empêche Firefox de récupérer le nom du fichier cible lors d'un téléchargement avec redirection.
Désactivez temporairement cette option si vous souhaitez que Firefox lise correctement le nom du fichier fourni par l'entête. Seuls les redirections de fichiers ont ce problème, pour les liens directs laissez la case cochée. 

Cette option ne désactive pas le filtrage sur les menus 'Enregistrer l'image sous...' n [...]
<!ENTITY asf.rightclick.DSort.label "L'extension Download Sort à été détectée. 
La fonction clic-droit d'Automatic Save Folder est temporairement indisponible. Désactivez l'extension Download Sort dans le menu 'outils/modules complémentaires...' afin de pouvoir utiliser le clic-droit avec Automatic Save Folder.">
+<!ENTITY asf.usecurrenturl.bool "Utiliser l'adresse du site courant pour comparer le domaine du filtre si le domaine d'hébergement ne correspond pas.">
<!-- Dynamics tab-->
<!ENTITY asf.dynamics.label "Dossiers dynamiques">
diff --git a/locale/it-IT/asf.dtd b/locale/it-IT/asf.dtd
index 1d3c114..64aeb0b 100644
--- a/locale/it-IT/asf.dtd
+++ b/locale/it-IT/asf.dtd
@@ -43,6 +43,7 @@
<!ENTITY asf.rightclick.bool "Activate the filtering on the Right-Click menu 'Save link as...'">
<!ENTITY asf.rightclick.label "Note: Activating the filtering on this menu prevent Firefox to read the file's target name if it is from a redirection download.
Temporarily disable this feature if you want Firefox to read the filename provided by the header. Only files from a redirection download have this problem, for direct download links leave this option checked.

This option doesn't disable the filtering on the menus 'Save image as...' nor 'Save as... (Ctrl+S)'.">
<!ENTITY asf.rightclick.DSort.label "Download sort extension has been detected. 
Automatic Save Folder's right-click feature will not work until you disable Download Sort in your Add-on manager.">
+<!ENTITY asf.usecurrenturl.bool "Use the current website URL to verify the filter's domain if the hosted domain doesn't match.">
<!-- Dynamics tab-->
<!ENTITY asf.dynamics.label "Dynamic folders">
diff --git a/locale/it-IT/to translate.txt b/locale/it-IT/to translate.txt
index e963bee..f07a13b 100644
--- a/locale/it-IT/to translate.txt
+++ b/locale/it-IT/to translate.txt
@@ -3,7 +3,7 @@ asf.properties :
2 to end
asf.dtd :
-42-49
+42-50
Variables.html :
--
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