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