Create a bookmark in your broser and copy pase calc.min.js
content in url.
Now you can go to the a themeforest page and click on that bookmark.
You can set window.dollarInToman=5000
in js console.
If you want to make money in themeforest like us cotact me ;)
Last active
December 14, 2015 15:39
-
-
Save alimd/5109680 to your computer and use it in GitHub Desktop.
ThemeForest Total Sale and Sale/Month Calculator and Convert to Iranian Rial ;)
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
(function($,undefined){ | |
"use strict"; | |
var | |
$2r = window.dollarInToman || 3300, | |
bold = function(txt){ | |
return '<span style="font-weight:bold;">'+txt+'</span>'; | |
}, | |
num2digit = function(n){ | |
return (n+'').replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); | |
}, | |
$items = $('ul.item-list li'), | |
$purchase = $('.purchase-container .purchase').eq(0), | |
calcTotalSaleLists = function(){ | |
var | |
totalSales = 0, | |
totalSalesR = 0, | |
$calcEl = $('.totalSalesCalc'); | |
if(!$calcEl.length){ | |
$('#paginated-content-container').prepend("<div class='totalSalesCalc'></div>"); | |
$calcEl = $('.totalSalesCalc').css({ | |
'padding-bottom': 10 | |
}); | |
} | |
$items.each(function(){ | |
var | |
$sale = $('.sale-count',this), | |
$price = $('.price',this), | |
price = parseInt($price.html().substr(1),10), | |
sales = parseInt($sale.html(),10), | |
total = price * sales, | |
totalR = total * $2r; | |
totalSales += total; | |
totalSalesR += totalR; | |
$sale.html(num2digit(sales)+' Sales<br/>'+bold('$'+num2digit(total))+'<br/>'+num2digit(totalR)+' Toman'); | |
}); | |
$calcEl.html('Total : '+bold('$'+num2digit(totalSales))+' = '+bold(num2digit(totalSalesR)+' Toman')); | |
}, | |
calcTotalSaleItem = function (){ | |
var | |
$itemSale = $('.sidebar-stats__box--sales > div > span').eq(0), | |
$itemPrice = $('.price_in_dollars',$purchase).eq(0), | |
price = parseInt($itemPrice.html(),10), | |
sale = parseInt($itemSale.html().replace(',',''),10), | |
total = price * sale, | |
totalR = total * $2r, | |
now = new Date(), | |
created = $('#item_attributes tr:first-child .attr-detail').html(), | |
createdDate = new Date(created), | |
due = now.getTime() - createdDate.getTime(), | |
dueDate = new Date(due), | |
dueMonth = due / (30*24*60*60*1000), | |
salePerMonth = Math.round(sale/dueMonth), | |
salePerMonth$ = Math.round(total/dueMonth), | |
salePerMonthR = salePerMonth$ * $2r; | |
$purchase | |
.html($('.price',$purchase).eq(0)) | |
.append( | |
'<br/>'+ | |
'$'+num2digit(total)+' total<br/>'+ | |
bold(num2digit(totalR))+' T<br/>'+ | |
(dueDate.getFullYear()>1970?dueDate.getFullYear()-1970+' year & ':'')+ | |
(dueDate.getMonth()>0?dueDate.getMonth()+' month & ':'')+ | |
dueDate.getDate()+' day<br/>'+ | |
num2digit(salePerMonth)+' sale/m<br/>'+ | |
'$'+num2digit(salePerMonth$)+' /m<br/>'+ | |
bold(num2digit(salePerMonthR))+' T/m' | |
) | |
.css({ | |
'text-align': 'center' | |
}); | |
}; | |
$items.length && calcTotalSaleLists(); | |
$purchase.length && calcTotalSaleItem(); | |
})(window.Zepto || window.jQuery); |
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
javascript:!function(t){"use strict";var e=window.dollarInToman||3300,a=function(t){return'<span style="font-weight:bold;">'+t+"</span>"},n=function(t){return(t+"").replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},r=t("ul.item-list li"),l=t(".purchase-container .purchase").eq(0),s=function(){var l=0,s=0,i=t(".totalSalesCalc");i.length||(t("#paginated-content-container").prepend("<div class='totalSalesCalc'></div>"),i=t(".totalSalesCalc").css({"padding-bottom":10})),r.each(function(){var r=t(".sale-count",this),i=t(".price",this),o=parseInt(i.html().substr(1),10),c=parseInt(r.html(),10),d=o*c,h=d*e;l+=d,s+=h,r.html(n(c)+" Sales<br/>"+a("$"+n(d))+"<br/>"+n(h)+" Toman")}),i.html("Total : "+a("$"+n(l))+" = "+a(n(s)+" Toman"))},i=function(){var r=t(".sidebar-stats__box--sales > div > span").eq(0),s=t(".price_in_dollars",l).eq(0),i=parseInt(s.html(),10),o=parseInt(r.html().replace(",",""),10),c=i*o,d=c*e,h=new Date,p=t("#item_attributes tr:first-child .attr-detail").html(),m=new Date(p),u=h.getTime()-m.getTime(),g=new Date(u),b=u/2592e6,w=Math.round(o/b),f=Math.round(c/b),T=f*e;l.html(t(".price",l).eq(0)).append("<br/>$"+n(c)+" total<br/>"+a(n(d))+" T<br/>"+(g.getFullYear()>1970?g.getFullYear()-1970+" year & ":"")+(g.getMonth()>0?g.getMonth()+" month & ":"")+g.getDate()+" day<br/>"+n(w)+" sale/m<br/>"+"$"+n(f)+" /m<br/>"+a(n(T))+" T/m").css({"text-align":"center"})};r.length&&s(),l.length&&i()}(window.Zepto||window.jQuery) |
agha in kar nemikone jadidan! plz dorostesh konin! thx
Updated and fixed
THX! now it worked!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you!
it's very useful