Verified Commit e10524d0 authored by Luc Didry's avatar Luc Didry
Browse files

Add Peanuts & Nouka photo

parent e2b47e17
Pipeline #402306 passed with stage
in 18 seconds
......@@ -23,12 +23,12 @@ Then commit your changes and create a merge request.
## Modifying the javascript
You will need [`minifier`](https://www.npmjs.com/package/minifier).
You will need [`uglify-js`](https://www.npmjs.com/package/uglify-js) (`sudo npm install uglify-js -g`).
Modify `js/wemawema.js` then do `minify js/wemawema.js`.
Modify `js/wemawema.js` then do `uglifyjs -c -m -o js/wema_wema.min.js js/wema_wema.js`.
Then commit your changes and create a merge request.
## Other contributions
Just commit your changes and create a merge request.
\ No newline at end of file
Just commit your changes and create a merge request.
......@@ -411,6 +411,7 @@
<option value="uyuni">Uyuni</option>
<option value="bark">Tree bark</option>
<option value="snow">Snow</option>
<option value="peanuts-nouka">Peanuts &amp; Nouka</option>
<option value="piksel">Piksel</option>
<option value="whale">Whale</option>
<option value="macron">Macron</option>
......
......@@ -398,8 +398,23 @@ function bindEvents() {
if (this.id !== 'wemake-font' && this.id !== 'wemake-font-style' && this.id !== 'porn-font' && this.id !== 'porn-font-style') {
if (this.id === 'bg-type' ) {
$(this).change(function() {
if ($(this).val() === 'img' && $('#bg-img').val() === 'telechat') {
if ($(this).val() === 'img' && ($('#bg-img').val() === 'telechat') || $('#bg-img').val() === 'peanuts-nouka') {
$('#rect-alpha').val(100);
if ($('#bg-img').val() === 'peanuts-nouka') {
$('#wemake-x').val('400');
$('#wemake-y').val('100');
$('#wemake-size').val('90');
$('#wemake-color').val('#FFFFFF');
$('#wemake-outline-color').val('#000000');
$('#wemake-outline-size').val(5);
$('#porn-x').val('400');
$('#porn-y').val('385');
$('#porn-size').val('90');
$('#porn-color').val('#FFFFFF');
$('#porn-outline-color').val('#000000');
$('#porn-outline-size').val(5);
}
}
if ($(this).val() === 'img' && $('#bg-img').val() !== 'custom') {
$('#custom-img-url').val('');
......@@ -408,8 +423,23 @@ function bindEvents() {
});
} else if (this.id === 'bg-img') {
$(this).change(function() {
if ($(this).val() === 'telechat') {
if ($(this).val() === 'telechat' || $('#bg-img').val() === 'peanuts-nouka') {
$('#rect-alpha').val(100);
if ($('#bg-img').val() === 'peanuts-nouka') {
$('#wemake-x').val('400');
$('#wemake-y').val('100');
$('#wemake-size').val('90');
$('#wemake-color').val('#FFFFFF');
$('#wemake-outline-color').val('#000000');
$('#wemake-outline-size').val(5);
$('#porn-x').val('400');
$('#porn-y').val('385');
$('#porn-size').val('90');
$('#porn-color').val('#FFFFFF');
$('#porn-outline-color').val('#000000');
$('#porn-outline-size').val(5);
}
}
if ($(this).val() !== 'custom') {
$('#custom-x').val(0);
......
// vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
// Cookies
// center text
// create the URL with all the parameters
function detectLang(){var e=[],a=readCookie("lang")
void 0!==a&&null!==a&&e.push(a)
for(var t=navigator.languages,r=0;r<t.length;r++)e.push(t[r])
if(0!==e.length)translate(e.shift(),e)
else{console.log("Using old style language detection.")
translate(navigator.language||navigator.userLanguage)}}function translate(e,a){$.get({url:"locales/"+e+".json",dataType:"json",error:function(){void 0!==a&&null!==a&&0!==a.length&&translate(a.shift(),a)},success:function(a){if(toggleI18n(e),"groot"===e&&($("#wemake").val("I am"),$("#porn").val("Groot"),$("#bg-type").val("img"),$("#bg-img").val("bark"),$("#wemake-color").val("#ffffff"),$("#porn-color").val("#ffffff"),$("#rect-color").val("#ffffff"),toggleBgSettings(),refreshFilename(),refreshText()),["get-source","donate-dpdn","license","author","wemake","porn","border-txt","color","transparency","x-position","y-position","font","style","text-size","text-width","outline-color","outline-size"].forEach(function(e){void 0!==a[e]&&$("."+e).text(a[e])}),["hide-settings","set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","gallery"].forEach(function(e){void 0!==a[e]&&$('[data-setting="'+e+'"]').text(a[e])}),["wemake","porn","filename","corners","bg-type","bgu-color","bgr-color","egr-color","gr-orientation","bg-img","custom-img","custom-x","custom-y","custom-size","border-thickness","img-width","img-height","custom-img-url","rick-size","rick-x","rick-y","rick-rad"].forEach(function(e){void 0!==a[e]&&$('label[for="'+e+'"]').text(a[e])}),void 0!==a["corners-rounded"]&&$('#corners option[value="20"]').text(a["corners-rounded"]),void 0!==a["corners-square"]&&$('#corners option[value="0"]').text(a["corners-square"]),void 0!==a["add-glitter"]&&$(".glitter span").text(a["add-glitter"]),["plain","gradient","rainbow","img","lr","rl","tb","bt","r","beer","glitter","rainbow-flag","sky","field","bridge","regular","bold","italic","italic bold","bark","snow","whale"].forEach(function(e){void 0!==a[e]&&$('option[value="'+e+'"]').text(a[e])}),["donate-dpdn","settings-dpdn","toggle-svg","download","reset","switch-colors","make-text-center","print","save","import","export"].forEach(function(e){void 0!==a[e]&&("download"===e&&(download=a[e]),$("#"+e).text(a[e]))}),void 0!==a["i18n-dpdn"]&&$("#i18n-dpdn i").attr("title",a["i18n-dpdn"]),void 0!==a["import-n-export"]&&$("#import-n-export").attr("title",a["import-n-export"]),void 0!==a["toggle-canvas"]&&(workCanvas=a["toggle-canvas"]),void 0!==a["toggle-svg"]&&(workSvg=a["toggle-svg"]),void 0!==a["sorry-no-gallery"]&&(sorryNoGallery=a["sorry-no-gallery"]),void 0!==a.load&&(load=a.load),void 0!==a.delete&&(deleteText=a.delete),void 0!==a["custom-img-text"]){customImgText=a["custom-img-text"]
var t=$('option[value="custom"]')
0!==t.length&&t.text(customImgText)}void 0!==a["import-ok"]&&(importOk=a["import-ok"]),void 0!==a["download-clic"]&&(downloadClic=a["download-clic"]),void 0!==a["add-rick"]&&$(".rick span").text(a["add-rick"])}})}function getParameters(){window.location.hash&&$("#porn").val(decodeURIComponent(window.location.hash.substr(1)))
var e=new URL(window.location)
null!==e.searchParams.get("w")&&$("#wemake").val(e.searchParams.get("w")),null!==e.searchParams.get("wx")&&$("#wemake-x").val(e.searchParams.get("wx")),null!==e.searchParams.get("wy")&&$("#wemake-y").val(e.searchParams.get("wy")),null!==e.searchParams.get("ws")&&$("#wemake-size").val(e.searchParams.get("ws")),null!==e.searchParams.get("wc")&&$("#wemake-color").val(e.searchParams.get("wc")),null!==e.searchParams.get("wa")&&$("#wemake-alpha").val(e.searchParams.get("wa")),null!==e.searchParams.get("wf")&&$("#wemake-font").val(e.searchParams.get("wf")),null!==e.searchParams.get("wfs")&&$("#wemake-font-style").val(e.searchParams.get("wfs")),null!==e.searchParams.get("ww")&&$("#wemake-width").val(e.searchParams.get("ww")),null!==e.searchParams.get("p")&&$("#porn").val(e.searchParams.get("p")),null!==e.searchParams.get("px")&&$("#porn-x").val(e.searchParams.get("px")),null!==e.searchParams.get("py")&&$("#porn-y").val(e.searchParams.get("py")),null!==e.searchParams.get("ps")&&$("#porn-size").val(e.searchParams.get("ps")),null!==e.searchParams.get("pc")&&$("#porn-color").val(e.searchParams.get("pc")),null!==e.searchParams.get("pa")&&$("#porn-alpha").val(e.searchParams.get("pa")),null!==e.searchParams.get("pf")&&$("#porn-font").val(e.searchParams.get("pf")),null!==e.searchParams.get("pfs")&&$("#porn-font-style").val(e.searchParams.get("pfs")),null!==e.searchParams.get("pw")&&$("#porn-width").val(e.searchParams.get("pw")),null!==e.searchParams.get("co")&&$("#bgu-color").val(e.searchParams.get("co")),null!==e.searchParams.get("gli")&&$("#add-glitter").prop("checked","true"===e.searchParams.get("gli")),null!==e.searchParams.get("bgt")&&$("#bg-type").val(e.searchParams.get("bgt")),null!==e.searchParams.get("rc")&&$("#rect-color").val(e.searchParams.get("rc")),null!==e.searchParams.get("ra")&&$("#rect-alpha").val(e.searchParams.get("ra")),null!==e.searchParams.get("bgr")&&$("#bgr-color").val(e.searchParams.get("bgr")),null!==e.searchParams.get("egr")&&$("#egr-color").val(e.searchParams.get("egr")),null!==e.searchParams.get("or")&&$("#gr-orientation").val(e.searchParams.get("or")),null!==e.searchParams.get("bgi")&&"custom"!==e.searchParams.get("bgi")?$("#bg-img").val(e.searchParams.get("bgi")):$("#bg-img").val("beer"),null!==e.searchParams.get("cor")&&$("#corners").val(e.searchParams.get("cor")),null!==e.searchParams.get("f")&&$("#filename").val(e.searchParams.get("f")),null!==e.searchParams.get("width")&&$("#img-width").val(e.searchParams.get("width")),null!==e.searchParams.get("height")&&$("#img-height").val(e.searchParams.get("height")),null!==e.searchParams.get("bth")&&$("#border-thickness").val(e.searchParams.get("bth")),null!==e.searchParams.get("x")&&$("#custom-x").val(e.searchParams.get("x")),null!==e.searchParams.get("y")&&$("#custom-y").val(e.searchParams.get("y")),null!==e.searchParams.get("s")&&$("#custom-size").val(e.searchParams.get("s")),null!==e.searchParams.get("bgu")&&""!==e.searchParams.get("bgu")&&($("#custom-img-url").val(e.searchParams.get("bgu")),handleImageURL(!1)),null!==e.searchParams.get("r")&&$("#add-rick").prop("checked","true"===e.searchParams.get("r")),null!==e.searchParams.get("rx")&&$("#rick-x").val(e.searchParams.get("rx")),null!==e.searchParams.get("ry")&&$("#rick-y").val(e.searchParams.get("ry")),null!==e.searchParams.get("rs")&&$("#rick-size").val(e.searchParams.get("rs")),null!==e.searchParams.get("rr")&&$("#rick-rad").val(e.searchParams.get("rr")),null!==e.searchParams.get("woc")&&$("#wemake-outline-color").val(e.searchParams.get("woc")),null!==e.searchParams.get("wos")&&$("#wemake-outline-size").val(e.searchParams.get("wos")),null!==e.searchParams.get("poc")&&$("#porn-outline-color").val(e.searchParams.get("poc")),null!==e.searchParams.get("pos")&&$("#porn-outline-size").val(e.searchParams.get("pos"))}function bindEvents(){$('input[type="text"]').each(function(e){"filename"!==this.id&&($(this).keyup(function(){refreshText(),refreshFilename()}),$(this).on("paste",function(){refreshText(),refreshFilename()}))}),$("#custom-img-url").keyup(function(){this.checkValidity()&&!$(this).val().match(/^ *$/)&&(handleImageURL(!0),refreshText())}),$("#custom-img-url").on("paste",function(){this.checkValidity()&&!$(this).val().match(/^ *$/)&&(handleImageURL(!0),refreshText())}),$('select,input[type="number"],input[type="color"],input[type="checkbox"]').each(function(e){"wemake-font"!==this.id&&"wemake-font-style"!==this.id&&"porn-font"!==this.id&&"porn-font-style"!==this.id?"bg-type"===this.id?$(this).change(function(){"img"===$(this).val()&&"telechat"===$("#bg-img").val()&&$("#rect-alpha").val(100),"img"===$(this).val()&&"custom"!==$("#bg-img").val()&&$("#custom-img-url").val(""),refreshText()}):"bg-img"===this.id?$(this).change(function(){"telechat"===$(this).val()&&$("#rect-alpha").val(100),"custom"!==$(this).val()&&($("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(1),$("#custom-img-url").val("")),refreshText()}):$(this).change(refreshText):$(this).change(function(){waitForfont(this.id)})}),$("#bg-type").change(toggleBgSettings),$("#toggle-svg").click(function(e){e.preventDefault(),$("#svg").hasClass("d-none")?($(this).removeClass("btn-info"),$(this).addClass("btn-primary"),hide("canvas"),show("svg"),this.text=workCanvas):($(this).removeClass("btn-primary"),$(this).addClass("btn-info"),hide("svg"),show("canvas"),this.text=workSvg),refreshText(),refreshFilename()}),$("#import").click(function(e){e.preventDefault(),$("#import-file").click()}),$("#export").click(exportData),$("#download").click(function(e){if(this.download=$("#filename").val(),$("#svg").hasClass("d-none")){var a=$("#custom-img-url").val()
void 0===a||null===a||a.match(/^ *$/)||!$("#custom-img-url")[0].checkValidity()?this.href=document.getElementById("canvas").toDataURL("image/octet-stream"):(e.preventDefault(),alert(downloadClic))}else this.href="data:image/octet-stream;base64,"+btoa(svg.getSerializedSvg(!0))}),$("[data-setting]").click(function(e){e.preventDefault()
var a=$(this)
$("[data-setting]").removeClass("active"),a.addClass("active"),"hide-settings"===a.data("setting")?(hide("gallery"),show("main-tool"),["settings","set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","set-rick"].forEach(function(e){hide(e)})):"gallery"===a.data("setting")?(hide("main-tool"),show("gallery"),fillGallery()):(hide("gallery"),show("main-tool"),["set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","set-rick"].forEach(function(e){e!==a.data("setting")?hide(e):show(e),show("settings")}))}),$("#reset").click(function(e){e.preventDefault(),reset()}),$("#switch-colors").click(function(e){e.preventDefault(),switchTextColors(),refreshText()}),$("#make-text-center").click(centerText),$("#custom-img").change(handleImage),void 0!==customImg&&null!==customImg||$("#custom-img").val(null),$("[data-i18n]").click(function(e){e.preventDefault(),createCookie("lang",$(this).data("i18n"),30),translate($(this).data("i18n"))}),$("#print").click(function(e){e.preventDefault(),window.print()}),$("#save").click(function(e){e.preventDefault(),addItem()})}function handleImageURL(e){$("#bg-type").val("img")
var a=$("<option>"),t=$("#bg-img"),r=$('option[value="custom"]')
0!==r.length&&r.remove(),a.attr("value","custom"),a.text(customImgText),t.append(a),t.val("custom"),e&&($("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0)),toggleBgSettings()}function toggleBgSettings(){switch($("#bg-type").val()){case"plain":show("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings")
break
case"gradient":hide("bg-color"),show("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings")
break
case"img":hide("bg-color"),hide("gradient-settings"),show("bg-img-settings"),show("bg-custom-img-settings")
break
default:hide("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings")}}function refreshFilename(){var e=$("#wemake"),a=$("#porn"),t=$("#filename"),r=$("#svg"),o="png"
r.hasClass("d-none")||(o="svg")
var s=e.val()+" "+a.val()+"."+o
t.val(s.replace(/ /g,"_"))}function waitForfont(e,a){void 0!==a&&null!==a||(a=refreshText),e=e.replace("-style","")
var t=$("#"+e).val(),r=$("#"+e+"-style").val()
if("sans-serif"===t||void 0!==loadedFonts[t]&&void 0!==loadedFonts[t][r]||void 0===fonts[t]||void 0===fonts[t][r])"sans-serif"!==t&&(void 0===fonts[t]&&console.log(t+" is not a valid font"),void 0===fonts[t][r]&&console.log(r+" is not a valid style for font "+t)),a()
else{new FontFace(t,"url("+fonts[t][r]+")").load().then(function(e){console.log("font "+t+" "+r+" loaded"),document.fonts.add(e),void 0!==loadedFonts[t]?loadedFonts[t][r]=!0:loadedFonts[t]={s:!0},a()})}}function toggleI18n(e){$("[data-i18n]").removeClass("active"),$('[data-i18n="'+e+'"]').addClass("active")}function handleImage(e){var a=new FileReader
a.onload=function(e){var a=new Image
a.onload=function(){var e=$("<option>"),t=$("#bg-img"),r=$('option[value="custom"]')
0!==r.length&&r.remove(),e.attr("value","custom"),e.text(customImgText),t.append(e),t.val("custom"),customImg=a,$("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0),refreshText()},a.src=e.target.result},a.readAsDataURL(e.target.files[0])}function switchTextColors(){var e=$("#wemake-color"),a=$("#porn-color"),t=e.val(),r=a.val()
e.val(r),a.val(t)}function reset(){$("#wemake-x").val("400"),$("#wemake-y").val("160"),$("#wemake-size").val("150"),$("#wemake-color").val("#000000"),$("#wemake-alpha").val("0"),$("#wemake-font").val("Open Sans"),$("#wemake-font-style").val("bold"),$("#wemake-width").val("725"),$("#porn-x").val("400"),$("#porn-y").val("350"),$("#porn-size").val("220"),$("#porn-color").val("#000000"),$("#porn-alpha").val("0"),$("#porn-font").val("Open Sans"),$("#porn-font-style").val("bold"),$("#porn-width").val("725"),$("#bgu-color").val("#fcd205"),$("#rect-color").val("#000000"),$("#rect-alpha").val("0"),$("#add-glitter").prop("checked",!1),$("#bg-type").val("plain"),$("#gr-orientation").val("lr"),$("#bg-img").val("beer"),$("#corners").val("20"),$("#custom-img").val(null),$("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0),$("#img-width").val(800),$("#img-height").val(400),$("#border-thickness").val(20),$("#custom-img-url").val(null),$("#add-rick").prop("checked",!1),$("#rick-x").val(0),$("#rick-y").val(0),$("#rick-size").val(100),$("#rick-rad").val(0),$("#wemake-outline-color").val("#FFFFFF"),$("#wemake-outline-size").val(0),$("#porn-outline-color").val("#FFFFFF"),$("#porn-outline-size").val(0),show("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings"),refreshText()}function refreshText(){var e=$("#wemake").val(),a=$("#wemake-x").val(),t=$("#wemake-y").val(),r=$("#wemake-size").val(),o=$("#wemake-color").val(),s=$("#wemake-alpha").val(),l=$("#wemake-font").val(),n=$("#wemake-font-style").val(),i=$("#wemake-width").val(),c=$("#porn").val(),g=$("#porn-x").val(),m=$("#porn-y").val(),d=$("#porn-size").val(),h=$("#porn-color").val(),v=$("#porn-alpha").val(),f=$("#porn-font").val(),u=$("#porn-font-style").val(),p=$("#porn-width").val(),w=$("#bgu-color").val(),b=$("#add-glitter").prop("checked"),k=$("#bg-type").val(),P=$("#rect-color").val(),y=$("#rect-alpha").val(),x=$("#bgr-color").val(),S=$("#egr-color").val(),C=$("#gr-orientation").val(),I=$("#bg-img").val(),T=$("#corners").val(),z=$("#border-thickness").val(),R=$("#custom-x").val(),F=$("#custom-y").val(),L=$("#custom-size").val(),O=$("#custom-img-url")[0].checkValidity()?$("#custom-img-url").val():"",U=$("#add-rick").prop("checked"),D=$("#rick-x").val(),A=$("#rick-y").val(),G=$("#rick-size").val(),B=$("#rick-rad").val(),N=$("#wemake-outline-color").val(),E=$("#wemake-outline-size").val(),M=$("#porn-outline-color").val(),W=$("#porn-outline-size").val(),J=$("#img-width").val(),j=$("#img-height").val()
$("#canvas").remove()
var q=document.createElement("canvas")
q.id="canvas",q.classList.add("img-fluid"),q.width=J,q.height=j,document.getElementById("canvas-container").appendChild(q)
var V=q.getContext("2d"),X=$("#svg")
svg=new C2S(J,j),!1===X.hasClass("d-none")&&(V=svg)
var H=new URL(window.location)
window.history.pushState("change","WemaWema",createUrl(H,e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,y,b,k,P,x,S,C,I,T,z,J,j,R,F,L,O,U,D,A,G,B,N,E,M,W)),drawCtx(!1,V,P,y,r,o,s,l,n,e,a,t,d,h,v,f,u,c,g,m,b,J,j,z,k,w,T,I,L,x,S,C,R,F,O,U,D,A,G,B,i,p,N,E,M,W)}function drawCtx(e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,b,k,P,y,x,S,C,I,T,z,R,F,L,O,U,D,A,G,B,N,E,M,W,J,j,q,V){switch(a.clearRect(0,0,P,y),S){case"plain":a.fillStyle=C
break
case"gradient":var X
switch(L){case"lr":X=a.createLinearGradient(0,y/2,P,y/2)
break
case"rl":X=a.createLinearGradient(P,y/2,0,y/2)
break
case"tb":X=a.createLinearGradient(P/2,0,P/2,y)
break
case"bt":X=a.createLinearGradient(P/2,y,P/2,0)
break
case"r":X=a.createRadialGradient(P/2,y/2,25,P/2,y/2,P/2)}X.addColorStop(0,R),X.addColorStop(1,F),a.fillStyle=X
break
case"img":if(!0!==e&&"custom"===T&&void 0!==customImg&&null!==customImg){var H=customImg.width,Y=customImg.height,_=scalePreserveAspectRatio(H,Y,P,y)
if(0===parseFloat(z)?(z=Math.round(1e3*_)/1e3,!0!==e&&$("#custom-size").val(z)):_=z,!0!==e){var K=new URL(window.location)
window.history.pushState("change","WemaWema",createUrl(K,c,g,m,o,s,l,n,i,M,p,w,b,d,h,v,f,u,W,C,r,k,S,t,R,F,L,T,I,x,P,y,O,U,z,D,A,G,B,N,E,J,j,q,V))}a.drawImage(customImg,0,0,H,Y,O,U,H*_,Y*_),drawOver(a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,b,k,P,y,x,A,G,B,N,E,M,W,J,j,q,V)}else{""!==T&&("custom"!==T||void 0!==D&&null!==D&&""!==D)||(T="beer",!0===e||void 0!==D&&null!==D&&""!==D||$("#bg-img").val("beer"))
var Q=new Image,Z="img/"+T
20===parseInt(I)&&(Z+="-round"),void 0===D||null===D||""===D?Z+=".png":Z=D,Q.src=Z,Q.onload=function(){var X=Q.width,H=Q.height,Y=scalePreserveAspectRatio(X,H,P,y)
if(0===parseFloat(z)?(z=Math.round(1e3*Y)/1e3,!0!==e&&$("#custom-size").val(z)):Y=z,!0!==e){var _=new URL(window.location)
window.history.pushState("change","WemaWema",createUrl(_,c,g,m,o,s,l,n,i,M,p,w,b,d,h,v,f,u,W,C,r,k,S,t,R,F,L,T,I,x,P,y,O,U,z,D,A,G,B,N,E,J,j,q,V))}a.drawImage(Q,0,0,X,H,O,U,X*Y,H*Y),drawOver(a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,b,k,P,y,x,A,G,B,N,E,M,W,J,j,q,V)}}return
case"rainbow":var X=a.createLinearGradient(P/2,0,P/2,y),ee=svg.createLinearGradient(P/2,0,P/2,y)
X.addColorStop(0,"#e50000"),X.addColorStop(.2,"#ff8d00"),X.addColorStop(.4,"#ffee00"),X.addColorStop(.6,"#008121"),X.addColorStop(.8,"#004cff"),X.addColorStop(1,"#760188"),ee.addColorStop(0,"#e50000"),ee.addColorStop(.2,"#ff8d00"),ee.addColorStop(.4,"#ffee00"),ee.addColorStop(.6,"#008121"),ee.addColorStop(.8,"#004cff"),ee.addColorStop(1,"#760188"),a.fillStyle=X,svg.fillStyle=ee}roundRect(a,0,0,P,y,parseInt(I),!0,!1),drawOver(a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,b,k,P,y,x,A,G,B,N,E,M,W,J,j,q,V)}function drawOver(e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,b,k,P,y,x,S,C,I,T,z,R,F,L,O,U){y>0&&(e.lineWidth=y,e.strokeStyle=colorToRGBA(a,t),roundRect(e,1*k/32,1*P/16,15*k/16,7*P/8,20,!1)),e.textAlign="center"
var D="regular"===n?"":n+" "
if(e.font=D+parseInt(r)+"px '"+l+"'",e.fillStyle=colorToRGBA(o,s),L>0&&(e.strokeStyle=F,e.lineWidth=L,e.strokeText(i,parseInt(c),parseInt(g),z)),e.fillText(i,parseInt(c),parseInt(g),z),D="regular"===f?"":f+" ",e.font=D+parseInt(m)+"px '"+v,e.fillStyle=colorToRGBA(d,h),U>0&&(e.strokeStyle=O,e.lineWidth=U,e.strokeText(u,parseInt(p),parseInt(w),R)),e.fillText(u,parseInt(p),parseInt(w),R),x){var A=new Image
A.src="img/Rick.png",A.onload=function(){S=parseInt(S),C=parseInt(C)
var a=A.width*I/100,t=A.height*I/100
if(console.log(a),console.log(t),e.translate(S+a/2,C+t/2),e.rotate(T*Math.PI/180),e.drawImage(A,-a/2,-t/2,a,t),e.rotate(-T*Math.PI/180),e.translate(-(S+a/2),-(C+t/2)),b){var r=new Image
r.src="img/glitter-calc.png",r.onload=function(){e.drawImage(r,0,0),$("#svg").html(svg.getSerializedSvg())}}else $("#svg").html(svg.getSerializedSvg())}}else if(b){var G=new Image
G.src="img/glitter-calc.png",G.onload=function(){e.drawImage(G,0,0),$("#svg").html(svg.getSerializedSvg())}}else $("#svg").html(svg.getSerializedSvg())}function roundRect(e,a,t,r,o,s,l,n){if(void 0===n&&(n=!0),void 0===s&&(s=5),"number"==typeof s)s={tl:s,tr:s,br:s,bl:s}
else{var i={tl:0,tr:0,br:0,bl:0}
for(var c in i)s[c]=s[c]||i[c]}e.beginPath(),e.moveTo(a+s.tl,t),e.lineTo(a+r-s.tr,t),e.quadraticCurveTo(a+r,t,a+r,t+s.tr),e.lineTo(a+r,t+o-s.br),e.quadraticCurveTo(a+r,t+o,a+r-s.br,t+o),e.lineTo(a+s.bl,t+o),e.quadraticCurveTo(a,t+o,a,t+o-s.bl),e.lineTo(a,t+s.tl),e.quadraticCurveTo(a,t,a+s.tl,t),e.closePath(),l&&e.fill(),n&&e.stroke()}function addItem(){var e=localStorage.getItem("wemas")
e=null===e?{}:JSON.parse(e)
for(var a=$("#filename").val().replace(/\.(png|svg)$/,""),t=1,r=a;void 0!==e[r]&&null!==e[r];)r=a+"-"+t,t++
e[r]={w:$("#wemake").val(),wx:$("#wemake-x").val(),wy:$("#wemake-y").val(),ws:$("#wemake-size").val(),wc:$("#wemake-color").val(),wa:$("#wemake-alpha").val(),wf:$("#wemake-font").val(),wfs:$("#wemake-font-style").val(),ww:$("#wemake-width").val(),p:$("#porn").val(),px:$("#porn-x").val(),py:$("#porn-y").val(),ps:$("#porn-size").val(),pc:$("#porn-color").val(),pa:$("#porn-alpha").val(),pf:$("#porn-font").val(),pfs:$("#porn-font-style").val(),pw:$("#porn-width").val(),co:$("#bgu-color").val(),gli:$("#add-glitter").prop("checked"),bgt:$("#bg-type").val(),rc:$("#rect-color").val(),ra:$("#rect-alpha").val(),bgr:$("#bgr-color").val(),egr:$("#egr-color").val(),or:$("#gr-orientation").val(),bgi:$("#bg-img").val(),cor:$("#corners").val(),bth:$("#border-thickness").val(),width:$("#img-width").val(),height:$("#img-height").val(),x:$("#custom-x").val(),y:$("#custom-y").val(),s:$("#custom-size").val(),bgu:$("#custom-img-url").val(),r:$("#add-rick").prop("checked"),rx:$("#rick-x").val(),ry:$("#rick-y").val(),rs:$("#rick-size").val(),rr:$("#rick-rad").val(),woc:$("#wemake-outline-color").val(),wos:$("#wemake-outline-size").val(),poc:$("#porn-outline-color").val(),pos:$("#porn-outline-size").val()},localStorage.setItem("wemas",JSON.stringify(e))}function deleteItem(e){var a=localStorage.getItem("wemas")
null===a?a={}:(a=JSON.parse(a),void 0!==a[e]&&null!==a[e]&&delete a[e]),localStorage.setItem("wemas",JSON.stringify(a))}function fillGallery(){var e=$("#gallery"),a=localStorage.getItem("wemas")
null===a?(a={},localStorage.setItem("wemas",JSON.stringify(a))):a=JSON.parse(a),e.empty()
var t=Object.keys(a).sort()
0===t.length?e.html("<h1>"+sorryNoGallery+"</h1>"):t.forEach(function(t){var r=a[t],o=$("<div>")
o.addClass("card"),o.attr("data-item",t)
var s=document.createElement("canvas")
s.classList.add("img-fluid"),s.setAttribute("width",r.width),s.setAttribute("height",r.height),drawCtx(!0,s.getContext("2d"),r.rc,r.ra,r.ws,r.wc,r.wa,r.wf,r.wfs,r.w,r.wx,r.wy,r.ps,r.pc,r.pa,r.pf,r.pfs,r.p,r.px,r.py,r.gli,r.width,r.height,r.bth,r.bgt,r.co,r.cor,r.bgi,r.s,r.bgr,r.egr,r.org,r.x,r.y,r.bgu,r.r,r.rx,r.ry,r.rs,r.rr,r.ww,r.pw,r.woc,r.wos,r.poc,r.pos),o.html(s)
var l=$("<div>")
l.addClass("row text-center")
var n=$("<div>")
n.addClass("col-sm-12 col-md-4")
var i=$("<a>")
i.addClass("btn btn-info btn-block")
var c=createUrl(new URL(window.location),r.w,r.wx,r.wy,r.ws,r.wc,r.wa,r.wf,r.wfs,r.ww,r.p,r.px,r.py,r.ps,r.pc,r.pa,r.pf,r.pfs,r.pw,r.co,r.ra,r.gli,r.bgt,r.rc,r.bgr,r.egr,r.or,r.bgi,r.cor,r.bth,r.width,r.height,r.x,r.y,r.s,r.bgu,r.r,r.rx,r.ry,r.rs,r.rr,r.woc,r.wos,r.poc,r.pos)
i.attr("href",c),i.text(load),n.append(i)
var g=$("<div>")
g.addClass("col-sm-12 col-md-4")
var m=$("<a>")
m.addClass("btn btn-info btn-block"),m.attr("href","#"),m.click(function(e){this.download=$("#filename").val(),void 0===r.bgu||null===r.bgu||r.bgu.match(/^ *$/)?this.href=$('[data-item="'+t+'"] canvas')[0].toDataURL("image/octet-stream"):(e.preventDefault(),alert(downloadClic))}),m.text(download),g.append(m)
var d=$("<div>")
d.addClass("col-sm-12 col-md-4")
var h=$("<a>")
h.addClass("btn btn-info btn-block"),h.attr("href","#"),h.click(function(e){e.preventDefault(),deleteItem(t),$('[data-item="'+t+'"]').remove()}),h.text(deleteText),d.append(h),l.append(n,g,d),o.append(l),e.append(o)})}function show(e){var a=$("#"+e)
a.hasClass("d-none")&&a.removeClass("d-none")}function hide(e){var a=$("#"+e)
a.hasClass("d-none")||a.addClass("d-none")}function scalePreserveAspectRatio(e,a,t,r){return Math.min(t/e,r/a)}function colorToRGBA(e,a){var t=e.split("")
return r=parseInt(""+t[1]+t[2],16),g=parseInt(""+t[3]+t[4],16),b=parseInt(""+t[5]+t[6],16),"rgba("+r+","+g+","+b+","+(1-a/100)+")"}function createCookie(e,a,t){if(t){var r=new Date
r.setTime(r.getTime()+24*t*60*60*1e3)
var o="; expires="+r.toGMTString()}else var o=""
document.cookie=e+"="+a+o+"; path=/"}function readCookie(e){for(var a=e+"=",t=document.cookie.split(";"),r=0;r<t.length;r++){for(var o=t[r];" "==o.charAt(0);)o=o.substring(1,o.length)
if(0==o.indexOf(a))return o.substring(a.length,o.length)}return null}function centerText(e){e.preventDefault()
var a=$("#wemake-x"),t=$("#wemake-y"),r=$("#porn-x"),o=$("#porn-y"),s=$("#img-width").val(),l=$("#img-height").val()
a.val(s/2),t.val(l/4+3*l/20),r.val(s/2),o.val(3*l/4+l/8),refreshText()}function createUrl(e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,f,u,p,w,$,b,k,P,y,x,S,C,I,T,z,R,F,L,O,U,D,A,G,B,N,E,M,W,J,j){return e.searchParams.set("w",a),e.searchParams.set("wx",t),e.searchParams.set("wy",r),e.searchParams.set("ws",o),e.searchParams.set("wc",s),e.searchParams.set("wa",l),e.searchParams.set("wf",n),e.searchParams.set("wfs",i),e.searchParams.set("ww",c),e.searchParams.set("p",g),e.searchParams.set("px",m),e.searchParams.set("py",d),e.searchParams.set("ps",h),e.searchParams.set("pc",v),e.searchParams.set("pa",f),e.searchParams.set("pf",u),e.searchParams.set("pfs",p),e.searchParams.set("pw",w),e.searchParams.set("co",$),e.searchParams.set("ra",b),e.searchParams.set("gli",k),e.searchParams.set("bgt",P),e.searchParams.set("rc",y),e.searchParams.set("bgr",x),e.searchParams.set("egr",S),e.searchParams.set("or",C),e.searchParams.set("bgi",I),e.searchParams.set("cor",T),e.searchParams.set("bth",z),e.searchParams.set("width",R),e.searchParams.set("height",F),e.searchParams.set("x",L),e.searchParams.set("y",O),e.searchParams.set("s",U),e.searchParams.set("bgu",D),e.searchParams.set("r",A),e.searchParams.set("rx",G),e.searchParams.set("ry",B),e.searchParams.set("rs",N),e.searchParams.set("rr",E),e.searchParams.set("woc",M),e.searchParams.set("wos",W),e.searchParams.set("poc",J),e.searchParams.set("pos",j),e}function importData(e){var a=new FileReader
a.addEventListener("loadend",function(){try{var e=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(a.result))),t=localStorage.getItem("wemas")
null===t?localStorage.setItem("wemas",JSON.stringify(e)):(t=JSON.parse(t),$.extend(t,e),localStorage.setItem("wemas",JSON.stringify(t))),fillGallery(),alert(importOk)}catch(e){alert(e)}}),a.readAsArrayBuffer(e[0])}function exportData(e){e.preventDefault()
var a=$('<a id="export-data-json">')
a.hide(),$("body").append(a)
var t=[localStorage.getItem("wemas")],r=new Blob(t,{type:"application/json"}),o=window.URL.createObjectURL(r)
a.attr("href",o),a.attr("download","export-data.json"),$("#export-data-json")[0].click(),$("#export-data-json").remove()}var svg,workCanvas="Work with canvas",workSvg="Work with SVG",customImgText="Custom image",sorryNoGallery="Sorry, but you haven't saved any image yet",load="Load",deleteText="Delete",download="Download",downloadClic='Please, right-click on the sticker and select "Save as" to download the sticker',importOk="Your file has been successfully imported",customImg,fonts={Amarante:{regular:"fonts/amarante/Amarante.woff2",bold:"fonts/amarante/Amarante.woff2",italic:"fonts/amarante/Amarante.woff2","italic bold":"fonts/amarante/Amarante.woff2"},"Comic Neue":{regular:"fonts/comic-neue/ComicNeue-Regular.woff2",bold:"fonts/comic-neue/ComicNeue-Bold.woff2",italic:"fonts/comic-neue/ComicNeue-Regular-Oblique.woff2","italic bold":"fonts/comic-neue/ComicNeue-Bold-Oblique.woff2"},"Comic Spice":{regular:"fonts/comic-spice/ComicSpice.woff2",bold:"fonts/comic-spice/ComicSpice.woff2",italic:"fonts/comic-spice/ComicSpice.woff2","italic bold":"fonts/comic-spice/ComicSpice.woff2"},Hack:{regular:"fonts/hack/hack-regular-webfont.woff2",bold:"fonts/hack/hack-bold-webfont.woff2",italic:"fonts/hack/hack-italic-webfont.woff2","italic bold":"fonts/hack/hack-bolditalic-webfont.woff2"},"Open Sans":{regular:"fonts/open-sans/OpenSans-Regular.woff2",bold:"fonts/open-sans/OpenSans-Bold.woff2",italic:"fonts/open-sans/OpenSans-Italic.woff2","italic bold":"fonts/open-sans/OpenSans-BoldItalic.woff2"},"Some Time Later":{regular:"fonts/some-time-later/Some-Time-Later.woff2",bold:"fonts/some-time-later/Some-Time-Later.woff2",italic:"fonts/some-time-later/Some-Time-Later.woff2","italic bold":"fonts/some-time-later/Some-Time-Later.woff2"},Nosifer:{regular:"fonts/nosifer/nosifer.woff2",bold:"fonts/nosifer/nosifer.woff2",italic:"fonts/nosifer/nosifer.woff2","italic bold":"fonts/nosifer/nosifer.woff2"},UnifrakturMaguntia:{regular:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2",bold:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2",italic:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2","italic bold":"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2"},Xolonium:{regular:"fonts/xolonium/Xolonium-Regular.woff2",bold:"fonts/xolonium/Xolonium-Bold.woff2",italic:"fonts/xolonium/Xolonium-Regular.woff2","italic bold":"fonts/xolonium/Xolonium-Bold.woff2"}},loadedFonts={}
$(document).ready(function(){detectLang(),getParameters(),bindEvents(),toggleBgSettings(),refreshFilename(),waitForfont("wemake-font",function(){waitForfont("porn-font")})})
var svg,customImg,workCanvas="Work with canvas",workSvg="Work with SVG",customImgText="Custom image",sorryNoGallery="Sorry, but you haven't saved any image yet",load="Load",deleteText="Delete",download="Download",downloadClic='Please, right-click on the sticker and select "Save as" to download the sticker',importOk="Your file has been successfully imported",fonts={Amarante:{regular:"fonts/amarante/Amarante.woff2",bold:"fonts/amarante/Amarante.woff2",italic:"fonts/amarante/Amarante.woff2","italic bold":"fonts/amarante/Amarante.woff2"},"Comic Neue":{regular:"fonts/comic-neue/ComicNeue-Regular.woff2",bold:"fonts/comic-neue/ComicNeue-Bold.woff2",italic:"fonts/comic-neue/ComicNeue-Regular-Oblique.woff2","italic bold":"fonts/comic-neue/ComicNeue-Bold-Oblique.woff2"},"Comic Spice":{regular:"fonts/comic-spice/ComicSpice.woff2",bold:"fonts/comic-spice/ComicSpice.woff2",italic:"fonts/comic-spice/ComicSpice.woff2","italic bold":"fonts/comic-spice/ComicSpice.woff2"},Hack:{regular:"fonts/hack/hack-regular-webfont.woff2",bold:"fonts/hack/hack-bold-webfont.woff2",italic:"fonts/hack/hack-italic-webfont.woff2","italic bold":"fonts/hack/hack-bolditalic-webfont.woff2"},"Open Sans":{regular:"fonts/open-sans/OpenSans-Regular.woff2",bold:"fonts/open-sans/OpenSans-Bold.woff2",italic:"fonts/open-sans/OpenSans-Italic.woff2","italic bold":"fonts/open-sans/OpenSans-BoldItalic.woff2"},"Some Time Later":{regular:"fonts/some-time-later/Some-Time-Later.woff2",bold:"fonts/some-time-later/Some-Time-Later.woff2",italic:"fonts/some-time-later/Some-Time-Later.woff2","italic bold":"fonts/some-time-later/Some-Time-Later.woff2"},Nosifer:{regular:"fonts/nosifer/nosifer.woff2",bold:"fonts/nosifer/nosifer.woff2",italic:"fonts/nosifer/nosifer.woff2","italic bold":"fonts/nosifer/nosifer.woff2"},UnifrakturMaguntia:{regular:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2",bold:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2",italic:"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2","italic bold":"fonts/unifraktur-maguntia/UnifrakturMaguntia.woff2"},Xolonium:{regular:"fonts/xolonium/Xolonium-Regular.woff2",bold:"fonts/xolonium/Xolonium-Bold.woff2",italic:"fonts/xolonium/Xolonium-Regular.woff2","italic bold":"fonts/xolonium/Xolonium-Bold.woff2"}},loadedFonts={};function detectLang(){var e=[],a=readCookie("lang");null!=a&&e.push(a);for(var t=navigator.languages,r=0;r<t.length;r++)e.push(t[r]);0!==e.length?translate(e.shift(),e):(console.log("Using old style language detection."),translate(navigator.language||navigator.userLanguage))}function translate(t,e){$.get({url:"locales/"+t+".json",dataType:"json",error:function(){null!=e&&0!==e.length&&translate(e.shift(),e)},success:function(a){var e;toggleI18n(t),"groot"===t&&($("#wemake").val("I am"),$("#porn").val("Groot"),$("#bg-type").val("img"),$("#bg-img").val("bark"),$("#wemake-color").val("#ffffff"),$("#porn-color").val("#ffffff"),$("#rect-color").val("#ffffff"),toggleBgSettings(),refreshFilename(),refreshText()),["get-source","donate-dpdn","license","author","wemake","porn","border-txt","color","transparency","x-position","y-position","font","style","text-size","text-width","outline-color","outline-size"].forEach(function(e){void 0!==a[e]&&$("."+e).text(a[e])}),["hide-settings","set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","gallery"].forEach(function(e){void 0!==a[e]&&$('[data-setting="'+e+'"]').text(a[e])}),["wemake","porn","filename","corners","bg-type","bgu-color","bgr-color","egr-color","gr-orientation","bg-img","custom-img","custom-x","custom-y","custom-size","border-thickness","img-width","img-height","custom-img-url","rick-size","rick-x","rick-y","rick-rad"].forEach(function(e){void 0!==a[e]&&$('label[for="'+e+'"]').text(a[e])}),void 0!==a["corners-rounded"]&&$('#corners option[value="20"]').text(a["corners-rounded"]),void 0!==a["corners-square"]&&$('#corners option[value="0"]').text(a["corners-square"]),void 0!==a["add-glitter"]&&$(".glitter span").text(a["add-glitter"]),["plain","gradient","rainbow","img","lr","rl","tb","bt","r","beer","glitter","rainbow-flag","sky","field","bridge","regular","bold","italic","italic bold","bark","snow","whale"].forEach(function(e){void 0!==a[e]&&$('option[value="'+e+'"]').text(a[e])}),["donate-dpdn","settings-dpdn","toggle-svg","download","reset","switch-colors","make-text-center","print","save","import","export"].forEach(function(e){void 0!==a[e]&&("download"===e&&(download=a[e]),$("#"+e).text(a[e]))}),void 0!==a["i18n-dpdn"]&&$("#i18n-dpdn i").attr("title",a["i18n-dpdn"]),void 0!==a["import-n-export"]&&$("#import-n-export").attr("title",a["import-n-export"]),void 0!==a["toggle-canvas"]&&(workCanvas=a["toggle-canvas"]),void 0!==a["toggle-svg"]&&(workSvg=a["toggle-svg"]),void 0!==a["sorry-no-gallery"]&&(sorryNoGallery=a["sorry-no-gallery"]),void 0!==a.load&&(load=a.load),void 0!==a.delete&&(deleteText=a.delete),void 0!==a["custom-img-text"]&&(customImgText=a["custom-img-text"],0!==(e=$('option[value="custom"]')).length&&e.text(customImgText)),void 0!==a["import-ok"]&&(importOk=a["import-ok"]),void 0!==a["download-clic"]&&(downloadClic=a["download-clic"]),void 0!==a["add-rick"]&&$(".rick span").text(a["add-rick"])}})}function getParameters(){window.location.hash&&$("#porn").val(decodeURIComponent(window.location.hash.substr(1)));var e=new URL(window.location);null!==e.searchParams.get("w")&&$("#wemake").val(e.searchParams.get("w")),null!==e.searchParams.get("wx")&&$("#wemake-x").val(e.searchParams.get("wx")),null!==e.searchParams.get("wy")&&$("#wemake-y").val(e.searchParams.get("wy")),null!==e.searchParams.get("ws")&&$("#wemake-size").val(e.searchParams.get("ws")),null!==e.searchParams.get("wc")&&$("#wemake-color").val(e.searchParams.get("wc")),null!==e.searchParams.get("wa")&&$("#wemake-alpha").val(e.searchParams.get("wa")),null!==e.searchParams.get("wf")&&$("#wemake-font").val(e.searchParams.get("wf")),null!==e.searchParams.get("wfs")&&$("#wemake-font-style").val(e.searchParams.get("wfs")),null!==e.searchParams.get("ww")&&$("#wemake-width").val(e.searchParams.get("ww")),null!==e.searchParams.get("p")&&$("#porn").val(e.searchParams.get("p")),null!==e.searchParams.get("px")&&$("#porn-x").val(e.searchParams.get("px")),null!==e.searchParams.get("py")&&$("#porn-y").val(e.searchParams.get("py")),null!==e.searchParams.get("ps")&&$("#porn-size").val(e.searchParams.get("ps")),null!==e.searchParams.get("pc")&&$("#porn-color").val(e.searchParams.get("pc")),null!==e.searchParams.get("pa")&&$("#porn-alpha").val(e.searchParams.get("pa")),null!==e.searchParams.get("pf")&&$("#porn-font").val(e.searchParams.get("pf")),null!==e.searchParams.get("pfs")&&$("#porn-font-style").val(e.searchParams.get("pfs")),null!==e.searchParams.get("pw")&&$("#porn-width").val(e.searchParams.get("pw")),null!==e.searchParams.get("co")&&$("#bgu-color").val(e.searchParams.get("co")),null!==e.searchParams.get("gli")&&$("#add-glitter").prop("checked","true"===e.searchParams.get("gli")),null!==e.searchParams.get("bgt")&&$("#bg-type").val(e.searchParams.get("bgt")),null!==e.searchParams.get("rc")&&$("#rect-color").val(e.searchParams.get("rc")),null!==e.searchParams.get("ra")&&$("#rect-alpha").val(e.searchParams.get("ra")),null!==e.searchParams.get("bgr")&&$("#bgr-color").val(e.searchParams.get("bgr")),null!==e.searchParams.get("egr")&&$("#egr-color").val(e.searchParams.get("egr")),null!==e.searchParams.get("or")&&$("#gr-orientation").val(e.searchParams.get("or")),null!==e.searchParams.get("bgi")&&"custom"!==e.searchParams.get("bgi")?$("#bg-img").val(e.searchParams.get("bgi")):$("#bg-img").val("beer"),null!==e.searchParams.get("cor")&&$("#corners").val(e.searchParams.get("cor")),null!==e.searchParams.get("f")&&$("#filename").val(e.searchParams.get("f")),null!==e.searchParams.get("width")&&$("#img-width").val(e.searchParams.get("width")),null!==e.searchParams.get("height")&&$("#img-height").val(e.searchParams.get("height")),null!==e.searchParams.get("bth")&&$("#border-thickness").val(e.searchParams.get("bth")),null!==e.searchParams.get("x")&&$("#custom-x").val(e.searchParams.get("x")),null!==e.searchParams.get("y")&&$("#custom-y").val(e.searchParams.get("y")),null!==e.searchParams.get("s")&&$("#custom-size").val(e.searchParams.get("s")),null!==e.searchParams.get("bgu")&&""!==e.searchParams.get("bgu")&&($("#custom-img-url").val(e.searchParams.get("bgu")),handleImageURL(!1)),null!==e.searchParams.get("r")&&$("#add-rick").prop("checked","true"===e.searchParams.get("r")),null!==e.searchParams.get("rx")&&$("#rick-x").val(e.searchParams.get("rx")),null!==e.searchParams.get("ry")&&$("#rick-y").val(e.searchParams.get("ry")),null!==e.searchParams.get("rs")&&$("#rick-size").val(e.searchParams.get("rs")),null!==e.searchParams.get("rr")&&$("#rick-rad").val(e.searchParams.get("rr")),null!==e.searchParams.get("woc")&&$("#wemake-outline-color").val(e.searchParams.get("woc")),null!==e.searchParams.get("wos")&&$("#wemake-outline-size").val(e.searchParams.get("wos")),null!==e.searchParams.get("poc")&&$("#porn-outline-color").val(e.searchParams.get("poc")),null!==e.searchParams.get("pos")&&$("#porn-outline-size").val(e.searchParams.get("pos"))}function bindEvents(){$('input[type="text"]').each(function(e){"filename"!==this.id&&($(this).keyup(function(){refreshText(),refreshFilename()}),$(this).on("paste",function(){refreshText(),refreshFilename()}))}),$("#custom-img-url").keyup(function(){this.checkValidity()&&!$(this).val().match(/^ *$/)&&(handleImageURL(!0),refreshText())}),$("#custom-img-url").on("paste",function(){this.checkValidity()&&!$(this).val().match(/^ *$/)&&(handleImageURL(!0),refreshText())}),$('select,input[type="number"],input[type="color"],input[type="checkbox"]').each(function(e){"wemake-font"!==this.id&&"wemake-font-style"!==this.id&&"porn-font"!==this.id&&"porn-font-style"!==this.id?"bg-type"===this.id?$(this).change(function(){("img"===$(this).val()&&"telechat"===$("#bg-img").val()||"peanuts-nouka"===$("#bg-img").val())&&($("#rect-alpha").val(100),"peanuts-nouka"===$("#bg-img").val()&&($("#wemake-x").val("400"),$("#wemake-y").val("100"),$("#wemake-size").val("90"),$("#wemake-color").val("#FFFFFF"),$("#wemake-outline-color").val("#000000"),$("#wemake-outline-size").val(5),$("#porn-x").val("400"),$("#porn-y").val("385"),$("#porn-size").val("90"),$("#porn-color").val("#FFFFFF"),$("#porn-outline-color").val("#000000"),$("#porn-outline-size").val(5))),"img"===$(this).val()&&"custom"!==$("#bg-img").val()&&$("#custom-img-url").val(""),refreshText()}):"bg-img"===this.id?$(this).change(function(){"telechat"!==$(this).val()&&"peanuts-nouka"!==$("#bg-img").val()||($("#rect-alpha").val(100),"peanuts-nouka"===$("#bg-img").val()&&($("#wemake-x").val("400"),$("#wemake-y").val("100"),$("#wemake-size").val("90"),$("#wemake-color").val("#FFFFFF"),$("#wemake-outline-color").val("#000000"),$("#wemake-outline-size").val(5),$("#porn-x").val("400"),$("#porn-y").val("385"),$("#porn-size").val("90"),$("#porn-color").val("#FFFFFF"),$("#porn-outline-color").val("#000000"),$("#porn-outline-size").val(5))),"custom"!==$(this).val()&&($("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(1),$("#custom-img-url").val("")),refreshText()}):$(this).change(refreshText):$(this).change(function(){waitForfont(this.id)})}),$("#bg-type").change(toggleBgSettings),$("#toggle-svg").click(function(e){e.preventDefault(),$("#svg").hasClass("d-none")?($(this).removeClass("btn-info"),$(this).addClass("btn-primary"),hide("canvas"),show("svg"),this.text=workCanvas):($(this).removeClass("btn-primary"),$(this).addClass("btn-info"),hide("svg"),show("canvas"),this.text=workSvg),refreshText(),refreshFilename()}),$("#import").click(function(e){e.preventDefault(),$("#import-file").click()}),$("#export").click(exportData),$("#download").click(function(e){var a;this.download=$("#filename").val(),$("#svg").hasClass("d-none")?null==(a=$("#custom-img-url").val())||a.match(/^ *$/)||!$("#custom-img-url")[0].checkValidity()?this.href=document.getElementById("canvas").toDataURL("image/octet-stream"):(e.preventDefault(),alert(downloadClic)):this.href="data:image/octet-stream;base64,"+btoa(svg.getSerializedSvg(!0))}),$("[data-setting]").click(function(e){e.preventDefault();var a=$(this);$("[data-setting]").removeClass("active"),a.addClass("active"),"hide-settings"===a.data("setting")?(hide("gallery"),show("main-tool"),["settings","set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","set-rick"].forEach(function(e){hide(e)})):"gallery"===a.data("setting")?(hide("main-tool"),show("gallery"),fillGallery()):(hide("gallery"),show("main-tool"),["set-corner-shape","set-colors","set-fonts","set-bg","set-positions","set-img-size","set-rick"].forEach(function(e){(e!==a.data("setting")?hide:show)(e),show("settings")}))}),$("#reset").click(function(e){e.preventDefault(),reset()}),$("#switch-colors").click(function(e){e.preventDefault(),switchTextColors(),refreshText()}),$("#make-text-center").click(centerText),$("#custom-img").change(handleImage),null==customImg&&$("#custom-img").val(null),$("[data-i18n]").click(function(e){e.preventDefault(),createCookie("lang",$(this).data("i18n"),30),translate($(this).data("i18n"))}),$("#print").click(function(e){e.preventDefault(),window.print()}),$("#save").click(function(e){e.preventDefault(),addItem()})}function handleImageURL(e){$("#bg-type").val("img");var a=$("<option>"),t=$("#bg-img"),r=$('option[value="custom"]');0!==r.length&&r.remove(),a.attr("value","custom"),a.text(customImgText),t.append(a),t.val("custom"),e&&($("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0)),toggleBgSettings()}function toggleBgSettings(){switch($("#bg-type").val()){case"plain":show("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings");break;case"gradient":hide("bg-color"),show("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings");break;case"img":hide("bg-color"),hide("gradient-settings"),show("bg-img-settings"),show("bg-custom-img-settings");break;default:hide("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings")}}function refreshFilename(){var e=$("#wemake"),a=$("#porn"),t=$("#filename"),r="png";$("#svg").hasClass("d-none")||(r="svg");r=e.val()+" "+a.val()+"."+r;t.val(r.replace(/ /g,"_"))}function waitForfont(e,a){null==a&&(a=refreshText),e=e.replace("-style","");var t=$("#"+e).val(),r=$("#"+e+"-style").val();"sans-serif"===t||void 0!==loadedFonts[t]&&void 0!==loadedFonts[t][r]||void 0===fonts[t]||void 0===fonts[t][r]?("sans-serif"!==t&&(void 0===fonts[t]&&console.log(t+" is not a valid font"),void 0===fonts[t][r]&&console.log(r+" is not a valid style for font "+t)),a()):new FontFace(t,"url("+fonts[t][r]+")").load().then(function(e){console.log("font "+t+" "+r+" loaded"),document.fonts.add(e),void 0!==loadedFonts[t]?loadedFonts[t][r]=!0:loadedFonts[t]={s:!0},a()})}function toggleI18n(e){$("[data-i18n]").removeClass("active"),$('[data-i18n="'+e+'"]').addClass("active")}function handleImage(e){var a=new FileReader;a.onload=function(e){var r=new Image;r.onload=function(){var e=$("<option>"),a=$("#bg-img"),t=$('option[value="custom"]');0!==t.length&&t.remove(),e.attr("value","custom"),e.text(customImgText),a.append(e),a.val("custom"),customImg=r,$("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0),refreshText()},r.src=e.target.result},a.readAsDataURL(e.target.files[0])}function switchTextColors(){var e=$("#wemake-color"),a=$("#porn-color"),t=e.val(),r=a.val();e.val(r),a.val(t)}function reset(){$("#wemake-x").val("400"),$("#wemake-y").val("160"),$("#wemake-size").val("150"),$("#wemake-color").val("#000000"),$("#wemake-alpha").val("0"),$("#wemake-font").val("Open Sans"),$("#wemake-font-style").val("bold"),$("#wemake-width").val("725"),$("#porn-x").val("400"),$("#porn-y").val("350"),$("#porn-size").val("220"),$("#porn-color").val("#000000"),$("#porn-alpha").val("0"),$("#porn-font").val("Open Sans"),$("#porn-font-style").val("bold"),$("#porn-width").val("725"),$("#bgu-color").val("#fcd205"),$("#rect-color").val("#000000"),$("#rect-alpha").val("0"),$("#add-glitter").prop("checked",!1),$("#bg-type").val("plain"),$("#gr-orientation").val("lr"),$("#bg-img").val("beer"),$("#corners").val("20"),$("#custom-img").val(null),$("#custom-x").val(0),$("#custom-y").val(0),$("#custom-size").val(0),$("#img-width").val(800),$("#img-height").val(400),$("#border-thickness").val(20),$("#custom-img-url").val(null),$("#add-rick").prop("checked",!1),$("#rick-x").val(0),$("#rick-y").val(0),$("#rick-size").val(100),$("#rick-rad").val(0),$("#wemake-outline-color").val("#FFFFFF"),$("#wemake-outline-size").val(0),$("#porn-outline-color").val("#FFFFFF"),$("#porn-outline-size").val(0),show("bg-color"),hide("gradient-settings"),hide("bg-img-settings"),hide("bg-custom-img-settings"),refreshText()}function refreshText(){var e=$("#wemake").val(),a=$("#wemake-x").val(),t=$("#wemake-y").val(),r=$("#wemake-size").val(),o=$("#wemake-color").val(),s=$("#wemake-alpha").val(),l=$("#wemake-font").val(),n=$("#wemake-font-style").val(),i=$("#wemake-width").val(),c=$("#porn").val(),g=$("#porn-x").val(),m=$("#porn-y").val(),d=$("#porn-size").val(),h=$("#porn-color").val(),v=$("#porn-alpha").val(),u=$("#porn-font").val(),f=$("#porn-font-style").val(),p=$("#porn-width").val(),w=$("#bgu-color").val(),k=$("#add-glitter").prop("checked"),b=$("#bg-type").val(),P=$("#rect-color").val(),y=$("#rect-alpha").val(),x=$("#bgr-color").val(),S=$("#egr-color").val(),C=$("#gr-orientation").val(),I=$("#bg-img").val(),F=$("#corners").val(),T=$("#border-thickness").val(),z=$("#custom-x").val(),R=$("#custom-y").val(),L=$("#custom-size").val(),O=$("#custom-img-url")[0].checkValidity()?$("#custom-img-url").val():"",U=$("#add-rick").prop("checked"),D=$("#rick-x").val(),A=$("#rick-y").val(),G=$("#rick-size").val(),B=$("#rick-rad").val(),N=$("#wemake-outline-color").val(),E=$("#wemake-outline-size").val(),M=$("#porn-outline-color").val(),W=$("#porn-outline-size").val(),J=$("#img-width").val(),j=$("#img-height").val();$("#canvas").remove();var q=document.createElement("canvas");q.id="canvas",q.classList.add("img-fluid"),q.width=J,q.height=j,document.getElementById("canvas-container").appendChild(q);var V=q.getContext("2d"),q=$("#svg");svg=new C2S(J,j),!1===q.hasClass("d-none")&&(V=svg);q=new URL(window.location);window.history.pushState("change","WemaWema",createUrl(q,e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,u,f,p,w,y,k,b,P,x,S,C,I,F,T,J,j,z,R,L,O,U,D,A,G,B,N,E,M,W)),drawCtx(!1,V,P,y,r,o,s,l,n,e,a,t,d,h,v,u,f,c,g,m,k,J,j,T,b,w,F,I,L,x,S,C,z,R,O,U,D,A,G,B,i,p,N,E,M,W)}function drawCtx(o,s,l,n,i,c,g,m,d,h,v,u,f,p,w,k,b,P,y,x,S,C,I,F,T,z,R,L,O,U,D,A,G,B,N,E,M,W,J,j,q,V,X,H,Y,_){switch(s.clearRect(0,0,C,I),T){case"plain":s.fillStyle=z;break;case"gradient":switch(A){case"lr":Q=s.createLinearGradient(0,I/2,C,I/2);break;case"rl":Q=s.createLinearGradient(C,I/2,0,I/2);break;case"tb":Q=s.createLinearGradient(C/2,0,C/2,I);break;case"bt":Q=s.createLinearGradient(C/2,I,C/2,0);break;case"r":Q=s.createRadialGradient(C/2,I/2,25,C/2,I/2,C/2)}Q.addColorStop(0,U),Q.addColorStop(1,D),s.fillStyle=Q;break;case"img":var e,a,t,r,K;return void(!0!==o&&"custom"===L&&null!=customImg?(t=scalePreserveAspectRatio(e=customImg.width,a=customImg.height,C,I),0===parseFloat(O)?(O=Math.round(1e3*t)/1e3,!0!==o&&$("#custom-size").val(O)):t=O,!0!==o&&(r=new URL(window.location),window.history.pushState("change","WemaWema",createUrl(r,h,v,u,i,c,g,m,d,q,P,y,x,f,p,w,k,b,V,z,n,S,T,l,U,D,A,L,R,F,C,I,G,B,O,N,E,M,W,J,j,X,H,Y,_))),s.drawImage(customImg,0,0,e,a,G,B,e*t,a*t),drawOver(s,l,n,i,c,g,m,d,h,v,u,f,p,w,k,b,P,y,x,S,C,I,F,E,M,W,J,j,q,V,X,H,Y,_)):(""!==L&&("custom"!==L||null!=N&&""!==N)||(L="beer",!0===o||null!=N&&""!==N||$("#bg-img").val("beer")),K=new Image,Z="img/"+L,20===parseInt(R)&&(Z+="-round"),null==N||""===N?Z+=".png":Z=N,K.src=Z,K.onload=function(){var e,a=K.width,t=K.height,r=scalePreserveAspectRatio(a,t,C,I);0===parseFloat(O)?(O=Math.round(1e3*r)/1e3,!0!==o&&$("#custom-size").val(O)):r=O,!0!==o&&(e=new URL(window.location),window.history.pushState("change","WemaWema",createUrl(e,h,v,u,i,c,g,m,d,q,P,y,x,f,p,w,k,b,V,z,n,S,T,l,U,D,A,L,R,F,C,I,G,B,O,N,E,M,W,J,j,X,H,Y,_))),s.drawImage(K,0,0,a,t,G,B,a*r,t*r),drawOver(s,l,n,i,c,g,m,d,h,v,u,f,p,w,k,b,P,y,x,S,C,I,F,E,M,W,J,j,q,V,X,H,Y,_)}));case"rainbow":var Q=s.createLinearGradient(C/2,0,C/2,I),Z=svg.createLinearGradient(C/2,0,C/2,I);Q.addColorStop(0,"#e50000"),Q.addColorStop(.2,"#ff8d00"),Q.addColorStop(.4,"#ffee00"),Q.addColorStop(.6,"#008121"),Q.addColorStop(.8,"#004cff"),Q.addColorStop(1,"#760188"),Z.addColorStop(0,"#e50000"),Z.addColorStop(.2,"#ff8d00"),Z.addColorStop(.4,"#ffee00"),Z.addColorStop(.6,"#008121"),Z.addColorStop(.8,"#004cff"),Z.addColorStop(1,"#760188"),s.fillStyle=Q,svg.fillStyle=Z}roundRect(s,0,0,C,I,parseInt(R),!0,!1),drawOver(s,l,n,i,c,g,m,d,h,v,u,f,p,w,k,b,P,y,x,S,C,I,F,E,M,W,J,j,q,V,X,H,Y,_)}function drawOver(r,e,a,t,o,s,l,n,i,c,g,m,d,h,v,u,f,p,w,k,b,P,y,x,S,C,I,F,T,z,R,L,O,U){0<y&&(r.lineWidth=y,r.strokeStyle=colorToRGBA(e,a),roundRect(r,+b/32,+P/16,15*b/16,7*P/8,20,!1)),r.textAlign="center";var D,A,n="regular"===n?"":n+" ";r.font=n+parseInt(t)+"px '"+l+"'",r.fillStyle=colorToRGBA(o,s),0<L&&(r.strokeStyle=R,r.lineWidth=L,r.strokeText(i,parseInt(c),parseInt(g),T)),r.fillText(i,parseInt(c),parseInt(g),T),r.font=(n="regular"===u?"":u+" ")+parseInt(m)+"px '"+v,r.fillStyle=colorToRGBA(d,h),0<U&&(r.strokeStyle=O,r.lineWidth=U,r.strokeText(f,parseInt(p),parseInt(w),z)),r.fillText(f,parseInt(p),parseInt(w),z),x?((D=new Image).src="img/Rick.png",D.onload=function(){S=parseInt(S),C=parseInt(C);var e,a=D.width*I/100,t=D.height*I/100;console.log(a),console.log(t),r.translate(S+a/2,C+t/2),r.rotate(F*Math.PI/180),r.drawImage(D,-a/2,-t/2,a,t),r.rotate(-F*Math.PI/180),r.translate(-(S+a/2),-(C+t/2)),k?((e=new Image).src="img/glitter-calc.png",e.onload=function(){r.drawImage(e,0,0),$("#svg").html(svg.getSerializedSvg())}):$("#svg").html(svg.getSerializedSvg())}):k?((A=new Image).src="img/glitter-calc.png",A.onload=function(){r.drawImage(A,0,0),$("#svg").html(svg.getSerializedSvg())}):$("#svg").html(svg.getSerializedSvg())}function roundRect(e,a,t,r,o,s,l,n){if(void 0===n&&(n=!0),"number"==typeof(s=void 0===s?5:s))s={tl:s,tr:s,br:s,bl:s};else{var i,c={tl:0,tr:0,br:0,bl:0};for(i in c)s[i]=s[i]||c[i]}e.beginPath(),e.moveTo(a+s.tl,t),e.lineTo(a+r-s.tr,t),e.quadraticCurveTo(a+r,t,a+r,t+s.tr),e.lineTo(a+r,t+o-s.br),e.quadraticCurveTo(a+r,t+o,a+r-s.br,t+o),e.lineTo(a+s.bl,t+o),e.quadraticCurveTo(a,t+o,a,t+o-s.bl),e.lineTo(a,t+s.tl),e.quadraticCurveTo(a,t,a+s.tl,t),e.closePath(),l&&e.fill(),n&&e.stroke()}function addItem(){for(var e=null===(e=localStorage.getItem("wemas"))?{}:JSON.parse(e),a=$("#filename").val().replace(/\.(png|svg)$/,""),t=1,r=a;void 0!==e[r]&&null!==e[r];)r=a+"-"+t,t++;e[r]={w:$("#wemake").val(),wx:$("#wemake-x").val(),wy:$("#wemake-y").val(),ws:$("#wemake-size").val(),wc:$("#wemake-color").val(),wa:$("#wemake-alpha").val(),wf:$("#wemake-font").val(),wfs:$("#wemake-font-style").val(),ww:$("#wemake-width").val(),p:$("#porn").val(),px:$("#porn-x").val(),py:$("#porn-y").val(),ps:$("#porn-size").val(),pc:$("#porn-color").val(),pa:$("#porn-alpha").val(),pf:$("#porn-font").val(),pfs:$("#porn-font-style").val(),pw:$("#porn-width").val(),co:$("#bgu-color").val(),gli:$("#add-glitter").prop("checked"),bgt:$("#bg-type").val(),rc:$("#rect-color").val(),ra:$("#rect-alpha").val(),bgr:$("#bgr-color").val(),egr:$("#egr-color").val(),or:$("#gr-orientation").val(),bgi:$("#bg-img").val(),cor:$("#corners").val(),bth:$("#border-thickness").val(),width:$("#img-width").val(),height:$("#img-height").val(),x:$("#custom-x").val(),y:$("#custom-y").val(),s:$("#custom-size").val(),bgu:$("#custom-img-url").val(),r:$("#add-rick").prop("checked"),rx:$("#rick-x").val(),ry:$("#rick-y").val(),rs:$("#rick-size").val(),rr:$("#rick-rad").val(),woc:$("#wemake-outline-color").val(),wos:$("#wemake-outline-size").val(),poc:$("#porn-outline-color").val(),pos:$("#porn-outline-size").val()},localStorage.setItem("wemas",JSON.stringify(e))}function deleteItem(e){var a=localStorage.getItem("wemas");null===a?a={}:void 0!==(a=JSON.parse(a))[e]&&null!==a[e]&&delete a[e],localStorage.setItem("wemas",JSON.stringify(a))}function fillGallery(){var i=$("#gallery"),c=localStorage.getItem("wemas");null===c?(c={},localStorage.setItem("wemas",JSON.stringify(c))):c=JSON.parse(c),i.empty();var e=Object.keys(c).sort();0===e.length?i.html("<h1>"+sorryNoGallery+"</h1>"):e.forEach(function(a){var t=c[a],e=$("<div>");e.addClass("card"),e.attr("data-item",a);var r=document.createElement("canvas");r.classList.add("img-fluid"),r.setAttribute("width",t.width),r.setAttribute("height",t.height),drawCtx(!0,r.getContext("2d"),t.rc,t.ra,t.ws,t.wc,t.wa,t.wf,t.wfs,t.w,t.wx,t.wy,t.ps,t.pc,t.pa,t.pf,t.pfs,t.p,t.px,t.py,t.gli,t.width,t.height,t.bth,t.bgt,t.co,t.cor,t.bgi,t.s,t.bgr,t.egr,t.org,t.x,t.y,t.bgu,t.r,t.rx,t.ry,t.rs,t.rr,t.ww,t.pw,t.woc,t.wos,t.poc,t.pos),e.html(r);var o=$("<div>");o.addClass("row text-center");var s=$("<div>");s.addClass("col-sm-12 col-md-4");var l=$("<a>");l.addClass("btn btn-info btn-block");var n=createUrl(new URL(window.location),t.w,t.wx,t.wy,t.ws,t.wc,t.wa,t.wf,t.wfs,t.ww,t.p,t.px,t.py,t.ps,t.pc,t.pa,t.pf,t.pfs,t.pw,t.co,t.ra,t.gli,t.bgt,t.rc,t.bgr,t.egr,t.or,t.bgi,t.cor,t.bth,t.width,t.height,t.x,t.y,t.s,t.bgu,t.r,t.rx,t.ry,t.rs,t.rr,t.woc,t.wos,t.poc,t.pos);l.attr("href",n),l.text(load),s.append(l);r=$("<div>");r.addClass("col-sm-12 col-md-4");n=$("<a>");n.addClass("btn btn-info btn-block"),n.attr("href","#"),n.click(function(e){this.download=$("#filename").val(),void 0===t.bgu||null===t.bgu||t.bgu.match(/^ *$/)?this.href=$('[data-item="'+a+'"] canvas')[0].toDataURL("image/octet-stream"):(e.preventDefault(),alert(downloadClic))}),n.text(download),r.append(n);l=$("<div>");l.addClass("col-sm-12 col-md-4");n=$("<a>");n.addClass("btn btn-info btn-block"),n.attr("href","#"),n.click(function(e){e.preventDefault(),deleteItem(a),$('[data-item="'+a+'"]').remove()}),n.text(deleteText),l.append(n),o.append(s,r,l),e.append(o),i.append(e)})}function show(e){e=$("#"+e);e.hasClass("d-none")&&e.removeClass("d-none")}function hide(e){e=$("#"+e);e.hasClass("d-none")||e.addClass("d-none")}function scalePreserveAspectRatio(e,a,t,r){return Math.min(t/e,r/a)}function colorToRGBA(e,a){e=e.split("");return r=parseInt(""+e[1]+e[2],16),g=parseInt(""+e[3]+e[4],16),b=parseInt(""+e[5]+e[6],16),"rgba("+r+","+g+","+b+","+(1-a/100)+")"}function createCookie(e,a,t){var r;r=t?((r=new Date).setTime(r.getTime()+24*t*60*60*1e3),"; expires="+r.toGMTString()):"",document.cookie=e+"="+a+r+"; path=/"}function readCookie(e){for(var a=e+"=",t=document.cookie.split(";"),r=0;r<t.length;r++){for(var o=t[r];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(a))return o.substring(a.length,o.length)}return null}function centerText(e){e.preventDefault();var a=$("#wemake-x"),t=$("#wemake-y"),r=$("#porn-x"),o=$("#porn-y"),s=$("#img-width").val(),e=$("#img-height").val();a.val(s/2),t.val(e/4+3*e/20),r.val(s/2),o.val(3*e/4+e/8),refreshText()}function createUrl(e,a,t,r,o,s,l,n,i,c,g,m,d,h,v,u,f,p,$,w,k,b,P,y,x,S,C,I,F,T,z,R,L,O,U,D,A,G,B,N,E,M,W,J,j){return e.searchParams.set("w",a),e.searchParams.set("wx",t),e.searchParams.set("wy",r),e.searchParams.set("ws",o),e.searchParams.set("wc",s),e.searchParams.set("wa",l),e.searchParams.set("wf",n),e.searchParams.set("wfs",i),e.searchParams.set("ww",c),e.searchParams.set("p",g),e.searchParams.set("px",m),e.searchParams.set("py",d),e.searchParams.set("ps",h),e.searchParams.set("pc",v),e.searchParams.set("pa",u),e.searchParams.set("pf",f),e.searchParams.set("pfs",p),e.searchParams.set("pw",$),e.searchParams.set("co",w),e.searchParams.set("ra",k),e.searchParams.set("gli",b),e.searchParams.set("bgt",P),e.searchParams.set("rc",y),e.searchParams.set("bgr",x),e.searchParams.set("egr",S),e.searchParams.set("or",C),e.searchParams.set("bgi",I),e.searchParams.set("cor",F),e.searchParams.set("bth",T),e.searchParams.set("width",z),e.searchParams.set("height",R),e.searchParams.set("x",L),e.searchParams.set("y",O),e.searchParams.set("s",U),e.searchParams.set("bgu",D),e.searchParams.set("r",A),e.searchParams.set("rx",G),e.searchParams.set("ry",B),e.searchParams.set("rs",N),e.searchParams.set("rr",E),e.searchParams.set("woc",M),e.searchParams.set("wos",W),e.searchParams.set("poc",J),e.searchParams.set("pos",j),e}function importData(e){var t=new FileReader;t.addEventListener("loadend",function(){try{var e=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t.result))),a=localStorage.getItem("wemas");null===a?localStorage.setItem("wemas",JSON.stringify(e)):(a=JSON.parse(a),$.extend(a,e),localStorage.setItem("wemas",JSON.stringify(a))),fillGallery(),alert(importOk)}catch(e){alert(e)}}),t.readAsArrayBuffer(e[0])}function exportData(e){e.preventDefault();var a=$('<a id="export-data-json">');a.hide(),$("body").append(a);e=[localStorage.getItem("wemas")],e=new Blob(e,{type:"application/json"}),e=window.URL.createObjectURL(e);a.attr("href",e),a.attr("download","export-data.json"),$("#export-data-json")[0].click(),$("#export-data-json").remove()}$(document).ready(function(){detectLang(),getParameters(),bindEvents(),toggleBgSettings(),refreshFilename(),waitForfont("wemake-font",function(){waitForfont("porn-font")})});
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment