// ==UserScript== // @name BTN Extension // @namespace https://broadcasthe.net/ // @version 0.1.0 // @description Minor alterations to the website and adding functionalities // @author Glorious // @match http*://broadcasthe.net/* // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== (function() { 'use strict'; var $q = jQuery; if(location.href.indexOf("user.php?id=") > 0) { $q("div.head.colhead b:contains('Stamps') span").before(`(${$q("div.pad.center .toolTip").length})`); } else if(location.href.indexOf("bonus.php?action=rate") > 0) { var pagesize = $q("select.pagesize").append(''); var a = $q("#myTable")[0].config.rowsCopy; var episodes = 0, seasons = 0, s_total = 0, e_total = 0; var s_months = [], e_months = []; var rate_15m = 0, rate_1h = 0, rate_1d = 0, rate_1m = 0; for(var i=0; i
TypeMonthsCount
'); var season_months = "", episode_months = ""; var inserted_months = 0, total_months = 0, total_episodes = 0; for(i=0; i 0 && inserted_months + (total_months % 3) - 1 >= total_months) colspan = 6 / (total_months % 3); season_months += `${i+1}M: ${s_months[i]}`; } } if(season_months) season_months += ""; inserted_months = total_months = 0; for(i=0; i 0 && inserted_months + (total_months % 3) - 1 >= total_months) colspan = 6 / (total_months % 3); episode_months += `${i+1}M: ${e_months[i]}`; } } if(episode_months) episode_months += ""; $q("#glorious").append('Season' + season_months + '' + seasons + ''); $q("#glorious").append('Episode' + episode_months+ '' + episodes + ''); for(i=0; i 0 && inserted_months + (total_months % 3) - 1 >= total_months) colspan = 6 / (total_months % 3); season_months += `${i+1}M: ${s_months[i]}`; } } if(season_months) season_months += ""; $q("#glorious").append('Total' + season_months + '' + (seasons+episodes) + ''); } if(location.href.indexOf("bonus.php?action=stamps") > 0) { var stamps = $q("a[href*='action=takestamps']"); var stamps_max = Math.floor(parseInt($q("#pointsStats").text().replace(/,/g, ''))/10000); stamps_max = Math.min(stamps_max, stamps.length); $q(".pad").append(`
Available: ${stamps.length} Stamps
`) var bought = 0, threads_done = 0, running = false; function _buystamps(limit, threads=1, thread=1, count=0) { if(threads<1 || thread<1 || limit<1) { console.log("limit, threads and thread variables must be 1 or above (default = 1)") return; } var index = (thread-1)+(threads*count); if(index < limit) $q.ajax(stamps[index].href + "&return=networks").done(function() { console.log(++bought); $q("input[type='number']").val(bought); _buystamps(limit, threads, thread, ++count); }); else { if(++threads_done >= threads && bought >= limit) { setTimeout(function() { alert(`Bought: ${Number(bought).toLocaleString()} stamps\nSpent: ${Number(bought*10000).toLocaleString()} bonus points`); location.reload(); }, 50); } } } function buystamps(limit=1, threads=1) { if(threads < 1 || limit < 1) return console.log("limit and threads variables must be 1 or above (default = 1)"); if(running) return console.log("Buying stamps process is already running."); running = true; bought = 0; threads_done = 0; $q("input[type='number']").val(0); for(var i=0; i= 1) { if(confirm(`Are you sure you want to buy ${Number(num).toLocaleString()} stamp(s)?\nCost: ${Number(num*10000).toLocaleString()} bonus points`)) buystamps(num); } else alert("Number must be 1 or above."); }); $q("#stampsbuymax").click(function() { if(confirm(`Are you sure you want to buy ${Number(stamps_max).toLocaleString()} stamp(s)?\nCost: ${Number(stamps_max*10000).toLocaleString()} bonus points`)) buystamps(stamps_max); }); $q("#stampsbuynum").keydown(function(e) { eve=e; if(isNaN(parseInt(e.key)) && !allowed_keys.includes(e.key)) return false; else if(this.value[0] == "0") this.value = this.value.substr(1); }) .on('input', function() { while(this.value.length > 1 && this.value[0] == '0') this.value = this.value.substr(1); if(!isNaN(parseInt(this.value))) { var val = parseInt(this.value), min = parseInt(this.min), max = parseInt(this.max); if(val > max) this.value = max; else if(val < min) this.value = min; } }); } if(location.href.indexOf("upload.php") > 0) { a = $q("#scenename").val(); if(a && (a.toLowerCase().indexOf("hebtv") > -1 || a.toLowerCase().indexOf("btn")) > -1) { $q("#origin").val("P2P").change(); $q("#international_box").prop("checked", true).change(); $q("#country").val(41).change(); $q("#fasttorrent").prop("checked", true).change(); } } function InitiateRankETA() { var eta_li = $q("#userinfo_stats"); if(eta_li.length == 1) { var promotion = [ // [years,months,weeks,"name"] [0,0,2, "Member"], // Member [0,0,4, "Power User"], // Power User [0,0,12, "Extreme User"], // Extreme User [0,0,24, "Elite"], // Elite [0,0,36, "Guru"], // Guru [0,0,52, "Master"], // Master [0,0,152, "Overlord"] // Overlord ]; function FindTargetPromotion() { for(var i=0; i= 0) { $q("#nextclass").text(promotion[i][3]); return target; } } return -1; } var ms_day = 86400000, ms_hour = 3600000, ms_minute = 60000, ms_second = 1000; eta_li = eta_li.append("
  • ETA:
  • ").find(":last"); var target = -1; function GetETA() { var d = target - Date.now(); if(d < 0) { target = FindTargetPromotion(); if(target == -1) { eta_li.parent().remove(); return; } GetETA(); return; } var days = Math.floor(d / ms_day); if(days < 10) { if(days == 0) days = ""; else days = "0" + days; } var hours = Math.floor(d % ms_day / ms_hour); if(hours < 10) { if(hours == 0 && !days) hours = ""; else hours = "0" + hours; } var minutes = Math.floor(d % ms_day % ms_hour / ms_minute); if(minutes < 10) { if(minutes == 0 && !days && !hours) minutes = ""; else minutes = "0" + minutes; } var seconds = Math.floor(d % ms_day % ms_hour % ms_minute / ms_second); if(seconds < 10) seconds = "0" + seconds; eta_li.text(`${days ? days + "D:" : ''}${hours ? hours + "H:" : ''}${minutes ? minutes + "M:" : ''}${seconds}S`); setTimeout(GetETA, 1000); } GetETA(); } } var regdate_storeval = "btn_regdate"; var regdate = GM_getValue(regdate_storeval); var site_regdate = $q("li:contains('Joined: ') span"); if(site_regdate && site_regdate.length > 0) site_regdate = site_regdate.attr("title"); if(typeof site_regdate === 'string' && regdate != site_regdate) { regdate = site_regdate; GM_setValue(regdate_storeval, regdate); } if(typeof regdate === 'undefined') { jQuery.ajax("http://broadcasthe.net/user.php").done(function(res) { var site_regdate = $q(res).find("li:contains('Joined: ') span"); if(site_regdate && site_regdate.length > 0) { GM_setValue(regdate_storeval, site_regdate.attr("title")); regdate = GM_getValue(regdate_storeval); InitiateRankETA(); } }); } else InitiateRankETA(); })();