Skip to content

Instantly share code, notes, and snippets.

@anasnakawa
Created October 24, 2013 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anasnakawa/7133323 to your computer and use it in GitHub Desktop.
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
/**
* 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