Swagbucks App Completion

A script to add a new tab to the users acount page to show how much you have progressed for each swagbuck app.

当前为 2014-09-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Swagbucks App Completion
  3. // @namespace https://github.com/Omegaice/SwagBucksAppMonitor
  4. // @version 1.4
  5. // @description A script to add a new tab to the users acount page to show how much you have progressed for each swagbuck app.
  6. // @match http://www.swagbucks.com/account/summary
  7. // @copyright 2014+, Omegaice
  8. // ==/UserScript==
  9.  
  10. // App Maximums
  11. var sbtvpc_max = 150;
  12. var sbtv_max = 36;
  13. var lifestylez_max = 20;
  14. var indymusic_max = 36;
  15. var sportly_max = 36;
  16. var movieclips_max = 36;
  17. var entertainow_max = 36;
  18.  
  19. function CreateAppRows(name, current, maximum, reward, video_duration, videos_per_reward) {
  20. var result = "<p>"+ name + ":</br>";
  21. if( current >= maximum ){
  22. result += "&nbsp&nbsp&nbsp&nbspComplete [" + current + "/" + maximum + "]";
  23. }else{
  24. result += "&nbsp&nbsp&nbsp&nbspIncomplete [" + current + "/" + maximum + "]";
  25. }
  26. result += "</br>&nbsp&nbsp&nbsp&nbspVideos Remaining: " + videos_per_reward * (Math.max(maximum-current, 0)/reward);
  27. if( video_duration > 0) result += "</br>&nbsp&nbsp&nbsp&nbspEstimated Time Remaining: " + CalculateDuration(video_duration, current, maximum, videos_per_reward, reward);
  28. return result + "</p>";
  29. }
  30.  
  31. // Time Variables
  32. var advert_time = 15;
  33. var nextup_time = 10;
  34. var video_load_time = 5;
  35.  
  36. function CalculateDuration(minimum_time, current_points, maximum_points, videos_per_reward, reward_value){
  37. var remaining_points = Math.max(maximum_points - current_points, 0);
  38. var remaining_videos = remaining_points * (videos_per_reward / reward_value);
  39. var remaining_adverts = remaining_videos;
  40.  
  41. var time = remaining_videos * (video_load_time + minimum_time + nextup_time) + remaining_adverts * advert_time;
  42.  
  43. var hours = Math.floor(time / 3600) % 24;
  44. var minutes = Math.floor(time / 60) % 60;
  45. var seconds = time % 60;
  46.  
  47. return (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
  48. }
  49.  
  50. $("#ledgerInnerCont").append('<div id="appContent" style="position: relative; display: none;"></div>');
  51.  
  52. $.get("http://www.swagbucks.com/?cmd=sb-acct-ledger&allTime=false",function(data,status){
  53. var values = data.split("|")[2].substr(1);
  54. values = values.substring(0, values.length - 1);
  55.  
  56. var rewards = new Array();
  57. rewards["SBTV"] = 0;
  58. rewards["SBTVPC"] = 0;
  59. rewards["Sportly"] = 0;
  60. rewards["Indymusic"] = 0;
  61. rewards["Lifestylz"] = 0;
  62. rewards["EntertaiNow"] = 0;
  63. rewards["MovieCli.ps"] = 0;
  64.  
  65. var lines = values.split("],");
  66. for( var i = 0; i < lines.length; i++ ){
  67. var lData = lines[i].replace("[", "").replace("]", "").split(",");
  68.  
  69. var desc = lData[5].replace("'", "").replace("'", "").trim();
  70. var value = parseInt(lData[3]);
  71.  
  72. if( desc == "" ) desc = ( value == 2 ? "SBTV" : "SBTVPC" )
  73.  
  74. if( rewards[desc] == null ){
  75. rewards[desc] = value;
  76. }else{
  77. rewards[desc] = rewards[desc] + parseInt(lData[3]);
  78. }
  79. }
  80.  
  81. $("#appContent").append(CreateAppRows("SBTV - PC", rewards["SBTVPC"], sbtvpc_max, 3, 0, 10) + "</br>");
  82. $("#appContent").append(CreateAppRows("SBTV - Mobile", rewards["SBTV"], sbtv_max, 2, 9, 5) + "</br>");
  83. $("#appContent").append(CreateAppRows("Sportly.tv", rewards["Sportly"], sportly_max, 2, 25, 15) + "</br>");
  84. $("#appContent").append(CreateAppRows("Indymusic.tv", rewards["Indymusic"], indymusic_max, 2, 30, 15) + "</br>");
  85. $("#appContent").append(CreateAppRows("Lifestylz.tv", rewards["Lifestylz"], lifestylez_max, 2, 12, 15) + "</br>");
  86. $("#appContent").append(CreateAppRows("EntertaiNow", rewards["EntertaiNow"], entertainow_max, 2, 11, 15) + "</br>");
  87. $("#appContent").append(CreateAppRows("MovieCli.ps", rewards["MovieCli.ps"], movieclips_max, 2, 23, 15) + "</br>");
  88. });
  89.  
  90. $("#accountTab1").parent().append("<li id=\"accountTab2\">Applications</li>");
  91.  
  92. $("#accountTab2").click(function(){
  93. $("#accountTab1").removeClass("selected");
  94. $("#ledgerContL").css({position: "relative", display: "none"});
  95.  
  96. $("#accountTab2").addClass("selected");
  97. $("#appContent").removeAttr( 'style' );
  98.  
  99. $("#accountTab3").removeClass("selected");
  100. $("#collectorBills").css({position: "relative", display: "none"});
  101. })
  102.  
  103. // Helpers for old tabs
  104. $("#accountTab1").click(function(){
  105. $("#accountTab2").removeClass("selected");
  106. $("#appContent").css({position: "relative", display: "none"});
  107. })
  108. $("#accountTab3").click(function(){
  109. $("#accountTab2").removeClass("selected");
  110. $("#appContent").css({position: "relative", display: "none"});
  111. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址