The Un-Official Proxomitron Forum
url cleaner for privoxy - Printable Version

+- The Un-Official Proxomitron Forum (https://www.prxbx.com/forums)
+-- Forum: Forum Related (/forumdisplay.php?fid=37)
+--- Forum: Privoxy (/forumdisplay.php?fid=49)
+--- Thread: url cleaner for privoxy (/showthread.php?tid=2264)



url cleaner for privoxy - kik0s - Jan. 31, 2016 09:31 PM

hey guys,

so i found this one on greasyfork: https://greasyfork.org/de/scripts/13230-slickdeals-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!


RE: url cleaner for privoxy - Faxopita - Feb. 02, 2016 09:49 PM

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.


RE: url cleaner for privoxy - Faxopita - Feb. 04, 2016 11:55 AM

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.