"use strict";$(document).ready(function(){$(".menu").on("click tap",function(){$("#menu").toggleClass("pulled")}),$(".save").on("click tap",function(){$("#save").removeClass("hidden")}),$(".load").on("click tap",function(){$("#load").removeClass("hidden"),$("#load li, #load p").remove();var a=JSON.parse(localStorage.getItem("projects"));if(!a||a.length<1)return void $("#load ol").append($("
No sketch found.
"));for(var c=0,d=a.length;d>c;c++)$("#load ol").append($(""));b.find("li").off("click").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Current Color"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2)").removeClass("hidden")})}),$("#pro").on("click tap",function(){$("#save ol:nth-of-type(2) li").each(function(){"Current Color"!==$(this).find("span").html()?($(this).addClass("hidden"),$(this).removeAttr("aria-selected")):$(this).attr("aria-selected","true")})}),$("#exp").on("click tap",function(){$("#save ol:nth-of-type(2) li").removeClass("hidden")}),$c.last().on("mousedown touchstart",function(a){a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]);var b=relative(a.pageX,a.pageY);startPoint(b.x,b.y),window.active=!0}).on("mousemove touchmove",function(a){if(a.preventDefault(),a.changedTouches&&(a=a.changedTouches[0]),window.active&&"line"!=settings.type){var b=relative(a.pageX,a.pageY);drawPoint(b.x,b.y)}}).on("mouseup touchend",function(a){if(a.preventDefault(),window.active=!1,"eraser"!=settings.type){if(window.points.history.last div").addClass("hidden"),$("#menu div.options > .general, #menu div.options > ."+c).removeClass("hidden")),$(this).parents("form").addClass("hidden")}),a.submit(function(a){a.preventDefault(),$(this).addClass("hidden")});var b=$("form.confirm");b.each(function(){$(this).find("li").on("click tap",function(){$(this).parent().find("li[aria-selected]").removeAttr("aria-selected"),$(this).attr("aria-selected","true")}),$(this).find("button").last().on("click tap",function(a){a.preventDefault();var b=$(this).parents("form").attr("id");$(this).parents("form").find("h1").each(function(a){if(a>0){var c=$(this).html().toLowerCase(),d=$(this).parent().find("ol:nth-of-type("+a+") li[aria-selected] span").html();"file name"!==c&&"file"!==c&&(d=d.toLowerCase()),window[b][c]=d}}),$(this).parents("form").addClass("hidden"),window[b]()}),$(this).find("button").first().on("click tap",function(a){a.preventDefault(),$(this).parents("form").addClass("hidden")})});var d=$('button[id^="set"]');d.each(function(){var a=/set(.*)/.exec($(this).attr("id"))[1];return"color"==a||"bg"==a?$(this).on("click tap",function(){$(".picker").removeClass("hidden"),$(".picker").attr("data-caller",a),setTimeout(function(){$("body").on("click tap","canvas, #menu, header",function(){$(".picker").addClass("hidden"),$("body").off("click tap")})},500)}):void $(this).on("click tap",function(b){b.preventDefault(),$('form[id="'+a+'"]').removeClass("hidden")})});var e;$('div[role="slider"] button').on("mousedown touchstart",function(){$(this).attr("data-moving","true"),e||(e=$('div[role="slider"] button').offset().left)}).on("mousemove touchmove",function(a){if($(this).attr("data-moving")){a.changedTouches&&(a=a.changedTouches[0]);var b=parseInt(a.pageX-e-15),c=$("."+$(this).parents('div[role="slider"]').attr("class")),d=c.find("progress"),f=+d.attr("max"),g=+d.attr("min");if(f>=b&&b>=g){c.find("button").css("left",b+"%"),d.attr("value",b);var h=c.attr("class");settings[h]=b,$("#"+h+" span").html(b)}}}).on("mouseup mouseleave touchend",function(){$(this).removeAttr("data-moving")}),$(".fill, .stroke").on("click tap",function(){var a=$("."+$(this).attr("class")).find("span");"Yes"==a.html()?(a.html("No"),settings[$(this).attr("class")]=!1):(a.html("Yes"),settings[$(this).attr("class")]=!0)}),$(".close, .tour button").on("click tap",function(){$(this).parent().addClass("hidden"),$("body").off("click tap")}),$("#clear").on("click tap",function(){c.clear();var a=window.points.history;window.points=[],window.points.history=a,window.points.history.last