Created
October 24, 2013 08:30
-
-
Save anasnakawa/7133323 to your computer and use it in GitHub Desktop.
calculate how much templates has been sold on ThemeForest during last week for any category
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
/** | |
* calculate how much templates has been sold on ThemeForest during last week for any category | |
* for example: | |
* - open themeforest.net > Wordpress > Popular Items | |
* - open the javascript console | |
* - paste this snippet | |
* _ ... BAM! | |
*/ | |
(function($, console){ | |
var total = 0; | |
$('.sale-info').each(function(){ | |
var $this = $(this) | |
, sales = parseInt( $.trim( $this.find('.sale-count').text().replace(/Sales/, '') ), 10 ) | |
, price = parseInt( $.trim( $this.find('.price').text().replace(/[$]/, '') ), 10 ) | |
if(!isNaN(price) && !isNaN(sales)) { | |
total += price * sales; | |
} | |
}); | |
console.log('${total}'.replace(/{total}/, total)); | |
})(jQuery, console); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment