Skip to content

Instantly share code, notes, and snippets.

@SathyaBhat
Created September 7, 2011 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SathyaBhat/1201185 to your computer and use it in GitHub Desktop.
Save SathyaBhat/1201185 to your computer and use it in GitHub Desktop.
var pattern=/\bIWSS/
// var mobilizr = "http://google.com/gwt/x?u="
// var mobilizr = "http://www.instapaper.com/m?u="
var mobilizr = "http://viewtext.org/article?url="
var hnold = /news.ycombinator.com/
var imgur = /imgur.com/
var new_image = "http://sbhat.me/u/fetch_images.php?ImgUrl="
var newurl
var mobi
if (pattern.test(window.document.title))
{
newurl = mobilizr + encodeURIComponent(window.location.href);
console.log(newurl)
if (window.location.href.match(hnold))
{
newurl = window.location.href.replace(hnold,"hackerne.ws");
}
else if (window.location.href.match(imgur))
{
newurl = new_image + window.location.href;
}
// chrome.tabs.update(tabId, {"url":newurl});
chrome.extension.sendRequest({redirect: newurl});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment