Commit ec9088e9 authored by Luc Didry's avatar Luc Didry
Browse files

Fix bug when deselecting custom image

parent bce11ad2
......@@ -348,6 +348,9 @@ function bindEvents() {
if ($(this).val() === 'img' && $('#bg-img').val() === 'telechat') {
$('#rect-alpha').val(100);
}
if ($(this).val() === 'img' && $('#bg-img').val() !== 'custom') {
$('#custom-img-url').val('');
}
refreshText();
});
} else if (this.id === 'bg-img') {
......@@ -355,6 +358,12 @@ function bindEvents() {
if ($(this).val() === 'telechat') {
$('#rect-alpha').val(100);
}
if ($(this).val() !== 'custom') {
$('#custom-x').val(0);
$('#custom-y').val(0);
$('#custom-size').val(1);
$('#custom-img-url').val('');
}
refreshText();
});
} else {
......
......@@ -11,7 +11,7 @@ translate(navigator.language||navigator.userLanguage)}}function translate(e,a){$
var t=$('option[value="custom"]')
0!==t.length&&t.text(customImgText)}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("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("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"))}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),refreshText()}):"bg-img"===this.id?$(this).change(function(){"telechat"===$(this).val()&&$("#rect-alpha").val(100),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()}),$("#download").click(function(e){if(this.download=$("#filename").val(),$("#svg").hasClass("d-none")){var a=$("#custom-img-url").val()
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("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("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"))}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()}),$("#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")
......
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