Post Reply 
url cleaner for privoxy
Jan. 31, 2016, 09:31 PM
Post: #1
url cleaner for privoxy
hey guys,

so i found this one on greasyfork: https://greasyfork.org/de/scripts/13230-...-clean-url tried to add it with

Code:
### filter for url cleaning
FILTER: urlcleaner
s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@<script src="https://raw.githubusercontent.com/schrauger/slickdeals-clean-url/master/slickdeals-clean-url.user.js"></$

to my privoxy but it did not work. any advice? or maybe any improvements? Smile!
Add Thank You Quote this message in a reply
Feb. 02, 2016, 09:49 PM (This post was last modified: Feb. 04, 2016 04:04 PM by Faxopita.)
Post: #2
RE: url cleaner for privoxy
Instead, can you apply it this way…
Code:
FILTER: urlcleaner

s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@<script>\n\
(function () {\n\
    'use strict';\n\
    document.addEventListener('DOMContentLoaded', function (e) {\n\
    var thisLink, allLinks,linkArray;\n\
allLinks = document.getElementsByTagName('a');\n\
for (var j = 0; j < allLinks.length; j++) {\n\
    thisLink = allLinks[j];\n\
    if(thisLink.href.indexOf('http') !=-1)\n\
    {\n\
    linkArray=thisLink.href.split('http');\n\
thisLink.href=decodeURIComponent('http'+linkArray[linkArray.length-1]);\n\
thisLink.href=thisLink.href.replace(/&amp;/g,'&');\n\
    }\n\
}\n\
    });\n\
})()\n\
</script>\n$1@i

Based on this this template and getting first the DOM ready; read here.
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to Faxopita for this post:
cattleyavns
Feb. 04, 2016, 11:55 AM (This post was last modified: Feb. 04, 2016 04:05 PM by Faxopita.)
Post: #3
RE: url cleaner for privoxy
I had a new look, again. Reformat that way:
Code:
FILTER: urlcleaner

s@(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))@\n<script>\n\
window.addEventListener("DOMContentLoaded", Greasemonkey_main, false);\n\
function Greasemonkey_main ()\n\
{\n\
var imported = document.createElement('script');\n\
imported.src = 'https://raw.githubusercontent.com/schrauger/slickdeals-clean-url/master/slickdeals-clean-url.user.js';\n\
document.body.appendChild(imported);\n\
}\n\
</script>\n$1@i

Also, make sure the path is not blocked by your configuration.

Script seems to be loaded properly on my side when I visit a page.
Add Thank You Quote this message in a reply
[-] The following 2 users say Thank You to Faxopita for this post:
kik0s, cattleyavns
Post Reply 


Forum Jump: