anilmuthineni / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

links to stylesheet are not going to be replaced #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load a webpage locally from file system e.g. C:\temp\test.html which has
absolute paths for images and style sheets e.g.:
<link rel="stylesheet" type="text/css" href="/base/css/WebApp.css">
<img src="/base/images/pic.gif"/>
2. define the following replacement pattern so that the absolute paths are
replaced with a path to the filesystem
"/base/xxx" ==> "file:///C:/base/xxx"
3. execute the replacement, image are replaced fine and loaded but style
sheets not 

What is the expected output? What do you see instead?
- paths to images are going to be replaced and loaded
- paths to stylesheets are not going to be replaced resp. not loaded

What version of the product are you using? On what operating system?
I am using firefox 3.0.3 and foxreplace 012.2
Windows XP SP3

Please provide any additional information below.

thank you 
best regards
Mark

Original issue reported on code.google.com by data.deu...@gmail.com on 6 Nov 2009 at 1:18

GoogleCodeExporter commented 9 years ago
Hi, this is because the HTML replacement is done on the body node instead of 
the html
node. This was done in purpose to keep the head intact, but now I see that it 
may be
a limitation as in your example. I will try to fix it for next version.

Original comment by marc.r...@gmail.com on 10 Nov 2009 at 7:48

GoogleCodeExporter commented 9 years ago
I helped my self by extending the code. I changed the "foxreplace.js" so that 
the style sheet links in the "head" get replaced too. I attached the modified 
"foxreplace.jar" for those ones which are interested.
You find this file in :

\Profiles\{windows user name}\Application 
Data\Mozilla\Firefox\Profiles\{default.profile}\extensions\fox@replace.fx\foxrep
lace\chrome\foxreplace.jar

Modification:
foxreplace.jar\content\foxreplace.js

approx. line 322:
    ...
    if (this.prefs.replaceUrls) {
      valueNodesXpath += "|/html/body//a/@href"
              + "|/html/head//link/@href"     // added
              + "|/html/head//script/@src"    // added
                      + "|/html/body//img/@src";
    }
    ...

regards
Mark

Original comment by egloff.m...@gmail.com on 10 Jan 2011 at 7:56

Attachments:

GoogleCodeExporter commented 9 years ago
Assuming the problem was on HTML substitutions, as I understand from my 
comment, then it was fixed on r168. If instead it was asking for replace URLs 
to include stylesheets and scripts, as the last comment suggests (I don't know 
if it's the same original poster, because it has a similar signature), then I 
think it's out of the intended scope of non-HTML substitutions, which is to 
change text on the body and the title (the scope could change, but currently 
it's still this one).

For now, I will close the issue as fixed in r168.

Original comment by marc.r...@gmail.com on 3 Aug 2013 at 4:53