1

I've recently started working at a company as a student where the workload is minimal. Many of the jobs they do manually, I can solve with a simple script, thus giving me loads of free time.

The downside to this is my account does not have internet access outside the website relevant to my workplace. I've been sniffing around and notice their redirect proxy server has a really amateurish system to block websites, it basically scans the web address and looks for certain keywords. By simply adding ?google to a web address, I can access it without issue.

But, every single link has to be edited with "?google" at the end, which is not really efficient. So I'm looking to write a script that looks up links (CSS/JS/Pictures/etc..) and automatically adds ?google at the end.

For example:

https://cdn.sstatic.net/stackoverflow/all.css?v=4a57bb936dd5 

would become:

https://cdn.sstatic.net/stackoverflow/all.css?v=4a57bb936dd5?google 

Since I haven't worked yet with Tampermonkey yet I wonder if anyone knows a simple and efficient way to do this?

2
  • Don't put your answer in the question. Make an answer post instead. See "Can I answer my own question?". Commented Jul 10, 2013 at 20:55
  • I had to wait 8 hours cause it's a new account :( Commented Jul 10, 2013 at 21:37

1 Answer 1

1

Well after fiddling a bit I managed to write a script, here's the code if anyone's interested.

// ==UserScript== // @name Google Add // @namespace // @description // @include * // ==/UserScript== var srcs = document.links; var links = document.getElementsByTagName("link"); var scripts = document.getElementsByTagName("script"); var imgs = document.getElementsByTagName("img"); var iframes = document.getElementsByTagName("iframe"); for (i = 0; i < links.length; i++ ) { links[i].href = links[i].href+'?google'; } for (i = 0; i < scripts.length; i++ ) { scripts[i].src = scripts[i].src+'?google'; } for (i = 0; i < imgs.length; i++ ) { imgs[i].src = imgs[i].src+'?google'; } for (i=0; i<srcs.length; i++) { srcs[i].href = srcs[i].href+'?google'; } for (i=0; i<iframes.length; i++){ iframes[i].src = iframes[i].src+'?google'; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.