// ==UserScript== // @name Swagbucks App Completion // @namespace https://github.com/Omegaice/SwagBucksAppMonitor // @version 1.0 // @description A script to add a new tab to the users acount page to show how much you have progressed for each swagbuck app. // @match http://www.swagbucks.com/account/summary // @copyright 2014+, Omegaice // @downloadURL none // ==/UserScript== // App Maximums var sbtv_max = 36; var indymusic_max = 20; var sportly_max = 52; var entertainow_max = 90; var movieclips_max = 80; function CreateAppRows(name, current, maximum, video_duration, videos_per_reward) { var result = "
"+ name + ":"; if( current >= maximum ){ result += "    Complete [" + current + "/" + maximum + "]"; }else{ result += "    Incomplete [" + current + "/" + maximum + "]"; } result += "    Videos Remaining: " + videos_per_reward * (Math.max(maximum-current, 0)*0.5); return result + "    Estimated Time Remaining: " + CalculateDuration(video_duration, current, maximum, videos_per_reward, 2) + "
"; } // Time Variables var advert_time = 30; var nextup_time = 10; var video_load_time = 5; function CalculateDuration(minimum_time, current_points, maximum_points, videos_per_reward, reward_value){ var remaining_points = Math.max(maximum_points - current_points, 0); var remaining_videos = remaining_points * (videos_per_reward / reward_value); var remaining_adverts = Math.floor(remaining_points / reward_value); var time = remaining_videos * (video_load_time + minimum_time + nextup_time) + remaining_adverts * advert_time; var hours = Math.floor(time / 3600) % 24; var minutes = Math.floor(time / 60) % 60; var seconds = time % 60; return (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds); } $("#ledgerInnerCont").append(''); $.get("http://www.swagbucks.com/?cmd=sb-acct-ledger&allTime=false",function(data,status){ var values = data.split("|")[2].substr(1); values = values.substring(0, values.length - 1); var rewards = new Array(); rewards[""] = 0; rewards["Sportly"] = 0; rewards["Indymusic"] = 0; rewards["EntertaiNow"] = 0; rewards["MovieCli.ps"] = 0; var lines = values.split("],"); for( var i = 0; i < lines.length; i++ ){ var lData = lines[i].replace("[", "").replace("]", "").split(","); var desc = lData[5].replace("'", "").replace("'", "").trim(); if( rewards[desc] == null ){ rewards[desc] = parseInt(lData[3]); }else{ rewards[desc] = rewards[desc] + parseInt(lData[3]); } } $("#appContent").append(CreateAppRows("SBTV", rewards[""], sbtv_max, 9, 5) + ""); $("#appContent").append(CreateAppRows("Indymusic.tv", rewards["Indymusic"], indymusic_max, 30, 10) + ""); $("#appContent").append(CreateAppRows("Sportly.tv", rewards["Sportly"], sportly_max, 25, 10) + ""); $("#appContent").append(CreateAppRows("EntertaiNow", rewards["EntertaiNow"], entertainow_max, 11, 10) + ""); $("#appContent").append(CreateAppRows("MovieCli.ps", rewards["MovieCli.ps"], movieclips_max, 23, 10) + ""); }); $("#accountTab1").parent().append("