filesbox/web/dist/design/designstatic/home/js/main.js

2 lines
28 KiB
JavaScript
Raw Permalink Normal View History

2024-07-26 06:10:54 +00:00
(function(o,S){var A={init:function(){var e=this;e.aHrefClick(),e.fixed(),e.advert(),e.serach(),e.calendar(),e.baiduMap(),e.weather(),e.course(),e.courseWare(),e.getAjaxRoomInfo(),e.setAnimation()},aHrefClick:function(){for(var e=o("a[href]"),n=[],s=0,i=e.length;s<i;s++){var t=e.eq(s);(t.attr("href").indexOf("/aroom/#")>-1||t.attr("href").indexOf("/myroom/#")>-1&&t.attr("href").indexOf("/nolimit")<0||t.attr("href").indexOf("/pay/#")>-1)&&(t.attr("clickUrl",t.attr("href")),t.removeAttr("href"))}o(".module a[clickUrl]").on("click",function(p){p.stopPropagation();var r=window.user,a=o(this).attr("clickUrl"),u=function(l){l=="STUDENT"?a.indexOf("/pay/#")>-1?window.location.href=a.indexOf("/pay/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=a.indexOf("/myroom/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=a.indexOf("/aroom/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/"},d=function(){r.loginLayer(function(l){l.success&&r.isLogin(function(c){c.success&&u(c.data.userTypeExact)})})};getCookie("token")||getCookie("stoken")?r.isLogin(function(l){l.success?u(l.data.userTypeExact):d()}):d()})},fixed:function(){for(var e=this,n=o(".module[data-fixed]"),s=0,i=n.length;s<i;s++){var t=n.eq(s),p=parseInt(t.css("left")),r=t.parent().width(),a=p-r/2;t.attr("data-fixed")=="fixedTop"?t.css({position:"fixed",top:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:a+"px",zIndex:999}):t.attr("data-fixed")=="fixedBottom"&&t.css({position:"fixed",top:"auto",bottom:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:a+"px",zIndex:999})}},advert:function(){var e=this,n=o(".module[data-type=suspend]");if(n.length<1)return!1;var s=3,i=100,t=o(window).width(),p=o(window).height(),r=o(document).height();o(window).resize(function(){t=o(window).width();for(var k=0,I=n.length;k<I;k++){var g=n.eq(k);if(g.attr("data-suspend")){var T=o.parseJSON(g.attr("data-suspend"));if(T.type=="dynamic"){var b=g[0].parentElement.offsetLeft,x=g[0].parentElement.offsetTop;g.css({left:-b,top:-x,zIndex:999})}}}});for(var a={},u=0,d=n.length;u<d;u++){var l=n.eq(u);if(l.find("a").attr("href")==""&&l.find("a").removeAttr("href"),l.attr("data-suspend")){var c=o.parseJSON(l.attr("data-suspend")),f=l[0].parentElement.offsetLeft,m=l[0].parentElement.offsetTop,h=f+l[0].offsetLeft,w=m+l[0].offsetTop;if(c.type=="dynamic")l.css({left:-f,top:-m,zIndex:999}),function(k,I,g){var T=0,b=0,x=0,D,O,C=!0,N=!0,j=parseInt(I.css("width")),W=parseInt(I.css("height")),P=t-j,_=r-W;I.css({transition:"transform "+i/1e3+"s linear",cursor:"pointer"}),a["fn"+g]=function(B,q){C?b+=s:b-=s,N?x+=s:x-=s,b>P&&(C=!1,b=P),b<0&&(C=!0,b=0),x>_&&(N=!1,x=_),x<0&&(N=!0,x=0),B.css({transform:"translate("+b+"px, "+x+"px)"})},a["int"+g]=setInterval(function(){a["fn"+g](I,g)},i),I.hover(function(){clearInterval(a["int"+g])},function(){a["int"+g]=setInterval(function(){a["fn"+g](I,g)},i)})}(c,l,u);else{var v=parseInt(t)-parseInt(l.css("width")),y=parseInt(p)-parseInt(l.css("height"));l.css({position:"fixed",left:h<0?0:h>v?"auto":h,right:h>v?0:"auto",top:w>p?y:w,zIndex:999})}}}},serach:function(){var e=this;if(e.$search=o(".module[data-type=search]"),e.$search.length<1)return!1;for(var n=0,s=e.$search.length;n<s;n++){var i=e.$search.eq(n);(function(t){var p=t.find(".searchBtn"),r=t.find("input");p.on("click",function(){r.val()?S.location.href="/pages/elective.html?keyword="+r.val():S.location.href="/pages/elective.html"})})(i)}},calendar:function(){var e=this;if(e.$calendar=o(".module[data-type=calendar]"),e.$calendar.length<1)return!1;loadScriptmin.apply(e,["/design/designstatic/home/js/simple-calendar.js",function(n){for(var s=0,i=n.length;s<i;s++){var t=n.eq(s);t.find("div[id=calendarbox]").attr("id","calendarbox"+s),e.myCalendar=new SimpleCalendar("#calendarbox"+s)}},e.$calendar])},baiduMap:function(){var e=this;if(e.$Map=o(".module[data-type=Map]"),!window.BMap||e.$Map.length<1)return!1;for(var n=0,s=e.$Map.length;n<s;n++){var i=e.$Map.eq(n),t=JSON.parse(i.attr("data-map")),p=i.attr("data-mid");self["map"+p]=new BMap.Map(p),self["myGeo"+p]=new BM