/*! 2018-07-13 */
function gotoplugs(a){if($("iframe").attr("src",PLUGS[a].url),""==customqrcode){$(".qrcode").attr("src","./wall/defaultqrcode.php?from="+a)}void 0!=MUSIC[a]&&playmusic(a,MUSIC[a].bgmusicstatus),$("iframe").attr("src",$("iframe").attr("src")),1==BACKGROUNDIMAGE[a].bgtype?($("iframe").css({"background-image":"url("+BACKGROUNDIMAGE[a].path+")"}),$(".bgvideo").find("video").attr("src","")):($("iframe").removeAttr("style"),$(".bgvideo").find("video").attr("src",BACKGROUNDIMAGE[a].path),1==$(".bgvideo").find("video")[0].paused&&$(".bgvideo").find("video")[0].play()),CURRENTPLUG=a}function switchmusic(){1==MUSIC[CURRENTPLUG].bgmusicstatus?MUSIC[CURRENTPLUG].bgmusicstatus=2:MUSIC[CURRENTPLUG].bgmusicstatus=1,$.ajax({url:"/wall/ajax_act_set_bgmusic.php",data:{bgmusicstatus:MUSIC[CURRENTPLUG].bgmusicstatus,plugname:CURRENTPLUG},type:"get",dataType:"json",success:function(a){playmusic(CURRENTPLUG,MUSIC[CURRENTPLUG].bgmusicstatus)}})}function playmusic(a,b){console.log("playmusic");var c=MUSIC[a].bgmusicpath,d=$("#bgmusic")[0];$("audio source").attr("src")!=c&&(d.pause(),$("audio source").attr("src",c),$("#bgmusic")[0].load());var e=$("#playbgmusic");e.find("i").removeClass("icon-music-on"),e.find("i").removeClass("icon-music-off"),1!=b?(e.find("i").addClass("icon-music-off"),d.paused||d.pause()):(e.find("i").addClass("icon-music-on"),d.paused&&d.play())}$(function(){$(".fullscreen").bind("click",function(a){$.fullscreen.isFullScreen()?($(this).find("i").removeClass("icon-full-screen-cancel"),$(this).find("i").addClass("icon-full-screen"),$.fullscreen.exit()):($(this).find("i").removeClass("icon-full-screen"),$(this).find("i").addClass("icon-full-screen-cancel"),$("body").fullscreen()),a.preventDefault()})}),$(function(){$(".plug-btn").bind("click",function(){gotoplugs($(this).attr("data"))}),$("#playbgmusic").bind("click",function(){switchmusic()}),gotoplugs(CURRENTPLUG)}),$(function(){window.sessionStorage.getItem("loginkey")?($(".loader").hide(),$(".loginform").hide(),$("iframe").attr("src",$("iframe").attr("src"))):($(".loader").hide(),$(".loginform").show()),$(".button-login").on("click",function(){$(".loader").show(),$.getJSON("/wall/login.do.php",{password:$("#password").val()},function(a){0==a.errno?(window.sessionStorage.setItem("loginkey",1),$(".loginform").hide(),$("iframe").attr("src",$("iframe").attr("src")),""!=$(".bgvideo").find("video").attr("src")&&1==$(".bgvideo").find("video")[0].paused&&$(".bgvideo").find("video")[0].play(),playmusic(CURRENTPLUG,MUSIC[CURRENTPLUG].bgmusicstatus)):alert("密码错误")}).complete(function(){$(".loader").hide()})})});