Last active
January 1, 2016 17:39
-
-
Save dwiash/8178856 to your computer and use it in GitHub Desktop.
total earning in envato marketplace items
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
(function (unsafeWindow) { | |
// ==UserScript== | |
// @name total earning in envato marketplace items | |
// @creator dwiash | |
// @include http://codecanyon.net/* | |
// @include http://activeden.net/* | |
// @include http://audiojungle.net/* | |
// @include http://themeforest.net/* | |
// @include http://videohive.net/* | |
// @include http://graphicriver.net/* | |
// @include http://3docean.net/* | |
// @include http://marketplace.tutsplus.com/* | |
// @include http://photodune.net/* | |
// ==/UserScript== | |
window.hitungThemeForest = function() { | |
jQuery(document).ready(function(){ | |
var salesInIDR = jQuery('.price_in_dollars').html() * jQuery('.sidebar-stats__box--sales > div > span').html().replace(',','') * 0.5 * 10000; | |
var from = jQuery('#item_attributes .attr-detail').first().html(); | |
console.log(salesInIDR); | |
function addCommas(nStr) { | |
nStr += ''; | |
var x = nStr.split('.'); | |
var x1 = x[0]; | |
var x2 = x.length > 1 ? '.' + x[1] : ''; | |
var rgx = /(\d+)(\d{3})/; | |
while (rgx.test(x1)) { | |
x1 = x1.replace(rgx, '$1' + '.' + '$2'); | |
} | |
return x1 + x2; | |
} | |
jQuery('.pricebox').before('<div class="content-box vertical-space" style="background: white; box-shadow: 0px 0px 15px #FA0; border: none;"> <div class="page-title" style="float:none;font-size: 24px;">Rp. '+addCommas(salesInIDR)+',-</div>since '+from+' </div>'); | |
}); | |
}; | |
// a function that loads jQuery and calls a callback function when jQuery has finished loading | |
// (c) http://stackoverflow.com/questions/2246901/include-jquery-inside-greasemonkey-script-under-google-chrome | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
// load jQuery and execute the main function | |
addJQuery(window.hitungThemeForest); | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment