;(function(){ function ready(fn) { window.addEventListener("load", fn); } function appendStyleSheet(){ var style = document.createElement('style'); style.type = "text/css"; style.appendChild(document.createTextNode("")); document.head.appendChild(style); style.sheet.insertRule(".no-price .tripPriceFrom:before, .no-price .tripPriceFrom:after { content: '';display: block;pointer-events: none;position: absolute;height: 0px;width: 0px;top: 13px; }", 0); style.sheet.insertRule(".no-price .tripPriceFrom:before { border-top:11px solid transparent;border-bottom:11px solid transparent;border-left:10px solid #57a50b;right: 8px; }", 1); style.sheet.insertRule(".no-price .tripPriceFrom:after { border-top:11px solid transparent;border-bottom:11px solid transparent;border-left:10px solid #eef3ee;right: 12px; }", 2); } function handlePrices(){ var prices = document.querySelectorAll('.tripOption'); [].forEach.call(prices, function(el) { var available = el.querySelectorAll('.consistsNotAvailableJourneys').length === 0; if(available){ var price = el.querySelectorAll('.tripPriceFrom'); if(price.length > 0 && price[0].innerHTML.trim().length === 0){ el.className = el.className + ' no-price'; } } }); } function addStyles(){ appendStyleSheet(); handlePrices(); ;(function($){ $('body').on('pagechange', handlePrices); })(window.jQuery); } ready(addStyles); })();