DhtmlXQ_MXQ_HEAD.js
资源名称:xiangqi.rar [点击查看]
上传用户:hldjtg
上传日期:2022-07-28
资源大小:4250k
文件大小:6k
源码类别:
棋牌游戏
开发平台:
Java
- var isMXQ=false;
- var MXQMove='';
- var AllowSearch=2;
- var isMXQLoad=(location.protocol!='http:')?false:true;
- function Init_MXQ(MCJ,MXQ,SIDE)
- {
- AllowSearch=SIDE;
- MXQ=MXQ.replace(/[- ]/gi,'').toUpperCase();
- if (MXQ.length>=4) MXQ=MXQ.match(/w{4}/gi).join('');
- else MXQ='';
- MXQMove=MXQ;
- var p,n,i,m,o;
- p='8979695949392919097717866646260600102030405060708012720323436383'; //目前只支持全局,日后加上倒推棋步到初始局面功能。
- m=MXQ.split('');
- o='ABCDEFGHIJ';
- n='9876543210'.split('');
- for(i=1;i<m.length;i=i+2) m[i]=n[o.indexOf(m[i])];
- m=m.join('');
- UBB='[DhtmlXQ_ver]www_dpxq_com[/DhtmlXQ_ver]rn[DhtmlXQ_init]500,350[/DhtmlXQ_init]rn[DhtmlXQ_binit]'+p+'[/DhtmlXQ_binit]rn[DhtmlXQ_move_0_1_0]'+m+'[/DhtmlXQ_move_0_1_0]rn[DhtmlXQ_viewurl]?f=400[/DhtmlXQ_viewurl]';
- if (!isMXQ) return;
- initdata();
- if (SIDE==1) turnBoard(); //旋转棋盘
- document.getElementById('m_text').scrollTop=0;
- document.getElementById('divsave').style.display='';
- }
- function Conv_MCJ(MCJ)
- {
- if (MCJ=='')
- return '8979695949392919097717866646260600102030405060708012720323436383';
- else
- {
- var p='864213579abcdefgomkihjlnpqrstuvw'.split('');
- for(i=0;i<32;i++)
- {
- n=MCJ.indexOf(p[i]);
- p[i]=(n<0)?'99':(parseInt(n/10)+''+(9-n%10));
- }
- p=p.join('');
- return p;
- }
- }
- function Conv_MXQ(MCJ,MXQ,SIDE)
- {
- AllowSearch=SIDE;
- if (!isMXQ) return;
- MXQ=MXQ.replace(/[- ]/gi,'').toUpperCase();
- if (MXQ.length>=4) MXQ=MXQ.match(/w{4}/gi).join('');
- else MXQ='';
- var i,j,p,s,m,o,n,r,s1,s2;
- o='ABCDEFGHIJ';
- n='9876543210'.split('');
- if (MXQ.substr(0,MXQMove.length)==MXQMove)
- {
- MXQMove=MXQ;
- MXQ=MXQ.match(/w{4}/gi);
- if (MXQ==null) return;
- j=0;s='';
- for (i=lnum;i<MXQ.length;i++)
- {
- lnum++;j++;
- m=MXQ[i].split('');
- m[1]=n[o.indexOf(m[1])];
- m[3]=n[o.indexOf(m[3])];
- s1='_'+m[0]+m[1]+'_';
- s2='_'+m[2]+m[3]+'_';
- m=m.join('');
- move+=m;
- s+='rn<div id="move_'+lnum+'" onmouseup="gotonum('+lnum+')">'+((lnum%2==1)?(' '+(lnum+1)/2+'.').replace(/.*(.{4})$/gi,'$1'):(' ')).replace(/ /gi,' ')+getMovelistString(m,P[lnum-1])+' </div>';
- sMI[lnum]=sMI[lnum-1];
- pMI[lnum]=sMI[lnum-1];
- p='_'+P[lnum-1].replace(/(dd)/gi,'$1_');
- if (p.indexOf(s2)>=0) p=p.replace(s2,'_99_').replace(s1,s2);
- else p=p.replace(s1,s2);
- P[lnum]=p.replace(/_/gi,'');
- }
- if (s!='')
- {
- MoveDIV.innerHTML+=s;
- r=eval('/\[(DhtmlXQ_move_'+sMI[lnum]+')\](.*)\[\/\1\]/gi');
- UBB=UBB.replace(r,'[$1]MOVE[/$1]').replace('MOVE',move);
- }
- if ((pClick.length<2&&nnum>=lnum-1)||j>1) gotonum('Last');
- else document.getElementById('shownow').value=nnum+'/'+lnum;
- }
- else Init_MXQ(MCJ,MXQ,SIDE);
- }
- function SearchP_MXQ(p)
- {
- if (DhtmlXQ=='') {showalert('对不起,您打开本推演棋盘页面时东萍棋谱仓库网站无法接通,因此暂时无法使用搜索');return;}
- if (AllowSearch<2) {showalert('只有旁观者才能使用棋谱仓库搜索功能学棋,对局者只能在棋盘上推演棋局,研究走法');return;}
- if (AllowSearch>2) {showalert('上一个搜索还未完成,请稍候再搜索');AllowSearch--;return;}
- if (p=='') return;
- if (p.length==4) p=getpos().join('')+p;
- if (!isMXQLoad) {Load_MXQ(p);return;}
- AllowSearch=5;
- setTimeout('AllowSearch=2;',3000);
- if (isMXQ)
- {
- search_diy.document.s.e.value='';
- search_diy.document.s.p.value=p;
- search_diy.document.s.submit();
- }
- else
- NS_MXQ.location.href='mxq.asp?p='+p;
- document.getElementById('divsave').style.height='100%';
- document.getElementById("viewframe").style.left=510;
- document.getElementById('sButton1').value='显示棋谱';
- document.getElementById('sButton2').value='返回对局';
- }
- function Load_MXQ(p)
- {
- var m=VarDIV.innerHTML.match(/getMove(.d{4}.)/gi);
- m=(m==null)?'':(m[0].match(/d{4}/gi)[0]);
- var f='?f='+nnum+'_'+sMI[nnum]+((isTurn)?'_1':'_')+((isMirror)?'_1':'_')+'_'+m+((pCid>=0)?('_'+pCid):'_')+((CSS)?'_':('_'+conv_ev(getpos(1))));
- self.name='NoFile_[DhtmlXQ_viewurl]'+f+'[/DhtmlXQ_viewurl]rn[DhtmlXQ_mxq_p]'+p+'[/DhtmlXQ_mxq_p]rn[DhtmlXQ_mxq_side]'+AllowSearch+'[/DhtmlXQ_mxq_side]rn[DhtmlXQ_mxq_move]'+MXQMove+'[/DhtmlXQ_mxq_move]rn'+UBB;
- self.location.href='http://www.dpxq.com/hldcg/search/DhtmlXQ_MXQ.htm';
- }
- function Buy_MXQ()
- {
- window.open('http://www.dpxq.com/hldcg/shop/mxq.html');
- }
- function Login_MXQ()
- {
- if (!isMXQLoad) {Load_MXQ('');return;}
- NS_MXQ.location.href='http://www.dpxq.com/hldcg/search/mxqlogin.asp';
- document.getElementById('divsave').style.height='100%';
- }
- function Logout_MXQ()
- {
- if (!isMXQLoad) {Load_MXQ('');return;}
- NS_MXQ.location.href='http://www.dpxq.com/hldcg/search/mxqlogout.asp';
- document.getElementById('divsave').style.height='100%';
- }
- function ShowB_MXQ()
- {
- document.getElementById('divsave').style.height=(document.getElementById('divsave').style.height=='28px')?'100%':'28px';
- if (isMXQLoad) document.getElementById('sButton2').value=(document.getElementById('divsave').style.height=='28px')?'显示搜索':'返回对局';
- }
- function ShowV_MXQ()
- {
- if (!isMXQLoad) {Load_MXQ('');return}
- if (viewframe.location.pathname!='/hldcg/chess/view.htm') {showalert('你还没有看过棋谱仓库中的棋谱');return;}
- document.getElementById('divsave').style.height='100%';
- document.getElementById('sButton2').value='返回对局';
- document.getElementById('viewframe').style.left=(document.getElementById('sButton1').value=='隐藏棋谱')?'510px':'0px';
- document.getElementById('sButton1').value=(document.getElementById('sButton1').value=='隐藏棋谱')?'显示棋谱':'隐藏棋谱';
- }
- function hidebgimg()
- {
- if (viewframe.name_dhtmlxq_search_view)
- {
- viewframe.name_dhtmlxq_search_view.document.getElementById('divs').style.backgroundImage='none';
- document.getElementById("viewframe").style.left=0;
- document.getElementById('sButton1').value='隐藏棋谱';
- document.getElementById('sButton2').value='返回对局';
- }
- }
- function showWideSPage()
- {
- document.getElementById('IS_MXQ').style.width=494;
- }