se_image_replace
// ==UserScript== // @name Streamelements Img // @include https://streamelements.com/overlay/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require https://raw.github.com/eligrey/hotlink.js/master/hotlink.min.js // @grant GM_addStyle // ==/UserScript== var allowListEdit = [ "multitapmugen","streamelements","allowed","names","go_here" ]; var allowList = []; for (var i = 0; i < allowListEdit.length; i++) { allowList.push(allowListEdit[i].trim().toLowerCase()); } addGlobalStyle('.chat-line{ display: none;}'); waitForKeyElements (".message", removeImage); function removeImage (jNode) { var currentUser = jNode.parent().find('.username').text().trim().toLowerCase(); var userIndex = $.inArray(currentUser,allowList); if (userIndex > -1) { jNode.find('img').each(function() { var oldSrc = $(this).attr('src'); $(this).after(' '+oldSrc); $(this).remove(); }); jNode.html(jNode.html().replace(/\bhttp[^ ]+/ig, urlwrap)); } jNode.parent().css('display','inline'); } function delinkImage (jNode) { jNode.html(jNode.html().replace(/\bhttp[^ ]+/ig, urlwrap)); } function urlwrap( str ) { return '<img src="' + str + '" alt="' + str + '" referrerpolicy="no-referrer">'; }; function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); }
se_image_replace.txt · Last modified: 2022/02/01 23:42 by multitapmugen