Created
May 3, 2014 02:15
-
-
Save knsmr/3aa20670e90cc0c6a811 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 stat page for WordPress. | |
| // You need to be logged in to WordPress.com, and have permission. | |
| // | |
| // | |
| javascript:(function(){ | |
| function getFirstElementByClass(matchClass) { | |
| var elems = document.getElementsByTagName('*'), i; | |
| for (i in elems) { | |
| if ((" "+elems[i].className + " ").indexOf(" " + matchClass + " ") > -1) { | |
| return elems[i]; | |
| } | |
| } | |
| }; | |
| var editButton, url, postId; | |
| var statsUrl = "http://ja.wordpress.com/my-stats/?view=post&post="; | |
| editButton = getFirstElementByClass("post-edit-link"); | |
| url = editButton.href; | |
| postId = url.match(/post=([0-9]+)/)[1]; | |
| window.open(statsUrl + postId); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment