Orlygift.com Cleaner

A userscript to clean the orlygift website up

  1. // ==UserScript==
  2. // @name Orlygift.com Cleaner
  3. // @namespace https://github.com/Tackyou/orlygift-cleaner
  4. // @description A userscript to clean the orlygift website up
  5. // @author Tackyou
  6. // @version 1.9
  7. // @license https://raw.githubusercontent.com/Tackyou/orlygift-cleaner/master/LICENSE
  8. // @icon http://i.imgur.com/ukYltA1.png
  9. // @match https://www.orlygift.com/
  10. // @supportURL https://github.com/Tackyou/orlygift-cleaner/issues
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. // start with injecting some new css rules
  15. var style = document.createElement('style');
  16. style.appendChild(document.createTextNode('.slider,.row,.countdown-container,.modal-backdrop.fade.in,.ad-container,.headline-container div p,.last_claimed,#commander-cool-banner,.thumb,div.cc_banner-wrapper{display:none}.row.headline-container.animated,.content-perspective .content-inner .row{display:block}.content-perspective .content-inner div + .row{display:none !important}.headline-container{padding:0}.timeline .content-inner{padding:5px}.timeline .content-inner h3{font-size:16px;margin-top:11px}.timeline .content-perspective{margin-left:30px}.event label.arrow,.event input[type="radio"]{left:-50px}.timeline:before{left:-30px}.container-fluid .container{width:800px}'));
  17. document.head.appendChild(style);
  18.  
  19. console.log("[Userscript] OrlyCleaner is active");
  20.  
  21. // automatically accept the new TOS if required, saving you some clicks and time
  22. if($('input#terms').length>0){
  23. $('form.ng-pristine input#terms').prop('checked', true);
  24. $('form.ng-pristine input#newsletter').prop('checked', false);
  25. $('form.ng-pristine div.col-xs-4 button').trigger('click');
  26. console.log('[Userscript] Orlygift TOS accepted');
  27. }
  28.  
  29. // cleaning some stuff to prevent loading images in background etc.
  30. $('.countdown-container').remove();
  31. $('.last_claimed').remove();
  32.  
  33. // clean finished steps
  34. if($('.event.finished').length>3){ $('.event.finished').slice(0, -1).remove(); }else{ $('.event.finished').remove(); }
  35. $('.alert.alert-success').nextAll().remove();
  36.  
  37. // lets make the timer alive and reload automatically on round end
  38. var timelem = $('div.callout.callout-info strong');
  39. if(timelem.length>0){
  40. var fetchtime = timelem.text();
  41. var mins = +(fetchtime.split(':')[0]), secs = (mins * 60 + (+(fetchtime.split(':')[1].split(' min')[0]))), currentSeconds = 0, currentMinutes = 0, count = setInterval(function() {
  42. currentMinutes = Math.floor(secs / 60); currentSeconds = secs % 60; if(currentSeconds <= 9) currentSeconds = '0' + currentSeconds; secs--; timelem.text(currentMinutes + ':' + currentSeconds + ' min');
  43. if(secs == -1){ clearInterval(count); $('.callout.callout-info').empty().html('<h1 style="margin:0;text-align:center;font-weight:bold"><a href="javascript:location.reload()" style="text-decoration:none">&gt;&gt;&gt; Reload & try again &lt;&lt;&lt;</a></h1>'); }
  44. }, 1000);
  45. }