Created
December 19, 2017 06:29
-
-
Save knsmr/ba379d3793c1c65da7370b46ca4f9717 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // | |
| // Bookmarklet | |
| // | |
| // Open up the corresponding translation in Japanese or original English article | |
| // in a new window for http://techcrunch.com and http://jp.techcrunch.com | |
| // | |
| // New format: | |
| // Use this regular expression test site: https://regex101.com/ | |
| // | |
| // http://jp.techcrunch.com/2017/12/19/2017-12-18-bmw-teams-up-with-solid-power-to-develop-solid-state-batteries-for-cars/ | |
| // | |
| // <--> | |
| // | |
| // https://techcrunch.com/2017/12/18/bmw-teams-up-with-solid-power-to-develop-solid-state-batteries-for-cars/ | |
| // | |
| javascript:(function(){ | |
| _url=location.href; | |
| if(_url.indexOf("http://jp.techcrunch") !== -1) { | |
| _new_url = _url.replace("http://jp.", "https://").replace(/[0-9]+\/[0-9]+\/[0-9]+\//, "").replace(/(20[0-9]+)\-([0-9]+)\-([0-9]+)\-/, function (match, y, m, d) { | |
| return y + "/" + m + "/" + d + "/"; | |
| }); | |
| }; | |
| if(_url.indexOf("https://techcrunch") !== -1) { | |
| _new_url = _url.replace("https://", "https://jp."); | |
| _new_url = _new_url.replace(/(201[0-9])\/([0-9]+)\/([0-9]+)\//, function(match, y, m, d) { | |
| return y + "-" + m + "-" + d + "-"; | |
| }); | |
| }; | |
| window.open(_new_url); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment