// ==UserScript== // @name fuck display:flex crutch // @version 1 // @include https://www.instagram.com/* // @exclude *.wikia.com/* // ==/UserScript== (function(opera){ var once = true; var always = false; // log function fuck(s, f){ //var tmp = s.replace(/inline-flex/g,'inline').replace(/display\s*:\s*flex/g,'display: block'); var tmp = s.replace(/display\s*:\s*flex/g,'display: block'); if (tmp!=s){ if (once||always) {once=false; opera.postError('fuck display:flex crutch: '+(f||'<no source file>'));} return tmp; } } window.opera.addEventListener('BeforeCSS', function(userJSEvent){ var tmp = fuck(userJSEvent.cssText, userJSEvent.element.href); if (tmp) userJSEvent.cssText = tmp; }, false); document.addEventListener('DOMContentLoaded',function(){ var styles = document.querySelectorAll('style:not(:empty)'); for (var i=0; i<styles.length; i++) { var s = styles[i]; var tmp; if (s.innerHTML) { tmp = fuck(s.innerHTML); if (tmp) s.innerHTML = tmp; } else if (s.textContent) { tmp = fuck(s.textContent); if (tmp) s.textContent = tmp; } } },false); })(opera) |