From ee97b8faab023042dd763952388fe80368f36cca Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Sat, 31 Jan 2026 18:27:19 +0100 Subject: [PATCH] Photo booth --- photo-booth/README.md | 32 ++++++ photo-booth/config_example.js | 19 ++++ photo-booth/ding.mp3 | Bin 0 -> 4800 bytes photo-booth/index.html | 19 ++++ photo-booth/scripts/jquery-3.6.1.min.js | 2 + photo-booth/scripts/script.js | 124 ++++++++++++++++++++++++ photo-booth/shutter.mp3 | Bin 0 -> 4168 bytes photo-booth/style.css | 62 ++++++++++++ 8 files changed, 258 insertions(+) create mode 100644 photo-booth/README.md create mode 100644 photo-booth/config_example.js create mode 100644 photo-booth/ding.mp3 create mode 100644 photo-booth/index.html create mode 100644 photo-booth/scripts/jquery-3.6.1.min.js create mode 100644 photo-booth/scripts/script.js create mode 100644 photo-booth/shutter.mp3 create mode 100644 photo-booth/style.css diff --git a/photo-booth/README.md b/photo-booth/README.md new file mode 100644 index 0000000..625e5fc --- /dev/null +++ b/photo-booth/README.md @@ -0,0 +1,32 @@ +# Photo booth web + +This is a photo booth that posts the photos shot by the guests to the app. +It shots a photo when the Enter or Space keys are pressed (I used one of these fluffy big USB Enter keys) and uploades it to the app on behalf of an existing user. + +## Install + +- Create an user that will post the photos adding a row in the user's table. Assign a token, any sufficiently strong string is ok. +- Copy the current folder in the PC that will be used as Photo Booth +- Copy config_example.js to config.js and edit it +- Place your webservices url in BASEURL +- Place the user's token in the config. +- Configure the browser using the following indications: + +``` +Use Firefox as browser. Go in about:config and set: +browser.download.alwaysOpenPanel false // Prevents to open download list when taking a photo +privacy.webrtc.legacyGlobalIndicator false // Hides camera overlay + +When starting firefox in the photo booth totem, press F11 to make it full screen and leave only the Enter or Space key exposed +If the download panel is shown anyway, right click on the download icon and deselect "Show panel when starting a download". +If it appears already deselected, select and deselect it. +``` + + +## Attributions + +### Sounds + +All creative commons: +- Bike, Bell Ding, Single, 01-01.wav from InspectorJ (https://freesound.org/s/484344/) +- Camera shutter.wav from jdaniel1999 (https://freesound.org/s/376205/) diff --git a/photo-booth/config_example.js b/photo-booth/config_example.js new file mode 100644 index 0000000..d88acaa --- /dev/null +++ b/photo-booth/config_example.js @@ -0,0 +1,19 @@ +// Configuration + +const BASEURL = "https://mysite.com"; +const TOKEN = ""; // Photo booth user's token + +const COUNTDOWN_FROM = 3; + + +/* + Browser configurations: + + Use Firefox as browser. Go in about:config and set: + browser.download.alwaysOpenPanel false // Prevents to open download list when taking a photo + privacy.webrtc.legacyGlobalIndicator false // Hides camera overlay + + When starting firefox in the photo booth totem, press F11 to make it full screen and leave only the Enter or Space key exposed + If the download panel is shown anyway, right click on the download icon and deselect "Show panel when starting a download". + If it appears already deselected, select and desenect it. +*/ diff --git a/photo-booth/ding.mp3 b/photo-booth/ding.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..c0f7d2f6ada158d3ea4dc12a091505849c0ee2bb GIT binary patch literal 4800 zcmd6rdpK0v|Ht>tFpZhP(2zToG@N3RTUX z2$NJwBG=^9kduT`LZ@M7efRD>=lt>g##S`O5r)??u@Tq$1d*&@>ju z+lDi>RoyOj_R;v)zfSK~-6euay4I;GnO-2YEZB`n@c9;Lw*Ks2Cr$yBs_LVsU<`uR zci=wMZ67~mmlNT0cr0(F)HZHKHNGTS`H{?7u=<1Y!&OX>IM2!eAVo=z|Bf98!1&^D zNc7Mry)4WABM}=2CFFXIt4ByO6%~&VemU{;nd#ac1t`)Rp0*%^f;KmdA}SJ+UX~Ze z&X(UV*c++7LoqutwsWU}{7~%2B0p>V?-w&lQW&8JpIo_h&d$>>is(1!SbKx{E*6+bT}K#&M4k92t~eoxT;N9U&VGu&o6 z5+8*uM9V%u_%UXSHHL6Bs?oW&$PRfe|B5})R+gNa8++(Te?7#laC^I=W7by{h48Ny z{}30IF-t>96wiN`@1>w$RSb^gg&9p~ao$>ezr-D~nbfE>44d879-||dUwq;{-TIk& zzHP>EY5FS*DHFvFf@`urJX?;WS=05|>6#ns2686LM^5(59Af@*Kk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gm=ysFYw{6Ru6EC^8Za(JfmA=5mrv0i`FRH*3`V&)h0^aV^5z$PG*ngnX2KTx;<2X zX}bFPJ1PzPI@aP$ai*lCwK(`^O3Fn(U*y61`=$-Rk9hQ{OIQ{= + + + + Photo booth + + + + + + + +
+ +
+
+
3
+ + diff --git a/photo-booth/scripts/jquery-3.6.1.min.js b/photo-booth/scripts/jquery-3.6.1.min.js new file mode 100644 index 0000000..2c69bc9 --- /dev/null +++ b/photo-booth/scripts/jquery-3.6.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),v={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&v(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!y||!y.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ve(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ye(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ve(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],y=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",v.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 0) { + if (from === COUNTDOWN_FROM) + countdownEl.show(); + countdownSound.play(); + setTimeout(function() {countdown(from - 1, onCountdownElapsed)}, 1000); + } else { + countingDown = false; + countdownEl.hide(); + onCountdownElapsed(); + } + countdownEl.text(from); +} + +function takePhoto() { + const canvas = $('#canvas'); + const canvasContainer = $('#canvas-container'); + const flash = $('#flash'); + const context = canvas[0].getContext('2d'); + context.drawImage(video, 0, 0, 3840, 2160); + canvasContainer.show(); + flash.show(); + $('#video').addClass('blurred'); + shutterSound.play(); + uploadImage(); + + // Hide flash + setTimeout(function() { + flash.hide(); + }, 200) + + // Hide canvas + setTimeout(function() { + canvasContainer.hide(); + $('#video').removeClass('blurred'); + }, 5000); +} + +function uploadImage() { + document.querySelector("#canvas").toBlob(function(blob) { + let file = new File([blob], 'photobooth.jpg', { type: 'image/jpeg' }); + let data = new FormData(); + data.append('image', file); + + let request = new XMLHttpRequest(); + request.open('POST', `${BASEURL}/api/gallery_item/upload.php`); + request.setRequestHeader('Authentication', TOKEN); + request.addEventListener('load', function(e) { + console.log(request.response); + }); + request.send(data); + saveLocalImage(file); + }, 'image/jpeg', 1); +} + +/** + * Saves the image locally for backup + */ +function saveLocalImage(blob) { + const fileName = `photobooth-${Date.now()}` + if (typeof navigator.msSaveBlob == "function") + return navigator.msSaveBlob(blob, fileName); + + var saver = document.createElementNS("http://www.w3.org/1999/xhtml", "a"); + var blobURL = saver.href = URL.createObjectURL(blob), + body = document.body; + + saver.download = fileName; + + body.appendChild(saver); + saver.dispatchEvent(new MouseEvent("click")); + body.removeChild(saver); + URL.revokeObjectURL(blobURL); +} diff --git a/photo-booth/shutter.mp3 b/photo-booth/shutter.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..284c2a5325ff07aeb69b45febef15486c2c98fa1 GIT binary patch literal 4168 zcmd^?c{J2t|G+=i7-WpGWNWP1l8}rgWXZk{GLmf~`xdg!WZ##J(8#Wg$nuq~ELp;o z7Aeah#6*@NS@U@~^*hh+{C;?WWwl{s;j@DR@8VdkG z^#JZaod1i#U)=tH{R`nQ#6NWXW%w`TKP>-c=P%$Nj?O|FX&URu%OI5ks4I>|l4bw^ zxULAD(`5kAJ(fe=jEntvOfr>FV5%HzVbufYS ztQf%<^Lgje>7Zi4?(Y#$X1|Ej(WIF5Zb0jx*ah4X{C1)nyr&L=-!J1dx*TQsPSOhj zT^axjPmC;riy4Y#d_+s*+2+^+(blm4IA?y#$SH~;p8j)RoGt_kQ0$$C*_|Wck-AB- z1;Lda)PHLaLZfov_*&3b|=o?x!ir5sRbayg&S1Dfn8F zLP3GWug(0!#>3UBp2Fs+texz>eHHd*>9n`Al8w2W>*I^y^AB5jWQPS&!ebN5ZTq#> zgP8>|BRahQV?S=9c(+((KyWr|LH%Ih2^jO0K}1MSO2D8wyFy1Yz$h{q{c|H8 zM5HfY+-~)%JA|xXg(!pP92*;s6)4GfX?>mvJ5fWFkIw|eT;&{Jl=R8v`4mJM{mw6+ zO?<;EwIkkm)w;6P)UNBS_U7X2WGIRLB!*Kb*ka$5bgut1*Vosa#@pJPd>O0dJKikg zhp#Gg(H$o5u9r8O+(_ytM0p0#2Tgl3)eW5D1-C#j?fK>dXTc;$Jq^_rT)rVe8=}ez zf(PJEV=Hg)WGreot|wlA&q+fB`$FSAR*%7N=;ArpX4OLwT$ce4dFq{~L@%Un$JCOF z#^RVSXxW6wkndMdN2`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5zaDC3&U!*%+gE>w~wMo{$+r z0f6RW@RMJW#%PX6DK64_zQCGvv#cL++^yPT_LfKB)xk{rkrXSK&)iI5K0zt0dUjq? zrq<}yt3{LW5tx846gv%rrrV8gi{$L`NBp~mq4^W~ONK>bJj3z`^?r2qf` literal 0 HcmV?d00001 diff --git a/photo-booth/style.css b/photo-booth/style.css new file mode 100644 index 0000000..63c8421 --- /dev/null +++ b/photo-booth/style.css @@ -0,0 +1,62 @@ +body { + margin: 0px; +} + +#video { + width: 100vw; + height: 100vh; + position: absolute; + cursor: none; +} + +.blurred { + filter: blur(8px); +} + +#canvas-container { + width: 100vw; + height: 100vh; + position: absolute; + background-color: #000a; + cursor: none; + display: none; +} + +#canvas { + width: 50vw; + height: 50vh; + position: relative; + margin-left: 25vw; + margin-top: 25vh; + border: 100px solid white; + left: -100px; + top: -100px; + cursor: none; +} + +#flash { + width: 100vw; + height: 100vh; + position: absolute; + display: none; + background-color: white; + cursor: none; +} + +#countdown { + width: 600px; + height: 600px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -300px; + margin-top: -300px; + font-size: 450px; + text-align: center; + font-family: sefif; + color: white; + background: #000a; + border-radius: 100px; + cursor: none; + display: none; +} \ No newline at end of file