25 lines
17 KiB
Plaintext
25 lines
17 KiB
Plaintext
function textUpdate(){var h=ad.root.querySelectorAll(".text:not(.clip), .text-left:not(.clip), .text-right:not(.clip), .text-bottom:not(.clip), .text-top-left:not(.clip)");var a=ad.root.querySelectorAll(".text.clip, .text-left.clip, .text-right.clip, .text-bottom.clip, .text-top-left.clip");if(a&&a.length){for(var e=0;e<a.length;e++){var g=a[e];var n=g.offsetHeight;var m=g.querySelector("span");if(m){if(m.offsetHeight>n){var j=m.innerHTML;var l=j.split(" ");var p=l.length;for(var f=0;f<p;f++){l.pop();m.innerHTML=l.join(" ")+"...";if(m.offsetHeight<=n){break}}}}else{var d=g.style.height;g.style.height="auto";if(g.offsetHeight>n){var j=g.innerHTML;var l=j.split(" ");var p=l.length;for(var f=0;f<p;f++){l.pop();g.innerHTML=l.join(" ")+"...";if(g.offsetHeight<=n){break}}}g.style.height=d}}}for(var e=0;e<h.length;e++){var g=h[e];var b=window.getComputedStyle(g,null).getPropertyValue("font-size");var o=parseInt(b);var n=g.offsetHeight;var c=g.offsetWidth;var m=g.querySelector("span");if(m){if(m.offsetHeight>n||m.offsetWidth>c){for(var f=o-1;f>0;f--){g.style.fontSize=f+"px";if(m.offsetHeight<=n&&m.offsetWidth<=c){break}}}}else{var d=g.style.height;g.style.height="auto";if(g.offsetHeight>n||g.offsetWidth>c){for(var f=o-1;f>0;f--){g.style.fontSize=f+"px";if(g.offsetHeight<=n&&g.offsetWidth<=c){break}}}g.style.height=d}}}var clipText=function(g,a){if(g.length&&g.length>a){var e=g.match(/\<.*?\>/g);g=g.split(/\<.*?\>/g);var h=0,d=true;g=g.map(function(i){if(d){if((h+i.length)>a){d=false;i=i.substring(0,(a-h))+"..."}}else{i=""}h+=i.length;return i});var f=g,c=e,b;if(f.length<c){b=f;f=c;c=b}c.push("");g=f.map(function(k,j){return k+c[j]}).join("")}return g};var addTypingContent=function(e){if(e){var d=e.innerHTML.match(/\<.*?\>/g);d=d&&d.length?d:[];var g=e.innerHTML.split(/\<.*?\>/g);var h=0,c=true;g=g.map(function(i){return i.split("").map(function(j){return'<type class="transparent">'+j+"</type>"}).join("")});var f=g,b=d,a;if(f.length<b){a=f;f=b;b=a}b.push("");e.innerHTML=f.map(function(k,j){return k+b[j]}).join("")}};var removeTypingContent=function(a){if(a){a.innerHTML=a.innerHTML.split(/\<type\>/g).join("").split(/\<\/type\>/g).join("")}};var typingAnimation=function(c,d,b){if(c){addTypingContent(c);var a=setInterval(function(){var e=c.querySelectorAll("type.transparent");if(e&&e.length){e[0].removeAttribute("class")}else{clearInterval(a);removeTypingContent(c);if(b&&typeof b=="function"){b()}}},d)}};var Ad=function(d){var b=d.width,o=d.height,m=d.root;var a="borderWidth" in d&&d.borderWidth?d.borderWidth:1;var e="borderColor" in d&&d.borderColor?d.borderColor:"#000";var h={},k={},n=[];var l=function(t,q){if(t&&typeof t=="string"){var u=t;t=[];t.push(u)}if(t&&typeof t=="object"&&t.length){var s=[];var r=document.querySelector("head");function p(v){s.push(this);if(s.length==t.length){q(s)}}t.forEach(function(y){if(y&&typeof y=="string"&&y.length){if(y.indexOf(".js")>0){var v=document.createElement("script");v.type="text/javascript";v.onload=p;v.src=y;r.appendChild(v)}else{if(y.indexOf(".css")>0){var w=document.createElement("style");w.type="text/css";w.setAttribute("rel","stylesheet");w.onload=p;w.setAttribute("href",y);r.appendChild(w)}else{var x=new Image();x.onload=p;x.src=y}}}})}};var g=function(p,r){var q=typeof p=="string"&&p&&p.length&&m.querySelector(p)?m.querySelector(p):p;if(q&&r&&r.length){q.textContent=r;while(q.clientHeight<q.scrollHeight){r=q.innerHTML.trim();if(r.split(" ").length<=1){break}q.innerHTML=r.replace(/\W*\s(\S)*$/,"...")}}};var j=function(){var t="",r=m.offsetWidth,p=m.offsetHeight;var q=a+"px solid "+e;t='<div class="ad-border-top" style="position:absolute;display:inline-block;width:'+r+"px;border-top:"+q+';top:0px;left:0px;"></div><div class="ad-border-right" style="position:absolute;display:inline-block;height:'+p+"px;border-left:"+q+";top:0px;left:"+(r-a)+'px;"></div><div class="ad-border-bottom" style="position:absolute;display:inline-block;width:'+r+"px;border-top:"+q+";top:"+(p-a)+'px;left:0px;"></div><div class="ad-border-left" style="position:absolute;display:inline-block;height:'+p+"px;border-left:"+q+';top:0px;left:0px;"></div>';var s=document.createElement("div");s.className="ad-borders";s.innerHTML=t;m.appendChild(s)};var i=function(r,q){var p=r.match(/\!\{(.*?)\}/g);if(p){p.forEach(function(u){var s=u.split("!{").join("").split("}").join("");for(var t in q){if(t==s){s=q[t]}}r=r.split(u).join(s)})}return r};var f=function(){var t=m.innerHTML.replace(/(\r\n|\n|\r)/gm," ").trim();var z=t.split(" ");while(z.length>1){t=t.split(" ").join(" ").split("> <").join("><");z=t.split(" ")}var u=n[0];m.innerHTML=t;var y=m.querySelectorAll("[data-image]");if(y.length){for(var v=0;v<y.length;v++){var w=y[v];var q="style" in w.dataset?w.dataset.style:"";w.innerHTML="<img "+(q.length?'style="'+q+'"':"")+' src="'+u[w.dataset.image]+'" />';w.removeAttribute("data-image")}}var r=m.querySelectorAll("[data-text]");if(r.length){for(var v=0;v<r.length;v++){var w=r[v];var q="style" in w.dataset?w.dataset.style:"";w.innerHTML="<span "+(q.length?'style="'+q+'"':"")+">"+(w.dataset.text.indexOf("!{")==-1?(w.dataset.text in u?u[w.dataset.text]:w.dataset.text):i(w.dataset.text,u))+"</span>";w.removeAttribute("data-text")}}t=m.innerHTML;t=i(t,u);m.innerHTML=t;var p=document.querySelectorAll("[data-dynamic]");for(var v=0;v<p.length;v++){var w=p[v];w.innerHTML=i(w.innerHTML,u)}var x=m.querySelectorAll("[data-backgroundImage]");if(x.length){for(var v=0;v<x.length;v++){var w=x[v];w.style.backgroundImage="url("+u[w.dataset.backgroundimage]+")";w.removeAttribute("data-backgroundImage")}}textUpdate();var s=m.querySelectorAll("[id]");if(s&&s.length){for(var v=0;v<s.length;v++){var w=s[v];if(w){h[w.id]=w}}}};var c=function(t,p){var r=[],s;if(typeof t=="object"&&amo&&"attributes" in amo&&Object.keys(amo.attributes).length){n.push(amo.attributes)}else{if("cam" in t&&Object.keys(t).length){for(var q in t.cam){amo.registerVariation(q,t.cam[q])}}if("feed" in t&&t.feed.length){t.feed.forEach(function(u){amo.registerContent(u)})}if("content" in amo&&amo.content&&amo.content.length){amo.content.forEach(function(v){var w=v;w.feedData=v;if("variation" in amo&&amo.variation&&Object.keys(amo.variation).length){for(var u in amo.variation){w[u]=amo.variation[u]}}if("staticData" in t&&t.staticData&&Object.keys(t.staticData).length){for(var u in t.staticData){w[u]=t.staticData[u]}}n.push(w)})}}if("beforeLoad" in t&&typeof t.beforeLoad=="function"){s=t.beforeLoad}if(n.length){n.map(function(v){if("staticData" in t&&t.staticData&&Object.keys(t.staticData).length){for(var u in t.staticData){v[u]=t.staticData[u]}}for(var u in v){v[u]=typeof v[u]=="string"?i(v[u],v.feedData):v[u]}});n=s(n);n.forEach(function(v){for(var u in v){var w=v[u];if(typeof w=="string"&&w.match(/\.(bmp|jpeg|jpg|gif|png|webp)$/)!=null&&w.indexOf("/")!=-1){r.push(w)}}});if(r&&r.length){l(r,function(u){f();p(n,u);setTimeout(function(){h.overlay.style.opacity=0;ad.addBorder()},10);setTimeout(function(){h.overlay.style.visibility="hidden"},510)})}else{f();p(n);setTimeout(function(){h.overlay.style.opacity=0;ad.addBorder()},10);setTimeout(function(){h.overlay.style.visibility="hidden"},510)}}};return{root:m,layers:h,frames:k,width:b,height:o,loadAssets:function(q,p){return l(q,p)},setText:function(p,r,q){return g(p,r,q)},addBorder:function(){return j()},update:function(){return f()},contentSetup:function(q,p){return c(q,p)}}};
|
||
<EFBFBD><EFBFBD>c<EFBFBD>@ |