Last active
August 1, 2019 08:16
-
-
Save davidmz/9f848e070957605950e2 to your computer and use it in GitHub Desktop.
m.facebook.com → facebook.com #bookmarklet
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
if (location.hostname != "m.facebook.com") { | |
alert("Not a m.facebook.com site"); | |
return; | |
}; | |
if (location.pathname == "/story.php") { | |
var authorId, itemId; | |
location.search.substr(1) | |
.split("&").forEach(function(pair) { | |
var p = pair.split("="); | |
if (p[0] == "story_fbid") itemId = p[1]; | |
if (p[0] == "id") authorId = p[1]; | |
}); | |
location = "https://facebook.com/" + authorId + "/posts/" + itemId; | |
} else if (location.pathname == "/photo.php") { | |
location = location.href.replace("https://m.facebook.com", "https://facebook.com"); | |
} else { | |
alert("Unknown URL type"); | |
} |
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
javascript:(function()%7Bif%20(location.hostname%20!%3D%20%22m.facebook.com%22)%20%7Balert(%22Not%20a%20m.facebook.com%20site%22)%3Breturn%3B%7D%3Bif%20(location.pathname%20%3D%3D%20%22%2Fstory.php%22)%20%7Bvar%20authorId%2C%20itemId%3Blocation.search.substr(1).split(%22%26%22).forEach(function(pair)%20%7Bvar%20p%20%3D%20pair.split(%22%3D%22)%3Bif%20(p%5B0%5D%20%3D%3D%20%22story_fbid%22)%20itemId%20%3D%20p%5B1%5D%3Bif%20(p%5B0%5D%20%3D%3D%20%22id%22)%20authorId%20%3D%20p%5B1%5D%3B%7D)%3Blocation%20%3D%20%22https%3A%2F%2Ffacebook.com%2F%22%2BauthorId%2B%22%2Fposts%2F%22%2BitemId%3B%7D%20else%20if%20(location.pathname%20%3D%3D%20%22%2Fphoto.php%22)%20%7Blocation%20%3D%20location.href.replace(%22https%3A%2F%2Fm.facebook.com%22%2C%20%22https%3A%2F%2Ffacebook.com%22)%3B%7D%20else%20%7Balert(%22Unknown%20URL%20type%22)%3B%7D%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment