{"id":1906,"date":"2012-12-20T18:07:55","date_gmt":"2012-12-20T16:07:55","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=1906"},"modified":"2012-12-20T19:49:42","modified_gmt":"2012-12-20T17:49:42","slug":"fun-bookmarklet-wp-org-plugin-and-download-count","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2012\/12\/fun-bookmarklet-wp-org-plugin-and-download-count\/","title":{"rendered":"Fun Bookmarklet: wp.org Plugin and Download Count"},"content":{"rendered":"<p>I was having a look at <a href=\"http:\/\/profiles.wordpress.org\/ozh\/\">my Profile page on WordPress.org<\/a> and wondered how many downloads all my plugins had. Start Menu, Accessories, Calculat.. HEY? What am I doing here?<\/p>\n<h2>Bookmarklet Fun<\/h2>\n<p>The following Javascript snippet will do the job for you:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">javascript<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"javascript\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">(function () {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; var total = 0,<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; count = 0;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; jQuery('p.downloads').each(function (i, e) {<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; count++;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; total += parseInt(jQuery(e).text().replace(\/,\/g, ''));<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; });<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; total = total.toString().replace(\/\\B(?=(\\d{3})+(?!\\d))\/g, &quot;,&quot;);<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; alert(count + &quot; plugins and &quot; + total + &quot; downloads&quot;);<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">})();<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>Which makes that bookmarklet: <a href=\"javascript:(function(){var%20total=0,count=0;jQuery('p.downloads').each(function(i,e){count++;total+=parseInt(jQuery(e).text().replace(\/,\/g,''));});total=total.toString().replace(\/\\B(?=(\\d{3})+(?!\\d))\/g,',');alert(count+'%20plugins%20and%20'+total+'%20downloads');})();\">Plugin Count<\/a>. Drag to your bookmarks or right click and bookmark it, head to your wp.org profile page and trigger the bookmarklet!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2012\/12\/plugincount.png\" alt=\"plugincount\" width=\"518\" height=\"318\" class=\"aligncenter size-full wp-image-1910\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2012\/12\/plugincount.png 518w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2012\/12\/plugincount-300x184.png 300w\" sizes=\"auto, (max-width: 518px) 100vw, 518px\" \/><\/p>\n<h2>More Bragginess: Tweet It!<\/h2>\n<p>Yeah, a humble alert box won&#39;t make the world and your Mom proud of you, right? <a href=\"javascript:(function(){var%20total=0,count=0;jQuery('p.downloads').each(function(i,e){count++;total+=parseInt(jQuery(e).text().replace(\/,\/g,''));});total=total.toString().replace(\/\\B(?=(\\d{3})+(?!\\d))\/g,',');window.open('http:\/\/twitter.com\/intent\/tweet?status='+'I%20have%20'+count+'%20plugins%20and%20'+total+'%20downloads%20on%20'+window.location.href,'tw','toolbar=no,width=800,height=550');})();\">Tweet Plugin Count<\/a>!<\/p>\n<h2>FYI<\/h2>\n<p>Bookmarklets are fun. Two tools will help you:<\/p>\n<ul>\n<li><a href=\"http:\/\/ted.mielczarek.org\/code\/mozilla\/bookmarklet.html\">The Crunchinator<\/a> will convert your nicely indented code into an ugly browser-bookmarkable one liner<\/li>\n<li><a href=\"http:\/\/jsbeautifier.org\/\">JS Beautifier<\/a> will make the opposite<\/li>\n<\/ul>\n<p>Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was having a look at my Profile page on WordPress.org and wondered how many downloads all my plugins had. Start Menu, Accessories, Calculat.. HEY? What am I doing here? Bookmarklet Fun The following Javascript snippet will do the job for you: &lt; View plain text &gt; javascript (function () { &nbsp; &nbsp; var total = 0, &nbsp; &nbsp; &nbsp;\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[293,2,7,85,245],"class_list":["post-1906","post","type-post","status-publish","format-standard","hentry","category-published","tag-bookmarklet","tag-code","tag-javascript","tag-plugins","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=1906"}],"version-history":[{"count":8,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1906\/revisions"}],"predecessor-version":[{"id":1915,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1906\/revisions\/1915"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=1906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=1906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=1906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}