Created
July 25, 2013 12:44
-
-
Save hekt/6079253 to your computer and use it in GitHub Desktop.
skip hatebu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var urls = ['http://b.hatena.ne.jp/entry/', | |
'http://zenback.itmedia.co.jp/contents/', | |
'http://ceron.jp/url/']; | |
chrome.tabs.onUpdated.addListener(function(tabid, inf, tab) { | |
for (var i = 0; i < urls.length; i++) { | |
if (inf.url.indexOf(urls[i]) === 0) { | |
var newUrl = inf.url.replace(/^(https?:\/\/).*?\/.*?\/(.*)$/, '$1$2'); | |
chrome.tabs.update(tabid, {"url": newUrl}); | |
break; | |
} | |
} | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "skip hatebu", | |
"version": "1.0", | |
"manifest_version": 2, | |
"permissions": ["tabs", "http://*/*"], | |
"background": { | |
"scripts": ["background.js"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment