-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
HypeBlendModes.min.js
9 lines (9 loc) · 2.27 KB
/
HypeBlendModes.min.js
1
2
3
4
5
6
7
8
9
/*
Hype BlendModes 1.3
copyright (c) 2019 Max Ziebell, (https://maxziebell.de). MIT-license
*/
!1==="HypeBlendModes"in window&&(window.HypeBlendModes=function(){function e(a,b,d){a.getCurrentSceneElement=function(){return document.querySelector("#"+a.documentId()+' > .HYPE_scene[style*="block"]')};a.applyBlendModeByElement=function(a){var b=String(a.dataset.blendmode).trim().toLowerCase();-1<c.indexOf(b)?a.parentNode.style.setProperty("mix-blend-mode",b,"important"):c.forEach(function(b){a.classList.contains("blendmode-"+b)&&a.parentNode.style.setProperty("mix-blend-mode",b,"important")})};
a.removeUndeclaredBlendModes=function(){var b=a.getCurrentSceneElement().querySelectorAll("[style*='mix-blend-mode']");[].forEach.call(b,function(a){-1!=String(a.firstChild.className).indexOf("blendmode-")||a.firstChild.dataset.blendmode||a.style.removeProperty("mix-blend-mode")})};a.applyBlendModes=function(b){b=a.getCurrentSceneElement().querySelectorAll("[class*='blendmode-'], [data-blendmode]");[].forEach.call(b,function(b){a.applyBlendModeByElement(b)});a.removeUndeclaredBlendModes()}}var c=
"color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply overlay saturation screen soft-light".split(" ");!1==="HYPE_eventListeners"in window&&(window.HYPE_eventListeners=[]);window.HYPE_eventListeners.push({type:"HypeDocumentLoad",callback:e});window.HYPE_eventListeners.push({type:"HypeSceneLoad",callback:function(a,b,d){a.applyBlendModes()}});document.addEventListener("DOMContentLoaded",function(a){if(-1!=window.location.href.indexOf("/Hype/Scratch/HypeScratch.")&&
!document.querySelector(".HYPE_document")){var b={};e(b);b.getCurrentSceneElement=function(){return document.getElementById("HypeMainContentDiv")};var d=!1,c=new MutationObserver(function(a){c.disconnect();d||(d=!0,window.requestAnimationFrame(function(){(new MutationObserver(function(a){a.forEach(function(a){"attributes"!=a.type||"class"!=a.attributeName&&"data-blendmode"!=a.attributeName||(b.applyBlendModeByElement(a.target),b.removeUndeclaredBlendModes())})})).observe(b.getCurrentSceneElement(),
{attributes:!0,attributeOldValue:!0,attributeFilter:["class","data-blendmode"],subtree:!0});b.applyBlendModes()}))});c.observe(b.getCurrentSceneElement(),{childList:!0})}});return{version:"1.3"}}());