// ==UserScript== // @name PTH Remove required ratio if it's 0.00 // @version 0.33 // @description Remove required ratio either when it's 0.00 or always // @author Chameleon // @include http*://redacted.ch/* // @grant none // @namespace https://greasyfork.org/users/87476 // @downloadURL https://update.greasyfork.icu/scripts/25757/PTH%20Remove%20required%20ratio%20if%20it%27s%20000.user.js // @updateURL https://update.greasyfork.icu/scripts/25757/PTH%20Remove%20required%20ratio%20if%20it%27s%20000.meta.js // ==/UserScript== (function() { 'use strict'; debug('start debug'); debug('threadid: '+(window.location.href.indexOf('threadid=2646') != -1)); debug('user.php?id=: '+(window.location.href.indexOf('user.php?id=') != -1)); try { var settings=getSettings(); var headerRatio = document.getElementById('stats_required'); if(headerRatio.textContent.replace(/[\t,\n]/g, "") == "Required:0.00" || settings.hideAlways) headerRatio.style.display = 'none'; if(window.location.href.indexOf("user.php?id=") != -1) { var stats=document.getElementsByClassName('stats')[0].getElementsByTagName('li')[5]; if(stats.textContent == "Required Ratio: 0.00" || settings.hideAlways) stats.style.display = 'none'; } if(window.location.href.indexOf('threadid=2646') != -1) showSettings(); } catch(error) { debug("Error: "+error.message); } })(); function showSettings() { debug('in settings'); var div=document.getElementById('chameleonSettings'); debug('div exists: '+(!(!div))); if(!div) { var before = document.getElementsByClassName('forum_post')[0]; div = document.createElement('div'); div.setAttribute('id', 'chameleonSettings'); before.parentNode.insertBefore(div, before); div.setAttribute('style', 'width: 100%; text-align: center; padding-bottom: 10px;'); div.setAttribute('class', 'box'); } div.innerHTML = '