/*** Created by A.J on 2020/6/23.*/$(document).ready(function(){$('#image').on('change',function(){var fileName = $(this).val();$(this).next('.custom-file-label').html(fileName);});$('#formsubmit').on('click',function(){var subobj = $(this);subobj.attr("disabled",true).children("i").removeClass("d-none");$('#image').upload("", $("form").serialize(), function(data) {subobj.attr("disabled",false).children("i").addClass("d-none");if(data == "ok"){window.location.reload();}else{$.alert({title: $('#chucuo').text(),content: data,buttons: {confirm: {text: $('#queding').text(),btnClass: 'btn-info',keys: ['enter']}}});}});});$('#islink').on('click',function(){if($(this).prop("checked")){$('#linkurl').removeClass("d-none");$('#modulediv').addClass("d-none");}else{$('#modulediv').removeClass("d-none");$('#linkurl').addClass("d-none");}});$.post("geticonlist", { verification:$("#verification").text()},function(data){var html = '';$.each(data, function(index,val){html += '<div class="col-3 col-md-2 text-center mb-2 p-2 icondiv" id="icon_'+val["name"]+'"><svg class="bi" width="32" height="32" fill="currentColor"><use xlink:href="'+$("#domain").text()+'public/common/images/bootstrap-icons.svg#'+val["name"]+'"/></svg><div>'+val["name"]+'</div></div>';});$("#iconlist").html(html);});$('#iconlist').on('click', '.icondiv',function(){$(this).addClass("bg-info").addClass("text-white").siblings().removeClass("bg-info").removeClass("text-white");$('#currenticon').text($(this).children("div:last").text());});$('#iconsModal').on('shown.bs.modal', function (e) {var currenticon = $('#currenticon').text();if(currenticon != ""){$("#icon_"+currenticon).addClass("bg-info").addClass("text-white").siblings().removeClass("bg-info").removeClass("text-white");}});$('#iconok').on('click',function(){$.inicon();});$('#iconlist').on('dblclick', '.icondiv',function(){$.inicon();});$("#changeicon").bind("input propertychange",function(event){var iconsize = $("#changeicon").val();var currenticon = $('#currenticon').text();if(currenticon != ""){$('#selectedicon').html('<svg class="bi" width="'+iconsize+'" height="'+iconsize+'" fill="currentColor"><use xlink:href="'+$("#domain").text()+'public/common/images/bootstrap-icons.svg#'+currenticon+'"/></svg>');$("#iconsize").text(iconsize);$("#icons").val($('#selectedicon').html());}});$('#closeicon').on('click',function(){$('#selectedicon').html("");$("#icons").val("");$("#iconselect").addClass("d-none");$("#iconinputdiv").removeClass("d-none");});});$.extend({'inicon':function(){var currenticon = $('#currenticon').text();if(currenticon == ""){$.alert({title: $('#chucuo').text(),content: $('#currenticonempty').text(),buttons: {confirm: {text: $('#queding').text(),btnClass: 'btn-info',keys: ['enter']}}});}else{$('#selectedicon').html('<svg class="bi" width="32" height="32" fill="currentColor"><use xlink:href="'+$("#domain").text()+'public/common/images/bootstrap-icons.svg#'+currenticon+'"/></svg>');$("#iconsize").text(32);$('#iconsModal').modal('hide');$("#iconinputdiv").addClass("d-none");$("#iconselect").removeClass("d-none");$("#icons").val($('#selectedicon').html());}}});