indexshow.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. function initbody(){
  2. jm.setJmstr(jm.base64decode(show_key));
  3. objcont = $('#content_allmainview');
  4. objtabs = $('#tabs_title');
  5. resizewh();
  6. $(window).resize(resizewh);
  7. clickhome();
  8. _addbodykey();
  9. }
  10. function opentixiang(){
  11. addtabs({num:'todo',url:'system,geren,todo',icons:'bell',name:'提醒信息'});
  12. return false;
  13. }
  14. function clickhome(){
  15. addtabs({num:'home',url:'home,index',icons:'home',name:'首页',hideclose:true});
  16. return false;
  17. }
  18. function resizewh(){
  19. var _lw = 0;
  20. var w = winWb()-_lw-5;
  21. var h = winHb();
  22. viewwidth = w;
  23. viewheight = h-44;
  24. $('#indexcontent').css({width:''+viewwidth+'px',height:''+(viewheight)+'px'});
  25. $('#tabsindexm').css({width:''+viewwidth+'px'});
  26. var nh = h-50;
  27. $('#indexmenu').css({height:''+nh+'px'});
  28. $('#indexsplit').css({height:''+nh+'px'});
  29. $('#indexmenuss').css({height:''+nh+'px'});
  30. $('#menulist').css({height:''+(viewheight)+'px'});
  31. _pdleftirng();
  32. }
  33. function clickmenu(o, i, k){
  34. var a = menuarr[i];
  35. if(k>-1)a=menuarr[i].children[k];
  36. var oi = a.stotal;
  37. if(oi>0){
  38. $('#menu_down_'+a.num+'').toggle();
  39. var o1 = get('menu_down_isons_'+a.num+'');
  40. if(o1.className.indexOf('down')>0){
  41. o1.className='icon-caret-up';
  42. }else{
  43. o1.className='icon-caret-down';
  44. }
  45. }else{
  46. addtabs(a);
  47. }
  48. }
  49. function changelassa(){
  50. var o1 = $("div[temp='menu']"),i,cls,cls1;
  51. for(i=0;i<o1.length;i++){
  52. cls = o1[i].className,cls1='menuone';
  53. if(cls.indexOf('two')>0)cls1='menutwo';
  54. o1[i].className=cls1;
  55. }
  56. }
  57. var coloebool = false;
  58. function closetabs(num){
  59. tabsarr[num] = false;
  60. $('#content_'+num+'').remove();
  61. $('#tabs_'+num+'').remove();
  62. if(num == nowtabs.num){
  63. var now ='home',i,noux;
  64. for(i=opentabs.length-1;i>=0;i--){
  65. noux= opentabs[i];
  66. if(get('content_'+noux+'')){
  67. now = noux;
  68. break;
  69. }
  70. }
  71. changetabs(now);
  72. }
  73. coloebool = true;
  74. _pdleftirng();
  75. setTimeout('coloebool=false',10);
  76. }
  77. function closenowtabs(){
  78. var nu=nowtabs.num;
  79. if(nu=='home')return;
  80. closetabs(nu);
  81. }
  82. function changetabs(num,lx){
  83. if(coloebool)return;
  84. if(!lx)lx=0;
  85. $("div[temp='content']").hide();
  86. $("[temp='tabs']").removeClass();
  87. var bo = false;
  88. if(get('content_'+num+'')){
  89. $('#content_'+num+'').show();
  90. $('#tabs_'+num+'').addClass('accive');
  91. nowtabs = tabsarr[num];
  92. bo = true;
  93. }
  94. opentabs.push(num);
  95. if(lx==0)_changhhhsv(num);
  96. return bo;
  97. }
  98. function _changhhhsv(num){
  99. var o=$("[temp='tabs']"),i,w1=0;
  100. for(i=0;i<o.length;i++){
  101. if(o[i].id=='tabs_'+num+'')break;
  102. w1=w1+o[i].scrollWidth;
  103. }
  104. $('#tabsindexm').animate({scrollLeft:w1});
  105. }
  106. function _changesrcool(lx){
  107. var l = $('#tabsindexm').scrollLeft();
  108. var w = l+200*lx;
  109. $('#tabsindexm').animate({scrollLeft:w});
  110. }
  111. function _pdleftirng(){
  112. var mw=get('tabs_title').scrollWidth;
  113. if(mw>viewwidth){$('.jtcls').show();}else{$('.jtcls').hide();}
  114. }
  115. function addtabs(a){
  116. var url = a.url,
  117. num = a.num;
  118. if(isempt(url))return false;
  119. if(url.indexOf('add,')==0){openinput(a.name,url.substr(4));return;}
  120. if(url.indexOf('http')==0){window.open(url);return;}
  121. nowtabs = a;
  122. if(changetabs(num))return true;
  123. var s = '<td temp="tabs" nowrap onclick="changetabs(\''+num+'\',1)" id="tabs_'+num+'" class="accive">';
  124. if(a.icons)s+='<i class="icon-'+a.icons+'"></i> ';
  125. s+=a.name;
  126. if(!a.hideclose)s+='<span onclick="closetabs(\''+num+'\')" class="icon-remove"></span>';
  127. s+='</td>';
  128. objtabs.append(s);
  129. _changhhhsv(num);
  130. _pdleftirng();
  131. var rand = js.getrand(),i,oi=2,
  132. ura = url.split(','),
  133. dir = ura[0],
  134. mode= ura[1];
  135. url =''+PROJECT+'/'+dir+'/'+mode+'/rock_'+mode+'';
  136. if(ura[2]){
  137. if(ura[2].indexOf('=')<0){
  138. oi=3;
  139. url+='_'+ura[2]+'';
  140. }
  141. }
  142. url+='.shtml?rnd='+Math.random()+'';
  143. var urlpms= '';
  144. for(i=oi;i<ura.length;i++){
  145. var nus = ura[i].split('=');
  146. urlpms += ",'"+nus[0]+"':'"+nus[1]+"'";
  147. }
  148. if(urlpms!='')urlpms = urlpms.substr(1);
  149. var bgs = '<div id="mainloaddiv" style="width:'+viewwidth+'px;height:'+viewheight+'px;overflow:hidden;background:#000000;color:white;filter:Alpha(opacity=20);opacity:0.2;z-index:3;position:absolute;left:0px;line-height:'+viewheight+'px;top:0px;" align="center"><img src="images/mloading.gif" align="absmiddle">&nbsp;加载中...</div>';
  150. $('#indexcontent').append(bgs);
  151. objcont.append('<div temp="content" id="content_'+num+'"></div>');
  152. $.ajax({
  153. url:url,
  154. type:'get',
  155. success: function(da){
  156. $('#mainloaddiv').remove();
  157. var s = da;
  158. s = s.replace(/\{rand\}/gi, rand);
  159. s = s.replace(/\{adminid\}/gi, adminid);
  160. s = s.replace(/\{adminname\}/gi, adminname);
  161. s = s.replace(/\{mode\}/gi, mode);
  162. s = s.replace(/\{dir\}/gi, dir);
  163. s = s.replace(/\{params\}/gi, "var params={"+urlpms+"};");
  164. var obja = $('#content_'+num+'');
  165. obja.html(s);
  166. },
  167. error:function(){
  168. $('#mainloaddiv').remove();
  169. var s = 'Error:加载出错喽,'+url+'';
  170. if(num=='home')s+='<br><h3>你的服务器不支持shtml文件的类型,请设置添加,后缀名:.shtml,MIME类型:text/html</h3>';
  171. $('#content_'+num+'').html(s);
  172. }
  173. });
  174. tabsarr[num] = a;
  175. return false;
  176. }