Hi,
I dont know if Privoxy can filter and change .js file, example: http://code.jquery.com/jquery-1.11.1.min.js
Example change setTimeout(m.ready) to setTimeout(9999999)
I've wrote this filter, but seem it is not work:
FILTER: js
s@setTimeout(m.ready)@setTimeout(0)@g
{+filter{js}}
.*.js
Please help me, thanks!
Sorry, I solved
Filter:
FILTER: js
s@a@b@g
Action:
{+filter{js} \ +force-text-mode \ }
/.*js
Enabling +force-text-mode should only be necessary if the script is delivered with an incorrect or unexpected Content-Type header.
That doesn't seem to be the case for your example URL:
fk@r500 ~ $curl --head http://code.jquery.com/jquery-1.11.1.min.js
HTTP/1.1 200 OK
Date: Sun, 01 Jun 2014 17:57:24 GMT
Content-Type: application/x-javascript; charset=utf-8
Content-Length: 95786
Connection: keep-alive
Last-Modified: Fri, 02 May 2014 06:36:39 GMT
Vary: Accept-Encoding
ETag: "53628b86-1762a"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Cache-Control: public
Server: NetDNA-cache/2.2
X-Cache: HIT
Accept-Ranges: bytes
Proxy-Connection: keep-alive
I think the real problem is that your first js filter is flawed. It should work if you change it to:
FILTER: js Test
s@setTimeout(m.ready)@setTimeout(0)@g
Escaping the dot isn't absolutely necessary, but not escaping the parentheses prevents the filter from matching literal parentheses.
As you already seem to have noticed, the first action section was incorrect as well, as the URL pattern was missing the leading slash.
Nevermind the escaping parts.
The broken bug tracker is silently removing slashes and my example isn't correctly shown on the web either ...
Thank you, I solved
FILTER: js
s@a@b@g
{+filter{js}}
/.*js
The slash character make Privoxy filter .js file