This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle-a054177d157597b524a794214.js
2 lines (2 loc) · 9.82 KB
/
bundle-a054177d157597b524a794214.js
1
2
!function(){"use strict";function t(){}function n(t){return t()}function e(){return Object.create(null)}function o(t){t.forEach(n)}function i(t){return"function"==typeof t}function r(t,n){return t!=t?n==n:t!==n||t&&"object"==typeof t||"function"==typeof t}function c(t,n,e,o){return t[1]&&o?function(t,n){for(const e in n)t[e]=n[e];return t}(e.ctx.slice(),t[1](o(n))):e.ctx}function a(t,n){t.appendChild(n)}function u(t,n,e){t.insertBefore(n,e||null)}function s(t){t.parentNode.removeChild(t)}function l(t){return document.createElement(t)}function f(t){return document.createTextNode(t)}function d(){return f(" ")}function h(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}function p(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function g(t){return""===t?void 0:+t}function m(t,n){(null!=n||t.value)&&(t.value=n)}let $;function w(t){$=t}function y(t){(function(){if(!$)throw new Error("Function called outside component initialization");return $})().$$.on_mount.push(t)}const x=[],b=[],k=[],v=[],_=Promise.resolve();let C=!1;function L(t){k.push(t)}let M=!1;const E=new Set;function D(){if(!M){M=!0;do{for(let t=0;t<x.length;t+=1){const n=x[t];w(n),I(n.$$)}for(x.length=0;b.length;)b.pop()();for(let t=0;t<k.length;t+=1){const n=k[t];E.has(n)||(E.add(n),n())}k.length=0}while(x.length);for(;v.length;)v.pop()();C=!1,M=!1,E.clear()}}function I(t){if(null!==t.fragment){t.update(),o(t.before_update);const n=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,n),t.after_update.forEach(L)}}const z=new Set;let H;function R(){H={r:0,c:[],p:H}}function A(){H.r||o(H.c),H=H.p}function T(t,n){t&&t.i&&(z.delete(t),t.i(n))}function W(t,n,e,o){if(t&&t.o){if(z.has(t))return;z.add(t),H.c.push(()=>{z.delete(t),o&&(e&&t.d(1),o())}),t.o(n)}}const B="undefined"!=typeof window?window:global;function F(t){t&&t.c()}function N(t,e,r){const{fragment:c,on_mount:a,on_destroy:u,after_update:s}=t.$$;c&&c.m(e,r),L(()=>{const e=a.map(n).filter(i);u?u.push(...e):o(e),t.$$.on_mount=[]}),s.forEach(L)}function j(t,n){const e=t.$$;null!==e.fragment&&(o(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}function S(t,n){-1===t.$$.dirty[0]&&(x.push(t),C||(C=!0,_.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[n/31|0]|=1<<n%31}function U(n,i,r,c,a,u,l=[-1]){const f=$;w(n);const d=i.props||{},h=n.$$={fragment:null,ctx:null,props:u,update:t,not_equal:a,bound:e(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(f?f.$$.context:[]),callbacks:e(),dirty:l};let p=!1;if(h.ctx=r?r(n,d,(t,e,...o)=>{const i=o.length?o[0]:e;return h.ctx&&a(h.ctx[t],h.ctx[t]=i)&&(h.bound[t]&&h.bound[t](i),p&&S(n,t)),e}):[],h.update(),p=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);h.fragment&&h.fragment.l(t),t.forEach(s)}else h.fragment&&h.fragment.c();i.intro&&T(n.$$.fragment),N(n,i.target,i.anchor),D()}w(f)}class q{$destroy(){j(this,1),this.$destroy=t}$on(t,n){const e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(n),()=>{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(){}}function O(t){let n,e,o;const i=t[3].default,r=function(t,n,e,o){if(t){const i=c(t,n,e,o);return t[0](i)}}(i,t,t[2],null);return{c(){n=l("div"),e=l("a"),r&&r.c(),p(e,"class","button"),p(e,"href",t[0]),p(e,"download",t[1]),p(e,"data-goatcounter-click",""),p(n,"class","download-button-container")},m(t,i){u(t,n,i),a(n,e),r&&r.m(e,null),o=!0},p(t,[n]){r&&r.p&&4&n&&r.p(c(i,t,t[2],null),function(t,n,e,o){if(t[2]&&o){const i=t[2](o(e));if(void 0===n.dirty)return i;if("object"==typeof i){const t=[],e=Math.max(n.dirty.length,i.length);for(let o=0;o<e;o+=1)t[o]=n.dirty[o]|i[o];return t}return n.dirty|i}return n.dirty}(i,t[2],n,null)),(!o||1&n)&&p(e,"href",t[0]),(!o||2&n)&&p(e,"download",t[1])},i(t){o||(T(r,t),o=!0)},o(t){W(r,t),o=!1},d(t){t&&s(n),r&&r.d(t)}}}function Y(t,n,e){let{href:o}=n,{filename:i}=n,{$$slots:r={},$$scope:c}=n;return t.$set=t=>{"href"in t&&e(0,o=t.href),"filename"in t&&e(1,i=t.filename),"$$scope"in t&&e(2,c=t.$$scope)},[o,i,c,r]}class P extends q{constructor(t){super(),U(this,t,Y,O,r,{href:0,filename:1})}}function X(t){let n;const e=new P({props:{href:t[3],filename:"BlackMyScreen.png",$$slots:{default:[G]},$$scope:{ctx:t}}});return{c(){F(e.$$.fragment)},m(t,o){N(e,t,o),n=!0},p(t,n){const o={};8&n&&(o.href=t[3]),128&n&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){W(e.$$.fragment,t),n=!1},d(t){j(e,t)}}}function G(t){let n;return{c(){n=f("Download")},m(t,e){u(t,n,e)},d(t){t&&s(n)}}}function J(t){let n,e,o,i,r,c,h,g=t[3]&&X(t);return{c(){n=l("figure"),e=l("canvas"),o=d(),i=l("figcaption"),i.innerHTML='\n By\n <a href="https://twitter.com/canrau" data-goatcounter-click="" rel="noopener">\n @CanRau\n </a>',r=d(),g&&g.c(),c=f(""),p(e,"width",t[0]),p(e,"height",t[1])},m(s,l){u(s,n,l),a(n,e),t[6](e),a(n,o),a(n,i),u(s,r,l),g&&g.m(s,l),u(s,c,l),h=!0},p(t,[n]){(!h||1&n)&&p(e,"width",t[0]),(!h||2&n)&&p(e,"height",t[1]),t[3]?g?(g.p(t,n),T(g,1)):(g=X(t),g.c(),T(g,1),g.m(c.parentNode,c)):g&&(R(),W(g,1,1,()=>{g=null}),A())},i(t){h||(T(g),h=!0)},o(t){W(g),h=!1},d(e){e&&s(n),t[6](null),e&&s(r),g&&g.d(e),e&&s(c)}}}function K(t,n,e){let o,i,r,{width:c}=n,{height:a}=n;function u(){o&&(r||(r=o.getContext("2d")),r.fillStyle="#000",r.fillRect(0,0,c,a),e(3,i=o.toDataURL("image/png;base64")))}return y(u),t.$set=t=>{"width"in t&&e(0,c=t.width),"height"in t&&e(1,a=t.height)},t.$$.update=()=>{3&t.$$.dirty&&c&&a&&window.setTimeout(u,50)},[c,a,o,i,r,u,function(t){b[t?"unshift":"push"](()=>{e(2,o=t)})}]}class Q extends q{constructor(t){super(),U(this,t,K,J,r,{width:0,height:1})}}function V(t){let n;const e=new P({props:{href:t[3],filename:"ImFeelingLucky.png",$$slots:{default:[Z]},$$scope:{ctx:t}}});return{c(){F(e.$$.fragment)},m(t,o){N(e,t,o),n=!0},p(t,n){const o={};8&n&&(o.href=t[3]),64&n&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(T(e.$$.fragment,t),n=!0)},o(t){W(e.$$.fragment,t),n=!1},d(t){j(e,t)}}}function Z(t){let n;return{c(){n=f("Download")},m(t,e){u(t,n,e)},d(t){t&&s(n)}}}function tt(t){let n,e,o,i,r,c,f,h,g,m,$,w,y,x=t[3]&&V(t);return{c(){n=l("main"),e=l("h2"),e.textContent="I'm Feeling Lucky",o=d(),i=l("p"),i.textContent="I know this is definitely not black 😂 yet while developing this site I came\n across this neat effect and couldn't resist including it.",r=d(),c=l("p"),c.innerHTML="<strong>Note:</strong>\n You will download the picture at the moment of your click on the download\n button, meaning it's a static image and the downloaded .png file won't be\n animated.\n ",f=d(),h=l("figure"),g=l("canvas"),m=d(),$=l("figcaption"),$.innerHTML='\n By\n <a href="https://twitter.com/canrau" data-goatcounter-click="" rel="noopener">\n @CanRau\n </a>',w=d(),x&&x.c(),p(g,"width",t[0]),p(g,"height",t[1])},m(s,l){u(s,n,l),a(n,e),a(n,o),a(n,i),a(n,r),a(n,c),a(n,f),a(n,h),a(h,g),t[5](g),a(h,m),a(h,$),a(n,w),x&&x.m(n,null),y=!0},p(t,[e]){(!y||1&e)&&p(g,"width",t[0]),(!y||2&e)&&p(g,"height",t[1]),t[3]?x?(x.p(t,e),T(x,1)):(x=V(t),x.c(),T(x,1),x.m(n,null)):x&&(R(),W(x,1,1,()=>{x=null}),A())},i(t){y||(T(x),y=!0)},o(t){W(x),y=!1},d(e){e&&s(n),t[5](null),x&&x.d()}}}function nt(t,n,e){let o,i,r,{width:c}=n,{height:a}=n;return y(()=>{const t=o.getContext("2d");return window.Worker&&(r=new Worker("/worker-imfeelinglucky.js")),function n(){let u;u=requestAnimationFrame(n);const s=t.getImageData(0,0,c,a);if(window.Worker&&r)r.postMessage([c,a,s]),r.onmessage=n=>{t.putImageData(n.data,0,0),e(3,i=o.toDataURL("image/png;base64"))};else{for(let t=0;t<s.data.length;t+=4){const n=t/4,e=n%c,o=n/a>>>0,i=window.performance.now(),r=64+128*e/c+64*Math.sin(i/1e3),u=64+128*o/a+64*Math.cos(i/1e3),l=128;s.data[t+0]=r,s.data[t+1]=u,s.data[t+2]=l,s.data[t+3]=255}t.putImageData(s,0,0),e(3,i=o.toDataURL("image/png;base64"))}}(),()=>{cancelAnimationFrame(frame),r&&r.terminate()}}),t.$set=t=>{"width"in t&&e(0,c=t.width),"height"in t&&e(1,a=t.height)},[c,a,o,i,r,function(t){b[t?"unshift":"push"](()=>{e(2,o=t)})}]}class et extends q{constructor(t){super(),U(this,t,nt,tt,r,{width:0,height:1})}}const{window:ot}=B;function it(t){let n,e,i,r,c,f,g,$,w,y,x,b,k,v,_,C,M,E=!1,D=!1;function I(){E=!0,t[6].call(c)}function z(){D=!0,t[7].call(w)}L(t[5]);const H=new Q({props:{width:t[2],height:t[3]}}),R=new et({props:{width:t[2],height:t[3]}});return{c(){n=l("main"),e=l("h5"),e.textContent="Your current devices display dimensions",i=d(),r=l("div"),c=l("input"),f=d(),g=l("span"),g.textContent="X",$=d(),w=l("input"),y=d(),x=l("button"),x.textContent="Reset",b=d(),k=l("section"),F(H.$$.fragment),v=d(),_=l("section"),F(R.$$.fragment),p(c,"class","size-control"),p(c,"type","number"),p(g,"class","size-controls-operator"),p(w,"class","size-control"),p(w,"type","number"),p(x,"class","size-reset"),p(x,"type","button"),p(r,"class","size-controls")},m(s,l,d){u(s,n,l),a(n,e),a(n,i),a(n,r),a(r,c),m(c,t[2]),a(r,f),a(r,g),a(r,$),a(r,w),m(w,t[3]),a(r,y),a(r,x),a(n,b),a(n,k),N(H,k,null),a(n,v),a(n,_),N(R,_,null),C=!0,d&&o(M),M=[h(ot,"resize",t[5]),h(c,"input",I),h(w,"input",z),h(x,"click",t[4])]},p(t,[n]){!E&&4&n&&m(c,t[2]),E=!1,!D&&8&n&&m(w,t[3]),D=!1;const e={};4&n&&(e.width=t[2]),8&n&&(e.height=t[3]),H.$set(e);const o={};4&n&&(o.width=t[2]),8&n&&(o.height=t[3]),R.$set(o)},i(t){C||(T(H.$$.fragment,t),T(R.$$.fragment,t),C=!0)},o(t){W(H.$$.fragment,t),W(R.$$.fragment,t),C=!1},d(t){t&&s(n),j(H),j(R),o(M)}}}function rt(t,n,e){let o,i,r=window.innerWidth,c=window.innerHeight;return t.$$.update=()=>{1&t.$$.dirty&&e(2,o=r),2&t.$$.dirty&&e(3,i=c)},[r,c,o,i,function(){e(2,o=window.innerWidth),e(3,i=window.innerHeight)},function(){e(0,r=ot.innerWidth),e(1,c=ot.innerHeight)},function(){o=g(this.value),e(2,o),e(0,r)},function(){i=g(this.value),e(3,i),e(1,c)}]}var ct;new class extends q{constructor(t){super(),U(this,t,rt,it,r,{})}}({target:(ct=document.getElementById("blackmyscreen"),ct.innerHTML="",ct)})}();
//# sourceMappingURL=bundle-a054177d157597b524a794214.js.map