How to use asElement method in Puppeteer

Best JavaScript code snippet using puppeteer

Custom.js

Source:Custom.js Github

copy

Full Screen

1 var ASSourceNameList=[2 {src:"Image/Page/radioPoint.png"},3 {src:"Image/Page/checkBox.png"},4 {src:"Image/Page/basicTitleBottom.jpg"},5 {src:"Image/Page/loadingBottom.png"},6 {src:"Image/Page/loadingCover.png"},7 {src:"Image/Page/loadingSucceed.png"},8 {src:"Image/Page/loadingFail.png"},9 {src:"Image/TopLogo/TopLogo.png"},10 {name:"startScene",src:"Image/Scene/Origin/main.png"},11 {name:"userHead1",src:"Image/User/logo1.png"},12 {name:"userHead2",src:"Image/User/logo2.png"},13 {name:"cardBoardSearch1",src:"Image/CardBoard/search1.png"},14 {name:"cardBoardSearch2",src:"Image/CardBoard/search2.png"},15 {name:"cardBoardBack1",src:"Image/CardBoard/back1.png"},16 {name:"cardBoardBack2",src:"Image/CardBoard/back2.png"},17 {name:"cardBoardBack3",src:"Image/CardBoard/back3.png"},18 {src:"Image/Search/bihuaCover.png"},19 {name:"searchLight",src:"Image/Search/light.png"},20 {name:"searchFold1",src:"Image/Search/fold1.png"},21 {name:"searchFold2",src:"Image/Search/fold2.png"},22 {name:"searchSearch1",src:"Image/Search/search1.png"},23 {name:"searchSearch2",src:"Image/Search/search2.png"},24 {name:"headBack",src:"Image/Head/background.jpg"},25 {name:"icon_back",src:"Image/Head/Icon/back.png"},26 {name:"icon_backL",src:"Image/Head/Icon/backL.png"},27 {name:"shellClose1",src:"Image/Shell/close1.png"},28 {name:"shellClose2",src:"Image/Shell/close2.png"},29 {name:"frameDivideBar",src:"Image/Frame/divideBar.png"},30 {name:"frameDivideLine",src:"Image/Frame/divideLine.png"},31 {name:"anchorListPointCover",src:"Image/Frame/jumpPointCover.png"},32 {name:"anchorListEndCover",src:"Image/Frame/jumpEndCover.png"},33 {name:"anchorListLineCover",src:"Image/Frame/jumpLineCover.png"},34 {name:"anchorListLight",src:"Image/Frame/jumpLight.png"},35 {name:"pageListLine",src:"Image/Frame/jumpLine.png"},36 {name:"pageListBlock",src:"Image/Frame/jumpBlock.png"},37 {name:"frameLinkLineB",src:"Image/Frame/linkLineB.png"},38 {name:"frameLinkLineW",src:"Image/Frame/linkLineW.png"},39 {name:"CFASQrcode",src:"Image/Page/Wechat/qrcode.jpg"},40 {name:"emailListClose",src:"Image/Page/Email/close.png"},41 {name:"enroll_past",src:"Image/Page/Function/past.png"},42 {name:"enroll_waiting",src:"Image/Page/Function/waiting.png"},43 {name:"enroll_available",src:"Image/Page/Function/available.png"},44 {name:"enroll_full",src:"Image/Page/Function/full.png"},45 {name:"enroll_ban",src:"Image/Page/Function/ban.png"},46 {name:"enroll_paying",src:"Image/Page/Function/paying.png"},47 {name:"enroll_success",src:"Image/Page/Function/success.png"},48 {name:"enroll_check",src:"Image/Page/Function/check.png"},49 {name:"enroll_change",src:"Image/Page/Function/change.png"},50 {name:"editorToolIcon",src:"Image/Page/Email/toolIcon.png"},51 {name:"editorToolRegion",src:"Image/Page/Email/toolRegion.png"},52 ];53 var ASSourceLoadList=[54 {src:"Data/data0.xml"},55 {name:"loadingScene",src:"Image/Scene/main.png"},56 {src:"Image/logo.png"},57 {src:"Image/logoL.png"},58 {src:"Image/loadingCircle.png"},59 {src:"Image/loadingLight.png"},60 ];61 var ASSourceBuildList=[62 ];63 var ASSourceWaitList=[64 ];65 //Component66 var BasicWordStr=new function() {67 BasicWordList=[];68 this.setLang=function(l) {69 if (!this["word"+l] && (this.wordC || this.wordE)) {70 if (l=="C") this.setLang("E");71 else this.setLang("C");72 return;73 }74 this.lang=l;75 this.word.set({innerHTML:this["word"+this.lang]});76 this.value=this["word"+this.lang];77 if (this.width=="max") this.set({style:{width:ASGetWordWidth(this.word)+2}});78 if (this.giveupExtra) return;79 var dx=0,dy=0;80 if (this.lang=="C" && this.word.style.fontFamily.indexOf("Microsoft Yahei")>-1) {81 dy-=this.size*0.06;82 dx-=this.size*0.06;83 }84 if (this.word.style.fontFamily.indexOf("Droid Sans Fallback")>-1) {85 dy+=this.size*0.07;86 }87 if (this.lang=="E" && this.sizeE) {88 this.word.set({style:{fontSize:this.sizeE}});89 } else {90 this.word.set({style:{fontSize:this.size}});91 }92 if (this.lang=="C" && this.letterSpacingC) {93 dx+=this.letterSpacingC/2;94 this.word.set({style:{letterSpacing:this.letterSpacingC,}});95 } else {96 this.word.set({style:{letterSpacing:0,}});97 }98 this.word.set({style:{99 top:dy,100 left:dx,101 }});102 }103 this.setWord=function(typeP) {104 if ("wordC" in typeP) this.wordC=typeP.wordC;105 if ("wordE" in typeP) this.wordE=typeP.wordE;106 this.widthA=0;107 this.heightA=0;108 this.word.set({innerHTML:this.wordC}),109 this.widthA=Math.max(this.widthA,ASGetWordWidth(this.word));110 this.heightA=Math.max(this.heightA,ASGetWordHeight(this.word));111 this.word.set({innerHTML:this.wordE}),112 this.widthA=Math.max(this.widthA,ASGetWordWidth(this.word));113 this.heightA=Math.max(this.heightA,ASGetWordHeight(this.word));114 this.setLang(this.lang);115 }116 this.getValue=function() {117 return(this.value);118 }119 }120 function BasicWord(buildP) {121 if (!buildP.size) buildP.size=18;122 if (!buildP.font) buildP.font=DEFAULT_FONT;123 if (!buildP.wordC) buildP.wordC="";124 if (!buildP.wordE) buildP.wordE="";125 if (!buildP.color) buildP.color="black";126 if (!buildP.defaultL) buildP.defaultL=ASLang;127 var target=ASElement({128 nodeName:"div",129 });130 target.size=buildP.size;131 target.lang=buildP.defaultL;132 target.wordC=buildP.wordC;133 target.wordE=buildP.wordE;134 target.sizeE=buildP.sizeE;135 target.letterSpacingC=buildP.letterSpacingC;136 target.giveupExtra=buildP.giveupExtra;137 BasicWordList[BasicWordList.length]=target;138 target.word=ASElement({139 nodeName:"p",140 style:{141 position:"relative",142 fontSize:buildP.size,143 fontFamily:buildP.font,144 color:buildP.color,145 },146 });147 target.appendChild(target.word);148 target.setLang=BasicWordStr.setLang;149 target.setWord=BasicWordStr.setWord;150 target.getValue=BasicWordStr.getValue;151 target.width=buildP.width;152 target.setWord({153 wordC:buildP.wordC,154 wordE:buildP.wordE,155 });156 target.set(buildP);157 return(target);158 }159 function BasicTitle(buildP) {160 if (!buildP.size) buildP.size=30;161 // Default Title Color162 if (!buildP.color) buildP.color="rgb(230,0,0)";163 var target=ASElement({164 nodeName:"div",165 style:{166 backgroundImage:"url('"+ASGetSrcByName("basicTitleBottom")+"')",167 backgroundPosition:"0 0",168 backgroundSize:buildP.size*0.18+"px 100%",169 backgroundRepeat:"no-repeat",170 },171 });172 target.word=BasicWord({173 size:buildP.size,174 sizeE:buildP.sizeE,175 font:buildP.font,176 wordC:buildP.wordC,177 wordE:buildP.wordE,178 color:buildP.color,179 defaultL:buildP.defaultL,180 letterSpacingC:buildP.letterSpacingC,181 style:{182 position:"relative",183 marginLeft:buildP.size*0.5,184 },185 });186 target.appendChild(target.word);187 if (buildP.widthA) {188 target.set({style:{189 width:buildP.widthA,190 }});191 }192 target.set(buildP);193 return(target);194 }195 var BasicButtonStr=new function() {196 this.onmouseover=function() {197 this.bottom.setTarget({198 transform:{scale:1},199 });200 this.bottom.light.setTarget({201 opacity:1,202 });203 this.bottom.shade.setTarget({204 opacity:0,205 });206 this.word.setTarget({207 transform:{208 translateX:-2,209 translateY:-1,210 },211 });212 }213 this.onmouseout=function() {214 this.bottom.setTarget({215 transform:{scale:1},216 });217 this.bottom.light.setTarget({218 opacity:0,219 });220 this.bottom.shade.setTarget({221 opacity:0,222 });223 this.word.setTarget({224 transform:"translate(0,0)",225 });226 }227 this.onmousedown=function() {228 this.bottom.setTarget({229 transform:{scale:1},230 });231 this.bottom.light.setTarget({232 opacity:0,233 });234 this.bottom.shade.setTarget({235 opacity:1,236 });237 this.word.setTarget({238 transform:{239 translateX:2,240 translateY:1,241 },242 });243 }244 this.onmouseup=function() {245 this.bottom.setTarget({246 transform:{scale:1},247 });248 this.bottom.light.setTarget({249 opacity:1,250 });251 this.bottom.shade.setTarget({252 opacity:0,253 });254 this.word.setTarget({255 transform:{256 translateX:-2,257 translateY:-1,258 },259 });260 }261 this.resize=function(typeP) {262 if (typeP.widthA) {263 this.width0=typeP.widthA;264 this.word.set({style:{width:typeP.widthA}});265 this.set({style:{width:typeP.widthA}});266 }267 }268 }269 function BasicButton(buildP) {270 // Default Button Color271 if (!buildP.size) buildP.size=18;272 if (!buildP.color) buildP.color="rgb(240,0,0)";273 if (!buildP.colorW) buildP.colorW="white";274 if (!buildP.colorL) buildP.colorL="rgb(255,145,0)";275 var target=ASElement({276 nodeName:"div",277 style:{278 position:"relative",279 borderRadius:buildP.size*0.15,280 textAlign:"center",281 cursor:"pointer",282 },283 onmouseover:BasicButtonStr.onmouseover,284 onmouseout:BasicButtonStr.onmouseout,285 onmousedown:BasicButtonStr.onmousedown,286 onmouseup:BasicButtonStr.onmouseup,287 resize:BasicButtonStr.resize,288 });289 target.size=buildP.size;290 target.word=BasicWord({291 font:buildP.font,292 size:buildP.size,293 color:buildP.colorW,294 wordC:buildP.wordC,295 wordE:buildP.wordE,296 wCenter:true,297 style:{298 position:"absolute",299 pointerEvents:"none",300 },301 });302 target.width0=target.word.widthA+buildP.size*1;303 target.height0=target.word.heightA+buildP.size*0.5;304 if (buildP.widthA) target.width0=buildP.widthA;305 target.word.set({style:{306 top:buildP.size*0.25,307 width:"100%",308 }});309 target.bottom=ASElement({310 nodeName:"div",311 style:{312 position:"absolute",313 left:0,314 top:0,315 transformOrigin:"50% 50%",316 backgroundColor:buildP.color,317 borderRadius:buildP.size*0.15,318 width:"100%",319 height:"100%",320 boxShadow:"0 0 "+target.size*0.5+"px "+buildP.colorL+" inset",321 },322 });323 target.bottom.light=ASElement({324 nodeName:"div",325 style:{326 position:"absolute",327 top:0,328 left:0,329 borderRadius:buildP.size*0.15,330 width:"100%",331 height:"100%",332 opacity:0,333 boxShadow:(-target.size*0.1)+"px "+(-target.size*0.1)+"px "+target.size*0.4+"px rgba(255,255,255,1) inset",334 },335 });336 target.bottom.appendChild(target.bottom.light);337 target.bottom.shade=ASElement({338 nodeName:"div",339 style:{340 position:"absolute",341 top:0,342 left:0,343 borderRadius:buildP.size*0.15,344 width:"100%",345 height:"100%",346 opacity:0,347 boxShadow:(target.size*0.1)+"px "+(target.size*0.1)+"px "+target.size*0.4+"px rgba(0,0,0,0.8) inset",348 },349 });350 target.bottom.appendChild(target.bottom.shade);351 target.appendChild(target.bottom);352 target.appendChild(target.word);353 target.set({style:{354 width:target.width0,355 height:target.height0,356 }});357 target.set(buildP);358 return(target);359 }360 var BasicDoubleButtonStr=new function() {361 this.button0Onclick=function() {362 if (!this.root.wOpen) {363 this.root.open();364 } else {365 if (this.root.confirm) this.root.confirm();366 this.root.close();367 }368 this.onmouseout();369 }370 this.button1Onclick=function() {371 this.root.close();372 }373 this.onmouseoutdown=function() {374 this.close();375 }376 this.open=function() {377 if (this.wOpen) return;378 this.wOpen=true;379 this.floor1.set({style:{display:"inline-block"}});380 this.floor1.setTarget({opacity:1});381 switch (this.fx) {382 case "left": this.floor0.setTarget({transform:{translateX:-ASGetElementWidth(this.button0)+this.dx}}); break;383 case "right": this.floor0.setTarget({transform:{translateX:ASGetElementWidth(this.button1)+this.dx}}); break;384 case "up": this.floor0.setTarget({transform:{translateY:-ASGetElementHeight(this.button0)}}); break;385 case "down": this.floor0.setTarget({transform:{translateY:ASGetElementHeight(this.button1)}}); break;386 }387 this.button1.onmouseover();388 }389 this.close=function() {390 if (!this.wOpen) return;391 this.wOpen=false;392 this.floor1.setTarget({opacity:0});393 switch (this.fx) {394 case "left": this.floor0.setTarget({transform:{translateX:0}}); break;395 case "right": this.floor0.setTarget({transform:{translateX:0}}); break;396 case "up": this.floor0.setTarget({transform:{translateY:0}}); break;397 case "down": this.floor0.setTarget({transform:{translateY:0}}); break;398 }399 this.setTimeout(function() {400 if (!this.wOpen) this.floor1.set({style:{display:"none"}});401 },300);402 }403 }404 function BasicDoubleButton(buildP) {405 if (!buildP.fx) buildP.fx="up";406 var target=ASElement({407 nodeName:"div",408 style:{409 position:"relative",410 },411 onmouseoutdown:BasicDoubleButtonStr.onmouseoutdown,412 open:BasicDoubleButtonStr.open,413 close:BasicDoubleButtonStr.close,414 });415 target.fx=buildP.fx;416 target.floor0=ASElement({417 nodeName:"div",418 style:{419 position:"relative",420 },421 });422 if (!buildP.button0) buildP.button0={};423 if (!buildP.button0.size) buildP.button0.size=buildP.size;424 target.button0=BasicButton(buildP.button0);425 target.floor0.appendChild(target.button0);426 target.button0.onclick=BasicDoubleButtonStr.button0Onclick;427 target.button0.root=target;428 target.floor1=ASElement({429 nodeName:"div",430 style:{431 position:"absolute",432 opacity:0,433 },434 });435 if (!buildP.button1) buildP.button1={};436 if (!buildP.button1.size) buildP.button1.size=buildP.button0.size;437 if (!buildP.button1.color) buildP.button1.color="rgb(200,200,200)";438 if (!buildP.button1.colorL) buildP.button1.colorL="rgba(230,230,230,0.3)";439 if (!buildP.button1.colorW) buildP.button1.colorW="black";440 target.button1=BasicButton(buildP.button1);441 target.floor1.appendChild(target.button1);442 target.button1.root=target;443 target.button1.onclick=BasicDoubleButtonStr.button1Onclick;444 target.appendChild(target.floor1);445 target.appendChild(target.floor0);446 if (buildP.wAequilate) {447 var width=Math.max(ASGetElementWidth(target.button0),ASGetElementWidth(target.button1));448 target.button0.resize({widthA:width});449 target.button1.resize({widthA:width});450 }451 target.dx=(ASGetElementWidth(target.button0)-ASGetElementWidth(target.button1))/2;452 target.floor1.set({style:{left:target.dx,display:"none"}});453 delete buildP.button0;454 delete buildP.button1;455 target.set(buildP);456 return(target);457 }458 var BasicLoadingStr=new function() {459 this.restart=function() {460 this.set({style:{opacity:0}});461 this.bottom.set({style:{opacity:1}});462 this.cover.set({style:{opacity:1}});463 this.success.set({style:{opacity:0}});464 this.failed.set({style:{opacity:0}});465 }466 this.start=function() {467 this.setTarget({opacity:1});468 }469 this.succeed=function() {470 this.success.setTarget({opacity:1});471 this.bottom.setTarget({opacity:0});472 this.cover.setTarget({opacity:0});473 }474 this.fail=function() {475 this.failed.setTarget({opacity:1});476 this.bottom.setTarget({opacity:0});477 this.cover.setTarget({opacity:0});478 }479 this.end=function() {480 this.setTarget({opacity:0,speed_alpha:0.05});481 }482 }483 function BasicLoading(buildP) {484 var target=ASElement({485 nodeName:"div",486 style:{487 position:"relative",488 width:100,489 height:100,490 opacity:0,491 },492 });493 target.bottom=ASElement({494 nodeName:"img",495 src:ASGetSrcByName("loadingBottom"),496 style:{497 position:"absolute",498 width:"100%",499 height:"100%",500 },501 });502 target.appendChild(target.bottom);503 target.cover=ASElement({504 nodeName:"img",505 src:ASGetSrcByName("loadingCover"),506 style:{507 position:"absolute",508 left:0,509 top:0,510 width:"100%",511 height:"100%",512 animation:"basicLoadingRotate 0.5s linear infinite",513 },514 });515 target.appendChild(target.cover);516 target.success=ASElement({517 nodeName:"img",518 src:ASGetSrcByName("loadingSucceed"),519 style:{520 position:"absolute",521 left:0,522 top:0,523 opacity:0,524 height:"100%",525 },526 });527 target.appendChild(target.success);528 target.failed=ASElement({529 nodeName:"img",530 src:ASGetSrcByName("loadingFail"),531 style:{532 position:"absolute",533 left:0,534 top:0,535 opacity:0,536 height:"100%",537 },538 });539 target.appendChild(target.failed);540 target.restart=BasicLoadingStr.restart;541 target.start=BasicLoadingStr.start;542 target.succeed=BasicLoadingStr.succeed;543 target.fail=BasicLoadingStr.fail;544 target.end=BasicLoadingStr.end;545 target.set(buildP);546 return(target);547 }548 var BasicInputStr=new function() {549 this.inputOnfocus=function() {550 this.root.alarm.setTarget({opacity:0});551 var width1=Math.min(ASGetWordWidth(this),ASGetElementWidth(this))+6;552 if (this.root.hint) width1=Math.max(width1,ASGetElementWidth(this.root.hint)+6);553 if (this.root.wWrong) {554 this.root.notice.set({style:{left:width1+11}});555 }556 }557 this.inputOnblur=function() {558 this.root.check();559 if (this.root.onblur1) this.root.onblur1();560 }561 this.inputOninput=function() {562 var width1=Math.min(ASGetWordWidth(this),ASGetElementWidth(this))+6;563 if (this.root.hint) width1=Math.max(width1,ASGetElementWidth(this.root.hint)+6);564 this.root.wWrong=false;565 this.root.alarm.set({style:{width:width1}});566 this.root.notice.set({style:{left:width1+11}});567 for (var i=0;i<this.root.wrong.length;i++) {568 if (this.root.wrong[i].type=="onblur") continue;569 this.judge=this.root.wrong[i].judge;570 if (this.judge()) {571 this.root.wWrong=true;572 this.root.alarm.setTarget({opacity:1});573 this.root.alarm.setTimeout(function() {this.setTarget({opacity:0});},150);574 this.root.notice.setWord({575 wordC:this.root.wrong[i].wordC,576 wordE:this.root.wrong[i].wordE,577 });578 this.root.notice.setTarget({opacity:1});579 break;580 }581 }582 if (!this.root.wWrong) {583 this.root.alarm.setTarget({opacity:0});584 this.root.notice.setTarget({opacity:0});585 }586 if (this.value) {587 if (this.root.hint) this.root.hint.set({style:{opacity:0}});588 } else {589 if (this.root.hint) this.root.hint.setTarget({opacity:1});590 }591 }592 this.inputClearWrong=function() {593 var width1=Math.min(ASGetWordWidth(this.input),ASGetElementWidth(this.input))+6;594 this.alarm.set({style:{width:width1}});595 this.notice.set({style:{left:width1+11}});596 this.alarm.setTarget({opacity:0});597 this.notice.setTarget({opacity:0});598 this.wWrong=false;599 }600 this.inputCheck=function() {601 var width1=ASGetWordWidth(this.input)+6;602 if (!this.value) width1=ASGetElementWidth(this.hint)+6;603 this.wWrong=false;604 for (var i=0;i<this.wrong.length;i++) {605 this.input.judge=this.wrong[i].judge;606 if (this.input.judge()) {607 this.wWrong=true;608 this.alarm.set({style:{width:width1}});609 this.alarm.setTarget({opacity:1});610 this.notice.setWord({611 wordC:this.wrong[i].wordC,612 wordE:this.wrong[i].wordE,613 });614 this.notice.set({style:{left:width1+11}});615 this.notice.setTarget({opacity:1});616 break;617 }618 }619 if (!this.wWrong) {620 this.alarm.setTarget({opacity:0});621 this.notice.setTarget({opacity:0});622 }623 }624 this.inputFocus=function() {625 this.input.focus();626 }627 this.inputSetValue=function(str) {628 this.input.value=str;629 if (str) {630 if (this.hint) this.hint.set({style:{opacity:0}});631 } else {632 if (this.hint) this.hint.setTarget({opacity:1});633 }634 this.clearWrong();635 }636 this.inputGetValue=function() {637 return(this.input.value);638 }639 this.textSetValue=function(str) {640 for (var i=0;i<this.text.length;i++) {641 if (this.text[i].value==str) {642 this.textF.setWord({643 wordC:this.text[i].wordC,644 wordE:this.text[i].wordE,645 });646 this.textC=i;647 return;648 }649 }650 }651 this.textGetValue=function(typeP) {652 return(this.text[this.textC].value);653 }654 this.popBlockOnmouseover=function() {655 this.word.setTarget({transform:{translateX:3}});656 this.line.setTarget({opacity:1});657 }658 this.popBlockOnmouseout=function() {659 this.word.setTarget({transform:{translateX:0}});660 this.line.setTarget({opacity:0});661 }662 this.popBlockOnmousedown=function() {663 this.word.setTarget({transform:{translateX:1}});664 this.line.setTarget({opacity:1});665 }666 this.popBlockOnmouseup=function() {667 this.word.setTarget({transform:{translateX:3}});668 this.line.setTarget({opacity:1});669 }670 this.popBlockOnclick=function() {671 if (this.num==this.root.blockC) {672 if (this.root.status=="close") {673 this.root.open();674 } else {675 this.root.close();676 }677 } else {678 this.root.change(this.num);679 this.onmouseout();680 }681 }682 this.popBlockSetBlock=function(w) {683 this.blockC=w;684 this.content.appendChild(this.block[w]);685 this.block[w].set({style:{686 opacity:1,687 left:0,688 pointerEvents:"auto",689 }});690 this.block[w].bottom.set({style:{opacity:0}});691 for (var i=0;i<this.block.length;i++) {692 if (i==w) continue;693 this.block[i].set({style:{694 opacity:0,695 left:0,696 pointerEvents:"none",697 }});698 }699 }700 this.popBlockOpen=function() {701 this.status="open";702 var x0=Math.round(ASGetElementWidth(this.block[this.blockC].word)+this.size*0.8);703 for (var i=0;i<this.block.length;i++) {704 this.block[i].bottom.setTarget({opacity:1});705 if (i==this.blockC) continue;706 this.block[i].setTarget({707 left:x0,708 opacity:1,709 });710 this.block[i].set({style:{711 pointerEvents:"auto",712 }});713 x0=Math.round(x0+ASGetElementWidth(this.block[i].word)+this.size*0.8);714 }715 }716 this.popBlockClose=function() {717 this.status="close";718 for (var i=0;i<this.block.length;i++) {719 this.block[i].bottom.setTarget({opacity:0});720 if (i==this.blockC) continue;721 this.block[i].setTarget({722 left:0,723 opacity:0,724 });725 this.block[i].set({style:{726 pointerEvents:"none",727 }});728 this.block[i].onmouseout();729 }730 }731 this.popBlockChange=function(w) {732 this.status="close";733 this.blockC=w;734 this.content.appendChild(this.block[w]);735 for (var i=0;i<this.block.length;i++) {736 this.block[i].bottom.setTarget({opacity:0});737 if (i==this.blockC) {738 this.block[i].setTarget({739 left:0,740 opacity:1,741 });742 this.block[i].set({style:{743 pointerEvents:"auto",744 }});745 continue;746 }747 this.block[i].setTarget({748 left:0,749 opacity:0,750 });751 this.block[i].set({style:{752 pointerEvents:"none",753 }});754 }755 }756 this.popBlockSetValue=function(str) {757 for (var i=0;i<this.block.length;i++) {758 if (this.block[i].value==str) {759 this.setBlock(i);760 return;761 }762 }763 return(false);764 }765 this.popBlockGetValue=function() {766 return(this.block[this.blockC].value);767 }768 this.radioPointOnmouseover=function() {769 this.setTarget({transform:{scale:1.2}});770 }771 this.radioPointOnmouseout=function() {772 this.setTarget({transform:{scale:1}});773 }774 this.radioPointOnmousedown=function() {775 this.setTarget({transform:{scale:0.9}});776 }777 this.radioPointOnmouseup=function() {778 this.setTarget({transform:{scale:1.2}});779 }780 this.radioPointOnclick=function() {781 this.root.setBlock(this.num);782 if (this.root.onchoose) this.root.onchoose();783 }784 this.radioPointSetBlock=function(w) {785 this.blockC=w;786 for (var i=0;i<this.block.length;i++) {787 if (i==w) continue;788 this.block[i].point.pic.setTarget({opacity:0});789 }790 this.block[w].point.pic.setTarget({opacity:1});791 }792 this.radioPointSetValue=function(str) {793 for (var i=0;i<this.block.length;i++) {794 if (this.block[i].value==str) {795 this.setBlock(i);796 return;797 }798 }799 return(false);800 }801 this.radioPointGetValue=function() {802 return(this.block[this.blockC].value);803 }804 this.checkBoxOnmouseover=function() {805 this.setTarget({transform:{scale:1.1}});806 }807 this.checkBoxOnmouseout=function() {808 this.setTarget({transform:{scale:1}});809 }810 this.checkBoxOnmousedown=function() {811 this.setTarget({transform:{scale:0.95}});812 }813 this.checkBoxOnmouseup=function() {814 this.setTarget({transform:{scale:1.1}});815 }816 this.checkBoxOnclick=function() {817 this.root.changeABlock(this.num);818 if (this.root.block[this.num].wChosen) {819 for (var i=0;i<this.root.block.length;i++) {820 if (this.root.block[i].belong==this.root.block[this.num].value) {821 this.root.chooseABlock(i);822 }823 }824 } else {825 for (var i=0;i<this.root.block.length;i++) {826 if (this.root.block[i].belong==this.root.block[this.num].value) {827 this.root.cancelABlock(i);828 }829 }830 }831 if (this.root.onchoose) this.root.onchoose();832 }833 this.checkBoxChangeABlock=function(w) {834 if (this.block[w].wChosen) {835 this.cancelABlock(w);836 } else {837 this.chooseABlock(w);838 }839 }840 this.checkBoxChooseABlock=function(w) {841 if (typeof(w)=="string") {842 for (var i=0;i<this.block.length;i++) {843 if (this.block[i].value==w) break;844 }845 if (i>=this.block.length) return;846 w=i;847 }848 if (this.block[w].wChosen) return;849 this.block[w].wChosen=true;850 this.block[w].point.pic.setTarget({opacity:1});851 if (this.block[w].belong) {852 var yes=true;853 for (var i=0;i<this.block.length;i++) {854 if (this.block[i].belong==this.block[w].belong && !this.block[i].wChosen) {855 yes=false;856 break;857 }858 }859 if (yes) {860 this.chooseABlock(this.block[w].belong);861 }862 }863 }864 this.checkBoxCancelABlock=function(w) {865 if (typeof(w)=="string") {866 for (var i=0;i<this.block.length;i++) {867 if (this.block[i].value==w) break;868 }869 if (i>=this.block.length) return;870 w=i;871 }872 if (!this.block[w].wChosen) return;873 this.block[w].wChosen=false;874 this.block[w].point.pic.setTarget({opacity:0});875 if (this.block[w].belong) {876 this.cancelABlock(this.block[w].belong);877 }878 }879 this.checkBoxSetValue=function(a) {880 if (typeof(a)!="object") {881 this.chooseABlock(a);882 return;883 }884 var w=[];885 for (var i=0;i<this.block.length;i++) {886 this.cancelABlock(i);887 }888 for (var i=0;i<a.length;i++) {889 this.chooseABlock(a[i]);890 }891 }892 this.checkBoxGetValue=function() {893 var a=[];894 for (var i=0;i<this.block.length;i++) {895 if (this.block[i].wChosen) a[a.length]=this.block[i].value;896 }897 return(a);898 }899 }900 function BasicInput(buildP) {901 var buildP1={};902 if (buildP.model=="nickname") {903 buildP1.type="input";904 buildP1.wordC="暱 稱";905 buildP1.wordE="Nickname";906 buildP1.hintC="沒想好- -";907 buildP1.hintE="Undefined";908 buildP1.maxLength=50;909 buildP1.wrong=[{910 wordC:"太長了",911 wordE:"It's too long",912 judge:function() {913 if (encodeWord(this.value).length>50) return(true);914 return(false);915 },916 }];917 }918 if (buildP.model=="name") {919 buildP1.type="input";920 buildP1.wordC="姓 名";921 buildP1.wordE="Name";922 buildP1.hintC="不告訴你→ →";923 buildP1.hintE="Undefined";924 buildP1.maxLength=30;925 buildP1.wrong=[{926 wordC:"太長了",927 wordE:"It's too long",928 judge:function() {929 if (encodeWord(this.value).length>30) return(true);930 return(false);931 },932 }];933 }934 if (buildP.model=="place") {935 buildP1.type="text";936 buildP1.wordC="身 份";937 buildP1.wordE="Status";938 buildP1.wReadonly=true;939 buildP1.text=[{940 wordC:"朋 友",941 wordE:"Friend",942 value:"N",943 },{944 wordC:"會員朋友",945 wordE:"Member",946 value:"m",947 },{948 wordC:"會員朋友(四年)",949 wordE:"Full Member",950 value:"M",951 },{952 wordC:"附屬執行委員會成員",953 wordE:"Subcom",954 value:"S",955 },{956 wordC:"執行委員會成員",957 wordE:"Exco",958 value:"E",959 }];960 }961 if (buildP.model=="sex") {962 buildP1.type="popBlock";963 buildP1.wordC="性 別";964 buildP1.wordE="Gender";965 buildP1.block=[{966 wordC:"漢 子",967 wordE:"Male",968 value:"M",969 },{970 wordC:"妹 子",971 wordE:"Female",972 value:"F",973 },{974 wordC:"保 密",975 wordE:"Secret",976 color:"rgba(150,150,150,0.8)",977 value:"U",978 }];979 buildP1.firstBlock=2;980 }981 if (buildP.model=="studentID") {982 buildP1.type="input";983 buildP1.wordC="學 號";984 buildP1.wordE="StudentID";985 buildP1.hintC="保 密";986 buildP1.hintE="Secret";987 buildP1.maxLength=8;988 buildP1.wrong=[{989 wordC:"只能是數字噢",990 wordE:"Should be 0~9",991 judge:function() {992 for (var i=0;i<this.value.length;i++) {993 if (this.value.charCodeAt(i)<48 || this.value.charCodeAt(i)>57) return(true);994 }995 return(false);996 }997 },{998 wordC:"需要8位数字",999 wordE:"Should be 8 numbers",1000 type:"onblur",1001 judge:function() {1002 if (this.value.length!=0 && this.value.length!=8) return(true);1003 return(false);1004 }1005 }];1006 }1007 if (buildP.model=="school") {1008 buildP1.type="popBlock";1009 buildP1.wordC="學 院";1010 buildP1.wordE="School";1011 buildP1.block=[{1012 wordC:"SBM",1013 wordE:"SBM",1014 value:"SBM",1015 },{1016 wordC:"SENG",1017 wordE:"SENG",1018 value:"SENG",1019 },{1020 wordC:"SSCI",1021 wordE:"SSCI",1022 value:"SSCI",1023 },{1024 wordC:"SHSS",1025 wordE:"SHSS",1026 value:"SHSS",1027 },{1028 wordC:"IPO",1029 wordE:"IPO",1030 value:"IPO",1031 },{1032 wordC:"保 密",1033 wordE:"Secret",1034 color:"rgba(150,150,150,0.8)",1035 value:"",1036 }];1037 buildP1.firstBlock=5;1038 }1039 if (buildP.model=="phone") {1040 buildP1.type="input";1041 buildP1.wordC="電 話";1042 buildP1.wordE="Phone";1043 buildP1.hintC="保 密";1044 buildP1.hintE="Secret";1045 buildP1.maxLength=8;1046 buildP1.wrong=[{1047 wordC:"只能是數字噢",1048 wordE:"Should be 0~9",1049 judge:function() {1050 for (var i=0;i<this.value.length;i++) {1051 if (this.value.charCodeAt(i)<48 || this.value.charCodeAt(i)>57) return(true);1052 }1053 return(false);1054 }1055 },{1056 wordC:"需要8位数字",1057 wordE:"Should be 8 numbers",1058 type:"onblur",1059 judge:function() {1060 if (this.value.length!=0 && this.value.length!=8) return(true);1061 return(false);1062 }1063 }];1064 }1065 if (buildP.model=="lang") {1066 buildP1.type="radioPoint";1067 buildP1.wordC="语 言<br>Language";1068 buildP1.wordE="语 言<br>Language";1069 buildP1.widthB=1000;1070 buildP1.block=[{1071 wordC:"中文",1072 wordE:"中文",1073 value:"C",1074 },{1075 wordC:"English",1076 wordE:"English",1077 value:"E",1078 }];1079 buildP1.onchoose=function() {1080 setLang(this.block[this.blockC].value);1081 addACookie("cfas_lang",this.getValue(),30*365*24*60);1082 }1083 }1084 if (buildP.model=="itsc") {1085 buildP1.type="input";1086 buildP1.wordC="ITSC";1087 buildP1.hintC="例如:fwuae";1088 buildP1.hintE="E.g. fwuae";1089 buildP1.wrong=[{1090 wordC:"只能是小寫字母噢",1091 wordE:"Should be 'a'-'z'",1092 judge:function() {1093 for (var i=0;i<this.value.length;i++) {1094 if (this.value.charCodeAt(i)<97 || this.value.charCodeAt(i)>122) return(true);1095 }1096 return(false);1097 },1098 },{1099 type:"onblur",1100 wordC:"必填",1101 wordE:"Compulsory",1102 judge:function() {1103 if (this.value.length==0) return(true);1104 return(false);1105 },1106 }];1107 }1108 if (buildP.model=="payway") {1109 buildP1.type="text";1110 buildP1.wordC="付款方式";1111 buildP1.wordE="How to pay";1112 buildP1.text=[{1113 wordC:"於民藝櫃檯付款",1114 wordE:"Pay on CFAS counter",1115 value:"E",1116 },{1117 wordC:"交予熟悉的民藝Exco",1118 wordE:"Pay to our Exco",1119 value:"N",1120 }];1121 }1122 if (buildP.model=="excoList") {1123 buildP1.type="radioPoint";1124 buildP1.block=[];1125 var data=ASGetSourceByName("data0").getNodeByName("exco14");1126 for (var i=0;i<data.node.length;i++) {1127 buildP1.block[i]={1128 wordC:data.node[i].getAttribute("nameC"),1129 wordE:data.node[i].getAttribute("nameE"),1130 value:data.node[i].getAttribute("itsc"),1131 }1132 }1133 }1134 for (var item in buildP1) {1135 if (!(item in buildP)) buildP[item]=buildP1[item];1136 }1137 if (!buildP.type) buildP.type="input";1138 if (!buildP.size) buildP.size=24;1139 if (!buildP.widthL) {1140 if (buildP.wordC || buildP.wordE) buildP.widthL=150;1141 }1142 if (!buildP.widthA) buildP.widthA=DEFAULT_PAGE_WIDTHL;1143 var target=ASElement({1144 nodeName:"div",1145 style:{1146 position:"relative",1147 width:buildP.widthA,1148 },1149 });1150 if (buildP.wordC || buildP.wordE) {1151 if (!buildP.colorW) buildP.colorW="rgb(200,0,0)";1152 if (!buildP.sizeW) buildP.sizeW=buildP.size*0.9;1153 target.word=BasicWord({1154 size:buildP.size,1155 wordC:buildP.wordC,1156 wordE:buildP.wordE,1157 });1158 var height1=target.word.heightA;1159 target.word=BasicWord({1160 size:buildP.sizeW,1161 color:buildP.colorW,1162 wordC:buildP.wordC,1163 wordE:buildP.wordE,1164 giveupExtra:true,1165 style:{1166 position:"absolute",1167 },1168 });1169 var height2=target.word.heightA;1170 target.word.set({style:{1171 top:(height1-height2),1172 }});1173 if (buildP.widthL!=0) {1174 target.word.set({style:{1175 width:buildP.widthL,1176 }});1177 }1178 target.appendChild(target.word);1179 }1180 var width1=buildP.widthA-buildP.widthL-10;1181 if (buildP.widthL==0 && target.word) width1=buildP.widthA-target.word.widthA-10;1182 if (buildP.wBr || (!target.word && !buildP.widthL)) width1=buildP.widthA;1183 var top=0;1184 if (buildP.wBr) top=ASGetElementHeight(target.word)*1.2;1185 target.content=ASElement({1186 nodeName:"div",1187 style:{1188 position:"relative",1189 marginTop:top,1190 left:buildP.widthA-width1,1191 width:width1,1192 },1193 });1194 target.appendChild(target.content);1195 if (buildP.type=="input") {1196 if (!buildP.wrong) buildP.wrong=[];1197 if (buildP.wCompulsory) {1198 buildP.wrong[buildP.wrong.length]={1199 wordC:"必填",1200 wordE:"Compulsory",1201 type:"onblur",1202 judge:function() {1203 if (this.value.length==0) return(true);1204 return(false);1205 },1206 };1207 };1208 target.alarm=ASElement({1209 nodeName:"div",1210 style:{1211 position:"absolute",1212 backgroundColor:"rgba(255,0,0,0.3)",1213 marginTop:-1,1214 left:-3,1215 opacity:0,1216 maxWidth:width1+6,1217 pointerEvents:"none",1218 },1219 });1220 target.content.appendChild(target.alarm);1221 if (buildP.hintC || buildP.hintE) {1222 if (!buildP.hintColor) buildP.hintColor="rgba(150,150,150,0.8)";1223 target.hint=BasicWord({1224 position:"absolute",1225 left:0,1226 top:0,1227 size:buildP.size,1228 color:buildP.hintColor,1229 wordC:buildP.hintC,1230 wordE:buildP.hintE,1231 width:"max",1232 giveupExtra:true,1233 style:{1234 position:"absolute",1235 pointerEvents:"none",1236 },1237 });1238 target.content.appendChild(target.hint);1239 }1240 target.input=ASElement({1241 nodeName:"input",1242 type:"text",1243 style:{1244 fontSize:buildP.size,1245 fontFamily:DEFAULT_FONT,1246 width:width1,1247 borderStyle:"none",1248 outline:"none",1249 backgroundColor:"rgba(0,0,0,0)",1250 },1251 root:target,1252 onfocus:BasicInputStr.inputOnfocus,1253 onblur:BasicInputStr.inputOnblur,1254 oninput:BasicInputStr.inputOninput,1255 });1256 target.content.appendChild(target.input);1257 if (buildP.wReadonly) target.input.set({readOnly:true});1258 if (buildP.maxLength) target.input.set({maxLength:buildP.maxLength});1259 if (buildP.onblur) {1260 target.onblur1=buildP.onblur;1261 delete buildP.onblur;1262 }1263 target.alarm.set({style:{height:ASGetElementHeight(target.input)}});1264 if (!buildP.noticeColor) buildP.noticeColor="rgb(130,130,130)";1265 target.notice=BasicWord({1266 size:buildP.size*0.8,1267 color:buildP.noticeColor,1268 wordC:"&#8203;",1269 wordE:"&#8203;",1270 width:"max",1271 style:{1272 position:"absolute",1273 pointerEvents:"none",1274 },1275 });1276 target.notice.set({style:{1277 top:target.notice.heightA/4,1278 }});1279 target.content.appendChild(target.notice);1280 target.clearWrong=BasicInputStr.inputClearWrong;1281 target.check=BasicInputStr.inputCheck;1282 target.setValue=BasicInputStr.inputSetValue;1283 target.getValue=BasicInputStr.inputGetValue;1284 target.focus=BasicInputStr.inputFocus;1285 }1286 if (buildP.type=="text") {1287 target.textF=BasicWord({1288 width:"max",1289 size:buildP.size,1290 wordC:buildP.text[0].wordC,1291 wordE:buildP.text[0].wordE,1292 giveupExtra:true,1293 });1294 target.content.appendChild(target.textF);1295 if (buildP.wReadonly) target.textF.set({1296 style:{cursor:"default"},1297 });1298 target.textC=0;1299 target.setValue=BasicInputStr.textSetValue;1300 target.getValue=BasicInputStr.textGetValue;1301 }1302 if (buildP.type=="popBlock") {1303 target.filler=BasicWord({1304 size:buildP.size,1305 wordC:"&#8203;",1306 giveupExtra:true,1307 style:{1308 pointerEvents:"none",1309 },1310 });1311 target.content.appendChild(target.filler);1312 target.block=[];1313 target.status="close";1314 for (var i=0;i<buildP.block.length;i++) {1315 target.block[i]=ASElement({1316 nodeName:"div",1317 style:{1318 position:"absolute",1319 opacity:0,1320 left:0,1321 cursor:"pointer",1322 },1323 onmouseover:BasicInputStr.popBlockOnmouseover,1324 onmouseout:BasicInputStr.popBlockOnmouseout,1325 onmousedown:BasicInputStr.popBlockOnmousedown,1326 onmouseup:BasicInputStr.popBlockOnmouseup,1327 onclick:BasicInputStr.popBlockOnclick,1328 num:i,1329 root:target,1330 value:buildP.block[i].value,1331 });1332 var block=target.block[i];1333 target.content.appendChild(block);1334 if (!buildP.block[i].color) buildP.block[i].color="black";1335 block.word=BasicWord({1336 size:buildP.size,1337 wordC:buildP.block[i].wordC,1338 wordE:buildP.block[i].wordE,1339 color:buildP.block[i].color,1340 width:"max",1341 giveupExtra:true,1342 ignoreM:true,1343 style:{1344 position:"absolute",1345 cursor:"pointer",1346 },1347 });1348 block.appendChild(block.word);1349 block.bottom=ASElement({1350 nodeName:"div",1351 style:{1352 position:"relative",1353 left:-buildP.size*0.4,1354 width:buildP.size*0.15,1355 height:block.word.heightA,1356 backgroundColor:"rgba(150,150,150,0.8)",1357 },1358 });1359 block.appendChild(block.bottom);1360 block.line=ASElement({1361 nodeName:"div",1362 style:{1363 position:"absolute",1364 left:-buildP.size*0.4,1365 width:buildP.size*0.15,1366 height:block.word.heightA,1367 backgroundColor:"rgb(230,0,0)",1368 opacity:0,1369 },1370 });1371 block.appendChild(block.line);1372 }1373 if (!buildP.firstBlock) buildP.firstBlock=0;1374 target.setBlock=BasicInputStr.popBlockSetBlock;1375 target.setBlock(buildP.firstBlock);1376 target.open=BasicInputStr.popBlockOpen;1377 target.close=BasicInputStr.popBlockClose;1378 target.change=BasicInputStr.popBlockChange;1379 target.setValue=BasicInputStr.popBlockSetValue;1380 target.getValue=BasicInputStr.popBlockGetValue;1381 delete buildP.block;1382 }1383 if (buildP.type=="radioPoint") {1384 target.block=[];1385 if (buildP.col) buildP.widthB=width1/buildP.col;1386 if (!buildP.space && !buildP.widthB) buildP.space=buildP.size*2;1387 if (buildP.space) target.content.set({style:{width:width1+buildP.space}});1388 for (var i=0;i<buildP.block.length;i++) {1389 target.block[i]=ASElement({1390 nodeName:"div",1391 value:buildP.block[i].value,1392 num:i,1393 style:{1394 position:"relative",1395 left:buildP.size,1396 },1397 });1398 target.content.appendChild(target.block[i]);1399 if (buildP.space) target.block[i].set({style:{marginRight:buildP.space}});1400 if (buildP.widthB) target.block[i].set({style:{width:buildP.widthB}});1401 var block=target.block[i];1402 if (!buildP.block[i].color) buildP.block[i].color="black";1403 block.word=BasicWord({1404 size:buildP.size,1405 wordC:buildP.block[i].wordC,1406 wordE:buildP.block[i].wordE,1407 color:buildP.block[i].color,1408 ignoreM:true,1409 width:"max",1410 giveupExtra:true,1411 });1412 block.appendChild(block.word);1413 block.point=ASElement({1414 nodeName:"div",1415 root:target,1416 num:i,1417 style:{1418 position:"absolute",1419 left:-buildP.size*1,1420 bottom:buildP.size*0.25,1421 borderRadius:buildP.size*0.7,1422 width:buildP.size*0.7,1423 height:buildP.size*0.7,1424 cursor:"pointer",1425 boxShadow:"0 0 0px "+buildP.size*0.1+"px rgba(150,150,150,0.8) inset",1426 },1427 onmouseover:BasicInputStr.radioPointOnmouseover,1428 onmouseout:BasicInputStr.radioPointOnmouseout,1429 onmousedown:BasicInputStr.radioPointOnmousedown,1430 onmouseup:BasicInputStr.radioPointOnmouseup,1431 onclick:BasicInputStr.radioPointOnclick,1432 });1433 block.appendChild(block.point);1434 block.point.pic=ASElement({1435 nodeName:"img",1436 src:ASGetSrcByName("radioPoint"),1437 style:{1438 width:"100%",1439 height:"100%",1440 opacity:0,1441 },1442 });1443 block.point.appendChild(block.point.pic);1444 }1445 if (!buildP.firstBlock) buildP.firstBlock=0;1446 target.setBlock=BasicInputStr.radioPointSetBlock;1447 target.setValue=BasicInputStr.radioPointSetValue;1448 target.getValue=BasicInputStr.radioPointGetValue;1449 target.onchoose=buildP.onchoose;1450 target.setBlock(buildP.firstBlock);1451 delete buildP.block;1452 }1453 if (buildP.type=="checkBox") {1454 target.block=[];1455 if (buildP.col) buildP.widthB=width1/buildP.col;1456 if (!buildP.space && !buildP.widthB) buildP.space=buildP.size*2;1457 if (buildP.space) target.content.set({style:{width:width1+buildP.space}});1458 for (var i=0;i<buildP.block.length;i++) {1459 target.block[i]=ASElement({1460 nodeName:"div",1461 value:buildP.block[i].value,1462 belong:buildP.block[i].belong,1463 num:i,1464 style:{1465 position:"relative",1466 left:buildP.size,1467 },1468 });1469 target.content.appendChild(target.block[i]);1470 if (buildP.space) target.block[i].set({style:{marginRight:buildP.space}});1471 if (buildP.widthB) target.block[i].set({style:{width:buildP.widthB}});1472 var block=target.block[i];1473 if (!buildP.block[i].color) buildP.block[i].color="black";1474 block.word=BasicWord({1475 size:buildP.size,1476 wordC:buildP.block[i].wordC,1477 wordE:buildP.block[i].wordE,1478 color:buildP.block[i].color,1479 ignoreM:true,1480 width:"max",1481 giveupExtra:true,1482 });1483 block.appendChild(block.word);1484 block.point=ASElement({1485 nodeName:"div",1486 root:target,1487 num:i,1488 style:{1489 position:"absolute",1490 left:-buildP.size*1,1491 bottom:buildP.size*0.25,1492 borderRadius:buildP.size*0.15,1493 width:buildP.size*0.7,1494 height:buildP.size*0.7,1495 cursor:"pointer",1496 boxShadow:"0 0 0px "+buildP.size*0.1+"px rgba(150,150,150,0.8) inset",1497 },1498 onmouseover:BasicInputStr.checkBoxOnmouseover,1499 onmouseout:BasicInputStr.checkBoxOnmouseout,1500 onmousedown:BasicInputStr.checkBoxOnmousedown,1501 onmouseup:BasicInputStr.checkBoxOnmouseup,1502 onclick:BasicInputStr.checkBoxOnclick,1503 });1504 block.appendChild(block.point);1505 block.point.pic=ASElement({1506 nodeName:"img",1507 src:ASGetSrcByName("checkBox"),1508 style:{1509 width:"100%",1510 height:"100%",1511 opacity:0,1512 },1513 });1514 block.point.appendChild(block.point.pic);1515 }1516 target.changeABlock=BasicInputStr.checkBoxChangeABlock;1517 target.chooseABlock=BasicInputStr.checkBoxChooseABlock;1518 target.cancelABlock=BasicInputStr.checkBoxCancelABlock;1519 target.getValue=BasicInputStr.checkBoxGetValue;1520 target.onchoose=buildP.onchoose;1521 delete buildP.block;1522 }1523 target.set(buildP);1524 if (buildP.value) target.setValue(buildP.value);1525 return(target);1526 }1527 var BasicSelectStr=new function() {1528 this.entryOnmousedown=function() {1529 this.root.downTimeS=ASGetTime();1530 this.wDown=true;1531 if (this.root.pressTime) this.setTimeout(this.onclick,this.root.pressTime);1532 }1533 this.entryOnmouseup=function() {1534 this.setTimeout(function() {this.wDown=false;},0);1535 }1536 this.entryOnclick=function() {1537 if (!this.wDown) return;1538 if (this.root.pressTime && ASGetTime()-this.root.downTimeS<this.root.pressTime) {1539 if (this.root.entryOnclick) this.root.entryOnclick();1540 if (this.root.wOpen) {1541 this.root.close();1542 }1543 } else {1544 if (!this.root.wOpen1545 || (this.root.pressTime && ASGetTime()-this.root.downTimeS>=this.root.pressTime)) {1546 this.root.open();1547 } else {1548 this.root.close();1549 }1550 }1551 }1552 this.blockOnmouseover=function() {1553 this.bottom.setTarget({opacity:1});1554 this.setTarget({transform:{scale:1}});1555 }1556 this.blockOnmouseout=function() {1557 this.bottom.setTarget({opacity:0});1558 this.setTarget({transform:{scale:1}});1559 }1560 this.blockOnmousedown=function() {1561 this.bottom.setTarget({opacity:1});1562 this.setTarget({transform:{scale:0.9}});1563 }1564 this.blockOnmouseup=function() {1565 this.bottom.setTarget({opacity:0});1566 this.setTarget({transform:{scale:1}});1567 }1568 this.blockOnclick=function() {1569 this.root.value=this.value;1570 this.root.blockC=this.num;1571 this.root.close();1572 if (this.root.onchoose) this.root.onchoose();1573 }1574 this.onmouseoutdown=function() {1575 this.close();1576 }1577 this.open=function() {1578 if (this.wOpen) return;1579 this.wOpen=true;1580 this.appendChild(this.menuF);1581 this.menuF.set({style:{opacity:0}});1582 this.menuF.setTimeout(function() {this.setTarget({opacity:1});},10);1583 if (this.onopen) this.onopen();1584 }1585 this.close=function() {1586 this.wOpen=false;1587 this.menuF.setTarget({opacity:0});1588 this.menuF.setTimeout(function() {1589 if (!this.root.wOpen) {1590 this.root.removeChild(this);1591 }1592 },150);1593 if (this.onclose) this.onclose();1594 }1595 }1596 function BasicSelect(buildP) {1597 if (!buildP.fx) buildP.fx="down";1598 var target=ASElement({1599 nodeName:"div",1600 style:{1601 position:"relative",1602 },1603 });1604 target.fx=buildP.fx;1605 target.wOpen=false;1606 target.blockC=-1;1607 target.value="";1608 if (buildP.firstBlock) {1609 target.blockC=buildP.firstBlock;1610 target.value=buildP.block[target.blockC].value;1611 }1612 ASOutdownList[ASOutdownList.length]=target;1613 target.onmouseoutdown=BasicSelectStr.onmouseoutdown;1614 target.entryF=ASElement({1615 nodeName:"div",1616 root:target,1617 onmousedown:BasicSelectStr.entryOnmousedown,1618 onmouseup:BasicSelectStr.entryOnmouseup,1619 onclick:BasicSelectStr.entryOnclick,1620 style:{1621 cursor:"pointer",1622 },1623 });1624 target.appendChild(target.entryF);1625 target.entry=buildP.entry;1626 target.entryF.appendChild(target.entry);1627 if (buildP.entryOnclick) {1628 if (!buildP.pressTime) buildP.pressTime=300;1629 }1630 if (!buildP.col) buildP.col=1;1631 target.col=buildP.col;1632 target.menuF=ASElement({1633 nodeName:"div",1634 style:{1635 position:"absolute",1636 },1637 root:target,1638 });1639 switch (target.fx) {1640 case "up": target.menuF.set({style:{bottom:ASGetElementHeight(target.entry)*1.1,left:0}}); break;1641 case "down": target.menuF.set({style:{top:ASGetElementHeight(target.entry)*1.1,left:0}}); break;1642 case "upRight": target.menuF.set({style:{bottom:ASGetElementHeight(target.entry)*1.1,right:0}}); break;1643 }1644 if (!buildP.widthA) {1645 buildP.widthA=0;1646 for (var i=0;i<buildP.block.length;i++) {1647 buildP.widthA=Math.max(buildP.widthA,ASGetElementWidth(buildP.block[i]));1648 }1649 buildP.widthA++;1650 }1651 if (!buildP.heightA) {1652 buildP.heightA=0;1653 var h1=0;1654 for (var i=0;i<buildP.block.length;i++) {1655 h1=Math.max(ASGetElementHeight(buildP.block[i]),h1);1656 if ((i+1)%target.col==0) {1657 buildP.heightA+=h1+0.5;1658 h1=0;1659 }1660 }1661 }1662 if (!buildP.BGC) buildP.BGC="rgb(250,250,250)";1663 if (!buildP.menuPadding) buildP.menuPadding=0;1664 target.menu=BasicScroll({1665 widthA:buildP.widthA*target.col+buildP.menuPadding*2,1666 heightA:buildP.heightA+buildP.menuPadding*2,1667 style:{1668 boxShadow:"0 0 10px rgba(0,0,0,0.8)",1669 backgroundColor:buildP.BGC,1670 },1671 });1672 target.menuF.appendChild(target.menu);1673 target.menu.container.set({style:{padding:buildP.menuPadding}});1674 if (!buildP.align) buildP.align="left";1675 target.menu.block=[];1676 for (var i=0;i<buildP.block.length;i++) {1677 target.menu.block[i]=ASElement({1678 nodeName:"div",1679 style:{1680 position:"relative",1681 width:buildP.widthA,1682 },1683 root:target,1684 value:buildP.block[i].value,1685 });1686 target.menu.container.appendChild(target.menu.block[i]);1687 if (!buildP.giveupMenuExtra && !buildP.block[i].giveupMenuExtra) {1688 target.menu.block[i].set({1689 style:{1690 cursor:"pointer",1691 },1692 onmouseover:BasicSelectStr.blockOnmouseover,1693 onmouseout:BasicSelectStr.blockOnmouseout,1694 onmousedown:BasicSelectStr.blockOnmousedown,1695 onmouseup:BasicSelectStr.blockOnmouseup,1696 onclick:BasicSelectStr.blockOnclick,1697 });1698 }1699 var block=target.menu.block[i];1700 block.bottom=ASElement({1701 nodeName:"div",1702 style:{1703 position:"absolute",1704 width:"100%",1705 height:"100%",1706 backgroundColor:"rgba(200,0,0,0.2)",1707 opacity:0,1708 },1709 });1710 block.appendChild(block.bottom);1711 block.content=buildP.block[i];1712 block.appendChild(buildP.block[i]);1713 buildP.block[i].set({style:{position:"absolute"}});1714 switch (buildP.align) {1715 case "left": break;1716 case "center": buildP.block[i].set({wCenter:true}); break;1717 }1718 block.set({style:{height:ASGetElementHeight(buildP.block[i])}});1719 if (!buildP.giveupMenuExtra && !buildP.block[i].giveupMenuExtra && !buildP.block[i].giveupMenuImg) {1720 block.region=ASElement({1721 nodeName:"img",1722 src:ASGetSrcByName("editorToolRegion"),1723 style:{1724 position:"absolute",1725 width:"100%",1726 height:"100%",1727 },1728 ondragstart:banFunction,1729 });1730 block.appendChild(block.region);1731 }1732 }1733 delete buildP.block;1734 if (buildP.menuP) target.menuF.set(buildP.menuP);1735 target.open=BasicSelectStr.open;1736 target.close=BasicSelectStr.close;1737 target.set(buildP);1738 return(target);1739 }1740 var BasicListStr=new function() {1741 this.titleOnmouseover=function() {1742 this.setTarget({transform:{translateY:-5}});1743 }1744 this.titleOnmouseout=function() {1745 this.setTarget({transform:{translateY:0}});1746 }1747 this.titleOnmousedown=function() {1748 this.setTarget({transform:{translateY:0}});1749 }1750 this.titleOnmouseup=function() {1751 this.setTarget({transform:{translateY:-5}});1752 }1753 this.titleOnclick=function() {1754 this.root.setKeyCol(this.name);1755 }1756 this.tideRow=function() {1757 var color1=["rgba(50,0,0,0.2)","rgba(0,0,0,0)"];1758 var color2=["rgba(255,255,255,0.8)","rgba(50,0,0,0.4)"];1759 for (var i=0;i<this.row.length;i++) {1760 this.row[i].set({style:{backgroundColor:color1[i%2]}});1761 for (var j=1;j<this.col.length;j++) {1762 this.row[i].line[j].set({style:{backgroundColor:color2[i%2]}});1763 }1764 }1765 }1766 this.addARow=function(data) {1767 this.row[this.row.length]=ASElement({1768 nodeName:"div",1769 style:{1770 position:"relative",1771 paddingTop:this.size*0.2,1772 paddingBottom:this.size*0.2,1773 width:this.widthA,1774 },1775 });1776 var row=this.row[this.row.length-1];1777 row.col=[];1778 row.colF=[];1779 row.line=[];1780 var heightA=0,x1=0;1781 for (var i=0;i<this.col.length;i++) {1782 row.colF[i]=ASElement({1783 nodeName:"div",1784 style:{1785 width:this.col[i].width,1786 }1787 });1788 row.appendChild(row.colF[i]);1789 var p=data[this.col[i].name];1790 p.size=this.size;1791 if (p.listType=="basicWord") {1792 if (!p.style) p.style={};1793 p.style.width="100%";1794 p.style.textAlign="center";1795 row.col[i]=BasicWord(p);1796 }1797 if (p.listType=="basicInput") {1798 row.col[i]=BasicInput(p);1799 if (!p.style) p.style={};1800 p.style.top=-this.size;1801 }1802 row.colF[i].appendChild(row.col[i]);1803 if (ASGetElementHeight(row.colF[i])>heightA) heightA=ASGetElementHeight(row.colF[i]);1804 if (i>0) {1805 row.line[i]=ASElement({1806 nodeName:"div",1807 style:{1808 position:"absolute",1809 width:1,1810 left:x1-0.5,1811 top:0,1812 },1813 });1814 row.appendChild(row.line[i]);1815 }1816 x1+=this.col[i].width;1817 }1818 for (var i=0;i<this.col.length;i++) {1819 row.colF[i].set({style:{transform:{1820 translateY:(ASGetElementHeight(row.colF[i])-heightA)/2,1821 }}});1822 if (i>0) row.line[i].set({style:{height:heightA+this.size*0.4}});1823 }1824 if (!this.keyCol) {1825 this.listF.appendChild(row);1826 this.listF.appendChild(ASElement("br"));1827 } else {1828 var k=-1;1829 for (var i=0;i<this.col.length;i++) {1830 if (this.col[i].name==this.keyCol) {1831 k=i;1832 break;1833 }1834 }1835 for (var i=this.row.length-1;i>0;i--) {1836 if (this.fx==1) {1837 if (this.row[i].col[k].getValue()>=this.row[i-1].col[k].getValue()) break;1838 } else {1839 if (this.row[i].col[k].getValue()<=this.row[i-1].col[k].getValue()) break;1840 }1841 var aa=this.row[i];1842 this.row[i]=this.row[i-1];1843 this.row[i-1]=aa;1844 }1845 if (i==this.row.length-1) {1846 this.listF.appendChild(row);1847 this.listF.appendChild(ASElement("br"));1848 } else {1849 this.listF.insertBefore(row,this.row[i+1]);1850 this.listF.insertBefore(ASElement("br"),this.row[i+1]);1851 }1852 }1853 this.tideRow();1854 }1855 this.clearRow=function() {1856 this.listF.clearChild();1857 this.row=[];1858 }1859 this.setKeyCol=function(name) {1860 if (this.keyCol==name) this.fx*=-1;1861 else this.fx=1;1862 this.keyCol=name;1863 var key=-1;1864 for (var i=0;i<this.col.length;i++) {1865 if (this.col[i].name==this.keyCol) {1866 key=i;1867 break;1868 }1869 }1870 for (var i=0;i<this.row.length-1;i++) {1871 var k=i;1872 for (var j=i+1;j<this.row.length;j++) {1873 if (this.fx==1) {1874 if (this.row[j].col[key].getValue()<this.row[k].col[key].getValue()) k=j;1875 } else {1876 if (this.row[j].col[key].getValue()>this.row[k].col[key].getValue()) k=j;1877 }1878 }1879 var aa=this.row[i];1880 this.row[i]=this.row[k];1881 this.row[k]=aa;1882 }1883 this.listF.clearChild();1884 for (var i=0;i<this.row.length;i++) {1885 this.listF.appendChild(this.row[i]);1886 this.listF.appendChild(ASElement("br"));1887 }1888 this.tideRow();1889 }1890 }1891 function BasicList(buildP) {1892 if (!buildP.size) buildP.size=24;1893 var target=ASElement({1894 nodeName:"div",1895 });1896 target.col=buildP.col;1897 target.widthA=0;1898 target.keyCol=null;1899 target.fx=1;1900 target.titleF=ASElement({1901 nodeName:"div",1902 style:{1903 position:"relative",1904 marginTop:buildP.size*0.3,1905 marginBottom:buildP.size*0.3,1906 },1907 });1908 target.appendChild(target.titleF);1909 target.titleF.word=[];1910 target.titleF.line=[];1911 for (var i=0;i<target.col.length;i++) {1912 target.titleF.word[i]=BasicWord({1913 size:buildP.size,1914 color:"rgb(230,0,0)",1915 wordC:target.col[i].wordC,1916 wordE:target.col[i].wordE,1917 ignoreM:true,1918 style:{1919 textAlign:"center",1920 width:target.col[i].width,1921 cursor:"pointer",1922 },1923 name:target.col[i].name,1924 root:target,1925 onmouseover:BasicListStr.titleOnmouseover,1926 onmouseout:BasicListStr.titleOnmouseout,1927 onmousedown:BasicListStr.titleOnmousedown,1928 onmouseup:BasicListStr.titleOnmouseup,1929 onclick:BasicListStr.titleOnclick,1930 });1931 target.titleF.appendChild(target.titleF.word[i]);1932 target.titleF.line[i]=ASElement({1933 nodeName:"div",1934 style:{1935 position:"absolute",1936 backgroundColor:"rgba(255,0,0,0.7)",1937 width:1,1938 left:target.widthA-0.5,1939 },1940 });1941 target.titleF.appendChild(target.titleF.line[i]);1942 target.widthA+=target.col[i].width;1943 }1944 target.titleF.set({style:{width:target.widthA}});1945 target.titleF.line[i]=ASElement({1946 nodeName:"div",1947 style:{1948 position:"absolute",1949 backgroundColor:"rgba(255,0,0,0.5)",1950 width:1,1951 left:target.widthA-0.5,1952 },1953 });1954 target.titleF.appendChild(target.titleF.line[i]);1955 var height=ASGetElementHeight(target.titleF);1956 for (var i=0;i<=target.col.length;i++) {1957 target.titleF.line[i].set({style:{height:height}});1958 }1959 target.set({style:{width:target.widthA}});1960 target.appendChild(ASElement("br"));1961 target.listF=ASElement({1962 nodeName:"div",1963 style:{1964 width:target.widthA,1965 },1966 });1967 target.appendChild(target.listF);1968 target.row=[];1969 target.tideRow=BasicListStr.tideRow;1970 target.addARow=BasicListStr.addARow;1971 target.clearRow=BasicListStr.clearRow;1972 target.setKeyCol=BasicListStr.setKeyCol;1973 target.set(buildP);1974 return(target);1975 }1976 var BasicScrollStr=new function() {1977 this.resize=function(typeP) {1978 if (typeP.widthA) {1979 this.set({style:{width:typeP.widthA}});1980 this.container.set({style:{width:typeP.widthA+DEFAULT_SCROLLBAR_WIDTH}});1981 this.context.set({style:{width:typeP.widthA}});1982 }1983 if (typeP.heightA) {1984 this.set({style:{height:typeP.heightA}});1985 this.container.set({style:{height:typeP.heightA}});1986 }1987 }1988 this.resizeT=function(typeP) {1989 if (typeP.widthA) {1990 this.setTarget({width:typeP.widthA});1991 this.container.setTarget({width:typeP.widthA+DEFAULT_SCROLLBAR_WIDTH});1992 this.context.setTarget({width:typeP.widthA});1993 }1994 if (typeP.heightA) {1995 this.setTarget({height:typeP.heightA});1996 this.container.setTarget({height:typeP.heightA});1997 }1998 }1999 this.changeScroll=function() {2000 if (this.targetScroll<0) return;2001 if (wSame(this.container.scrollTop,this.targetScroll,1)) {2002 this.targetScroll=-1;2003 return;2004 }2005 if (this.targetScroll>this.container.scrollTop) {2006 this.container.scrollTop+=Math.pow(this.targetScroll-this.container.scrollTop,0.65);2007 } else {2008 this.container.scrollTop-=Math.pow(this.container.scrollTop-this.targetScroll,0.65);2009 }2010 this.setTimeout(this.changeScroll,16);2011 }2012 this.scrollTo=function(s) {2013 if (s>this.container.scrollHeight-this.offsetHeight) {2014 s=this.container.scrollHeight-this.offsetHeight;2015 }2016 if (s<0) s=0;2017 if (this.targetScroll>0) {2018 this.targetScroll=s;2019 } else {2020 this.targetScroll=s;2021 this.changeScroll();2022 }2023 }2024 this.containerOnscroll=function() {2025 if (this.parentNode.onscroll) this.parentNode.onscroll();2026 }2027 this.onmousewheel=function() {2028 this.targetScroll=-1;2029 }2030 }2031 function BasicScroll(buildP) {2032 if (!buildP.widthA) buildP.widthA=0;2033 if (!buildP.heightA) buildP.heightA=0;2034 var target=ASElement({2035 nodeName:"div",2036 style:{2037 position:"relative",2038 overflow:"hidden",2039 width:buildP.widthA,2040 height:buildP.heightA,2041 },2042 onmousewheel:BasicScrollStr.onmousewheel,2043 });2044 target.targetScroll=-1;2045 target.container=ASElement({2046 nodeName:"div",2047 style:{2048 position:"relative",2049 overflowX:"hidden",2050 overflowY:"scroll",2051 width:buildP.widthA+DEFAULT_SCROLLBAR_WIDTH,2052 height:buildP.heightA,2053 },2054 onscroll:BasicScrollStr.containerOnscroll,2055 });2056 target.appendChild(target.container);2057 target.context=ASElement({2058 nodeName:"div",2059 style:{2060 width:buildP.widthA,2061 },2062 });2063 target.container.appendChild(target.context);2064 target.resize=BasicScrollStr.resize;2065 target.resizeT=BasicScrollStr.resizeT;2066 target.changeScroll=BasicScrollStr.changeScroll;2067 target.scrollTo=BasicScrollStr.scrollTo;2068 target.set(buildP);2069 return(target);2070 }2071 var BasicEditToolStr=new function() {2072 BasicEditToolList=[];2073 BasicEditToolIconList={2074 help:{2075 titleC:"幫助",2076 titleE:"Help",2077 pos:0,2078 },2079 font:{2080 pos:1,2081 titleC:"字體",2082 titleE:"Font",2083 onpressC:"選擇并應用字體",2084 onpressE:"Select and apply a font",2085 onclickC:"應用上一次選擇的字體",2086 onclickE:"Apply the font selected",2087 },2088 size:{2089 pos:2,2090 titleC:"字號",2091 titleE:"Size",2092 onpressC:"選擇并應用字號",2093 onpressE:"Select and apply a font size",2094 onclickC:"應用上一次選擇的字號",2095 onclickE:"Apply the font size selected",2096 },2097 bold:{2098 pos:3,2099 titleC:"加粗",2100 titleE:"Bold",2101 onclickC:"使用或取消粗體",2102 onclickE:"Use or cancel bold",2103 },2104 italic:{2105 pos:4,2106 titleC:"傾斜",2107 titleE:"Italic",2108 onclickC:"使用或取消斜體",2109 onclickE:"Use or cancel italics",2110 },2111 underline:{2112 pos:5,2113 titleC:"下劃線",2114 titleE:"Underline",2115 onclickC:"使用或取消下劃線",2116 onclickE:"Use or cancel underline",2117 },2118 colorW:{2119 pos:6,2120 titleC:"文字顏色",2121 titleE:"Font Color",2122 onpressC:"選擇并应用文字顏色",2123 onpressE:"Select and apply a text color",2124 onclickC:"應用上一次選擇的文字顏色",2125 onclickE:"Apply the text color selected",2126 },2127 colorB:{2128 pos:7,2129 titleC:"背景顏色",2130 titleE:"Back Color",2131 onpressC:"選擇并应用背景顏色",2132 onpressE:"Select and apply a background color",2133 onclickC:"應用上一次選擇的背景顏色",2134 onclickE:"Apply the background color selected",2135 },2136 left:{2137 pos:8,2138 titleC:"向左對齊",2139 titleE:"Align Left",2140 onclickC:"向左對齊",2141 onclickE:"Align left",2142 },2143 center:{2144 pos:9,2145 titleC:"居中對齊",2146 titleE:"Align Center",2147 onclickC:"居中",2148 onclickE:"Align center",2149 },2150 right:{2151 pos:10,2152 titleC:"向右對齊",2153 titleE:"Align Right",2154 onclickC:"向右對齊",2155 onclickE:"Align right",2156 },2157 full:{2158 pos:11,2159 titleC:"兩邊對齊",2160 titleE:"Align on Both Side",2161 onclickC:"兩邊對齊",2162 onclickE:"Align on both side",2163 },2164 divideline:{2165 pos:12,2166 titleC:"分割線",2167 titleE:"Divide Line",2168 onclickC:"添加一條分割線",2169 onclickE:"Add a divide line",2170 },2171 img:{2172 pos:13,2173 titleC:"插入圖片",2174 titleE:"Insert Image",2175 onclickC:"插入本地或網絡圖片",2176 onclickE:"Insert local or online image",2177 },2178 createlink:{2179 pos:14,2180 titleC:"超鏈接",2181 titleE:"Hyperlink",2182 onclickC:"將選中的文字作為超鏈接地址",2183 onclickE:"Change the selected word to a hyperlink",2184 onpressC:"為選中的文字添加超鏈接地址",2185 onpressE:"Add a hyperlink for selected word",2186 },2187 unlink:{2188 pos:15,2189 titleC:"取消超鏈接",2190 titleE:"Cancel Hyperlink",2191 onclickC:"取消超鏈接",2192 onclickE:"Cancel the hyperlink",2193 },2194 }2195 this.iconOnmouseover=function() {2196 this.light.setTarget({opacity:1});2197 }2198 this.iconOnmouseout=function() {2199 this.light.setTarget({opacity:0});2200 }2201 this.iconOnmousedown=function() {2202 this.light.setTarget({opacity:1,transform:{scale:0.9}});2203 this.pic.setTarget({transform:{scale:0.9}});2204 }2205 this.iconOnmouseup=function() {2206 this.light.setTarget({opacity:1,transform:{scale:1}});2207 this.pic.setTarget({transform:{scale:1}});2208 }2209 this.simpleOnclick=function() {2210 document.execCommand(this.action,false,"");2211 this.root.content.focus();2212 }2213 this.statusOnclick=function() {2214 document.execCommand(this.action,false,"");2215 this.root.content.updateSel();2216 if (!this.wDetect) {2217 this.wDetect=true;2218 this.icon.bottom.setTarget({opacity:1});2219 } else {2220 this.wDetect=false;2221 this.icon.bottom.setTarget({opacity:0});2222 }2223 this.root.content.focus();2224 }2225 this.statusDetectStatus=function() {2226 var yes=true;2227 for (var i=0;i<this.root.content.sel.node.length;i++) {2228 var yes2=0;2229 for (var c=this.root.content.sel.node[i];c!=this.root.content;c=c.parentNode) {2230 if (!c || c.nodeType!=1) continue;2231 if (c.nodeName==this.labelName) yes2=1;2232 if (c.style[this.styleName]==this.styleValue) yes2=1;2233 if (c.style[this.styleName] && c.style[this.styleName]!=this.styleValue) yes2=-1;2234 if (yes2!=0) break;2235 }2236 if (yes2!=1) {2237 yes=false;2238 break;2239 }2240 }2241 if (yes) {2242 this.wDetect=true;2243 this.icon.bottom.setTarget({opacity:1});2244 } else {2245 this.wDetect=false;2246 this.icon.bottom.setTarget({opacity:0});2247 }2248 }2249 this.sizeAction=function(node,value) {2250 node.style.fontSize=value+"px";2251 }2252 this.selectOnclick=function() {2253 this.onchoose();2254 }2255 this.selectOnchoose=function() {2256 if (typeof(this.action)=="string") {2257 document.execCommand(this.action,false,this.value);2258 } else {2259 this.root.content.advanceCommand(this.action,this.value);2260 }2261 this.root.content.focus();2262 }2263 this.sizeOnchoose=function() {2264 if (this.root.content.sel && this.root.content.sel.isCollapsed) {2265 var aa=ASElement({2266 nodeName:"span",2267 innerHTML:"&#8203;",2268 id:"insert_"+ASGetTime(),2269 style:{2270 fontSize:this.value,2271 display:"inline_block",2272 },2273 });2274 document.execCommand("InsertHtml",false,aa.outerHTML);2275 var aa=document.getElementById(aa.id);2276 if (aa.parentNode && aa.nextSibling && aa.nextSibling.nodeName=="BR") {2277 aa.parentNode.removeChild(aa.nextSibling);2278 }2279 } else {2280 this.root.content.advanceCommand(this.action,this.value);2281 }2282 this.root.content.focus();2283 }2284 this.imgOnchoose=function() {2285 if (this.value=="local") return;2286 this.root.content.recoverSel();2287 var img=ASElement({2288 nodeName:"img",2289 src:this.value,2290 style:{2291 maxWidth:"100%",2292 },2293 });2294 document.execCommand("InsertHtml",false,img.outerHTML);2295 }2296 this.imgOnopen=function() {2297 this.menu.block[0].content.removeChild(this.menu.block[0].content.input);2298 this.menu.block[0].content.input=BasicEditToolStr.imgFileInput({root:this.root});2299 this.menu.block[0].content.appendChild(this.menu.block[0].content.input);2300 this.menu.block[1].content.input.setValue("");2301 }2302 this.imgFileInput=function(buildP) {2303 var target=ASElement({2304 nodeName:"input",2305 type:"file",2306 multiple:"true",2307 accept:"image/gif,image/jpeg,image/png",2308 style:{2309 position:"absolute",2310 left:0,2311 top:-20,2312 width:"100%",2313 height:50+20,2314 opacity:0,2315 cursor:"pointer",2316 },2317 root:buildP.root,2318 onchange:function() {2319 this.root.content.recoverSel();2320 this.file=[];2321 this.fileDoneN=0;2322 this.img=[];2323 for (var i=0;i<this.files.length;i++) {2324 this.img[i]=ASElement({2325 nodeName:"img",2326 id:"img"+i+"_"+ASGetTime(),2327 style:{2328 maxWidth:"100%",2329 },2330 });2331 this.file[i]=new FileReader();2332 this.file[i].num=i;2333 this.file[i].root=this;2334 this.file[i].readAsDataURL(this.files[i]);2335 this.file[i].onload=function() {2336 this.root.fileDoneN++;2337 var img=document.getElementById(this.root.img[this.num].id);2338 img.src=this.result;2339 }2340 document.execCommand("InsertHtml",false,this.img[i].outerHTML);2341 this.root.content.updateSel();2342 }2343 this.root.content.focus();2344 },2345 });2346 return(target);2347 }2348 this.createlinkOnclick=function() {2349 if (this.root.content.sel) {2350 document.execCommand("CreateLink",false,this.root.content.sel.toString());2351 }2352 }2353 this.createlinkOnchoose=function() {2354 this.root.content.recoverSel();2355 document.execCommand("CreateLink",false,this.value);2356 }2357 this.createlinkOnopen=function() {2358 this.menu.block[0].content.input.setValue("");2359 this.menu.block[0].content.input.focus();2360 }2361 this.onselchange=function() {2362 for (var item in this.tool) {2363 if (this.tool[item].type=="status") {2364 this.tool[item].detectStatus();2365 }2366 }2367 }2368 this.setLang=function() {2369 for (var item in this.tool) {2370 if (this.tool[item].type=="select") {2371 this.tool[item].icon.title=this.tool[item]["title"+ASLang];2372 } else {2373 this.tool[item].title=this.tool[item]["title"+ASLang];2374 }2375 }2376 }2377 }2378 function BasicEditTool(buildP) {2379 if (!buildP.size) buildP.size=35;2380 if (!buildP.tool) buildP.tool={2381 font:true,2382 size:true,2383 bold:true,2384 italic:true,2385 underline:true,2386 colorW:true,2387 colorB:true,2388 left:true,2389 center:true,2390 right:true,2391 full:true,2392 divideline:true,2393 img:true,2394 createlink:true,2395 unlink:true,2396 help:true,2397 };2398 var n=0;2399 for (var item in buildP.tool) n++;2400 var target=ASElement({2401 nodeName:"div",2402 style:{2403 position:"relative",2404 width:buildP.size*1.1*n,2405 height:buildP.size,2406 },2407 onselchange:BasicEditToolStr.onselchange,2408 });2409 if (buildP.widthA) target.set({style:{width:buildP.widthA}});2410 BasicEditToolList[BasicEditToolList.length]=target;2411 target.toolList=buildP.tool;2412 target.tool={};2413 for (var item in target.toolList) {2414 var i=BasicEditToolIconList[item];2415 var icon=ASElement({2416 nodeName:"div",2417 style:{2418 position:"relative",2419 width:buildP.size,2420 height:buildP.size,2421 },2422 onmouseover:BasicEditToolStr.iconOnmouseover,2423 onmouseout:BasicEditToolStr.iconOnmouseout,2424 onmousedown:BasicEditToolStr.iconOnmousedown,2425 onmouseup:BasicEditToolStr.iconOnmouseup,2426 });2427 icon.bottom=ASElement({2428 nodeName:"div",2429 style:{2430 position:"absolute",2431 width:"90%",2432 height:"90%",2433 margin:"5%",2434 backgroundColor:"rgba(200,0,0,0.2)",2435 opacity:0,2436 },2437 });2438 icon.appendChild(icon.bottom);2439 icon.light=ASElement({2440 nodeName:"div",2441 style:{2442 position:"absolute",2443 width:"100%",2444 height:"100%",2445 boxShadow:"0 0 3px rgba(200,0,0,0.8)",2446 opacity:0,2447 },2448 });2449 icon.appendChild(icon.light);2450 icon.pic=ASElement({2451 nodeName:"div",2452 style:{2453 position:"absolute",2454 left:"2%",2455 top:"2%",2456 width:"96%",2457 height:"96%",2458 overflow:"hidden",2459 },2460 });2461 icon.appendChild(icon.pic);2462 icon.picC=ASElement({2463 nodeName:"img",2464 src:ASGetSrcByName("editorToolIcon"),2465 onselectstart:emptyFunction,2466 style:{2467 position:"absolute",2468 height:buildP.size*0.96,2469 left:-BasicEditToolIconList[item].pos*buildP.size*0.96,2470 },2471 });2472 icon.pic.appendChild(icon.picC);2473 var p={2474 root:target,2475 titleC:BasicEditToolIconList[item].titleC,2476 titleE:BasicEditToolIconList[item].titleE,2477 style:{2478 marginLeft:buildP.size*0.1,2479 },2480 };2481 if (item=="font") {2482 p.type="select";2483 var block=[];2484 for (var j=0;j<DEFAULT_FONTLIST.length;j++) {2485 block[block.length]=BasicWord({2486 size:24*DEFAULT_FONTLIST[j][2],2487 wordC:DEFAULT_FONTLIST[j][1],2488 wordE:DEFAULT_FONTLIST[j][0],2489 width:"max",2490 font:DEFAULT_FONTLIST[j][0],2491 style:{2492 padding:"3px 10px",2493 pointerEvents:"none",2494 },2495 value:DEFAULT_FONTLIST[j][0],2496 });2497 }2498 p.block=block;2499 p.value=DEFAULT_FONT;2500 p.action="FontName";2501 p.entryOnclick=BasicEditToolStr.selectOnclick;2502 }2503 if (item=="size") {2504 p.type="select";2505 p.heightA=300;2506 var block=[BasicWord({2507 size:48,2508 wordC:"極大",2509 wordE:"Huge",2510 style:{2511 padding:"3px 10px",2512 pointerEvents:"none",2513 },2514 value:48,2515 }),BasicWord({2516 size:32,2517 wordC:"大",2518 wordE:"Large",2519 style:{2520 padding:"3px 10px",2521 pointerEvents:"none",2522 },2523 value:32,2524 }),BasicWord({2525 size:18,2526 wordC:"正常",2527 wordE:"Normal",2528 style:{2529 padding:"3px 10px",2530 pointerEvents:"none",2531 },2532 value:18,2533 }),BasicWord({2534 size:12,2535 wordC:"小",2536 wordE:"Small",2537 style:{2538 padding:"3px 10px",2539 pointerEvents:"none",2540 },2541 value:12,2542 })];2543 for (var j=4;j<=15;j++) {2544 block[block.length]=BasicWord({2545 size:j*2,2546 wordE:j*2+" px",2547 style:{2548 padding:"3px 10px",2549 pointerEvents:"none",2550 },2551 value:j*2,2552 });2553 }2554 for (var j=1;j<=5;j++) {2555 block[block.length]=BasicWord({2556 size:30+j*3,2557 wordE:(30+j*3)+" px",2558 style:{2559 padding:"3px 10px",2560 pointerEvents:"none",2561 },2562 value:30+j*3,2563 });2564 }2565 p.block=block;2566 p.value=18;2567 p.action=BasicEditToolStr.sizeAction;2568 p.entryOnclick=BasicEditToolStr.selectOnclick;2569 p.onchoose=BasicEditToolStr.sizeOnchoose;2570 }2571 if (item=="bold") {2572 p.type="status";2573 p.action="Bold";2574 p.labelName="B";2575 p.styleName="fontWeight";2576 p.styleValue="bold";2577 }2578 if (item=="italic") {2579 p.type="status";2580 p.action="Italic";2581 p.labelName="I";2582 p.styleName="fontStyle";2583 p.styleValue="italic";2584 }2585 if (item=="underline") {2586 p.type="status";2587 p.action="Underline";2588 p.labelName="U";2589 p.styleName="textDecoration";2590 p.styleValue="underline";2591 }2592 if (item=="colorW" || item=="colorB") {2593 p.type="select";2594 var block=[];2595 p.col=6;2596 p.menuPadding=5;2597 var color=["#000000","#00C000","#0000C0","#8000FF","#FF8000","#C0C0C0","#FF0000","#00FF00","#0000FF","#FF00FF","#FFFF00","#FFFFFF"];2598 for (var i=0;i<color.length;i++) {2599 block[i]=ASElement({2600 nodeName:"div",2601 style:{2602 padding:6,2603 },2604 value:color[i],2605 });2606 block[i].pic=ASElement({2607 nodeName:"div",2608 style:{2609 backgroundColor:color[i],2610 width:35,2611 height:35,2612 },2613 });2614 block[i].appendChild(block[i].pic);2615 }2616 p.block=block;2617 if (item=="colorW") {2618 p.action="ForeColor";2619 p.value="black";2620 } else {2621 p.action="BackColor";2622 p.value="white";2623 }2624 p.entryOnclick=BasicEditToolStr.selectOnclick;2625 }2626 if (item=="left") {2627 p.type="simple";2628 p.action="JustifyLeft";2629 }2630 if (item=="center") {2631 p.type="simple";2632 p.action="JustifyCenter";2633 }2634 if (item=="right") {2635 p.type="simple";2636 p.action="JustifyRight";2637 }2638 if (item=="full") {2639 p.type="simple";2640 p.action="JustifyFull";2641 }2642 if (item=="divideline") {2643 p.type="simple";2644 p.action="InsertHorizontalRule";2645 }2646 if (item=="img") {2647 p.type="select";2648 p.fx="upRight";2649 var block=[];2650 block[0]=ASElement({2651 nodeName:"div",2652 style:{2653 position:"relative",2654 width:230,2655 height:50,2656 overflow:"hidden",2657 },2658 giveupMenuImg:true,2659 value:"local",2660 });2661 block[0].word=BasicWord({2662 size:24,2663 wordC:"本地圖片",2664 wordE:"Local Image",2665 style:{2666 position:"relative",2667 width:"100%",2668 textAlign:"center",2669 top:7.5,2670 },2671 });2672 block[0].appendChild(block[0].word);2673 block[0].input=BasicEditToolStr.imgFileInput({root:target});2674 block[0].appendChild(block[0].input);2675 block[1]=ASElement({2676 nodeName:"div",2677 style:{2678 position:"relative",2679 width:230,2680 height:120,2681 },2682 giveupMenuExtra:true,2683 });2684 block[1].word=BasicWord({2685 size:24,2686 wordC:"網絡圖片",2687 wordE:"Online Image",2688 style:{2689 position:"relative",2690 width:"100%",2691 textAlign:"center",2692 top:5,2693 },2694 });2695 block[1].appendChild(block[1].word);2696 block[1].input=BasicInput({2697 type:"input",2698 hintC:"請輸入鏈接",2699 hintE:"Hyperlink",2700 widthA:200,2701 style:{2702 position:"relative",2703 left:15,2704 marginTop:7,2705 },2706 });2707 block[1].appendChild(block[1].input);2708 block[1].confirm=BasicButton({2709 wordC:"導 入",2710 wordE:"Import",2711 size:18,2712 style:{2713 position:"relative",2714 left:72,2715 marginTop:5,2716 },2717 root:block[1],2718 onclick:function() {2719 var aa=this.root.parentNode.root;2720 aa.value=this.root.input.getValue();2721 aa.onchoose();2722 aa.close();2723 },2724 });2725 block[1].appendChild(block[1].confirm);2726 p.block=block;2727 p.onchoose=BasicEditToolStr.imgOnchoose;2728 p.onopen=BasicEditToolStr.imgOnopen;2729 }2730 if (item=="createlink") {2731 p.type="select";2732 p.fx="upRight";2733 p.action="CreateLink";2734 var block=ASElement({2735 nodeName:"div",2736 style:{2737 position:"relative",2738 width:330,2739 height:50,2740 },2741 });2742 block.input=BasicInput({2743 type:"input",2744 hintC:"請輸入鏈接",2745 hintE:"Hyperlink",2746 widthA:200,2747 style:{2748 position:"absolute",2749 left:15,2750 top:7.5,2751 },2752 });2753 block.appendChild(block.input);2754 block.confirm=BasicButton({2755 wordC:"確 認",2756 wordE:"Confirm",2757 size:18,2758 style:{2759 position:"absolute",2760 right:10,2761 top:7.5,2762 },2763 root:block,2764 onclick:function() {2765 var aa=this.root.parentNode.root;2766 aa.value=this.root.input.getValue();2767 aa.onchoose();2768 aa.close();2769 },2770 });2771 block.appendChild(block.confirm);2772 p.block=[block];2773 p.entryOnclick=BasicEditToolStr.createlinkOnclick;2774 p.onchoose=BasicEditToolStr.createlinkOnchoose;2775 p.onopen=BasicEditToolStr.createlinkOnopen;2776 p.giveupMenuExtra=true;2777 }2778 if (item=="unlink") {2779 p.type="simple";2780 p.action="Unlink";2781 }2782 if (item=="help") {2783 p.type="select";2784 p.fx="upRight";2785 p.heightA=400;2786 p.BGC="rgba(0,0,0,0.7)";2787 p.giveupMenuExtra=true;2788 var block=[ASElement({2789 nodeName:"div",2790 style:{2791 paddingTop:5,2792 paddingBottom:5,2793 },2794 })];2795 for (var item1 in buildP.tool) {2796 if (item1=="help") continue;2797 if (block[0].childNodes.length>0) {2798 block[0].appendChild(ASElement({2799 nodeName:"hr",2800 style:{2801 color:"white",2802 marginLeft:5,2803 marginRight:5,2804 marginTop:5,2805 marginBottom:5,2806 opacity:0.2,2807 },2808 }));2809 }2810 var b=ASElement({2811 nodeName:"table",2812 style:{2813 width:400,2814 minHeight:50,2815 },2816 });2817 block[0].appendChild(b);2818 b.r1=ASElement({2819 nodeName:"tr",2820 });2821 b.appendChild(b.r1);2822 b.r1.appendChild(ASElement({2823 nodeName:"td",2824 align:"center",2825 valign:"middle",2826 style:{2827 width:55,2828 },2829 }));2830 b.pic=ASElement({2831 nodeName:"div",2832 style:{2833 position:"relative",2834 width:35,2835 height:35,2836 overflow:"hidden",2837 backgroundColor:"white",2838 },2839 });2840 b.r1.lastChild.appendChild(b.pic);2841 b.picC=ASElement({2842 nodeName:"img",2843 src:ASGetSrcByName("editorToolIcon"),2844 style:{2845 position:"relative",2846 height:35,2847 left:-BasicEditToolIconList[item1].pos*35,2848 }2849 });2850 b.pic.appendChild(b.picC);2851 b.r1.appendChild(ASElement("td"));2852 for (var con in BasicEditToolIconList[item1]) {2853 if (con=="onclickC") {2854 b.r1.lastChild.appendChild(BasicWord({2855 color:"white",2856 size:18,2857 wordC:"點 擊:",2858 wordE:"Click:",2859 style:{2860 verticalAlign:"top",2861 width:70,2862 },2863 }));2864 b.r1.lastChild.appendChild(BasicWord({2865 color:"white",2866 size:18,2867 wordC:BasicEditToolIconList[item1].onclickC,2868 wordE:BasicEditToolIconList[item1].onclickE,2869 style:{2870 width:250,2871 },2872 }));2873 b.r1.lastChild.appendChild(ASElement("br"));2874 }2875 if (con=="onpressC") {2876 b.r1.lastChild.appendChild(BasicWord({2877 color:"white",2878 size:18,2879 wordC:"長 按:",2880 wordE:"Press:",2881 style:{2882 verticalAlign:"top",2883 width:70,2884 },2885 }));2886 b.r1.lastChild.appendChild(BasicWord({2887 color:"white",2888 size:18,2889 wordC:BasicEditToolIconList[item1].onpressC,2890 wordE:BasicEditToolIconList[item1].onpressE,2891 style:{2892 width:250,2893 },2894 }));2895 b.r1.lastChild.appendChild(ASElement("br"));2896 }2897 }2898 }2899 p.block=block;2900 }2901 if (p.type=="simple") {2902 p.nodeName="div";2903 p.style.width=buildP.size;2904 p.style.height=buildP.size;2905 p.style.cursor="pointer";2906 p.onclick=BasicEditToolStr.simpleOnclick;2907 target.tool[item]=ASElement(p);2908 target.tool[item].appendChild(icon);2909 }2910 if (p.type=="select") {2911 p.entry=icon;2912 if (!p.fx) p.fx="up";2913 if (!p.onchoose) p.onchoose=BasicEditToolStr.selectOnchoose;2914 target.tool[item]=BasicSelect(p);2915 target.tool[item].icon=icon;2916 }2917 if (p.type=="status") {2918 p.nodeName="div",2919 p.style.width=buildP.size;2920 p.style.height=buildP.size;2921 p.style.cursor="pointer";2922 p.onclick=BasicEditToolStr.statusOnclick;2923 p.detectStatus=BasicEditToolStr.statusDetectStatus;2924 p.wDetect=false;2925 target.tool[item]=ASElement(p);2926 target.tool[item].icon=icon;2927 target.tool[item].appendChild(icon);2928 }2929 if (p.type=="input_image") {2930 p.nodeName="div";2931 p.style.position="relative",2932 p.style.width=buildP.size;2933 p.style.height=buildP.size;2934 p.style.overflow="hidden";2935 p.onchange=BasicEditToolStr.imgOnchange;2936 p.onmouseover=BasicEditToolStr.iconOnmouseover;2937 p.onmouseout=BasicEditToolStr.iconOnmouseout;2938 p.onmousedown=BasicEditToolStr.iconOnmousedown;2939 p.onmouseup=BasicEditToolStr.iconOnmouseup;2940 target.tool[item]=ASElement(p);2941 target.tool[item].appendChild(icon);2942 target.tool[item].pic=icon.pic;2943 target.tool[item].input=ASElement({2944 nodeName:"input",2945 type:"file",2946 accept:"image/gif,image/jpeg,image/png",2947 style:{2948 position:"absolute",2949 left:0,2950 top:-20,2951 width:"100%",2952 height:buildP.size+20,2953 opacity:0,2954 cursor:"pointer",2955 },2956 });2957 target.tool[item].appendChild(target.tool[item].input);2958 }2959 target.appendChild(target.tool[item]);2960 }2961 if (target.tool.help) {2962 target.tool.help.set({style:{2963 position:"absolute",2964 right:0,2965 }});2966 }2967 target.setLang=BasicEditToolStr.setLang;2968 target.setLang();2969 delete buildP.tool;2970 target.set(buildP);2971 return(target);2972 }2973 var BasicEditorStr=new function() {2974 this.resize=function(typeP) {2975 if ("widthA" in typeP) {2976 this.set({style:{width:typeP.widthA}});2977 this.contentF.set({style:{width:typeP.widthA}});2978 this.content.set({style:{width:typeP.widthA}});2979 this.toolF.set({style:{width:typeP.widthA}});2980 }2981 if ("heightA" in typeP) {2982 this.contentF.set({style:{height:typeP.heightA-this.iconSize*1.2}});2983 }2984 }2985 this.contentAdvanceCommand=function(action,value) {2986 document.execCommand("FontSize",false,7);2987 this.tide(null,action,value);2988 }2989 this.contentGetSel=function(node) {2990 if (!node) {2991 if (this.sel.anchorNode==this.sel.focusNode) {2992 this.sel.node[0]=this.sel.anchorNode;2993 return;2994 }2995 this.checkStatus="before";2996 node=this;2997 }2998 var yes=true;2999 for (var i=0;i<node.childNodes.length;i++) {3000 var c=node.childNodes[i];3001 if (c==this.sel.anchorNode || c==this.sel.focusNode) {3002 if (this.checkStatus=="before") this.checkStatus="on";3003 else this.checkStatus="end";3004 }3005 if (this.checkStatus!="before" && c.nodeType==3) this.sel.node[this.sel.node.length]=c.parentNode;3006 if (c.nodeType!=1) continue;3007 yes=false;3008 this.getSel(c);3009 if (this.checkStatus=="end") return;3010 }3011 }3012 this.contentUpdateSel=function() {3013 var sel=window.getSelection();3014 this.sel={3015 anchorNode:sel.anchorNode,3016 anchorOffset:sel.anchorOffset,3017 focusNode:sel.focusNode,3018 focusOffset:sel.focusOffset,3019 isCollapsed:sel.isCollapsed,3020 node:[],3021 range:[],3022 };3023 for (var i=0;i<sel.rangeCount;i++) {3024 this.sel.range[i]=sel.getRangeAt(i);3025 }3026 this.getSel();3027 }3028 this.contentRecoverSel=function() {3029 if (!this.sel) return;3030 var sel=window.getSelection();3031 sel.removeAllRanges();3032 for (var i=0;i<this.sel.range.length;i++) {3033 sel.addRange(this.sel.range[i]);3034 }3035 }3036 this.contentTide=function(node,action,value) {3037 if (!node) {3038 node=this;3039 }3040 if (node.size=="7") {3041 action(node,value);3042 node.size="";3043 }3044 for (var i=0;i<node.childNodes.length;i++) {3045 var c=node.childNodes[i];3046 if (c.nodeType!=1) continue;3047 this.tide(c,action,value);3048 }3049 }3050 this.contentChangeSel=function() {3051 this.updateSel();3052 this.root.tool.onselchange();3053 }3054 this.contentOnpaste=function(e) {3055 ASPasteData={3056 item:[],3057 itemDoneN:0,3058 root:this,3059 onfinish:function() {3060 var html="";3061 for (var i=0;i<ASPasteData.item.length;i++) {3062 if (ASPasteData.item[i].html) html+=ASPasteData.item[i].html;3063 }3064 document.execCommand("InsertHtml",false,escapeHtml(html));3065 },3066 };3067 var data=e.clipboardData;3068 for (var i=0;i<data.items.length;i++) {3069 ASPasteData.item[i]={3070 type:data.items[i].type,3071 };3072 if (data.items[i].type=="text/plain") {3073 if (!(i+1<data.items.length && data.items[i+1].type=="text/html")) {3074 data.items[i].getAsString(function(e) {3075 for (var i=0;i<ASPasteData.item.length;i++) {3076 if (ASPasteData.item[i].type=="text/plain" && !ASPasteData.item[i].html) {3077 ASPasteData.item[i].html=e;3078 ASPasteData.itemDoneN++;3079 if (ASPasteData.itemDoneN>=ASPasteData.item.length) ASPasteData.onfinish();3080 break;3081 }3082 }3083 });3084 } else {3085 ASPasteData.itemDoneN++;3086 continue;3087 }3088 continue;3089 }3090 if (data.items[i].type=="text/html") {3091 data.items[i].getAsString(function(e) {3092 for (var i=0;i<ASPasteData.item.length;i++) {3093 if (ASPasteData.item[i].type=="text/html" && !ASPasteData.item[i].html) {3094 var start=e.indexOf("<!--StartFragment-->")+20;3095 var end=e.indexOf("<!--EndFragment-->");3096 ASPasteData.item[i].html=e.slice(start,end);3097 ASPasteData.itemDoneN++;3098 if (ASPasteData.itemDoneN>=ASPasteData.item.length) ASPasteData.onfinish();3099 break;3100 }3101 }3102 });3103 continue;3104 }3105 if (data.items[i].type.indexOf("image")!=-1) {3106 var blob=data.items[i].getAsFile();3107 var file=new FileReader();3108 file.readAsDataURL(blob);3109 file.root=ASPasteData.item[i];3110 file.onloadend=function(e) {3111 var img=ASElement({3112 nodeName:"img",3113 src:this.result,3114 });3115 for (var i=0;i<ASPasteData.item.length;i++) {3116 if (ASPasteData.item[i].type.indexOf("image")!=-1 && !ASPasteData.item[i].html) {3117 ASPasteData.item[i].html=img.outerHTML;3118 ASPasteData.itemDoneN++;3119 if (ASPasteData.itemDoneN>=ASPasteData.item.length) ASPasteData.onfinish();3120 break;3121 }3122 }3123 }3124 continue;3125 }3126 ASPasteData.itemDoneN++;3127 }3128 return false;3129 }3130 }3131 function BasicEditor(buildP) {3132 if (!buildP.widthA) buildP.widthA=DEFAULT_PAGE_WIDTHL;3133 if (!buildP.heightA) buildP.heightA=500;3134 if (!buildP.iconSize) buildP.iconSize=35;3135 var target=ASElement({3136 nodeName:"div",3137 style:{3138 position:"relative",3139 width:buildP.widthA,3140 border:"2px solid rgba(180,180,180,0.5)",3141 },3142 });3143 target.contentF=ASElement({3144 nodeName:"div",3145 style:{3146 width:buildP.widthA,3147 height:buildP.heightA-buildP.iconSize*1.2,3148 overflowX:"hidden",3149 overflowY:"auto",3150 backgroundColor:"white",3151 },3152 });3153 target.appendChild(target.contentF);3154 target.content=ASElement({3155 nodeName:"div",3156 root:target,3157 contentEditable:true,3158 style:{3159 fontFamily:DEFAULT_FONT,3160 fontSize:18,3161 width:buildP.widthA-16-DEFAULT_SCROLLBAR_WIDTH,3162 minHeight:buildP.heightA-buildP.iconSize*1.2-16,3163 borderStyle:"none",3164 outline:"none",3165 margin:8,3166 },3167 advanceCommand:BasicEditorStr.contentAdvanceCommand,3168 getSel:BasicEditorStr.contentGetSel,3169 updateSel:BasicEditorStr.contentUpdateSel,3170 recoverSel:BasicEditorStr.contentRecoverSel,3171 tide:BasicEditorStr.contentTide,3172 changeSel:BasicEditorStr.contentChangeSel,3173 onpaste:BasicEditorStr.contentOnpaste,3174 });3175 target.contentF.appendChild(target.content);3176 target.content.onclick=target.content.changeSel;3177 target.content.onkeydown=target.content.changeSel;3178 target.content.onkeyup=target.content.changeSel;3179 target.appendChild(ASElement({3180 nodeName:"hr",3181 style:{3182 marginLeft:5,3183 marginRight:5,3184 },3185 }));3186 target.toolF=ASElement({3187 nodeName:"div",3188 style:{3189 width:buildP.widthA,3190 },3191 });3192 target.appendChild(target.toolF);3193 target.tool=BasicEditTool({3194 size:buildP.iconSize,3195 content:target.content,3196 widthA:buildP.widthA-buildP.iconSize*0.3,3197 tool:{3198 font:true,3199 size:true,3200 bold:true,3201 italic:true,3202 underline:true,3203 colorW:true,3204 colorB:true,3205 left:true,3206 center:true,3207 right:true,3208 full:true,3209 divideline:true,3210 img:true,3211 createlink:true,3212 unlink:true,3213 help:true,3214 },3215 style:{3216 marginLeft:buildP.iconSize*0.1,3217 marginTop:buildP.iconSize*0.1,3218 marginBottom:buildP.iconSize*0.1,3219 },3220 });3221 target.toolF.appendChild(target.tool);3222 target.resize=BasicEditorStr.resize;3223 target.set(buildP);3224 return(target);3225 }3226 var FlashImgStr=new function() {3227 this.getPicScale=function() {3228 switch (this.imgSize) {3229 case "integral":3230 return(Math.min(this.widthA/this.pic.naturalWidth,this.heightA/this.pic.naturalHeight));3231 break;3232 case "full":3233 return(Math.max(this.widthA/this.pic.naturalWidth,this.heightA/this.pic.naturalHeight));3234 break;3235 case "intelligent":3236 var size1=Math.min(this.widthA/this.pic.naturalWidth,this.heightA/this.pic.naturalHeight);3237 var size2=Math.max(this.widthA/this.pic.naturalWidth,this.heightA/this.pic.naturalHeight);3238 if (size2<size1*1.25) {3239 return(size2);3240 } else {3241 return(size1);3242 }3243 break;3244 }3245 return(1);3246 }3247 this.firstLoad=function() {3248 var scale=this.getPicScale();3249 this.picF1.set({3250 style:{3251 backgroundPosition:"center",3252 backgroundImage:"url('"+this.pic.src+"')",3253 backgroundSize:this.pic.naturalWidth*scale+"px "+this.pic.naturalHeight*scale+"px",3254 },3255 });3256 if (this.img.length>1) this.reload();3257 }3258 this.reload=function() {3259 this.imgC=(this.imgC+1)%this.img.length;3260 this.pic=ASElement({3261 nodeName:"img",3262 src:this.img[this.imgC],3263 });3264 }3265 this.nextAppear=function() {3266 this.picF1.setTarget({3267 opacity:0,3268 });3269 var scale=this.getPicScale();3270 this.picF2=ASElement({3271 nodeName:"div",3272 style:{3273 position:"relative",3274 overflow:"hidden",3275 width:this.widthA,3276 height:this.heightA,3277 top:-this.heightA+this.heightA%2*0.4,3278 opacity:0,3279 backgroundPosition:"center",3280 backgroundImage:"url('"+this.pic.src+"')",3281 backgroundSize:this.pic.naturalWidth*scale+"px "+this.pic.naturalHeight*scale+"px",3282 backgroundRepeat:"no-repeat",3283 },3284 });3285 if (ASBrowser!="Mobile") {3286 this.picF2.set({style:{3287 transform:{3288 translateX:-this.widthA,3289 },3290 }});3291 }3292 this.appendChild(this.picF2);3293 this.setTimeout(function() {this.picF2.setTarget({3294 opacity:1,3295 time:400,3296 transform:{3297 translateX:0,3298 },3299 })},10);3300 this.setTimeout(this.switchPic,510);3301 }3302 this.switchPic=function() {3303 this.picF1.set({style:{3304 opacity:1,3305 backgroundPosition:this.picF2.style.backgroundPosition,3306 backgroundImage:this.picF2.style.backgroundImage,3307 backgroundSize:this.picF2.style.backgroundSize,3308 }});3309 this.removeChild(this.picF2);3310 }3311 this.change=function() {3312 if (this.type=="response") {3313 if (!this.wOn) {3314 this.wPlaying=false;3315 return;3316 }3317 }3318 if (this.pic.complete) {3319 this.nextAppear();3320 }3321 this.reload();3322 var time=ASGetTime()-this.startTime-this.delay;3323 this.setTimeout(this.change,this.timeSpace-time%this.timeSpace);3324 }3325 this.onmouseover=function() {3326 if (this.type=="response") {3327 this.wOn=true;3328 if (this.img.length>1 && !this.wPlaying) {3329 this.wPlaying=true;3330 this.setTimeout(this.change,this.timeSpace);3331 this.startTime=ASGetTime();3332 this.delay=0;3333 }3334 }3335 }3336 this.onmouseout=function() {3337 if (this.type=="response") {3338 this.wOn=false;3339 }3340 }3341 }3342 function FlashImg(buildP) {3343 if (!buildP.type) buildP.type="auto";3344 if (!buildP.delay) buildP.delay=0;3345 if (!buildP.timeSpace) buildP.timeSpace=DEFAULT_FLASHIMG_TIMESPACE;3346 var target=ASElement({3347 nodeName:"div",3348 style:{3349 overflow:"hidden",3350 width:buildP.widthA,3351 height:buildP.heightA,3352 },3353 onmouseover:FlashImgStr.onmouseover,3354 onmouseout:FlashImgStr.onmouseout,3355 onclick:FlashImgStr.onclick,3356 });3357 target.type=buildP.type;3358 target.widthA=buildP.widthA;3359 target.heightA=buildP.heightA;3360 target.imgSize=buildP.imgSize;3361 target.img=buildP.img;3362 target.imgC=0;3363 target.timeSpace=buildP.timeSpace;3364 if (target.type=="response") {3365 target.wPlaying=false;3366 target.wOn=false;3367 }3368 if (target.type=="auto") {3369 target.startTime=ASGetTime();3370 target.delay=buildP.delay;3371 }3372 target.picF1=ASElement({3373 nodeName:"div",3374 style:{3375 overflow:"hidden",3376 width:target.widthA,3377 height:target.heightA,3378 backgroundRepeat:"no-repeat",3379 },3380 });3381 target.appendChild(target.picF1);3382 target.pic=ASElement({3383 nodeName:"img",3384 src:target.img[0],3385 father:target,3386 onload:function() {3387 this.father.firstLoad();3388 },3389 });3390 target.getPicScale=FlashImgStr.getPicScale;3391 target.firstLoad=FlashImgStr.firstLoad;3392 target.reload=FlashImgStr.reload;3393 target.nextAppear=FlashImgStr.nextAppear;3394 target.switchPic=FlashImgStr.switchPic;3395 target.change=FlashImgStr.change;3396 target.onmouseover=FlashImgStr.onmouseover;3397 target.onmouseout=FlashImgStr.onmouseout;3398 if (target.img.length>1) target.setTimeout(target.change,target.delay+target.timeSpace);3399 target.set(buildP);3400 return(target);3401 }3402 var AnchorListStr=new function() {3403 AnchorListList=[];3404 this.resize=function() {3405 for (var i=0;i<this.block.length;i++) {3406 this.block[i].set({style:{3407 height:ASGetElementHeight(this.block[i].wordR)+this.size*0.3,3408 }});3409 this.block[i].content.set({style:{3410 top:-ASGetElementHeight(this.block[i].wordR),3411 }});3412 }3413 this.blockPos=[];3414 this.lightL[0].set({style:{3415 height:ASGetElementHeight(this.block[0])/2-23+this.size*1.28+this.space,3416 }});3417 var y0=ASGetElementHeight(this.block[0])/2-23+this.size*1.28+this.space;3418 for (var i=1;i<this.lightL.length-1;i++) {3419 if (i-1==this.blockNum) {3420 this.light.set({style:{3421 top:y0+21-25+2,3422 }});3423 }3424 this.blockPos[i-1]=y0;3425 this.lightL[i].set({style:{3426 height:(ASGetElementHeight(this.block[i-1])+ASGetElementHeight(this.block[i]))/2+this.size*0.2-8+this.space,3427 }});3428 y0+=(ASGetElementHeight(this.block[i-1])+ASGetElementHeight(this.block[i]))/2+this.size*0.2+this.space;3429 }3430 this.blockPos[i-1]=y0;3431 this.lightL[this.lightL.length-1].set({style:{3432 height:ASGetElementHeight(this.block[this.block.length-1])/2-23+this.size*1.28+this.space,3433 }});3434 y0+=(ASGetElementHeight(this.block[i-1])+ASGetElementHeight(this.block[i]))/2+this.size*0.2+this.space;3435 this.lightC.set({style:{3436 height:y0+45,3437 }});3438 }3439 this.changeBlock=function(w) {3440 for (var i=0;i<this.block.length;i++) {3441 if (i==w) continue;3442 this.block[i].bottom.setTarget({opacity:0});3443 this.block[i].wordW.setTarget({opacity:0});3444 }3445 this.block[w].bottom.setTarget({opacity:1});3446 this.block[w].wordW.setTarget({opacity:1});3447 this.light.setTarget({3448 top:this.blockPos[w]+21-25+2,3449 time:200,3450 });3451 this.blockNum=w;3452 if (this.parentNode.parentNode.scrollTo) {3453 this.parentNode.parentNode.scrollTo(this.blockPos[w]+21-25+2+ASGetElementHeight(this.block[w])/2-15);3454 }3455 }3456 this.blockOnmouseover=function() {3457 this.word.setTarget({transform:{translateX:5}});3458 }3459 this.blockOnmouseout=function() {3460 this.word.setTarget({transform:{translateX:0}});3461 }3462 this.blockOnmousedown=function() {3463 this.word.setTarget({transform:{translateX:2}});3464 }3465 this.blockOnmouseup=function() {3466 this.word.setTarget({transform:{translateX:5}});3467 }3468 this.blockOnclick=function() {3469 if (this.parentNode.parentNode.onchoose) this.parentNode.parentNode.onchoose(this.num);3470 }3471 }3472 function AnchorList(buildP) {3473 if (!buildP.size) buildP.size=20;3474 if (!buildP.widthA) buildP.widthA=140;3475 if (!buildP.space) buildP.space=0;3476 var target=ASElement({3477 nodeName:"div",3478 });3479 target.size=buildP.size;3480 target.blockNum=0;3481 target.space=buildP.space;3482 if (buildP.startBlock) target.blockNum=buildP.startBlock;3483 AnchorListList[AnchorListList.length]=target;3484 target.lightC=ASElement({3485 nodeName:"div",3486 style:{3487 position:"absolute",3488 width:19,3489 backgroundColor:"rgb(230,230,230)",3490 },3491 });3492 target.appendChild(target.lightC);3493 target.light=ASElement({3494 nodeName:"img",3495 src:ASGetSrcByName("anchorListLight"),3496 style:{3497 position:"absolute",3498 width:"100%",3499 },3500 onload:function() {3501 this.set({style:{height:this.naturalHeight}});3502 }3503 });3504 target.lightC.appendChild(target.light);3505 target.lightF=ASElement({3506 nodeName:"div",3507 style:{3508 position:"absolute",3509 width:"100%",3510 top:0,3511 },3512 });3513 target.lightC.appendChild(target.lightF);3514 target.lightE1=ASElement({3515 nodeName:"img",3516 src:ASGetSrcByName("anchorListEndCover"),3517 style:{3518 marginBottom:-2,3519 },3520 });3521 target.lightF.appendChild(target.lightE1);3522 target.lightL=[];3523 target.lightP=[];3524 for (var i=0;i<=buildP.block.length;i++) {3525 if (i!=0) {3526 target.lightP[i]=ASElement({3527 nodeName:"img",3528 src:ASGetSrcByName("anchorListPointCover"),3529 style:{3530 marginTop:-2,3531 marginBottom:-2,3532 },3533 });3534 target.lightF.appendChild(target.lightP[i]);3535 }3536 target.lightL[i]=ASElement({3537 nodeName:"img",3538 src:ASGetSrcByName("anchorListLineCover"),3539 style:{3540 width:"100%",3541 },3542 });3543 target.lightF.appendChild(target.lightL[i]);3544 }3545 target.lightE2=ASElement({3546 nodeName:"img",3547 src:ASGetSrcByName("anchorListEndCover"),3548 style:{3549 marginTop:-2,3550 marginBottom:-1,3551 transformOrigin:"50% 50%",3552 transform:{3553 rotate:180,3554 },3555 },3556 });3557 target.lightF.appendChild(target.lightE2);3558 target.blockC=ASElement({3559 nodeName:"div",3560 style:{3561 position:"relative",3562 top:buildP.size*1.1,3563 left:14,3564 },3565 });3566 target.appendChild(target.blockC);3567 target.block=[];3568 for (var i=0;i<buildP.block.length;i++) {3569 var alpha=0;3570 if (i==target.blockNum) alpha=1;3571 target.block[target.block.length]=ASElement({3572 nodeName:"div",3573 style:{3574 display:"block",3575 marginTop:buildP.size*0.2+target.space,3576 cursor:"pointer",3577 overflow:"hidden",3578 },3579 onmouseover:AnchorListStr.blockOnmouseover,3580 onmouseout:AnchorListStr.blockOnmouseout,3581 onmousedown:AnchorListStr.blockOnmousedown,3582 onmouseup:AnchorListStr.blockOnmouseup,3583 onclick:AnchorListStr.blockOnclick,3584 num:i,3585 });3586 var block=target.block[target.block.length-1];3587 target.blockC.appendChild(block);3588 block.bottom=ASElement({3589 nodeName:"div",3590 style:{3591 position:"relative",3592 borderRadius:"0 "+buildP.size*0.3+"px "+buildP.size*0.3+"px 0",3593 backgroundColor:"rgb(240,0,0)",3594 width:"100%",3595 height:"100%",3596 opacity:alpha,3597 },3598 })3599 block.appendChild(block.bottom);3600 block.content=ASElement({3601 nodeName:"div",3602 style:{3603 position:"relative",3604 left:0,3605 width:"100%",3606 },3607 });3608 block.appendChild(block.content);3609 block.word=ASElement({3610 nodeName:"div",3611 style:{3612 position:"relative",3613 top:-target.size*0.12,3614 left:target.size*0.1,3615 marginLeft:buildP.size*0.2,3616 marginRight:buildP.size*0.6,3617 }3618 });3619 block.content.appendChild(block.word);3620 block.wordR=BasicWord({3621 size:buildP.size,3622 sizeE:buildP.size*0.8,3623 wordC:buildP.block[i].wordC,3624 wordE:buildP.block[i].wordE,3625 color:"rgb(200,0,0)",3626 style:{3627 maxWidth:buildP.widthA-40,3628 display:"block",3629 pointerEvents:"none",3630 }3631 });3632 block.word.appendChild(block.wordR);3633 block.wordW=BasicWord({3634 size:buildP.size,3635 sizeE:buildP.size*0.8,3636 wordC:buildP.block[i].wordC,3637 wordE:buildP.block[i].wordE,3638 color:"white",3639 style:{3640 top:0,3641 position:"absolute",3642 opacity:alpha,3643 maxWidth:buildP.widthA-40,3644 pointerEvents:"none",3645 },3646 });3647 block.word.appendChild(block.wordW);3648 }3649 target.resize=AnchorListStr.resize;3650 target.resize();3651 target.changeBlock=AnchorListStr.changeBlock;3652 delete buildP.block;3653 target.set(buildP);3654 return(target);3655 }3656 var PageListStr=new function() {3657 PageListList=[];3658 this.resize=function() {3659 for (var i=0;i<this.block.length;i++) {3660 this.block[i].set({style:{3661 height:ASGetElementHeight(this.block[i].wordR)+15,3662 }});3663 this.block[i].word.set({style:{3664 top:-ASGetElementHeight(this.block[i].wordR)-7.5,3665 }});3666 }3667 }3668 this.changeBlock=function(w) {3669 if (this.blockNum==w) return;3670 for (var i=0;i<this.block.length;i++) {3671 if (i==w) continue;3672 this.block[i].bottom.setTarget({opacity:0});3673 this.block[i].wordW.setTarget({opacity:0});3674 }3675 this.block[w].bottom.setTarget({opacity:1});3676 this.block[w].wordW.setTarget({opacity:1});3677 this.blockNum=w;3678 }3679 this.blockOnmouseover=function() {3680 this.word.setTarget({transform:{translateX:5}});3681 }3682 this.blockOnmouseout=function() {3683 this.word.setTarget({transform:{translateX:0}});3684 }3685 this.blockOnmousedown=function() {3686 this.word.setTarget({transform:{translateX:2}});3687 }3688 this.blockOnmouseup=function() {3689 this.word.setTarget({transform:{translateX:5}});3690 }3691 this.blockOnclick=function() {3692 if (this.parentNode.onchoose) this.parentNode.onchoose(this.num);3693 this.parentNode.changeBlock(this.num);3694 }3695 }3696 function PageList(buildP) {3697 if (!buildP.size) buildP.size=24;3698 if (!buildP.widthA) buildP.widthA=140;3699 var target=ASElement({3700 nodeName:"div",3701 style:{3702 width:buildP.widthA,3703 },3704 });3705 PageListList[PageListList.length]=target;3706 target.block=[];3707 for (var i=0;i<buildP.block.length;i++) {3708 target.appendChild(ASElement({3709 nodeName:"img",3710 src:ASGetSrcByName("pageListLine"),3711 style:{3712 width:"100%",3713 },3714 }));3715 target.block[i]=ASElement({3716 nodeName:"div",3717 style:{3718 cursor:"pointer",3719 },3720 onmouseover:PageListStr.blockOnmouseover,3721 onmouseout:PageListStr.blockOnmouseout,3722 onmousedown:PageListStr.blockOnmousedown,3723 onmouseup:PageListStr.blockOnmouseup,3724 onclick:PageListStr.blockOnclick,3725 num:i,3726 value:buildP.block[i],3727 });3728 target.appendChild(target.block[i]);3729 var block=target.block[i];3730 block.bottom=ASElement({3731 nodeName:"img",3732 src:ASGetSrcByName("pageListBlock"),3733 style:{3734 width:"100%",3735 height:"100%",3736 opacity:0,3737 },3738 });3739 block.appendChild(block.bottom);3740 block.word=ASElement({3741 nodeName:"div",3742 style:{3743 position:"relative",3744 left:12,3745 },3746 });3747 block.appendChild(block.word);3748 block.wordR=BasicWord({3749 size:buildP.size,3750 sizeE:buildP.size*0.75,3751 color:"rgb(200,0,0)",3752 wordC:buildP.block[i].nameC,3753 wordE:buildP.block[i].nameE,3754 style:{3755 maxWidth:buildP.widthA-20,3756 display:"block",3757 pointerEvents:"none",3758 },3759 });3760 block.word.appendChild(block.wordR);3761 block.wordW=BasicWord({3762 size:buildP.size,3763 sizeE:buildP.size*0.75,3764 color:"white",3765 wordC:buildP.block[i].nameC,3766 wordE:buildP.block[i].nameE,3767 style:{3768 position:"absolute",3769 top:0,3770 maxWidth:buildP.widthA-20,3771 opacity:0,3772 cursor:"pointer",3773 pointerEvents:"none",3774 },3775 });3776 block.word.appendChild(block.wordW);3777 }3778 target.appendChild(ASElement({3779 nodeName:"img",3780 src:ASGetSrcByName("pageListLine"),3781 style:{3782 width:"100%",3783 },3784 }));3785 target.resize=PageListStr.resize;3786 target.resize();3787 target.changeBlock=PageListStr.changeBlock;3788 target.changeBlock(0);3789 delete buildP.block;3790 target.set(buildP);3791 return(target);3792 }3793 var HeadIconStr=new function() {3794 this.onmouseover=function() {3795 this.setTarget({transform:{scale:1}});3796 this.pic.setTarget({opacity:1});3797 this.wMouseOver=true;3798 INTERFACE_L.head.changeLabel(this);3799 }3800 this.onmouseout=function() {3801 this.setTarget({transform:{scale:1}});3802 this.pic.setTarget({opacity:0});3803 this.wMouseOver=false;3804 INTERFACE_L.head.changeLabel(null);3805 }3806 this.onmousedown=function() {3807 this.setTarget({transform:{scale:0.9}});3808 this.pic.setTarget({opacity:1});3809 }3810 this.onmouseup=function() {3811 this.setTarget({transform:{scale:1}});3812 this.pic.setTarget({opacity:1});3813 }3814 this.onclick=function() {3815 this.onmouseout();3816 changeURL(this.linkTo);3817 }3818 }3819 function HeadIcon(buildP) {3820 var target=ASElement({3821 nodeName:"div",3822 style:{3823 width:DEFAULT_HEAD_ICON_SIZE,3824 height:DEFAULT_HEAD_ICON_SIZE,3825 backgroundImage:"url('"+buildP.src+".png"+"')",3826 backgroundSize:"100% 100%",3827 transformOrigin:"50% 50%",3828 cursor:"pointer",3829 },3830 });3831 target.pic=ASElement({3832 nodeName:"img",3833 src:buildP.src+"L.png",3834 style:{3835 opacity:0,3836 width:"100%",3837 height:"100%",3838 cursor:"pointer",3839 },3840 });3841 target.appendChild(target.pic);3842 if (buildP.nameC) {3843 target.word=BasicWord({3844 wordC:buildP.nameC,3845 wordE:buildP.nameE,3846 color:"white",3847 style:{3848 pointerEvents:"none",3849 },3850 });3851 }3852 if (buildP.hyperlink) {3853 target.region=ASElement({3854 nodeName:"a",3855 href:buildP.hyperlink,3856 target:"_blank",3857 });3858 target.appendChild(target.region);3859 target.region.appendChild(target.pic);3860 }3861 target.onmouseover=HeadIconStr.onmouseover;3862 target.onmouseout=HeadIconStr.onmouseout;3863 target.onmousedown=HeadIconStr.onmousedown;3864 target.onmouseup=HeadIconStr.onmouseup;3865 if (buildP.linkTo) target.onclick=HeadIconStr.onclick;3866 target.set(buildP);3867 return(target);3868 }3869 //Component(end)3870 function ASInitialize() {3871 UserDataList=[3872 "user",3873 "ticket",3874 "target",3875 "studentID",3876 "place",3877 "post",3878 "name",3879 "nickname",3880 "sex",3881 "phone",3882 "school",3883 "enroll",3884 "addEnroll",3885 "payto",3886 ];3887 USERDATA="NULL";3888 TARGETDATA="NULL";3889 FUNCDATA=[];3890 RequestTargetDataCallbackS=null;3891 RequestTargetDataCallbackF=null;3892 FUNCDATA={};3893 RequestFunctionDataCallbackS=null;3894 RequestFunctionDataCallbackF=null;3895 PostDataR={};3896 PostDataCallback=null;3897 JumpPros={};3898 JumpProsF={};3899 JumpProsL={};3900 var data=ASGetSourceByName("data0");3901 var data_head=data.getNodeByName("head");3902 var data_head_icon=data_head.getNodeByName("icon");3903 for (var i=0;i<data_head_icon.getNodeByName("left").node.length;i++) {3904 ASAddASourceName({name:"icon_"+data_head_icon.getNodeByName("left").node[i].getAttribute("name"),src:data_head_icon.getAttribute("root")+data_head_icon.getNodeByName("left").node[i].getAttribute("name")+".png"});3905 ASAddASourceName({name:"icon_"+data_head_icon.getNodeByName("left").node[i].getAttribute("name")+"L",src:data_head_icon.getAttribute("root")+data_head_icon.getNodeByName("left").node[i].getAttribute("name")+"L.png"});3906 }3907 for (var i=0;i<data_head_icon.getNodeByName("right").node.length;i++) {3908 ASAddASourceName({name:"icon_"+data_head_icon.getNodeByName("right").node[i].getAttribute("name"),src:data_head_icon.getAttribute("root")+data_head_icon.getNodeByName("right").node[i].getAttribute("name")+".png"});3909 ASAddASourceName({name:"icon_"+data_head_icon.getNodeByName("right").node[i].getAttribute("name")+"L",src:data_head_icon.getAttribute("root")+data_head_icon.getNodeByName("right").node[i].getAttribute("name")+"L.png"});3910 }3911 var data_cardBoard=data.getNodeByName("cardBoard");3912 ASAddASourceBuild({src:data_cardBoard.getAttribute("sceneRoot")+data_cardBoard.getNodeByName("main").getAttribute("scene")});3913 for (var i=0;i<data_cardBoard.node.length;i++) {3914 var cardBoard=data_cardBoard.node[i];3915 for (var j=0;j<cardBoard.getNodeByName("card").node.length;j++) {3916 var img=cardBoard.getNodeByName("card").node[j].getNodeByName("img");3917 ASAddASourceName({src:img.getAttribute("root")+img.node[0].getAttribute("name")});3918 }3919 }3920 for (var i=0;i<data_cardBoard.node.length;i++) {3921 if (data_cardBoard.node[i].nodeName=="main") continue;3922 ASAddASourceWait({src:data_cardBoard.getAttribute("sceneRoot")+data_cardBoard.node[i].getAttribute("scene")});3923 }3924 var data_frame=data.getNodeByName("frame");3925 for (var i=0;i<data_frame.node.length;i++) {3926 ASAddASourceBuild({src:data_frame.node[i].getAttribute("titleImg")});3927 ASAddASourceBuild({src:data_frame.node[i].getAttribute("titleImg").replace("title","title2")});3928 if (data_frame.node[i].getAttribute("scene")) {3929 ASAddASourceWait({src:data_frame.getAttribute("sceneRoot")+data_frame.node[i].getAttribute("scene")});3930 }3931 }3932 var data_functionC=data.getNodeByName("functionC");3933 // console.log(data_functionC.getAttribute("root"));3934 for (var i=0;i<data_functionC.node.length;i++) {3935 var src = data_functionC.getAttribute("root")+ data_functionC.node[i].getAttribute("img");3936 // var src=data_functionC.node[i].getNodeByName("imgB").getAttribute("root")+"(1).jpg";3937 ASAddASourceName({src:src});3938 }3939 var data_sponsor=data.getNodeByName("sponsor");3940 for (var i=0;i<data_sponsor.node.length;i++) {3941 var src=data_sponsor.getAttribute("root")+data_sponsor.node[i].getAttribute("pic");3942 ASAddASourceWait({src:src});3943 }3944 DEFAULT_LANG="C";3945 DEFAULT_FONT="Microsoft Yahei";3946 if (ASDetectFont("Microsoft Yahei")) {3947 DEFAULT_FONTLIST=[3948 ["Microsoft Yahei","微軟雅黑",1],3949 ["SimHei","黑體",1],3950 ["SimSun","宋體",1],3951 ["KaiTi","楷體",1],3952 ["Arial","Arial",1],3953 ["Verdana","Verdana",0.95],3954 ["Times New Roman","Times New Roman",0.95],3955 ["Comic Sans MS","Comic Sans MS",0.85],3956 ];3957 } else {3958 DEFAULT_FONT="Microsoft Yahei";3959 DEFAULT_FONTLIST=[3960 ["STHeiti","黑體",1],3961 ["STSong","宋體",1],3962 ["BiauKai","楷體",1],3963 ["Arial","Arial",1],3964 ["Verdana","Verdana",0.95],3965 ["Times New Roman","Times New Roman",0.95],3966 ["Comic Sans MS","Comic Sans MS",0.85],3967 ];3968 }3969 if (ASBrowser=="Mobile") {3970 DEFAULT_FONT="Droid Sans Fallback";3971 }3972 DEFAULT_WORD_WIDTH=180;3973 DEFAULT_SCROLLBAR_WIDTH=15;3974 DEFAULT_ROLLBAR_WIDTH=7;3975 DEFAULT_TOPLOGO_WIDTH=606;3976 DEFAULT_TOPLOGO_HEIGHT=231;3977 DEFAULT_USER_IMG_WIDTH=121;3978 DEFAULT_USER_IMG_HEIGHT=150;3979 DEFAULT_CARDBOARD_WIDTH_L=100;3980 DEFAULT_CARDBOARD_HEIGHT_L=100;3981 DEFAULT_CARDBOARD_SPACE=10;3982 DEFAULT_CARD_RADIUS=2;3983 DEFAULT_FLASHIMG_TIMESPACE=6000;3984 DEFAULT_SEARCHER_SIZE=60;3985 DEFAULT_SEARCHER_RADIUS=6;3986 DEFAULT_SEARCHER_SPACE=8;3987 DEFAULT_CARDBOARD_APPEAR_WAITING=7;3988 DEFAULT_SCENE=data_cardBoard.getAttribute("sceneRoot")+data_cardBoard.getNodeByName("main").getAttribute("scene");3989 DEFAULT_CARDBOARD_BACK_X=15;3990 DEFAULT_CARDBOARD_BACK_Y=11;3991 DEFAULT_HEAD_HEIGHT=45;3992 DEFAULT_HEAD_ICON_SIZE=42;3993 DEFAULT_NOTICE_WIDTH=500;3994 DEFAULT_SHELL_WIDTH=870;3995 DEFAULT_SHELL_HEAD_HEIGHT=150;3996 DEFAULT_SHELL_CLOSE_SIZE=45;3997 DEFAULT_SHELL_BOTTOM_HEIGHT=65;3998 DEFAULT_FRAME_WIDTH=1064;3999 DEFAULT_FRAME_HEAD_MINHEIGHT=160;4000 DEFAULT_FRAME_LINK_HEIGHT=45;4001 DEFAULT_FRAME_JUMP_WIDTHL=30;4002 DEFAULT_FRAME_JUMP_WIDTHA=145;4003 DEFAULT_FRAME_BOTTOM_HEIGHT=80;4004 DEFAULT_PAGE_WIDTH=870;4005 DEFAULT_PAGE_WIDTHH=975;4006 DEFAULT_PAGE_WIDTHM=910;4007 DEFAULT_PAGE_WIDTHL=770;4008 DEFAULT_EDITOR_ICON_SIZE0=98;4009 DEFAULT_EDITOR_ICON_SIZE=45;4010 VERTICAL_SHELL_WIDTH=820;4011 VERTICAL_SHELL_HEAD_HEIGHT=250;4012 VERTICAL_SHELL_CLOSE_SIZE=80;4013 VERTICAL_SHELL_BOTTOM_HEIGHT=80;4014 VERTICAL_HEAD_HEIGHT=80;4015 VERTICAL_HEAD_ICON_SIZE=72;4016 VERTICAL_FRAME_WIDTH=980;4017 VERTICAL_FRAME_HEAD_MINHEIGHT=260;4018 VERTICAL_FRAME_DIVIDEBAR_HEIGHT=20;4019 VERTICAL_FRAME_LINK_HEIGHT=75;4020 VERTICAL_FRAME_JUMP_WIDTHL=30;4021 VERTICAL_FRAME_JUMP_WIDTHA=260;4022 VERTICAL_FRAME_BOTTOM_HEIGHT=80;4023 VERTICAL_PAGE_WIDTH=900;4024 VERTICAL_PAGE_WIDTHH=950;4025 VERTICAL_PAGE_WIDTHL=800;4026 }4027 function buildScene() {4028 SCENE=ASElement({4029 nodeName:"div",4030 style:{4031 position:"absolute",4032 },4033 });4034 SCENE.currentPic="main.png";4035 SCENE.pic0=ASElement({4036 nodeName:"img",4037 src:"Image/Scene/main.png",4038 onload:function() {4039 SCENE.reload(this.src);4040 },4041 });4042 SCENE.picF=ASElement({4043 nodeName:"div",4044 });4045 SCENE.appendChild(SCENE.picF);4046 SCENE.copyright=ASElement({4047 nodeName:"p",4048 innerHTML:"©2019-2020 Chinese Folk Art Society, HKUSTSU. All Right Reserved.",4049 style:{4050 position:"absolute",4051 transformOrigin:"50% 100%",4052 fontFamily:DEFAULT_FONT,4053 fontSize:15,4054 color:"white",4055 width:1000,4056 left:ASWindowWidth/2-500,4057 top:ASWindowHeight-30,4058 textAlign:"center",4059 textShadow:"2px 2px 5px rgba(0,0,0,0.8)",4060 pointerEvents:"none",4061 },4062 });4063 SCENE.appendChild(SCENE.copyright);4064 if (ASVersion=="vertical") SCENE.copyright.set({style:{transform:{scale:1.6}}});4065 SCENE.reload=function(src) {4066 if (this.pic) {4067 this.picF.removeChild(this.pic);4068 this.pic0=this.pic;4069 this.pic=null;4070 }4071 ROOT.set({style:{4072 backgroundImage:"url("+src+")",4073 }});4074 this.resize();4075 }4076 SCENE.resize=function() {4077 var width=ASWindowWidth,height=ASWindowHeight;4078 var scale=Math.max(width/this.pic0.naturalWidth,height/this.pic0.naturalHeight);4079 ROOT.set({style:{4080 width:width,4081 height:height,4082 backgroundSize:this.pic0.naturalWidth*scale+"px "+this.pic0.naturalHeight*scale+"px",4083 backgroundPosition:"center",4084 }});4085 if (this.pic) {4086 var scale=Math.max(width/this.pic.naturalWidth,height/this.pic.naturalHeight);4087 this.pic.set({wPrint:true,style:{4088 left:(width-this.pic.naturalWidth*scale)/2,4089 top:(height-this.pic.naturalHeight*scale)/2,4090 width:this.pic.naturalWidth*scale,4091 height:this.pic.naturalHeight*scale,4092 }});4093 }4094 this.copyright.set({style:{4095 left:ASWindowWidth/2-500,4096 top:ASWindowHeight-30,4097 }});4098 }4099 SCENE.changeVersion=function() {4100 if (ASVersion=="horizon") {4101 this.copyright.set({style:{transform:{scale:1}}});4102 } else {4103 this.copyright.set({style:{transform:{scale:1.6}}});4104 }4105 }4106 SCENE.nextAppear=function() {4107 this.setTimeout(function() {this.pic.setTarget({4108 opacity:1,4109 speed_alpha:0.05,4110 });},10);4111 this.resize();4112 this.setTimeout(function() {4113 if (!this.pic) return;4114 this.reload(this.pic.src);4115 },1000);4116 }4117 SCENE.change=function(pic) {4118 if (pic==this.currentPic) return;4119 this.currentPic=pic;4120 if (this.pic) this.picF.removeChild(this.pic);4121 this.pic=ASElement({4122 nodeName:"img",4123 src:"Image/Scene/"+pic,4124 onload:function() {4125 SCENE.nextAppear();4126 },4127 style:{4128 position:"relative",4129 opacity:0,4130 },4131 });4132 this.picF.appendChild(this.pic);4133 }4134 ROOT.appendChild(SCENE);4135 }4136 function buildPage_News() {4137 PAGE["news"]=ASElement({4138 nodeName:"div",4139 wCenter:true,4140 style:{4141 width:DEFAULT_PAGE_WIDTHL,4142 marginBottom:30,4143 },4144 });4145 PAGE["news"].build=function() {4146 this.wBuild=true;4147 var y0=0;4148 var data=ASGetSourceByName("data0").getNodeByName("news");4149 this.block=[];4150 for (var i=0;i<data.node.length;i++) {4151 if (i>0) {4152 this.appendChild(ASElement({nodeName:"hr"}));4153 }4154 this.block[i]=ASElement({4155 nodeName:"div",4156 style:{4157 width:DEFAULT_PAGE_WIDTH,4158 marginTop:40,4159 marginBottom:40,4160 },4161 });4162 this.appendChild(this.block[i]);4163 var block=this.block[i];4164 block.titleF=BasicTitle({4165 size:28,4166 wordC:data.node[i].getAttribute("titleC"),4167 wordE:data.node[i].getAttribute("titleE"),4168 widthA:DEFAULT_PAGE_WIDTHL-150,4169 });4170 block.appendChild(block.titleF);4171 block.time=BasicWord({4172 size:25,4173 wordC:data.node[i].getAttribute("timeY")+"/"+data.node[i].getAttribute("timeD"),4174 color:"rgb(200,0,0)",4175 style:{4176 },4177 });4178 block.appendChild(block.time);4179 block.word=BasicWord({4180 size:24,4181 wordC:data.node[i].getAttribute("wordC"),4182 wordE:data.node[i].getAttribute("wordE"),4183 style:{4184 width:DEFAULT_PAGE_WIDTHL-40,4185 marginTop:20,4186 marginLeft:20,4187 },4188 });4189 block.appendChild(block.word);4190 this.anchor[i].pos0=y0;4191 this.anchor[i].pos1=y0+ASGetElementHeight(block);4192 y0+=ASGetElementHeight(block)+80;4193 }4194 }4195 var data=ASGetSourceByName("data0").getNodeByName("news");4196 var page=PAGE["news"];4197 page.anchor=[];4198 for (var i=0;i<data.node.length;i++) {4199 page.anchor[i]={4200 wordC:data.node[i].getAttribute("titleC"),4201 wordE:data.node[i].getAttribute("titleE"),4202 };4203 }4204 }4205 function buildPageV_News() {4206 PAGE_V["news"]=ASElement({4207 nodeName:"div",4208 wCenter:true,4209 style:{4210 width:VERTICAL_PAGE_WIDTHL,4211 marginBottom:30,4212 },4213 });4214 PAGE_V["news"].build=function() {4215 this.wBuild=true;4216 var y0=0;4217 var data=ASGetSourceByName("data0").getNodeByName("news");4218 this.block=[];4219 for (var i=0;i<data.node.length;i++) {4220 if (i>0) {4221 this.appendChild(ASElement({nodeName:"hr"}));4222 }4223 this.block[i]=ASElement({4224 nodeName:"div",4225 style:{4226 width:DEFAULT_PAGE_WIDTH,4227 marginTop:40,4228 marginBottom:40,4229 },4230 });4231 this.appendChild(this.block[i]);4232 var block=this.block[i];4233 block.titleF=BasicTitle({4234 size:60,4235 wordC:data.node[i].getAttribute("titleC"),4236 wordE:data.node[i].getAttribute("titleE"),4237 widthA:VERTICAL_PAGE_WIDTHL,4238 });4239 block.appendChild(block.titleF);4240 block.time=BasicWord({4241 size:40,4242 wordC:data.node[i].getAttribute("timeY")+"/"+data.node[i].getAttribute("timeD"),4243 color:"rgb(200,0,0)",4244 style:{4245 marginTop:20,4246 marginLeft:33,4247 },4248 });4249 block.appendChild(block.time);4250 block.word=BasicWord({4251 size:45,4252 wordC:data.node[i].getAttribute("wordC"),4253 wordE:data.node[i].getAttribute("wordE"),4254 style:{4255 width:DEFAULT_PAGE_WIDTHL-40,4256 marginTop:20,4257 marginLeft:20,4258 },4259 });4260 block.appendChild(block.word);4261 this.anchor[i].pos0=y0;4262 this.anchor[i].pos1=y0+ASGetElementHeight(block);4263 y0+=ASGetElementHeight(block)+80;4264 }4265 }4266 var data=ASGetSourceByName("data0").getNodeByName("news");4267 var page=PAGE_V["news"];4268 page.anchor=[];4269 for (var i=0;i<data.node.length;i++) {4270 page.anchor[i]={4271 wordC:data.node[i].getAttribute("titleC"),4272 wordE:data.node[i].getAttribute("titleE"),4273 };4274 }4275 }4276 function buildPage_FunctionC() {4277 // functionC (現在的活動的製作頁面)4278 PAGE["functionC"]=ASElement({4279 nodeName:"div",4280 style:{4281 width:DEFAULT_PAGE_WIDTH,4282 marginTop:30,4283 marginBottom:20,4284 },4285 });4286 PAGE["functionC"].build=function() {4287 this.wBuild=true;4288 var data=ASGetSourceByName("data0").getNodeByName("functionC");4289 this.block=[];4290 for (var i=0;i<data.node.length;i++) {4291 this.block[this.block.length]=ASElement({4292 nodeName:"div",4293 style:{4294 position:"relative",4295 width:DEFAULT_PAGE_WIDTH,4296 height:360,4297 },4298 });4299 var block=this.block[this.block.length-1];4300 this.appendChild(block);4301 // 标题4302 block.titleC=ASElement({4303 nodeName:"div",4304 style:{4305 minWidth:300,4306 height:40,4307 backgroundColor:"rgb(220,0,0)",4308 borderRadius:"0 4px 4px 0",4309 boxShadow:"3px 3px 5px rgba(0,0,0,0.8)",4310 cursor:"default",4311 paddingRight:40,4312 },4313 // 获取活动名字,存到funcName4314 funcName:data.node[i].getAttribute('name'),4315 onmouseover:function() {4316 // this.word.setTarget({transform:{translateX:5}});4317 },4318 onmouseout:function() {4319 // this.word.setTarget({transform:{translateX:0}});4320 },4321 onmousedown:function() {4322 // this.word.setTarget({transform:{translateX:2}});4323 },4324 onmouseup:function() {4325 // this.word.setTarget({transform:{translateX:5}});4326 },4327 onclick:function() {4328 // changeURL(this.funcName);4329 },4330 });4331 block.appendChild(block.titleC);4332 block.titleC.word=BasicWord({4333 size:26,4334 color:"white",4335 wordC:data.node[i].getAttribute("nameC"),4336 wordE:data.node[i].getAttribute("nameE"),4337 width:"max",4338 style:{4339 position:"relative",4340 left:20,4341 top:3.5,4342 pointerEvents:"none",4343 },4344 });4345 block.titleC.appendChild(block.titleC.word);4346 block.enroll=ASElement({4347 nodeName:"div",4348 style:{4349 position:"relative",4350 width:DEFAULT_PAGE_WIDTH-ASGetElementWidth(block.titleC)-10,4351 height:28,4352 },4353 });4354 block.appendChild(block.enroll);4355 block.enroll.pic=ASElement({4356 nodeName:"div",4357 style:{4358 position:"absolute",4359 height:45,4360 left:30,4361 },4362 });4363 block.enroll.appendChild(block.enroll.pic);4364 var name=data.node[i].getAttribute("enroll");4365 var id=data.node[i].nodeName;4366 if (USERDATA!="NULL" && USERDATA.func[id]) {4367 if (USERDATA.func[id].status==",") name="paying";4368 if (USERDATA.func[id].status==".") name="success";4369 }4370 block.enroll.pic.appendChild(ASElement({4371 nodeName:"img",4372 src:ASGetSrcByName("enroll_"+name),4373 style:{4374 height:"100%",4375 },4376 }));4377 var wordC="",wordE="",color="";4378 switch (name) {4379 case "ban":4380 wordC="非報名活動";4381 wordE="Not available";4382 color="rgb(200,200,200)";4383 break;4384 case "past":4385 wordC="已結束";4386 wordE="Past";4387 color="rgb(150,150,150)";4388 break;4389 case "waiting":4390 color="rgb(200,0,0)";4391 wordC="即將到來";4392 wordE="Incoming";4393 break;4394 case "available":4395 wordC="快來報名!";4396 wordE="Sign Up Now!";4397 color="rgb(230,0,0)";4398 break;4399 case "full":4400 wordC="名額已滿";4401 wordE="Places are full";4402 color="rgb(230,0,0)";4403 break;4404 case "paying":4405 wordC="等待付款";4406 wordE="Paying";4407 color="rgb(200,0,0)";4408 break;4409 case "success":4410 wordC="已報名";4411 wordE="Registered";4412 color="rgb(0,200,0)";4413 break;4414 }4415 block.enroll.word=BasicWord({4416 size:25,4417 wordC:wordC,4418 wordE:wordE,4419 color:color,4420 style:{4421 position:"absolute",4422 left:80,4423 top:7,4424 },4425 });4426 block.enroll.appendChild(block.enroll.word);4427 block.date=BasicWord({4428 size:25,4429 color:"rgb(230,0,0)",4430 wordC:data.node[i].getAttribute("date"),4431 wordE:data.node[i].getAttribute("date"),4432 style:{4433 position:"absolute",4434 right:0,4435 top:5,4436 },4437 });4438 block.appendChild(block.date);4439 //介紹信息4440 block.intro=BasicWord({4441 size:22,4442 wordC:data.node[i].getAttribute("briefC"),4443 wordE:data.node[i].getAttribute("briefE"),4444 style:{4445 width:"48%",4446 marginLeft:30,4447 marginTop:20,4448 textAlign:"justify",4449 lineHeight:1.5,4450 },4451 });4452 block.appendChild(block.intro);4453 var img=[];4454 // var imgN=parseInt(data.node[i].getNodeByName("imgB").getAttribute("imgN"));4455 img[0] = data.getAttribute("root")+ data.node[i].getAttribute("img");4456 // var imageURL = ;4457 4458 // for (var j=1;j<=imgN;j++) {4459 // img[img.length]=data.node[i].getNodeByName("imgB").getAttribute("root")+"("+j+").jpg";4460 // }4461 block.imgC=ASElement({4462 nodeName:"div",4463 imageURL:data.getAttribute("root")+ data.node[i].getAttribute("img"),4464 imageNameC:data.getAttribute("root")+ data.node[i].getAttribute("nameC"),4465 imageNameE:data.getAttribute("root")+ data.node[i].getAttribute("nameE"),4466 style:{4467 float:"right",4468 width:390,4469 height:260,4470 marginTop:15,4471 },4472 onmouseover:function() {4473 this.style.cursor = 'pointer';4474 },4475 onclick:function() {4476 4477 changeURL("image?imageURL="+this.imageURL+"&nameC="+this.imageNameC+"&nameE="+this.imageNameE);4478 },4479 });4480 block.appendChild(block.imgC);4481 if (data.node[i].getAttribute("facebookL")) {4482 block.imgA=ASElement({4483 nodeName:"a",4484 href:data.node[i].getAttribute("facebookL").replace("%26","&"),4485 target:"_blank",4486 title:"facebook",4487 });4488 block.imgC.appendChild(block.imgA);4489 }4490 block.img=FlashImg({4491 type:"response",4492 widthA:390,4493 heightA:260,4494 imgSize:"intelligent", // 活動照片比例4495 img:img,4496 timeSpace:1500,4497 style:{4498 backgroundColor:"#fafafa",4499 },4500 });4501 if (data.node[i].getAttribute("facebookL")) block.imgA.appendChild(block.img);4502 else block.imgC.appendChild(block.img);4503 }4504 this.anchor=[];4505 var data=ASGetSourceByName("data0").getNodeByName("functionC");4506 for (var i=0;i<data.node.length;i++) {4507 this.anchor[i]={4508 wordC:data.node[i].getAttribute("nameC"),4509 wordE:data.node[i].getAttribute("nameE"),4510 pos0:i*ASGetElementHeight(this.block[i]),4511 pos1:(i+1)*ASGetElementHeight(this.block[i]),4512 };4513 }4514 }4515 PAGE["functionC"].anchor=[];4516 var data=ASGetSourceByName("data0").getNodeByName("functionC");4517 for (var i=0;i<data.node.length;i++) {4518 PAGE["functionC"].anchor[i]={4519 wordC:data.node[i].getAttribute("nameC"),4520 wordE:data.node[i].getAttribute("nameE"),4521 };4522 }4523 }4524 function buildPageV_FunctionC() {4525 PAGE_V["functionC"]=ASElement({4526 nodeName:"div",4527 style:{4528 width:VERTICAL_PAGE_WIDTH,4529 marginTop:30,4530 marginBottom:20,4531 },4532 });4533 PAGE_V["functionC"].build=function() {4534 this.wBuild=true;4535 var data=ASGetSourceByName("data0").getNodeByName("functionC");4536 this.block=[];4537 for (var i=0;i<data.node.length;i++) {4538 this.block[this.block.length]=ASElement({4539 nodeName:"div",4540 style:{4541 position:"relative",4542 width:VERTICAL_PAGE_WIDTH,4543 },4544 });4545 var block=this.block[this.block.length-1];4546 this.appendChild(block);4547 block.titleC=ASElement({4548 nodeName:"div",4549 style:{4550 position:"relative",4551 top:15,4552 minWidth:400,4553 height:80,4554 backgroundColor:"rgb(220,0,0)",4555 borderRadius:"0 4px 4px 0",4556 boxShadow:"3px 3px 5px rgba(0,0,0,0.8)",4557 cursor:"pointer",4558 paddingRight:40,4559 },4560 funcID:data.node[i].nodeName,4561 onmouseover:function() {4562 // this.word.setTarget({transform:{translateX:10}});4563 },4564 onmouseout:function() {4565 // this.word.setTarget({transform:{translateX:0}});4566 },4567 onmousedown:function() {4568 // this.word.setTarget({transform:{translateX:4}});4569 },4570 onmouseup:function() {4571 // this.word.setTarget({transform:{translateX:10}});4572 },4573 onclick:function() {4574 // changeURL(this.funcID);4575 },4576 });4577 block.appendChild(block.titleC);4578 block.titleC.word=BasicWord({4579 size:50,4580 color:"white",4581 wordC:data.node[i].getAttribute("nameC"),4582 wordE:data.node[i].getAttribute("nameE"),4583 width:"max",4584 style:{4585 position:"relative",4586 left:20,4587 top:5,4588 pointerEvents:"none",4589 },4590 });4591 block.titleC.appendChild(block.titleC.word);4592 block.date=BasicWord({4593 size:55,4594 color:"rgb(230,0,0)",4595 wordC:data.node[i].getAttribute("date"),4596 wordE:data.node[i].getAttribute("date"),4597 style:{4598 position:"absolute",4599 right:0,4600 top:17,4601 },4602 });4603 block.appendChild(block.date);4604 block.appendChild(ASElement("br"));4605 block.enroll=ASElement({4606 nodeName:"div",4607 style:{4608 marginTop:35,4609 marginleft:70,4610 height:56,4611 },4612 });4613 block.appendChild(block.enroll);4614 block.enroll.pic=ASElement({4615 nodeName:"div",4616 style:{4617 position:"absolute",4618 height:65,4619 left:25,4620 },4621 });4622 block.enroll.appendChild(block.enroll.pic);4623 var name=data.node[i].getAttribute("enroll");4624 if (USERDATA!="NULL" && USERDATA.func[data.node[i].nodeName]) {4625 if (USERDATA.func[data.node[i].nodeName].status==",") name="paying";4626 if (USERDATA.func[data.node[i].nodeName].status==".") name="success";4627 }4628 block.enroll.pic.appendChild(ASElement({4629 nodeName:"img",4630 src:ASGetSrcByName("enroll_"+name),4631 style:{4632 height:"100%",4633 },4634 }));4635 var wordC="",wordE="",color="";4636 switch (name) {4637 case "ban":4638 wordC="非報名活動";4639 wordE="Not available";4640 color="rgb(200,200,200)";4641 break;4642 case "past":4643 wordC="已結束";4644 wordE="Past";4645 color="rgb(150,150,150)";4646 break;4647 case "waiting":4648 color="rgb(200,0,0)";4649 wordC="即將到來";4650 wordE="Incoming";4651 break;4652 case "available":4653 wordC="快來報名!";4654 wordE="Sign Up Now!";4655 color="rgb(230,0,0)";4656 break;4657 case "paying":4658 wordC="等待付款";4659 wordE="Paying";4660 color="rgb(200,0,0)";4661 break;4662 case "success":4663 wordC="已報名";4664 wordE="Registered";4665 color="rgb(0,200,0)";4666 break;4667 }4668 block.enroll.word=BasicWord({4669 size:45,4670 wordC:wordC,4671 wordE:wordE,4672 color:color,4673 style:{4674 position:"relative",4675 marginLeft:80,4676 top:-3,4677 },4678 });4679 block.enroll.appendChild(block.enroll.word);4680 var img=[];4681 img[0] = data.getAttribute("root")+ data.node[i].getAttribute("img");4682 //-----4683 block.imgC=ASElement({4684 nodeName:"div",4685 style:{4686 width:750,4687 height:500,4688 marginTop:40,4689 marginLeft:90,4690 },4691 });4692 block.appendChild(block.imgC);4693 block.img=FlashImg({4694 widthA:750,4695 heightA:500,4696 imgSize:"intelligent",4697 img:img,4698 delay:(i-1)*250,4699 style:{4700 backgroundColor:"#fafafa",4701 },4702 });4703 block.imgC.appendChild(block.img);4704 block.intro=BasicWord({4705 size:45,4706 wordC:data.node[i].getAttribute("briefC"),4707 wordE:data.node[i].getAttribute("briefE"),4708 style:{4709 width:VERTICAL_PAGE_WIDTH-150,4710 marginLeft:90,4711 marginTop:40,4712 textAlign:"justify",4713 lineHeight:1.5,4714 },4715 });4716 block.appendChild(block.intro);4717 this.appendChild(ASElement({4718 nodeName:"hr",4719 style:{4720 marginTop:50,4721 marginBottom:20,4722 },4723 }));4724 }4725 this.anchor=[];4726 var data=ASGetSourceByName("data0").getNodeByName("functionC");4727 var y0=0;4728 for (var i=0;i<data.node.length;i++) {4729 this.anchor[i]={4730 wordC:data.node[i].getAttribute("nameC"),4731 wordE:data.node[i].getAttribute("nameE"),4732 pos0:y0,4733 pos1:y0+ASGetElementHeight(this.block[i]),4734 };4735 y0+=ASGetElementHeight(this.block[i])+72;4736 }4737 }4738 PAGE_V["functionC"].anchor=[];4739 var data=ASGetSourceByName("data0").getNodeByName("functionC");4740 for (var i=0;i<data.node.length;i++) {4741 PAGE_V["functionC"].anchor[i]={4742 wordC:data.node[i].getAttribute("nameC"),4743 wordE:data.node[i].getAttribute("nameE"),4744 };4745 }4746 }4747 // Brief4748 function buildPage_FunctionB() {4749 var data=ASGetSourceByName("data0").getNodeByName("functionC");4750 for (var o=0;o<data.node.length;o++) {4751 PAGE[data.node[o].nodeName+"Brief"]=ASElement({4752 nodeName:"div",4753 wCenter:true,4754 style:{4755 width:DEFAULT_PAGE_WIDTHL,4756 marginTop:30,4757 marginBottom:40,4758 },4759 o:o,4760 });4761 PAGE[data.node[o].nodeName+"Brief"].build=function() {4762 this.wBuild=true;4763 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];4764 this.title1=BasicTitle({4765 wordC:"活動信息",4766 wordE:"Information",4767 style:{4768 marginBottom:15,4769 },4770 });4771 this.appendChild(this.title1);4772 if (data.getAttribute("date")) {4773 this.date=BasicInput({4774 type:"text",4775 wordC:"日 期",4776 wordE:"Date",4777 text:[{4778 wordC:data.getAttribute("date"),4779 wordE:data.getAttribute("date"),4780 }],4781 style:{4782 marginLeft:30,4783 },4784 });4785 this.appendChild(this.date);4786 }4787 if (data.getAttribute("time")) {4788 this.time=BasicInput({4789 type:"text",4790 wordC:"時 間",4791 wordE:"Time",4792 text:[{4793 wordC:data.getAttribute("time"),4794 wordE:data.getAttribute("time"),4795 }],4796 style:{4797 marginLeft:30,4798 },4799 });4800 this.appendChild(this.time);4801 }4802 if (data.getAttribute("venue")) {4803 this.venue=BasicInput({4804 type:"text",4805 wordC:"地 點",4806 wordE:"Venue",4807 text:[{4808 wordC:data.getAttribute("venue"),4809 wordE:data.getAttribute("venue"),4810 }],4811 style:{4812 marginLeft:30,4813 },4814 });4815 this.appendChild(this.venue);4816 }4817 if(data.getAttribute("info")){4818 this.info=BasicInput({4819 type:"text",4820 wordC:"简 介",4821 wordE:"Brief",4822 text:[{4823 wordC:data.getAttribute("info"),4824 wordE:data.getAttribute("info"),4825 }],4826 style:{4827 marginLeft:30,4828 },4829 });4830 this.appendChild(this.info);4831 }4832 }4833 }4834 }4835 function buildPageV_FunctionB() {4836 var data=ASGetSourceByName("data0").getNodeByName("functionC");4837 for (var o=0;o<data.node.length;o++) {4838 PAGE_V[data.node[o].nodeName+"Brief"]=ASElement({4839 nodeName:"div",4840 wCenter:true,4841 style:{4842 width:DEFAULT_PAGE_WIDTHL,4843 marginTop:30,4844 marginBottom:40,4845 },4846 o:o,4847 });4848 PAGE_V[data.node[o].nodeName+"Brief"].build=function() {4849 this.wBuild=true;4850 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];4851 this.title1=BasicTitle({4852 size:60,4853 wordC:"活動信息",4854 wordE:"Information",4855 style:{4856 marginBottom:15,4857 },4858 });4859 this.appendChild(this.title1);4860 if (data.getAttribute("date")) {4861 this.date=BasicInput({4862 size:45,4863 type:"text",4864 wordC:"日 期",4865 wordE:"Date",4866 text:[{4867 wordC:data.getAttribute("date"),4868 wordE:data.getAttribute("date"),4869 }],4870 style:{4871 marginLeft:30,4872 },4873 });4874 this.appendChild(this.date);4875 }4876 if (data.getAttribute("time")) {4877 this.time=BasicInput({4878 size:45,4879 type:"text",4880 wordC:"時 間",4881 wordE:"Time",4882 text:[{4883 wordC:data.getAttribute("time"),4884 wordE:data.getAttribute("time"),4885 }],4886 style:{4887 marginLeft:30,4888 },4889 });4890 this.appendChild(this.time);4891 }4892 if (data.getAttribute("venue")) {4893 this.venue=BasicInput({4894 type:"text",4895 wordC:"地 點",4896 wordE:"Venue",4897 text:[{4898 wordC:data.getAttribute("venue"),4899 wordE:data.getAttribute("venue"),4900 }],4901 style:{4902 marginLeft:30,4903 },4904 });4905 this.appendChild(this.venue);4906 }4907 if (data.getAttribute("info")){4908 this.info=BasicInput({4909 type:"text",4910 wordC:"简 介",4911 wordE:"Brief",4912 text:[{4913 wordC:data.getAttribute("info"),4914 wordE:data.getAttribute("info"),4915 }],4916 style:{4917 marginLeft:30,4918 },4919 });4920 this.appendChild(this.info);4921 }4922 }4923 }4924 }4925 // 好像是个用来做 signup form 的4926 function buildPage_FunctionS() {4927 var data=ASGetSourceByName("data0").getNodeByName("functionC");4928 for (var o=0;o<data.node.length;o++) {4929 PAGE[data.node[o].nodeName+"Signup"]=ASElement({4930 nodeName:"div",4931 wCenter:true,4932 style:{4933 position:"relative",4934 width:DEFAULT_PAGE_WIDTHL,4935 marginTop:30,4936 marginBottom:30,4937 },4938 o:o,4939 funcID:data.node[o].nodeName,4940 });4941 var page=PAGE[data.node[o].nodeName+"Signup"];4942 page.appear=function() {4943 }4944 page.update=function() {4945 this.clearChild();4946 if (USERDATA=="NULL") {4947 this.appendChild(this.page[0]);4948 return;4949 }4950 if (USERDATA.place=="E") {4951 this.appendChild(this.page[2]);4952 } else {4953 this.appendChild(this.page[1]);4954 var page=this.page[1];4955 page.input["itsc"].setValue(USERDATA.user);4956 page.input["name"].setValue(USERDATA.name);4957 page.input["place"].setValue(USERDATA.place);4958 page.input["studentID"].setValue(USERDATA.studentID);4959 page.input["phone"].setValue(USERDATA.phone);4960 if (USERDATA.place!="N") {4961 page.input["studentID"].input.set({readOnly:true});4962 } else {4963 page.input["studentID"].input.set({readOnly:false});4964 }4965 if (USERDATA.func[this.funcID]) {4966 page.save.word.setWord({4967 wordC:"更 改",4968 wordE:"Update",4969 });4970 if (USERDATA.func[this.funcID].status==",") {4971 page.status.img.src=ASGetSrcByName("enroll_paying");4972 page.status.word.setWord({4973 wordC:"等待付款",4974 wordE:"Paying",4975 });4976 } else {4977 page.status.img.src=ASGetSrcByName("enroll_success");4978 page.status.word.setWord({4979 wordC:"已报名",4980 wordE:"Registered",4981 });4982 }4983 page.input["role"].setValue(USERDATA.func[this.funcID].role);4984 page.input["excoList"].setValue(USERDATA.func[this.funcID].payto);4985 } else {4986 page.save.word.setWord({4987 wordC:"提 交",4988 wordE:"Submit",4989 });4990 page.status.img.src=ASGetSrcByName("enroll_available");4991 page.status.word.setWord({4992 wordC:"正在報名",4993 wordE:"Registering",4994 });4995 }4996 }4997 this.dealFee();4998 this.setTimeout(function(){if (this.root) this.root.pageResize(this);},30);4999 }5000 page.dealFee=function() {5001 var page=this.page[1];5002 var place="N";5003 if (USERDATA!="NULL" && USERDATA.place!="N") place="M";5004 page.input["fee"].setValue(page.input["role"].getValue()+place);5005 if (page.input["fee"].text[page.input["fee"].textC].wordE=="Free") {5006 page.inputF.removeChild(page.input["payway"]);5007 page.inputF.removeChild(page.input["payway"].br);5008 page.inputF.removeChild(page.input["excoList"]);5009 page.inputF.removeChild(page.input["excoList"].br);5010 } else {5011 page.inputF.appendChild(page.input["payway"]);5012 page.inputF.appendChild(page.input["payway"].br);5013 page.inputF.appendChild(page.input["excoList"]);5014 page.inputF.appendChild(page.input["excoList"].br);5015 }5016 var page=this.page[2];5017 var place="N";5018 if (TARGETDATA!="NULL" && TARGETDATA.place!="N") place="M";5019 page.input["fee"].setValue(page.input["role"].getValue()+place);5020 if (page.input["fee"].text[page.input["fee"].textC].wordE=="Free") {5021 page.inputF.removeChild(page.input["payway"]);5022 page.inputF.removeChild(page.input["payway"].br);5023 } else {5024 page.inputF.appendChild(page.input["payway"]);5025 page.inputF.appendChild(page.input["payway"].br);5026 }5027 if (this.root) this.root.pageResize(this);5028 }5029 page.updateTargetData=function() {5030 if (USERDATA=="NULL" || USERDATA.place!="E") return;5031 var page=this.page[2];5032 if (TARGETDATA=="NULL") {5033 page.input["name"].setValue("");5034 page.input["studentID"].setValue("");5035 page.input["studentID"].input.set({readOnly:false});5036 page.input["phone"].setValue("");5037 page.input["place"].setValue("N");5038 } else {5039 page.input["name"].setValue(TARGETDATA.name);5040 page.input["studentID"].setValue(TARGETDATA.studentID);5041 if (TARGETDATA.place!="N") {5042 page.input["studentID"].input.set({readOnly:true});5043 } else {5044 page.input["studentID"].input.set({readOnly:false});5045 }5046 page.input["phone"].setValue(TARGETDATA.phone);5047 page.input["place"].setValue(TARGETDATA.place);5048 }5049 this.dealFee();5050 }5051 page.build=function() {5052 this.wBuild=true;5053 this.page=[];5054 this.page[0]=ASElement({5055 nodeName:"div",5056 root:this,5057 style:{5058 width:DEFAULT_PAGE_WIDTHL,5059 },5060 });5061 var page=this.page[0];5062 page.word=BasicWord({5063 size:60,5064 wordC:"請先登錄",5065 wordE:"Please log in first.",5066 style:{5067 width:"100%",5068 textAlign:"center",5069 marginTop:50,5070 },5071 });5072 page.appendChild(page.word);5073 page.log=BasicButton({5074 size:24,5075 wordC:"登 入",5076 wordE:"Log in",5077 wCenter:true,5078 style:{5079 marginTop:30,5080 },5081 onclick:function() {5082 changeURL("login");5083 },5084 });5085 page.appendChild(page.log);5086 this.page[1]=ASElement({5087 nodeName:"div",5088 root:this,5089 style:{5090 width:DEFAULT_PAGE_WIDTHL,5091 },5092 });5093 var page=this.page[1];5094 page.succeed=function(type) {5095 if (type=="user") {5096 this.succeedU=true;5097 }5098 if (type=="func") {5099 this.succeedS=true;5100 }5101 if (this.succeedU && this.succeedS) {5102 this.loading.succeed();5103 this.root.setTimeout(function() {5104 USERDATA.func[SignupPagePostFuncData_ID]=SignupPagePostFuncData_DATA;5105 delete PostDataR.banDefault;5106 postUserDataSucceed();5107 this.loading.end();5108 },1000);5109 }5110 }5111 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];5112 page.inputList=["itsc","name","studentID","phone","place","role","fee","payway","excoList"];5113 page.titleF=BasicTitle({5114 wordC:data.getAttribute("nameC")+" 報名表",5115 wordE:"Registration Form of<br>"+data.getAttribute("nameE"),5116 style:{5117 marginBottom:15,5118 },5119 });5120 page.appendChild(page.titleF);5121 page.status=ASElement({5122 nodeName:"div",5123 style:{5124 float:"right",5125 },5126 });5127 page.appendChild(page.status);5128 page.status.img=ASElement({5129 nodeName:"img",5130 style:{5131 height:45,5132 },5133 });5134 page.status.appendChild(page.status.img);5135 page.status.word=BasicWord({5136 size:28,5137 wordC:"aa",5138 wordE:"aa",5139 color:"rgb(230,0,0)",5140 style:{5141 position:"relative",5142 top:-10,5143 left:55144 },5145 });5146 page.status.appendChild(page.status.word);5147 page.input=[];5148 page.inputF=ASElement({5149 nodeName:"div",5150 });5151 page.appendChild(page.inputF);5152 for (var i=0;i<page.inputList.length;i++) {5153 var p={5154 model:page.inputList[i],5155 style:{5156 marginTop:2,5157 marginBottom:2,5158 marginLeft:30,5159 },5160 };5161 if (page.inputList[i]=="itsc") {5162 p.hintC="";5163 p.hintE="";5164 p.wReadonly=true;5165 p.wCompulsory=true;5166 }5167 if (page.inputList[i]=="name") {5168 p.hintC="例如:LI Hua";5169 p.hintE="E.g. Jarvis";5170 p.wCompulsory=true;5171 }5172 if (page.inputList[i]=="studentID") {5173 p.hintC="例如:20326666";5174 p.hintE="E.g. 20326666";5175 p.wCompulsory=true;5176 }5177 if (page.inputList[i]=="phone") {5178 p.hintC="例如:23586666";5179 p.hintE="E.g. 23586666";5180 p.wCompulsory=true;5181 }5182 if (page.inputList[i]=="role") {5183 p.model="";5184 p.type="radioPoint";5185 p.wordC="角 色";5186 p.wordE="Role";5187 p.root=page;5188 p.block=[];5189 var data1=data.getNodeByName("role");5190 for (var j=0;j<data1.node.length;j++) {5191 if (data1.node[j].getAttribute("counterOnly")) continue;5192 p.block[p.block.length]={5193 wordC:data1.node[j].getAttribute("nameC"),5194 wordE:data1.node[j].getAttribute("nameE"),5195 value:j,5196 }5197 }5198 p.onchoose=function() {5199 this.root.root.dealFee();5200 }5201 }5202 if (page.inputList[i]=="fee") {5203 p.wordC="費 用";5204 p.wordE="Fee";5205 p.model="";5206 p.type="text";5207 p.text=[];5208 var data1=data.getNodeByName("role");5209 for (var j=0;j<data1.node.length;j++) {5210 var str1C=data1.node[j].getAttribute("feeN");5211 var str1E=data1.node[j].getAttribute("feeN");5212 if (str1C=="0") {5213 str1C="免 費";5214 str1E="Free";5215 } else {5216 str1C+="HKD";5217 str1E+="HKD";5218 }5219 var str2C=data1.node[j].getAttribute("feeM");5220 var str2E=data1.node[j].getAttribute("feeM");5221 if (str2C=="0") {5222 str2C="免 費";5223 str2E="Free";5224 } else {5225 str2C+="HKD";5226 str2E+="HKD";5227 }5228 p.text[p.text.length]={5229 wordC:str1C,5230 wordE:str1E,5231 value:j+"N",5232 };5233 p.text[p.text.length]={5234 wordC:str2C,5235 wordE:str2E,5236 value:j+"M",5237 };5238 }5239 }5240 if (page.inputList[i]=="payway") {5241 p.value="N";5242 }5243 if (page.inputList[i]=="excoList") {5244 p.wordC="交 予";5245 p.wordE="Pay to";5246 p.firstBlock=3;5247 }5248 page.input[page.inputList[i]]=BasicInput(p);5249 page.inputF.appendChild(page.input[page.inputList[i]]);5250 page.input[page.inputList[i]].br=ASElement("br")5251 page.inputF.appendChild(page.input[page.inputList[i]].br);5252 }5253 if (page.input["fee"].text[page.input["fee"].textC].wordE=="Free") {5254 page.inputF.removeChild(page.input["payway"]);5255 page.inputF.removeChild(page.input["excoList"]);5256 }5257 if (data.getNodeByName("role").node.length<=1) {5258 page.inputF.removeChild(page.input["role"]);5259 }5260 page.loading=BasicLoading({5261 style:{5262 marginLeft:580,5263 width:44,5264 height:44,5265 },5266 });5267 page.appendChild(page.loading);5268 page.save=BasicButton({5269 size:24,5270 wordC:"提 交",5271 wordE:"Submit",5272 root:page,5273 style:{5274 marginTop:30,5275 marginLeft:30,5276 },5277 onclick:function() {5278 var wWrong=false;5279 for (var i=0;i<this.root.inputList.length;i++) {5280 if (this.root.input[this.root.inputList[i]].check) this.root.input[this.root.inputList[i]].check();5281 if (this.root.input[this.root.inputList[i]].wWrong) {5282 wWrong=true;5283 }5284 }5285 if (wWrong) return;5286 this.root.loading.restart();5287 this.root.loading.setTimeout(function(){this.start();},30);5288 this.root.succeedU=false;5289 this.root.succeedF=false;5290 var data={};5291 data.user=USERDATA.user;5292 data.ticket=USERDATA.ticket;5293 data.action="postUserData";5294 data.name=this.root.input["name"].getValue();5295 data.studentID=this.root.input["studentID"].getValue();5296 data.phone=this.root.input["phone"].getValue();5297 SignupPagePostFuncData_PAGE=this.root;5298 PostDataR=data;5299 PostDataR.banDefault=true;5300 sendAJAX({5301 type:"POST",5302 src:"cgi-bin/operateData.php",5303 data:data,5304 callback:"SignupPagePostFuncData_PAGE.succeed('user');",5305 });5306 var data={};5307 data.user=USERDATA.user;5308 data.ticket=USERDATA.ticket;5309 data.action="postUserFuncData";5310 data.id=this.root.root.funcID;5311 data.role=this.root.input["role"].getValue();5312 if (this.root.input["fee"].text[this.root.input["fee"].textC].wordE=="Free") {5313 data.status=".";5314 data.payto="free";5315 } else {5316 data.status=",";5317 data.payto=this.root.input["excoList"].getValue();5318 }5319 SignupPagePostFuncData_ID=data.id;5320 SignupPagePostFuncData_DATA={5321 id:data.id,5322 user:data.user,5323 status:data.status,5324 payto:data.payto,5325 role:data.role,5326 };5327 sendAJAX({5328 type:"POST",5329 src:"cgi-bin/operateData.php",5330 data:data,5331 callback:"SignupPagePostFuncData_PAGE.succeed('func');",5332 });5333 },5334 });5335 page.appendChild(page.save);5336 this.page[2]=ASElement({5337 nodeName:"div",5338 root:this,5339 style:{5340 width:DEFAULT_PAGE_WIDTHL,5341 },5342 });5343 var page=this.page[2];5344 page.succeed=function(type) {5345 if (type=="user") {5346 this.succeedU=true;5347 }5348 if (type=="func") {5349 this.succeedS=true;5350 }5351 if (this.succeedU && this.succeedS) {5352 this.loading.succeed();5353 }5354 }5355 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];5356 page.inputList=["itsc","name","studentID","phone","place","role","fee","payway"];5357 page.titleF=BasicTitle({5358 widthA:DEFAULT_PAGE_WIDTHL-300,5359 wordC:data.getAttribute("nameC")+" 報名表",5360 wordE:"Registration Form of<br>"+data.getAttribute("nameE"),5361 style:{5362 marginBottom:15,5363 },5364 });5365 page.appendChild(page.titleF);5366 page.input=[];5367 page.inputF=ASElement({5368 nodeName:"div",5369 });5370 page.appendChild(page.inputF);5371 for (var i=0;i<page.inputList.length;i++) {5372 var p={5373 model:page.inputList[i],5374 style:{5375 marginTop:2,5376 marginBottom:2,5377 marginLeft:30,5378 },5379 };5380 if (page.inputList[i]=="itsc") {5381 p.wCompulsory=true;5382 p.root=this;5383 p.onblur=function() {5384 if (!this.wWrong) {5385 SignupPageRequestTargetData_PAGE=this.root;5386 requestTargetData(this.input.value,"SignupPageRequestTargetData_PAGE.updateTargetData();");5387 }5388 }5389 }5390 if (page.inputList[i]=="name") {5391 p.hintC="例如:LI Hua";5392 p.hintE="E.g. Jarvis";5393 p.wCompulsory=true;5394 }5395 if (page.inputList[i]=="studentID") {5396 p.hintC="例如:20326666";5397 p.hintE="E.g. 20326666";5398 p.wCompulsory=true;5399 }5400 if (page.inputList[i]=="phone") {5401 p.hintC="例如:23586666";5402 p.hintE="E.g. 23586666";5403 p.wCompulsory=true;5404 }5405 if (page.inputList[i]=="role") {5406 p.model="";5407 p.type="radioPoint";5408 p.wordC="角 色";5409 p.wordE="Role";5410 p.root=page;5411 p.block=[];5412 var data1=data.getNodeByName("role");5413 for (var j=0;j<data1.node.length;j++) {5414 p.block[j]={5415 wordC:data1.node[j].getAttribute("nameC"),5416 wordE:data1.node[j].getAttribute("nameE"),5417 value:j,5418 }5419 }5420 p.onchoose=function() {5421 this.root.root.dealFee();5422 }5423 }5424 if (page.inputList[i]=="fee") {5425 p.wordC="費 用";5426 p.wordE="Fee";5427 p.model="";5428 p.type="text";5429 p.text=[];5430 var data1=data.getNodeByName("role");5431 for (var j=0;j<data1.node.length;j++) {5432 var str1C=data1.node[j].getAttribute("feeN");5433 var str1E=data1.node[j].getAttribute("feeN");5434 if (str1C=="0") {5435 str1C="免 費";5436 str1E="Free";5437 } else {5438 str1C+="HKD";5439 str1E+="HKD";5440 }5441 var str2C=data1.node[j].getAttribute("feeM");5442 var str2E=data1.node[j].getAttribute("feeM");5443 if (str2C=="0") {5444 str2C="免 費";5445 str2E="Free";5446 } else {5447 str2C+="HKD";5448 str2E+="HKD";5449 }5450 p.text[p.text.length]={5451 wordC:str1C,5452 wordE:str1E,5453 value:j+"N",5454 };5455 p.text[p.text.length]={5456 wordC:str2C,5457 wordE:str2E,5458 value:j+"M",5459 };5460 }5461 }5462 if (page.inputList[i]=="payway") {5463 p.value="E";5464 }5465 page.input[page.inputList[i]]=BasicInput(p);5466 page.inputF.appendChild(page.input[page.inputList[i]]);5467 page.input[page.inputList[i]].br=ASElement("br")5468 page.inputF.appendChild(page.input[page.inputList[i]].br);5469 }5470 page.switchLang=BasicButton({5471 size:24,5472 wordC:"English Version",5473 wordE:"切換至中文",5474 color:"rgb(240,240,240)",5475 colorL:"rgb(250,250,250)",5476 colorW:"rgb(230,0,0)",5477 style:{5478 position:"absolute",5479 top:0,5480 right:0,5481 },5482 onclick:function() {5483 if (ASLang=="C") setLang("E");5484 else setLang("C");5485 },5486 });5487 page.appendChild(page.switchLang);5488 page.loading=BasicLoading({5489 style:{5490 marginLeft:480,5491 width:44,5492 height:44,5493 },5494 });5495 page.appendChild(page.loading);5496 page.save=BasicButton({5497 size:24,5498 wordC:"提 交",5499 wordE:"Submit",5500 root:page,5501 style:{5502 marginTop:30,5503 marginLeft:20,5504 },5505 onclick:function() {5506 var wWrong=false;5507 for (var i=0;i<this.root.inputList.length;i++) {5508 if (this.root.input[this.root.inputList[i]].check) this.root.input[this.root.inputList[i]].check();5509 if (this.root.input[this.root.inputList[i]].wWrong) {5510 wWrong=true;5511 }5512 }5513 if (wWrong) return;5514 this.root.loading.restart();5515 this.root.loading.setTimeout(function(){this.start();},30);5516 this.root.succeedU=false;5517 this.root.succeedF=false;5518 var data={};5519 data.user=USERDATA.user;5520 data.ticket=USERDATA.ticket;5521 data.target=this.root.input["itsc"].getValue();5522 data.action="postTargetData";5523 data.name=this.root.input["name"].getValue();5524 data.studentID=this.root.input["studentID"].getValue();5525 data.phone=this.root.input["phone"].getValue();5526 SignupPagePostTargetFuncData_PAGE=this.root;5527 sendAJAX({5528 type:"POST",5529 src:"cgi-bin/operateData.php",5530 data:data,5531 callback:"SignupPagePostTargetFuncData_PAGE.succeed('user');",5532 });5533 var data={};5534 data.user=USERDATA.user;5535 data.ticket=USERDATA.ticket;5536 data.target=this.root.input["itsc"].getValue();5537 data.action="postTargetFuncData";5538 data.id=this.root.root.funcID;5539 data.role=this.root.input["role"].getValue();5540 data.status=".";5541 data.payto="counter";5542 sendAJAX({5543 type:"POST",5544 src:"cgi-bin/operateData.php",5545 data:data,5546 callback:"SignupPagePostTargetFuncData_PAGE.succeed('func');",5547 });5548 },5549 });5550 page.appendChild(page.save);5551 page.clear=BasicButton({5552 size:24,5553 wordC:"清 空",5554 wordE:"Clear",5555 color:"rgb(200,200,200)",5556 colorW:"black",5557 colorL:"rgb(230,230,230)",5558 root:page,5559 style:{5560 marginTop:30,5561 marginLeft:10,5562 },5563 onclick:function() {5564 TARGETDATA="NULL";5565 this.root.input["itsc"].setValue("");5566 this.root.input["name"].setValue("");5567 this.root.input["studentID"].setValue("");5568 this.root.input["phone"].setValue("");5569 this.root.input["place"].setValue("N");5570 this.root.input["role"].setValue(0);5571 this.root.root.dealFee();5572 this.root.loading.end();5573 },5574 });5575 page.appendChild(page.clear);5576 this.update();5577 }5578 }5579 }5580 function buildPageV_FunctionS() {5581 var data=ASGetSourceByName("data0").getNodeByName("functionC");5582 for (var o=0;o<data.node.length;o++) {5583 PAGE_V[data.node[o].nodeName+"Signup"]=ASElement({5584 nodeName:"div",5585 wCenter:true,5586 style:{5587 position:"relative",5588 width:VERTICAL_PAGE_WIDTHL,5589 marginTop:50,5590 marginBottom:50,5591 },5592 o:o,5593 funcID:data.node[o].nodeName,5594 });5595 var page=PAGE_V[data.node[o].nodeName+"Signup"];5596 page.appear=PAGE[data.node[o].nodeName+"Signup"].appear;5597 page.update=PAGE[data.node[o].nodeName+"Signup"].update;5598 page.dealFee=PAGE[data.node[o].nodeName+"Signup"].dealFee;5599 page.updateTargetData=PAGE[data.node[o].nodeName+"Signup"].updateTargetData;5600 page.build=function() {5601 this.wBuild=true;5602 this.page=[];5603 this.page[0]=ASElement({5604 nodeName:"div",5605 root:this,5606 style:{5607 width:VERTICAL_PAGE_WIDTHL,5608 },5609 });5610 var page=this.page[0];5611 page.word=BasicWord({5612 size:60,5613 wordC:"請先登錄",5614 wordE:"Please log in first.",5615 style:{5616 width:"100%",5617 textAlign:"center",5618 marginTop:50,5619 },5620 });5621 page.appendChild(page.word);5622 page.log=BasicButton({5623 size:45,5624 wordC:"登 入",5625 wordE:"Log in",5626 wCenter:true,5627 style:{5628 marginTop:30,5629 },5630 onclick:function() {5631 changeURL("login");5632 },5633 });5634 page.appendChild(page.log);5635 this.page[1]=ASElement({5636 nodeName:"div",5637 root:this,5638 style:{5639 width:VERTICAL_PAGE_WIDTHL,5640 },5641 });5642 var page=this.page[1];5643 page.succeed=function(type) {5644 if (type=="user") {5645 this.succeedU=true;5646 }5647 if (type=="func") {5648 this.succeedS=true;5649 }5650 if (this.succeedU && this.succeedS) {5651 this.loading.succeed();5652 this.root.setTimeout(function() {5653 USERDATA.func[SignupPagePostFuncData_ID]=SignupPagePostFuncData_DATA;5654 delete PostDataR.banDefault;5655 postUserDataSucceed();5656 this.loading.end();5657 },1000);5658 }5659 }5660 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];5661 page.inputList=["itsc","name","studentID","phone","place","role","fee","payway","excoList"];5662 page.titleF=BasicTitle({5663 size:60,5664 wordC:data.getAttribute("nameC")+" 報名表",5665 wordE:"Registration Form of<br>"+data.getAttribute("nameE"),5666 style:{5667 marginBottom:15,5668 },5669 });5670 page.appendChild(page.titleF);5671 page.status=ASElement({5672 nodeName:"div",5673 style:{5674 float:"right",5675 },5676 });5677 page.appendChild(page.status);5678 page.status.img=ASElement({5679 nodeName:"img",5680 style:{5681 height:75,5682 },5683 });5684 page.status.appendChild(page.status.img);5685 page.status.word=BasicWord({5686 size:45,5687 wordC:"aa",5688 wordE:"aa",5689 color:"rgb(230,0,0)",5690 style:{5691 position:"relative",5692 top:-10,5693 left:55694 },5695 });5696 page.status.appendChild(page.status.word);5697 page.input=[];5698 page.inputF=ASElement({5699 nodeName:"div",5700 });5701 page.appendChild(page.inputF);5702 for (var i=0;i<page.inputList.length;i++) {5703 var p={5704 size:45,5705 model:page.inputList[i],5706 widthL:270,5707 widthA:VERTICAL_PAGE_WIDTHL,5708 style:{5709 marginTop:20,5710 marginBottom:2,5711 marginLeft:30,5712 },5713 };5714 if (page.inputList[i]=="itsc") {5715 p.hintC="";5716 p.hintE="";5717 p.wReadonly=true;5718 p.wCompulsory=true;5719 }5720 if (page.inputList[i]=="name") {5721 p.hintC="例如:LI Hua";5722 p.hintE="E.g. Jarvis";5723 p.wCompulsory=true;5724 }5725 if (page.inputList[i]=="studentID") {5726 p.hintC="例如:20326666";5727 p.hintE="E.g. 20326666";5728 p.wCompulsory=true;5729 }5730 if (page.inputList[i]=="phone") {5731 p.hintC="例如:23586666";5732 p.hintE="E.g. 23586666";5733 p.wCompulsory=true;5734 }5735 if (page.inputList[i]=="role") {5736 p.model="";5737 p.type="radioPoint";5738 p.wordC="角 色";5739 p.wordE="Role";5740 p.root=page;5741 p.block=[];5742 var data1=data.getNodeByName("role");5743 for (var j=0;j<data1.node.length;j++) {5744 if (data1.node[j].getAttribute("counterOnly")) continue;5745 p.block[p.block.length]={5746 wordC:data1.node[j].getAttribute("nameC"),5747 wordE:data1.node[j].getAttribute("nameE"),5748 value:j,5749 }5750 }5751 p.onchoose=function() {5752 this.root.root.dealFee();5753 }5754 }5755 if (page.inputList[i]=="fee") {5756 p.wordC="費 用";5757 p.wordE="Fee";5758 p.model="";5759 p.type="text";5760 p.text=[];5761 var data1=data.getNodeByName("role");5762 for (var j=0;j<data1.node.length;j++) {5763 var str1C=data1.node[j].getAttribute("feeN");5764 var str1E=data1.node[j].getAttribute("feeN");5765 if (str1C=="0") {5766 str1C="免 費";5767 str1E="Free";5768 } else {5769 str1C+="HKD";5770 str1E+="HKD";5771 }5772 var str2C=data1.node[j].getAttribute("feeM");5773 var str2E=data1.node[j].getAttribute("feeM");5774 if (str2C=="0") {5775 str2C="免 費";5776 str2E="Free";5777 } else {5778 str2C+="HKD";5779 str2E+="HKD";5780 }5781 p.text[p.text.length]={5782 wordC:str1C,5783 wordE:str1E,5784 value:j+"N",5785 };5786 p.text[p.text.length]={5787 wordC:str2C,5788 wordE:str2E,5789 value:j+"M",5790 };5791 }5792 }5793 if (page.inputList[i]=="payway") {5794 p.value="N";5795 }5796 if (page.inputList[i]=="excoList") {5797 p.wordC="交 予";5798 p.wordE="Pay to";5799 p.firstBlock=3;5800 }5801 page.input[page.inputList[i]]=BasicInput(p);5802 page.inputF.appendChild(page.input[page.inputList[i]]);5803 page.input[page.inputList[i]].br=ASElement("br")5804 page.inputF.appendChild(page.input[page.inputList[i]].br);5805 }5806 if (page.input["fee"].text[page.input["fee"].textC].wordE=="Free") {5807 page.inputF.removeChild(page.input["payway"]);5808 page.inputF.removeChild(page.input["excoList"]);5809 }5810 if (data.getNodeByName("role").node.length<=1) {5811 page.inputF.removeChild(page.input["role"]);5812 }5813 page.loading=BasicLoading({5814 style:{5815 marginLeft:430,5816 width:88,5817 height:88,5818 },5819 });5820 page.appendChild(page.loading);5821 page.save=BasicButton({5822 size:45,5823 wordC:"提 交",5824 wordE:"Submit",5825 root:page,5826 style:{5827 marginTop:30,5828 marginLeft:30,5829 },5830 onclick:function() {5831 var wWrong=false;5832 for (var i=0;i<this.root.inputList.length;i++) {5833 if (this.root.input[this.root.inputList[i]].check) this.root.input[this.root.inputList[i]].check();5834 if (this.root.input[this.root.inputList[i]].wWrong) {5835 wWrong=true;5836 }5837 }5838 if (wWrong) return;5839 this.root.loading.restart();5840 this.root.loading.setTimeout(function(){this.start();},30);5841 this.root.succeedU=false;5842 this.root.succeedF=false;5843 var data={};5844 data.user=USERDATA.user;5845 data.ticket=USERDATA.ticket;5846 data.action="postUserData";5847 data.name=this.root.input["name"].getValue();5848 data.studentID=this.root.input["studentID"].getValue();5849 data.phone=this.root.input["phone"].getValue();5850 SignupPagePostFuncData_PAGE=this.root;5851 PostDataR=data;5852 PostDataR.banDefault=true;5853 sendAJAX({5854 type:"POST",5855 src:"cgi-bin/operateData.php",5856 data:data,5857 callback:"SignupPagePostFuncData_PAGE.succeed('user');",5858 });5859 var data={};5860 data.user=USERDATA.user;5861 data.ticket=USERDATA.ticket;5862 data.action="postUserFuncData";5863 data.id=this.root.root.funcID;5864 data.role=this.root.input["role"].getValue();5865 if (this.root.input["fee"].text[this.root.input["fee"].textC].wordE=="Free") {5866 data.status=".";5867 data.payto="free";5868 } else {5869 data.status=",";5870 data.payto=this.root.input["excoList"].getValue();5871 }5872 SignupPagePostFuncData_ID=data.id;5873 SignupPagePostFuncData_DATA={5874 id:data.id,5875 user:data.user,5876 status:data.status,5877 payto:data.payto,5878 role:data.role,5879 };5880 sendAJAX({5881 type:"POST",5882 src:"cgi-bin/operateData.php",5883 data:data,5884 callback:"SignupPagePostFuncData_PAGE.succeed('func');",5885 });5886 },5887 });5888 page.appendChild(page.save);5889 this.page[2]=ASElement({5890 nodeName:"div",5891 root:this,5892 style:{5893 width:VERTICAL_PAGE_WIDTHL,5894 },5895 });5896 var page=this.page[2];5897 page.succeed=function(type) {5898 if (type=="user") {5899 this.succeedU=true;5900 }5901 if (type=="func") {5902 this.succeedS=true;5903 }5904 if (this.succeedU && this.succeedS) {5905 this.loading.succeed();5906 }5907 }5908 var data=ASGetSourceByName("data0").getNodeByName("functionC").node[this.o];5909 page.inputList=["itsc","name","studentID","phone","place","role","fee","payway"];5910 page.titleF=BasicTitle({5911 size:60,5912 widthA:VERTICAL_PAGE_WIDTH,5913 wordC:data.getAttribute("nameC")+" 報名表",5914 wordE:"Registration Form of<br>"+data.getAttribute("nameE"),5915 style:{5916 marginBottom:15,5917 },5918 });5919 page.appendChild(page.titleF);5920 page.input=[];5921 page.inputF=ASElement({5922 nodeName:"div",5923 });5924 page.appendChild(page.inputF);5925 for (var i=0;i<page.inputList.length;i++) {5926 var p={5927 size:50,5928 model:page.inputList[i],5929 widthL:270,5930 widthA:VERTICAL_PAGE_WIDTHL,5931 style:{5932 marginTop:20,5933 marginBottom:2,5934 marginLeft:30,5935 },5936 };5937 if (page.inputList[i]=="itsc") {5938 p.wCompulsory=true;5939 p.root=this;5940 p.onblur=function() {5941 if (!this.wWrong) {5942 SignupPageRequestTargetData_PAGE=this.root;5943 requestTargetData(this.input.value,"SignupPageRequestTargetData_PAGE.updateTargetData();");5944 }5945 }5946 }5947 if (page.inputList[i]=="name") {5948 p.hintC="例如:LI Hua";5949 p.hintE="E.g. Jarvis";5950 p.wCompulsory=true;5951 }5952 if (page.inputList[i]=="studentID") {5953 p.hintC="例如:20326666";5954 p.hintE="E.g. 20326666";5955 p.wCompulsory=true;5956 }5957 if (page.inputList[i]=="phone") {5958 p.hintC="例如:23586666";5959 p.hintE="E.g. 23586666";5960 p.wCompulsory=true;5961 }5962 if (page.inputList[i]=="role") {5963 p.model="";5964 p.type="radioPoint";5965 p.wordC="角 色";5966 p.wordE="Role";5967 p.root=page;5968 p.block=[];5969 var data1=data.getNodeByName("role");5970 for (var j=0;j<data1.node.length;j++) {5971 p.block[j]={5972 wordC:data1.node[j].getAttribute("nameC"),5973 wordE:data1.node[j].getAttribute("nameE"),5974 value:j,5975 }5976 }5977 p.onchoose=function() {5978 this.root.root.dealFee();5979 }5980 }5981 if (page.inputList[i]=="fee") {5982 p.wordC="費 用";5983 p.wordE="Fee";5984 p.model="";5985 p.type="text";5986 p.text=[];5987 var data1=data.getNodeByName("role");5988 for (var j=0;j<data1.node.length;j++) {5989 var str1C=data1.node[j].getAttribute("feeN");5990 var str1E=data1.node[j].getAttribute("feeN");5991 if (str1C=="0") {5992 str1C="免 費";5993 str1E="Free";5994 } else {5995 str1C+="HKD";5996 str1E+="HKD";5997 }5998 var str2C=data1.node[j].getAttribute("feeM");5999 var str2E=data1.node[j].getAttribute("feeM");6000 if (str2C=="0") {6001 str2C="免 費";6002 str2E="Free";6003 } else {6004 str2C+="HKD";6005 str2E+="HKD";6006 }6007 p.text[p.text.length]={6008 wordC:str1C,6009 wordE:str1E,6010 value:j+"N",6011 };6012 p.text[p.text.length]={6013 wordC:str2C,6014 wordE:str2E,6015 value:j+"M",6016 };6017 }6018 }6019 if (page.inputList[i]=="payway") {6020 p.value="E";6021 }6022 page.input[page.inputList[i]]=BasicInput(p);6023 page.inputF.appendChild(page.input[page.inputList[i]]);6024 page.input[page.inputList[i]].br=ASElement("br")6025 page.inputF.appendChild(page.input[page.inputList[i]].br);6026 }6027 page.loading=BasicLoading({6028 style:{6029 marginLeft:300,6030 width:88,6031 height:88,6032 },6033 });6034 page.appendChild(page.loading);6035 page.save=BasicButton({6036 size:45,6037 wordC:"提 交",6038 wordE:"Submit",6039 root:page,6040 style:{6041 marginTop:30,6042 marginLeft:20,6043 },6044 onclick:function() {6045 var wWrong=false;6046 for (var i=0;i<this.root.inputList.length;i++) {6047 if (this.root.input[this.root.inputList[i]].check) this.root.input[this.root.inputList[i]].check();6048 if (this.root.input[this.root.inputList[i]].wWrong) {6049 wWrong=true;6050 }6051 }6052 if (wWrong) return;6053 this.root.loading.restart();6054 this.root.loading.setTimeout(function(){this.start();},30);6055 this.root.succeedU=false;6056 this.root.succeedF=false;6057 var data={};6058 data.user=USERDATA.user;6059 data.ticket=USERDATA.ticket;6060 data.target=this.root.input["itsc"].getValue();6061 data.action="postTargetData";6062 data.name=this.root.input["name"].getValue();6063 data.studentID=this.root.input["studentID"].getValue();6064 data.phone=this.root.input["phone"].getValue();6065 SignupPagePostTargetFuncData_PAGE=this.root;6066 sendAJAX({6067 type:"POST",6068 src:"cgi-bin/operateData.php",6069 data:data,6070 callback:"SignupPagePostTargetFuncData_PAGE.succeed('user');",6071 });6072 var data={};6073 data.user=USERDATA.user;6074 data.ticket=USERDATA.ticket;6075 data.target=this.root.input["itsc"].getValue();6076 data.action="postTargetFuncData";6077 data.id=this.root.root.funcID;6078 data.role=this.root.input["role"].getValue();6079 data.status=".";6080 data.payto="counter";6081 sendAJAX({6082 type:"POST",6083 src:"cgi-bin/operateData.php",6084 data:data,6085 callback:"SignupPagePostTargetFuncData_PAGE.succeed('func');",6086 });6087 },6088 });6089 page.appendChild(page.save);6090 page.clear=BasicButton({6091 size:45,6092 wordC:"清 空",6093 wordE:"Clear",6094 color:"rgb(200,200,200)",6095 colorW:"black",6096 colorL:"rgb(230,230,230)",6097 root:page,6098 style:{6099 marginTop:30,6100 marginLeft:10,6101 },6102 onclick:function() {6103 TARGETDATA="NULL";6104 this.root.input["itsc"].setValue("");6105 this.root.input["name"].setValue("");6106 this.root.input["studentID"].setValue("");6107 this.root.input["phone"].setValue("");6108 this.root.input["place"].setValue("N");6109 this.root.input["role"].setValue(0);6110 this.root.root.dealFee();6111 this.root.loading.end();6112 },6113 });6114 page.appendChild(page.clear);6115 this.update();6116 }6117 }6118 }6119 // List6120 function buildPage_FunctionL() {6121 var data=ASGetSourceByName("data0").getNodeByName("functionC");6122 for (var o=0;o<data.node.length;o++) {6123 PAGE[data.node[o].nodeName+"List"]=ASElement({6124 nodeName:"div",6125 wCenter:true,6126 style:{6127 position:"relative",6128 width:DEFAULT_PAGE_WIDTHM,6129 marginTop:15,6130 marginBottom:30,6131 },6132 o:o,6133 funcID:data.node[o].nodeName,6134 });6135 PAGE[data.node[o].nodeName+"List"].updateList=function() {6136 var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);6137 var dataE=ASGetSourceByName("data0").getNodeByName("exco14");6138 this.list.clearRow();6139 for (var i=0;i<FUNCDATA.length;i++) {6140 var time=FUNCDATA[i].time;6141 var p={6142 time:{6143 listType:"basicWord",6144 wordE:time.substr(2,2)+"/"+time.substr(4,2)+" "+time.substr(6,2)+":"+time.substr(8,2)+":"+time.substr(10,2),6145 },6146 name:{6147 listType:"basicWord",6148 wordE:FUNCDATA[i].name,6149 },6150 place:{6151 listType:"basicWord",6152 wordC:"是",6153 wordE:"Yes",6154 },6155 role:{6156 listType:"basicWord",6157 wordC:data.getNodeByName("role").node[FUNCDATA[i].role].getAttribute("nameC"),6158 wordE:data.getNodeByName("role").node[FUNCDATA[i].role].getAttribute("nameE"),6159 },6160 extra:{6161 listType:"basicWord",6162 wordC:"&nbsp;",6163 wordE:"&nbsp;",6164 },6165 payto:{6166 listType:"basicWord",6167 wordC:"&nbsp;",6168 wordE:"&nbsp;",6169 },6170 wPay:{6171 listType:"basicWord",6172 wordC:"是",6173 wordE:"Yes",6174 }6175 };6176 if (FUNCDATA[i].place=="N") {6177 p.place.wordC="否";6178 p.place.wordE="No";6179 }6180 if (FUNCDATA[i].status==",") {6181 p.wPay.wordC="否";6182 p.wPay.wordE="No";6183 }6184 for (var j=0;j<dataE.node.length;j++) {6185 if (FUNCDATA[i].payto==dataE.node[j].getAttribute("itsc")) {6186 p.payto.wordC=dataE.node[j].getAttribute("nickname");6187 p.payto.wordE=dataE.node[j].getAttribute("nameE");6188 break;6189 }6190 }6191 if (FUNCDATA[i].payto==USERDATA.user) {6192 p.payto.wordC="我";6193 p.payto.wordE="Me";6194 p.wPay={6195 listType:"basicInput",6196 type:"radioPoint",6197 block:[{6198 wordC:"是",6199 wordE:"Yes",6200 value:"Yes",6201 },{6202 wordC:"否",6203 wordE:"No",6204 value:"No",6205 }],6206 space:30,6207 widthA:80,6208 style:{6209 left:15,6210 },6211 funcID:FUNCDATA[i].id,6212 funcTarget:FUNCDATA[i].user,6213 onchoose:function() {6214 var status=",";6215 if (this.blockC==0) status=".";6216 sendAJAX({6217 type:"POST",6218 src:"cgi-bin/operateData.php",6219 data:{6220 user:USERDATA.user,6221 ticket:USERDATA.ticket,6222 action:"postTargetFuncData",6223 id:this.funcID,6224 target:this.funcTarget,6225 status:status,6226 },6227 });6228 },6229 };6230 if (FUNCDATA[i].status==",") p.wPay.firstBlock=1;6231 }6232 this.list.addARow(p);6233 }6234 if (this.root) this.root.pageResize();6235 }6236 PAGE[data.node[o].nodeName+"List"].refresh=function() {6237 var data={};6238 data.user=USERDATA.user;6239 data.ticket=USERDATA.ticket;6240 data.action="getFuncData";6241 data.funcID=this.funcID;6242 FuncListGetFuncData_PAGE=this;6243 sendAJAX({6244 type:"POST",6245 src:"cgi-bin/operateData.php",6246 data:data,6247 callback:"FuncListGetFuncData_PAGE.updateList();",6248 });6249 }6250 PAGE[data.node[o].nodeName+"List"].appear=function() {6251 this.clearChild();6252 this.appendChild(this.page[0]);6253 this.code.setValue("");6254 }6255 PAGE[data.node[o].nodeName+"List"].build=function() {6256 this.wBuild=true;6257 var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);6258 if (data.getNodeByName("role").node.length>1) this.wRole=true;6259 this.page=[];6260 this.page[0]=ASElement({6261 nodeName:"div",6262 style:{6263 width:"100%",6264 },6265 });6266 this.code=BasicInput({6267 type:"input",6268 wordC:"驗證碼",6269 wordE:"Check Code",6270 maxLength:8,6271 hintC:"輸入後才可查看",6272 hintE:"Enter to view",6273 style:{6274 marginTop:15,6275 marginLeft:85,6276 },6277 });6278 this.page[0].appendChild(this.code);6279 this.page[0].appendChild(ASElement("br"));6280 this.check=BasicButton({6281 wordC:"確 認",6282 wordE:"Confirm",6283 size:24,6284 root:this,6285 style:{6286 marginTop:15,6287 marginLeft:80,6288 },6289 onclick:function() {6290 if (this.root.code.getValue()=="cfas6666") {6291 this.root.clearChild();6292 this.root.appendChild(this.root.page[1]);6293 this.root.refresh();6294 }6295 },6296 });6297 this.page[0].appendChild(this.check);6298 this.page[1]=ASElement({6299 nodeName:"div",6300 style:{6301 width:"100%",6302 },6303 });6304 this.refreshB=BasicButton({6305 size:24,6306 wordC:"刷 新",6307 wordE:"Refresh",6308 style:{6309 position:"absolute",6310 top:0,6311 right:0,6312 },6313 root:this,6314 onclick:function() {6315 this.root.refresh();6316 }6317 });6318 this.page[1].appendChild(this.refreshB);6319 var col=[{6320 name:"time",6321 wordC:"時 間",6322 wordE:"Time",6323 width:180,6324 },{6325 name:"name",6326 wordC:"姓 名",6327 wordE:"Name",6328 width:195,6329 },{6330 name:"place",6331 wordC:"會 員",6332 wordE:"Member",6333 width:80,6334 }];6335 if (this.wRole) {6336 col[col.length]={6337 name:"role",6338 wordC:"角 色",6339 wordE:"Role",6340 width:80,6341 };6342 }6343 col[col.length]={6344 name:"payto",6345 wordC:"收款人",6346 wordE:"Payee",6347 width:100,6348 };6349 col[col.length]={6350 name:"wPay",6351 wordC:"支 付",6352 wordE:"Payed",6353 width:80,6354 };6355 col[col.length]={6356 name:"extra",6357 wordC:"備 註",6358 wordE:"Remarks",6359 width:150,6360 };6361 this.list=BasicList({6362 col:col,6363 root:this,6364 keyCol:"time",6365 fx:-1,6366 wCenter:true,6367 size:22,6368 style:{6369 marginTop:50,6370 },6371 });6372 this.page[1].appendChild(this.list);6373 }6374 }6375 }6376 function buildPageV_FunctionL() {6377 var data=ASGetSourceByName("data0").getNodeByName("functionC");6378 for (var o=0;o<data.node.length;o++) {6379 PAGE[data.node[o].nodeName+"List"]=ASElement({6380 nodeName:"div",6381 wCenter:true,6382 style:{6383 position:"relative",6384 width:DEFAULT_PAGE_WIDTHM,6385 marginTop:30,6386 marginBottom:30,6387 },6388 o:o,6389 funcID:data.node[o].nodeName,6390 });6391 PAGE[data.node[o].nodeName+"List"].updateList=function() {6392 var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);6393 var dataE=ASGetSourceByName("data0").getNodeByName("exco14");6394 this.list.clearRow();6395 for (var i=0;i<FUNCDATA.length;i++) {6396 var time=FUNCDATA[i].time;6397 var p={6398 time:{6399 listType:"basicWord",6400 wordE:time.substr(2,2)+"/"+time.substr(4,2)+" "+time.substr(6,2)+":"+time.substr(8,2)+":"+time.substr(10,2),6401 },6402 name:{6403 listType:"basicWord",6404 wordE:FUNCDATA[i].name,6405 },6406 place:{6407 listType:"basicWord",6408 wordC:"是",6409 wordE:"Yes",6410 },6411 role:{6412 listType:"basicWord",6413 wordC:data.getNodeByName("role").node[FUNCDATA[i].role].getAttribute("nameC"),6414 wordE:data.getNodeByName("role").node[FUNCDATA[i].role].getAttribute("nameE"),6415 },6416 extra:{6417 listType:"basicWord",6418 wordC:"&nbsp;",6419 wordE:"&nbsp;",6420 },6421 payto:{6422 listType:"basicWord",6423 wordC:"&nbsp;",6424 wordE:"&nbsp;",6425 },6426 wPay:{6427 listType:"basicWord",6428 wordC:"是",6429 wordE:"Yes",6430 }6431 };6432 if (FUNCDATA[i].place=="N") {6433 p.place.wordC="否";6434 p.place.wordE="No";6435 }6436 if (FUNCDATA[i].status==",") {6437 p.wPay.wordC="否";6438 p.wPay.wordE="No";6439 }6440 for (var j=0;j<dataE.node.length;j++) {6441 if (FUNCDATA[i].payto==dataE.node[j].getAttribute("itsc")) {6442 p.payto.wordC=dataE.node[j].getAttribute("nickname");6443 p.payto.wordE=dataE.node[j].getAttribute("nameE");6444 break;6445 }6446 }6447 if (FUNCDATA[i].payto==USERDATA.user) {6448 p.payto.wordC="我";6449 p.payto.wordE="Me";6450 p.wPay={6451 listType:"basicInput",6452 type:"radioPoint",6453 block:[{6454 wordC:"是",6455 wordE:"Yes",6456 value:"Yes",6457 },{6458 wordC:"否",6459 wordE:"No",6460 value:"No",6461 }],6462 space:30,6463 widthA:80,6464 style:{6465 left:15,6466 },6467 funcID:FUNCDATA[i].id,6468 funcTarget:FUNCDATA[i].user,6469 onchoose:function() {6470 var status=",";6471 if (this.blockC==0) status=".";6472 sendAJAX({6473 type:"POST",6474 src:"cgi-bin/operateData.php",6475 data:{6476 user:USERDATA.user,6477 ticket:USERDATA.ticket,6478 action:"postTargetFuncData",6479 id:this.funcID,6480 target:this.funcTarget,6481 status:status,6482 },6483 });6484 },6485 };6486 if (FUNCDATA[i].status==",") p.wPay.firstBlock=1;6487 }6488 this.list.addARow(p);6489 }6490 if (this.root) this.root.pageResize();6491 }6492 PAGE[data.node[o].nodeName+"List"].refresh=function() {6493 var data={};6494 data.user=USERDATA.user;6495 data.ticket=USERDATA.ticket;6496 data.action="getFuncData";6497 data.funcID=this.funcID;6498 FuncListGetFuncData_PAGE=this;6499 sendAJAX({6500 type:"POST",6501 src:"cgi-bin/operateData.php",6502 data:data,6503 callback:"FuncListGetFuncData_PAGE.updateList();",6504 });6505 }6506 PAGE[data.node[o].nodeName+"List"].appear=function() {6507 this.clearChild();6508 this.appendChild(this.page[0]);6509 this.code.setValue("");6510 }6511 PAGE[data.node[o].nodeName+"List"].build=function() {6512 this.wBuild=true;6513 var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);6514 if (data.getNodeByName("role").node.length>1) this.wRole=true;6515 this.page=[];6516 this.page[0]=ASElement({6517 nodeName:"div",6518 style:{6519 width:"100%",6520 },6521 });6522 this.code=BasicInput({6523 type:"input",6524 wordC:"驗證碼",6525 wordE:"Check Code",6526 maxLength:8,6527 hintC:"輸入後才可查看",6528 hintE:"Enter to view",6529 style:{6530 marginTop:15,6531 marginLeft:85,6532 },6533 });6534 this.page[0].appendChild(this.code);6535 this.page[0].appendChild(ASElement("br"));6536 this.check=BasicButton({6537 wordC:"確 認",6538 wordE:"Confirm",6539 size:24,6540 root:this,6541 style:{6542 marginTop:15,6543 marginLeft:80,6544 },6545 onclick:function() {6546 if (this.root.code.getValue()=="cfas6666") {6547 this.root.clearChild();6548 this.root.appendChild(this.root.page[1]);6549 this.root.refresh();6550 }6551 },6552 });6553 this.page[0].appendChild(this.check);6554 this.page[1]=ASElement({6555 nodeName:"div",6556 style:{6557 width:"100%",6558 },6559 });6560 var col=[{6561 name:"time",6562 wordC:"時 間",6563 wordE:"Time",6564 width:180,6565 },{6566 name:"name",6567 wordC:"姓 名",6568 wordE:"Name",6569 width:195,6570 },{6571 name:"place",6572 wordC:"會 員",6573 wordE:"Member",6574 width:80,6575 }];6576 if (this.wRole) {6577 col[col.length]={6578 name:"role",6579 wordC:"角 色",6580 wordE:"Role",6581 width:80,6582 };6583 }6584 col[col.length]={6585 name:"payto",6586 wordC:"收款人",6587 wordE:"Payee",6588 width:100,6589 };6590 col[col.length]={6591 name:"wPay",6592 wordC:"支 付",6593 wordE:"Payed",6594 width:80,6595 };6596 col[col.length]={6597 name:"extra",6598 wordC:"備 註",6599 wordE:"Remarks",6600 width:150,6601 };6602 this.list=BasicList({6603 col:col,6604 root:this,6605 keyCol:"time",6606 fx:-1,6607 wCenter:true,6608 size:22,6609 });6610 this.page[1].appendChild(this.list);6611 }6612 }6613 }6614 // 老的活動6615 function buildPage_FunctionO() {6616 var data=ASGetSourceByName("data0").getNodeByName("functionO");6617 for (var o=0;o<data.node.length;o++) {6618 PAGE[data.node[o].nodeName]=ASElement({6619 nodeName:"div",6620 wCenter:true,6621 style:{6622 marginBottom:30,6623 width:DEFAULT_PAGE_WIDTH,6624 },6625 num:o,6626 });6627 PAGE[data.node[o].nodeName].build=function() {6628 this.wBuild=true;6629 var o=this.num;6630 var data=ASGetSourceByName("data0").getNodeByName("functionO");6631 this.block=[];6632 for (var i=0;i<data.node[o].node.length;i++) {6633 var pageDetailURL = data.node[o].nodeName + "Detail" + i;6634 this.block[i]=ASElement({6635 pageDetailURL: pageDetailURL,6636 nodeName:"div",6637 style:{6638 width:290,6639 height:312,6640 },6641 onmouseover:function() {6642 this.style.cursor = 'pointer';6643 this.style.backgroundColor = '#efefef';6644 },6645 onmouseout:function() {6646 this.style.backgroundColor = '#fff';6647 },6648 onclick: function(){6649 changeURL(this.pageDetailURL);6650 },6651 });6652 var block=this.block[i];6653 this.appendChild(block);6654 // 活動照片6655 block.pic=ASElement({6656 nodeName:"img",6657 src:data.node[o].getAttribute("root")+data.node[o].node[i].getAttribute("img"),6658 style:{6659 width:256,6660 height:171,6661 margin:17,6662 objectFit:'contain'6663 },6664 });6665 block.appendChild(block.pic);6666 var nameE=data.node[o].node[i].getAttribute("nameE");6667 if (nameE.length<=22) nameE+="<br>&nbsp;";6668 block.name=BasicWord({6669 size:25,6670 sizeE:22,6671 color:"rgb(200,0,0)",6672 wordC:data.node[o].node[i].getAttribute("nameC")+"<br>&nbsp;",6673 wordE:nameE,6674 style:{6675 marginTop:-5,6676 marginLeft:20,6677 width:250,6678 }6679 });6680 block.appendChild(block.name);6681 // 活動時間6682 var timeStr = data.node[o].node[i].getAttribute("time");6683 if (timeStr.length > 10) timeStr = timeStr.substring(0, 10);6684 block.date=BasicWord({6685 size:20,6686 color:"rgb(200,0,0)",6687 wordC:timeStr,6688 style:{6689 marginLeft:20,6690 marginTop:10,6691 width:115,6692 },6693 });6694 block.appendChild(block.date);6695 if (data.node[o].node[i].getAttribute("linkF")) {6696 block.facebook=ASElement({6697 nodeName:"a",6698 href:data.node[o].node[i].getAttribute("linkF"),6699 target:"_blank",6700 style:{6701 marginLeft:20,6702 color:"rgb(150,150,150)",6703 fontFamily:DEFAULT_FONT,6704 fontSize:20,6705 },6706 innerHTML:"Facebook",6707 })6708 block.appendChild(block.facebook);6709 }6710 }6711 }6712 }6713 }6714 // 老活動詳情 6715 function buildPage_FunctionODetail() {6716 6717 var data=ASGetSourceByName("data0").getNodeByName("functionO");6718 for (var o=0;o<data.node.length;o++) {6719 var exco = data.node[o]6720 for (var i=0; i < exco.node.length; i++) {6721 6722 var func = exco.node[i]6723 var pageName = exco.nodeName + "Detail" + i;6724 PAGE[pageName]=ASElement({6725 nodeName:"div",6726 wCenter:true,6727 id : i,6728 style:{6729 // marginBottom:30,6730 width:DEFAULT_PAGE_WIDTH,6731 // height:'auto',6732 },6733 num:o,6734 });6735 6736 PAGE[pageName].build=function() {6737 6738 this.wBuild=true;6739 6740 var o = this.num;6741 var i = this.id;6742 var data=ASGetSourceByName("data0").getNodeByName("functionO");6743 var event = data.node[o].node[i];6744 6745 // 頁面 div6746 this.block=ASElement({6747 nodeName:"div",6748 style:{6749 width:'100%',6750 padding:25,6751 boxSizing:'border-box',6752 },6753 });6754 var block=this.block;6755 this.appendChild(block);6756 // 圖片6757 block.pic=ASElement({6758 nodeName:"img",6759 src:data.node[o].getAttribute("root")+event.getAttribute("img"),6760 style:{6761 width:'100%',6762 height:'auto',6763 },6764 });6765 block.appendChild(block.pic);6766 6767 // The time of the event6768 block.date=BasicWord({6769 size:22,6770 color:"rgb(150,0,0)",6771 wordC:event.getAttribute("time"),6772 style:{6773 // marginLeft:20,6774 marginTop:10,6775 width:115,6776 },6777 });6778 block.appendChild(block.date);6779 // Optional facebook link6780 if (event.getAttribute("linkF")) {6781 block.facebook=ASElement({6782 nodeName:"a",6783 href:event.getAttribute("linkF"),6784 target:"_blank",6785 style:{6786 marginLeft:20,6787 color:"rgb(150,150,150)",6788 fontFamily:DEFAULT_FONT,6789 fontSize:20,6790 },6791 innerHTML:"Facebook",6792 })6793 block.appendChild(block.facebook);6794 }6795 // Main Cotent6796 var briefC, briefE;6797 if (event.getAttribute('briefC')) {6798 briefC = event.getAttribute('briefC')6799 }6800 if (event.getAttribute('briefE')) {6801 briefE = event.getAttribute('briefE')6802 }6803 if (briefC || briefE) {6804 block.content=BasicWord({6805 size: 20,6806 // sizeE: 22,6807 color: "rgb(0,0,0)",6808 wordC: briefC,6809 wordE: briefE,6810 style: {6811 marginTop: 30,6812 width: '100%',6813 // marginLeft:20,6814 // width:250,6815 }6816 });6817 block.appendChild(block.content);6818 }6819 }6820 } 6821 }6822 }6823 // buildPageV6824 // 所有這裡的 buildPageV 都代表豎版的時候(手機)頁面的顯示邏輯6825 function buildPageV_FunctionO() {6826 var data=ASGetSourceByName("data0").getNodeByName("functionO");6827 for (var o=0;o<data.node.length;o++) {6828 PAGE_V[data.node[o].nodeName]=ASElement({6829 nodeName:"div",6830 wCenter:true,6831 style:{6832 marginBottom:60,6833 width:VERTICAL_PAGE_WIDTHL,6834 },6835 num:o,6836 });6837 PAGE_V[data.node[o].nodeName].build=function() {6838 this.wBuild=true;6839 var o=this.num;6840 var data=ASGetSourceByName("data0").getNodeByName("functionO");6841 this.block=[];6842 for (var i=0;i<data.node[o].node.length;i++) {6843 this.block[i]=ASElement({6844 nodeName:"div",6845 style:{6846 width:800,6847 },6848 });6849 var block=this.block[i];6850 this.appendChild(block);6851 block.pic=ASElement({6852 nodeName:"img",6853 src:data.node[o].getAttribute("root")+data.node[o].node[i].getAttribute("img"),6854 style:{6855 width:690,6856 height:460,6857 margin:"30px 55px",6858 },6859 });6860 block.appendChild(block.pic);6861 var nameE=data.node[o].node[i].getAttribute("nameE");6862 block.name=BasicWord({6863 size:60,6864 sizeE:55,6865 color:"rgb(200,0,0)",6866 wordC:data.node[o].node[i].getAttribute("nameC"),6867 wordE:nameE,6868 style:{6869 marginTop:-5,6870 marginLeft:50,6871 }6872 });6873 block.appendChild(block.name);6874 block.appendChild(ASElement("br"));6875 block.date=BasicWord({6876 size:50,6877 color:"rgb(200,0,0)",6878 wordC:data.node[o].node[i].getAttribute("time"),6879 width:"max",6880 style:{6881 float:"right",6882 marginRight:50,6883 marginTop:20,6884 },6885 });6886 block.appendChild(block.date);6887 block.facebook=ASElement({6888 nodeName:"a",6889 href:data.node[o].node[i].getAttribute("linkF"),6890 target:"_blank",6891 style:{6892 position:"relative",6893 marginLeft:50,6894 top:17,6895 color:"rgb(150,150,150)",6896 fontFamily:DEFAULT_FONT,6897 fontSize:50,6898 },6899 innerHTML:"Facebook",6900 })6901 block.appendChild(block.facebook);6902 this.appendChild(ASElement({6903 nodeName:"hr",6904 style:{6905 marginTop:30,6906 marginBottom:10,6907 },6908 }));6909 }6910 }6911 }6912 }6913 // Helper for parsing query6914 function parse_query_string(query) {6915 var vars = query.split("&");6916 var query_string = {};6917 for (var i = 0; i < vars.length; i++) {6918 var pair = vars[i].split("=");6919 var key = decodeURIComponent(pair[0]);6920 var value = decodeURIComponent(pair[1]);6921 // If first entry with this name6922 if (typeof query_string[key] === "undefined") {6923 query_string[key] = decodeURIComponent(value);6924 // If second entry with this name6925 } else if (typeof query_string[key] === "string") {6926 var arr = [query_string[key], decodeURIComponent(value)];6927 query_string[key] = arr;6928 // If third or later entry with this name6929 } else {6930 query_string[key].push(decodeURIComponent(value));6931 }6932 }6933 return query_string;6934 }6935 function buildPage_Image() {6936 PAGE["image"]=ASElement({6937 nodeName:"div",6938 wCenter:true,6939 style:{6940 width:DEFAULT_PAGE_WIDTHL,6941 },6942 });6943 PAGE["image"].build=function() {6944 const urlString = window.location.href6945 const paramIndex = urlString.indexOf("?");6946 const queryString = urlString.substring(paramIndex + 1, urlString.length)6947 6948 const params = parse_query_string(queryString);6949 var url = params.imageURL;6950 var nameC = params.nameC;6951 var nameE = params.nameE;6952 6953 if (!url) {6954 // No Param6955 // changeURL("main");6956 goBack();6957 }6958 this.wBuild=false;6959 this.clearChild();6960 6961 this.pic=ASElement({6962 nodeName:"img",6963 src:url,6964 style:{6965 display:"block",6966 width:'100%',6967 height:'auto',6968 marginLeft:"auto",6969 marginRight:"auto",6970 marginTop:50,6971 marginBottom:60,6972 },6973 });6974 this.appendChild(this.pic);6975 // this.word=BasicWord({6976 // size:30,6977 // wordC:"掃碼關注民藝公眾號吧~",6978 // wordE:"Scan the QR code to get our news on Wechat~",6979 // style:{6980 // width:"100%",6981 // marginTop:25,6982 // marginBottom:70,6983 // textAlign:"center",6984 // },6985 // }),6986 // this.appendChild(this.word);6987 }6988 }6989 // 庄员介绍页面,每一桩都有自己的一个function,应该可以简化,但是我当时是复制黏贴的6990 // 添加的 funcion 要在后面 buildPage() 添加6991 function buildPage_Exco16() {6992 PAGE["exco16"]=ASElement({6993 nodeName:"div",6994 style:{6995 display:"block",6996 width:DEFAULT_PAGE_WIDTH,6997 height:650,6998 },6999 });7000 PAGE["exco16"].build=function() {7001 this.wBuild=true;7002 var data=ASGetSourceByName("data0").getNodeByName("exco16");7003 var block=[];7004 for (var i=0;i<data.node.length;i++) {7005 block[i]={7006 wordC:data.node[i].getAttribute("nameC")+"<span style='font-size:15px;'>&nbsp;&nbsp;"+data.node[i].getAttribute("postC")+"</span>",7007 wordE:data.node[i].getAttribute("nameE")+"<br><span style='font-size:13px;'>"+data.node[i].getAttribute("postE")+"</span",7008 };7009 }7010 this.jump=AnchorList({7011 size:22,7012 sizeE:20,7013 widthA:210,7014 block:block,7015 space:-5.5,7016 style:{7017 position:"relative",7018 left:10,7019 top:5,7020 },7021 onchoose:function(w) {7022 this.root.changeBlock(w);7023 },7024 root:this,7025 });7026 this.appendChild(this.jump);7027 this.blockF=ASElement({7028 nodeName:"div",7029 style:{7030 position:"absolute",7031 left:200,7032 width:620,7033 },7034 });7035 this.appendChild(this.blockF);7036 this.block=[];7037 for (var i=0;i<data.node.length;i++) {7038 // Image name7039 // console.log(data.getAttribute("root")+data.node[i].nodeName+".jpg")7040 this.block[i]=ASElement({7041 nodeName:"div",7042 style:{7043 position:"absolute",7044 width:700,7045 },7046 });7047 var block=this.block[i];7048 block.picF=ASElement({7049 nodeName:"div",7050 style:{7051 marginTop:30,7052 marginLeft:50,7053 width:350,7054 height:450,7055 overflow:"hidden",7056 boxShadow:"0 0 10px rgba(0,0,0,0.8)",7057 },7058 });7059 block.appendChild(block.picF);7060 block.pic=ASElement({7061 nodeName:"img",7062 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7063 style:{7064 display:"block",7065 marginLeft:-50,7066 height:"100%",7067 },7068 });7069 block.picF.appendChild(block.pic);7070 block.brief=ASElement({7071 nodeName:"div",7072 style:{7073 position:"absolute",7074 top:30,7075 left:430,7076 width:260,7077 },7078 });7079 block.appendChild(block.brief);7080 block.name=BasicWord({7081 size:50,7082 wordC:data.node[i].getAttribute("nameC"),7083 wordE:data.node[i].getAttribute("nameE"),7084 style:{7085 marginTop:20,7086 marginBottom:15,7087 width:"100%",7088 textAlign:"center",7089 },7090 });7091 block.brief.appendChild(block.name);7092 block.brief.appendChild(ASElement({nodeName:"hr"}));7093 block.post=BasicWord({7094 size:40,7095 sizeE:35,7096 wordC:data.node[i].getAttribute("postC"),7097 wordE:data.node[i].getAttribute("postE"),7098 color:"rgb(200,0,0)",7099 style:{7100 marginTop:15,7101 marginBottom:15,7102 width:"100%",7103 textAlign:"center",7104 },7105 });7106 block.brief.appendChild(block.post);7107 block.brief.appendChild(ASElement({nodeName:"hr"}));7108 block.intro=BasicWord({7109 size:20,7110 wordC:data.node[i].getAttribute("word"),7111 style:{7112 marginTop:15,7113 width:240,7114 marginLeft:10,7115 //textAlign:"center",7116 },7117 });7118 block.brief.appendChild(block.intro);7119 block.contact=ASElement({7120 nodeName:"div",7121 style:{7122 position:"absolute",7123 top:480,7124 left:50,7125 width:350,7126 },7127 });7128 block.appendChild(block.contact);7129 block.contactW=BasicWord({7130 size:23,7131 sizeE:20,7132 color:"rgb(200,0,0)",7133 wordC:"聯繫方式",7134 wordE:"Contact Information",7135 style:{7136 display:"block",7137 marginTop:12,7138 marginBottom:6,7139 },7140 });7141 block.contact.appendChild(block.contactW);7142 block.contact.appendChild(ASElement({nodeName:"hr"}));7143 /*block.emailW=BasicWord({7144 size:21,7145 sizeE:18,7146 color:"rgb(200,0,0)",7147 wordC:"郵 件:",7148 wordE:"Email:",7149 style:{7150 marginTop:6,7151 marginRight:8,7152 },7153 });7154 block.contact.appendChild(block.emailW);7155 block.email=ASElement({7156 nodeName:"p",7157 style:{7158 display:"inline-block",7159 fontFamily:DEFAULT_FONT,7160 fontSize:18,7161 color:"rgb(100,100,100)",7162 textDecoration:"underline",7163 cursor:"pointer",7164 },7165 innerHTML:data.node[i].getAttribute("email"),7166 });7167 block.contact.appendChild(block.email);*/7168 block.contact.appendChild(ASElement("br"));7169 block.phoneW=BasicWord({7170 size:21,7171 sizeE:18,7172 color:"rgb(200,0,0)",7173 wordC:"電 話:",7174 wordE:"Phone:",7175 style:{7176 marginTop:6,7177 marginRight:8,7178 },7179 });7180 block.contact.appendChild(block.phoneW);7181 block.phone=ASElement({7182 nodeName:"p",7183 style:{7184 display:"inline-block",7185 fontFamily:DEFAULT_FONT,7186 fontSize:18,7187 },7188 innerHTML:data.node[i].getAttribute("phone"),7189 });7190 block.contact.appendChild(block.phone);7191 }7192 this.blockF.appendChild(this.block[0]);7193 this.blockC=0;7194 this.changeBlock=function(w) {7195 if (w==this.blockC) return;7196 this.block[this.blockC].setTarget({opacity:0});7197 this.block[this.blockC].setTimeout(function() {this.parentNode.removeChild(this);},200);7198 this.blockC=w;7199 this.blockF.appendChild(this.block[this.blockC]);7200 this.block[this.blockC].set({style:{opacity:0}});7201 this.block[this.blockC].setTarget({opacity:1});7202 this.jump.changeBlock(w);7203 }7204 }7205 }7206 function buildPage_Exco15() {7207 PAGE["exco15"]=ASElement({7208 nodeName:"div",7209 style:{7210 display:"block",7211 width:DEFAULT_PAGE_WIDTH,7212 height:650,7213 },7214 });7215 PAGE["exco15"].build=function() {7216 this.wBuild=true;7217 var data=ASGetSourceByName("data0").getNodeByName("exco15");7218 var block=[];7219 for (var i=0;i<data.node.length;i++) {7220 block[i]={7221 wordC:data.node[i].getAttribute("nameC")+"<span style='font-size:15px;'>&nbsp;&nbsp;"+data.node[i].getAttribute("postC")+"</span>",7222 wordE:data.node[i].getAttribute("nameE")+"<br><span style='font-size:13px;'>"+data.node[i].getAttribute("postE")+"</span",7223 };7224 }7225 this.jump=AnchorList({7226 size:22,7227 sizeE:20,7228 widthA:210,7229 block:block,7230 space:-5.5,7231 style:{7232 position:"relative",7233 left:10,7234 top:5,7235 },7236 onchoose:function(w) {7237 this.root.changeBlock(w);7238 },7239 root:this,7240 });7241 this.appendChild(this.jump);7242 this.blockF=ASElement({7243 nodeName:"div",7244 style:{7245 position:"absolute",7246 left:200,7247 width:620,7248 },7249 });7250 this.appendChild(this.blockF);7251 this.block=[];7252 for (var i=0;i<data.node.length;i++) {7253 this.block[i]=ASElement({7254 nodeName:"div",7255 style:{7256 position:"absolute",7257 width:700,7258 },7259 });7260 var block=this.block[i];7261 block.picF=ASElement({7262 nodeName:"div",7263 style:{7264 marginTop:30,7265 marginLeft:50,7266 width:350,7267 height:450,7268 overflow:"hidden",7269 boxShadow:"0 0 10px rgba(0,0,0,0.8)",7270 },7271 });7272 block.appendChild(block.picF);7273 block.pic=ASElement({7274 nodeName:"img",7275 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7276 style:{7277 display:"block",7278 marginLeft:-50,7279 height:"100%",7280 },7281 });7282 block.picF.appendChild(block.pic);7283 block.brief=ASElement({7284 nodeName:"div",7285 style:{7286 position:"absolute",7287 top:30,7288 left:430,7289 width:260,7290 },7291 });7292 block.appendChild(block.brief);7293 block.name=BasicWord({7294 size:50,7295 wordC:data.node[i].getAttribute("nameC"),7296 wordE:data.node[i].getAttribute("nameE"),7297 style:{7298 marginTop:20,7299 marginBottom:15,7300 width:"100%",7301 textAlign:"center",7302 },7303 });7304 block.brief.appendChild(block.name);7305 block.brief.appendChild(ASElement({nodeName:"hr"}));7306 block.post=BasicWord({7307 size:40,7308 sizeE:35,7309 wordC:data.node[i].getAttribute("postC"),7310 wordE:data.node[i].getAttribute("postE"),7311 color:"rgb(200,0,0)",7312 style:{7313 marginTop:15,7314 marginBottom:15,7315 width:"100%",7316 textAlign:"center",7317 },7318 });7319 block.brief.appendChild(block.post);7320 block.brief.appendChild(ASElement({nodeName:"hr"}));7321 block.intro=BasicWord({7322 size:20,7323 wordC:data.node[i].getAttribute("word"),7324 style:{7325 marginTop:15,7326 width:240,7327 marginLeft:10,7328 //textAlign:"center",7329 },7330 });7331 block.brief.appendChild(block.intro);7332 block.contact=ASElement({7333 nodeName:"div",7334 style:{7335 position:"absolute",7336 top:480,7337 left:50,7338 width:350,7339 },7340 });7341 block.appendChild(block.contact);7342 block.contactW=BasicWord({7343 size:23,7344 sizeE:20,7345 color:"rgb(200,0,0)",7346 wordC:"聯繫方式",7347 wordE:"Contact Information",7348 style:{7349 display:"block",7350 marginTop:12,7351 marginBottom:6,7352 },7353 });7354 block.contact.appendChild(block.contactW);7355 block.contact.appendChild(ASElement({nodeName:"hr"}));7356 /*block.emailW=BasicWord({7357 size:21,7358 sizeE:18,7359 color:"rgb(200,0,0)",7360 wordC:"郵 件:",7361 wordE:"Email:",7362 style:{7363 marginTop:6,7364 marginRight:8,7365 },7366 });7367 block.contact.appendChild(block.emailW);7368 block.email=ASElement({7369 nodeName:"p",7370 style:{7371 display:"inline-block",7372 fontFamily:DEFAULT_FONT,7373 fontSize:18,7374 color:"rgb(100,100,100)",7375 textDecoration:"underline",7376 cursor:"pointer",7377 },7378 innerHTML:data.node[i].getAttribute("email"),7379 });7380 block.contact.appendChild(block.email);*/7381 block.contact.appendChild(ASElement("br"));7382 block.phoneW=BasicWord({7383 size:21,7384 sizeE:18,7385 color:"rgb(200,0,0)",7386 wordC:"電 話:",7387 wordE:"Phone:",7388 style:{7389 marginTop:6,7390 marginRight:8,7391 },7392 });7393 block.contact.appendChild(block.phoneW);7394 block.phone=ASElement({7395 nodeName:"p",7396 style:{7397 display:"inline-block",7398 fontFamily:DEFAULT_FONT,7399 fontSize:18,7400 },7401 innerHTML:data.node[i].getAttribute("phone"),7402 });7403 block.contact.appendChild(block.phone);7404 }7405 this.blockF.appendChild(this.block[0]);7406 this.blockC=0;7407 this.changeBlock=function(w) {7408 if (w==this.blockC) return;7409 this.block[this.blockC].setTarget({opacity:0});7410 this.block[this.blockC].setTimeout(function() {this.parentNode.removeChild(this);},200);7411 this.blockC=w;7412 this.blockF.appendChild(this.block[this.blockC]);7413 this.block[this.blockC].set({style:{opacity:0}});7414 this.block[this.blockC].setTarget({opacity:1});7415 this.jump.changeBlock(w);7416 }7417 }7418 }7419 function buildPage_Exco14() {7420 PAGE["exco14"]=ASElement({7421 nodeName:"div",7422 style:{7423 display:"block",7424 width:DEFAULT_PAGE_WIDTH,7425 height:650,7426 },7427 });7428 PAGE["exco14"].build=function() {7429 this.wBuild=true;7430 var data=ASGetSourceByName("data0").getNodeByName("exco14");7431 var block=[];7432 for (var i=0;i<data.node.length;i++) {7433 block[i]={7434 wordC:data.node[i].getAttribute("nameC")+"<span style='font-size:15px;'>&nbsp;&nbsp;"+data.node[i].getAttribute("postC")+"</span>",7435 wordE:data.node[i].getAttribute("nameE")+"<br><span style='font-size:13px;'>"+data.node[i].getAttribute("postE")+"</span",7436 };7437 }7438 this.jump=AnchorList({7439 size:22,7440 sizeE:20,7441 widthA:210,7442 block:block,7443 space:-5.5,7444 style:{7445 position:"relative",7446 left:10,7447 top:5,7448 },7449 onchoose:function(w) {7450 this.root.changeBlock(w);7451 },7452 root:this,7453 });7454 this.appendChild(this.jump);7455 this.blockF=ASElement({7456 nodeName:"div",7457 style:{7458 position:"absolute",7459 left:200,7460 width:620,7461 },7462 });7463 this.appendChild(this.blockF);7464 this.block=[];7465 for (var i=0;i<data.node.length;i++) {7466 this.block[i]=ASElement({7467 nodeName:"div",7468 style:{7469 position:"absolute",7470 width:700,7471 },7472 });7473 var block=this.block[i];7474 block.picF=ASElement({7475 nodeName:"div",7476 style:{7477 marginTop:30,7478 marginLeft:50,7479 width:350,7480 height:450,7481 overflow:"hidden",7482 boxShadow:"0 0 10px rgba(0,0,0,0.8)",7483 },7484 });7485 block.appendChild(block.picF);7486 block.pic=ASElement({7487 nodeName:"img",7488 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7489 style:{7490 display:"block",7491 marginLeft:-50,7492 height:"100%",7493 },7494 });7495 block.picF.appendChild(block.pic);7496 block.brief=ASElement({7497 nodeName:"div",7498 style:{7499 position:"absolute",7500 top:30,7501 left:430,7502 width:260,7503 },7504 });7505 block.appendChild(block.brief);7506 block.name=BasicWord({7507 size:50,7508 wordC:data.node[i].getAttribute("nameC"),7509 wordE:data.node[i].getAttribute("nameE"),7510 style:{7511 marginTop:20,7512 marginBottom:15,7513 width:"100%",7514 textAlign:"center",7515 },7516 });7517 block.brief.appendChild(block.name);7518 block.brief.appendChild(ASElement({nodeName:"hr"}));7519 block.post=BasicWord({7520 size:40,7521 sizeE:35,7522 wordC:data.node[i].getAttribute("postC"),7523 wordE:data.node[i].getAttribute("postE"),7524 color:"rgb(200,0,0)",7525 style:{7526 marginTop:15,7527 marginBottom:15,7528 width:"100%",7529 textAlign:"center",7530 },7531 });7532 block.brief.appendChild(block.post);7533 block.brief.appendChild(ASElement({nodeName:"hr"}));7534 block.intro=BasicWord({7535 size:20,7536 wordC:data.node[i].getAttribute("word"),7537 style:{7538 marginTop:15,7539 width:240,7540 marginLeft:10,7541 //textAlign:"center",7542 },7543 });7544 block.brief.appendChild(block.intro);7545 block.contact=ASElement({7546 nodeName:"div",7547 style:{7548 position:"absolute",7549 top:480,7550 left:50,7551 width:350,7552 },7553 });7554 block.appendChild(block.contact);7555 block.contactW=BasicWord({7556 size:23,7557 sizeE:20,7558 color:"rgb(200,0,0)",7559 wordC:"聯繫方式",7560 wordE:"Contact Information",7561 style:{7562 display:"block",7563 marginTop:12,7564 marginBottom:6,7565 },7566 });7567 block.contact.appendChild(block.contactW);7568 block.contact.appendChild(ASElement({nodeName:"hr"}));7569 /*block.emailW=BasicWord({7570 size:21,7571 sizeE:18,7572 color:"rgb(200,0,0)",7573 wordC:"郵 件:",7574 wordE:"Email:",7575 style:{7576 marginTop:6,7577 marginRight:8,7578 },7579 });7580 block.contact.appendChild(block.emailW);7581 block.email=ASElement({7582 nodeName:"p",7583 style:{7584 display:"inline-block",7585 fontFamily:DEFAULT_FONT,7586 fontSize:18,7587 color:"rgb(100,100,100)",7588 textDecoration:"underline",7589 cursor:"pointer",7590 },7591 innerHTML:data.node[i].getAttribute("email"),7592 });7593 block.contact.appendChild(block.email);*/7594 block.contact.appendChild(ASElement("br"));7595 block.phoneW=BasicWord({7596 size:21,7597 sizeE:18,7598 color:"rgb(200,0,0)",7599 wordC:"電 話:",7600 wordE:"Phone:",7601 style:{7602 marginTop:6,7603 marginRight:8,7604 },7605 });7606 block.contact.appendChild(block.phoneW);7607 block.phone=ASElement({7608 nodeName:"p",7609 style:{7610 display:"inline-block",7611 fontFamily:DEFAULT_FONT,7612 fontSize:18,7613 },7614 innerHTML:data.node[i].getAttribute("phone"),7615 });7616 block.contact.appendChild(block.phone);7617 }7618 this.blockF.appendChild(this.block[0]);7619 this.blockC=0;7620 this.changeBlock=function(w) {7621 if (w==this.blockC) return;7622 this.block[this.blockC].setTarget({opacity:0});7623 this.block[this.blockC].setTimeout(function() {this.parentNode.removeChild(this);},200);7624 this.blockC=w;7625 this.blockF.appendChild(this.block[this.blockC]);7626 this.block[this.blockC].set({style:{opacity:0}});7627 this.block[this.blockC].setTarget({opacity:1});7628 this.jump.changeBlock(w);7629 }7630 }7631 }7632 function buildPageV_Exco14() {7633 PAGE_V["exco14"]=ASElement({7634 nodeName:"div",7635 wCenter:true,7636 style:{7637 width:VERTICAL_PAGE_WIDTHL,7638 marginBottom:30,7639 },7640 });7641 PAGE_V["exco14"].build=function() {7642 this.wBuild=true;7643 var data=ASGetSourceByName("data0").getNodeByName("exco14");7644 this.block=[];7645 for (var i=0;i<data.node.length;i++) {7646 this.block[i]=ASElement({7647 nodeName:"div",7648 style:{7649 width:VERTICAL_PAGE_WIDTHL,7650 },7651 });7652 var block=this.block[i];7653 this.appendChild(block);7654 block.pic=ASElement({7655 nodeName:"img",7656 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7657 style:{7658 display:"block",7659 marginLeft:"auto",7660 marginRight:"auto",7661 marginTop:45,7662 marginBottom:30,7663 width:"90%",7664 },7665 });7666 block.appendChild(block.pic);7667 block.post=BasicWord({7668 size:65,7669 sizeE:60,7670 wordC:data.node[i].getAttribute("postC"),7671 wordE:data.node[i].getAttribute("postE"),7672 color:"rgb(200,0,0)",7673 style:{7674 marginBottom:15,7675 width:"100%",7676 textAlign:"center",7677 },7678 });7679 block.appendChild(block.post);7680 block.name=BasicWord({7681 size:100,7682 wordC:data.node[i].getAttribute("nameC"),7683 wordE:data.node[i].getAttribute("nameE"),7684 style:{7685 marginBottom:25,7686 width:"100%",7687 textAlign:"center",7688 },7689 });7690 block.appendChild(block.name);7691 block.intro=BasicWord({7692 size:45,7693 wordC:data.node[i].getAttribute("word"),7694 style:{7695 width:"80%",7696 marginLeft:"10%",7697 marginTop:5,7698 marginBottom:30,7699 textAlign:"justify",7700 },7701 });7702 block.appendChild(block.intro);7703 block.contact=ASElement({7704 nodeName:"div",7705 wCenter:true,7706 style:{7707 width:"85%",7708 marginBottom:45,7709 },7710 });7711 block.appendChild(block.contact);7712 block.emailW=BasicWord({7713 size:40,7714 color:"rgb(200,0,0)",7715 wordC:"郵 件:",7716 wordE:"Email:",7717 style:{7718 marginTop:6,7719 marginRight:8,7720 },7721 });7722 block.contact.appendChild(block.emailW);7723 block.email=ASElement({7724 nodeName:"p",7725 style:{7726 display:"inline-block",7727 fontFamily:DEFAULT_FONT,7728 fontSize:40,7729 color:"rgb(100,100,100)",7730 textDecoration:"underline",7731 cursor:"pointer",7732 },7733 innerHTML:data.node[i].getAttribute("email"),7734 });7735 block.contact.appendChild(block.email);7736 block.contact.appendChild(ASElement("br"));7737 block.phoneW=BasicWord({7738 size:40,7739 color:"rgb(200,0,0)",7740 wordC:"電 話:",7741 wordE:"Phone:",7742 style:{7743 marginTop:6,7744 marginRight:8,7745 },7746 });7747 block.contact.appendChild(block.phoneW);7748 block.phone=ASElement({7749 nodeName:"p",7750 style:{7751 display:"inline-block",7752 fontFamily:DEFAULT_FONT,7753 fontSize:40,7754 },7755 innerHTML:data.node[i].getAttribute("phone"),7756 });7757 block.contact.appendChild(block.phone);7758 this.appendChild(ASElement({nodeName:"hr"}));7759 }7760 }7761 }7762 function buildPageV_Exco16() {7763 PAGE_V["exco16"]=ASElement({7764 nodeName:"div",7765 wCenter:true,7766 style:{7767 width:VERTICAL_PAGE_WIDTHL,7768 marginBottom:30,7769 },7770 });7771 PAGE_V["exco16"].build=function() {7772 this.wBuild=true;7773 var data=ASGetSourceByName("data0").getNodeByName("exco16");7774 this.block=[];7775 for (var i=0;i<data.node.length;i++) {7776 this.block[i]=ASElement({7777 nodeName:"div",7778 style:{7779 width:VERTICAL_PAGE_WIDTHL,7780 },7781 });7782 var block=this.block[i];7783 this.appendChild(block);7784 block.pic=ASElement({7785 nodeName:"img",7786 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7787 style:{7788 display:"block",7789 marginLeft:"auto",7790 marginRight:"auto",7791 marginTop:45,7792 marginBottom:30,7793 width:"90%",7794 },7795 });7796 block.appendChild(block.pic);7797 block.post=BasicWord({7798 size:65,7799 sizeE:60,7800 wordC:data.node[i].getAttribute("postC"),7801 wordE:data.node[i].getAttribute("postE"),7802 color:"rgb(200,0,0)",7803 style:{7804 marginBottom:15,7805 width:"100%",7806 textAlign:"center",7807 },7808 });7809 block.appendChild(block.post);7810 block.name=BasicWord({7811 size:100,7812 wordC:data.node[i].getAttribute("nameC"),7813 wordE:data.node[i].getAttribute("nameE"),7814 style:{7815 marginBottom:25,7816 width:"100%",7817 textAlign:"center",7818 },7819 });7820 block.appendChild(block.name);7821 block.intro=BasicWord({7822 size:45,7823 wordC:data.node[i].getAttribute("word"),7824 style:{7825 width:"80%",7826 marginLeft:"10%",7827 marginTop:5,7828 marginBottom:30,7829 textAlign:"justify",7830 },7831 });7832 block.appendChild(block.intro);7833 block.contact=ASElement({7834 nodeName:"div",7835 wCenter:true,7836 style:{7837 width:"85%",7838 marginBottom:45,7839 },7840 });7841 block.appendChild(block.contact);7842 block.emailW=BasicWord({7843 size:40,7844 color:"rgb(200,0,0)",7845 wordC:"郵 件:",7846 wordE:"Email:",7847 style:{7848 marginTop:6,7849 marginRight:8,7850 },7851 });7852 block.contact.appendChild(block.emailW);7853 block.email=ASElement({7854 nodeName:"p",7855 style:{7856 display:"inline-block",7857 fontFamily:DEFAULT_FONT,7858 fontSize:40,7859 color:"rgb(100,100,100)",7860 textDecoration:"underline",7861 cursor:"pointer",7862 },7863 innerHTML:data.node[i].getAttribute("email"),7864 });7865 block.contact.appendChild(block.email);7866 block.contact.appendChild(ASElement("br"));7867 block.phoneW=BasicWord({7868 size:40,7869 color:"rgb(200,0,0)",7870 wordC:"電 話:",7871 wordE:"Phone:",7872 style:{7873 marginTop:6,7874 marginRight:8,7875 },7876 });7877 block.contact.appendChild(block.phoneW);7878 block.phone=ASElement({7879 nodeName:"p",7880 style:{7881 display:"inline-block",7882 fontFamily:DEFAULT_FONT,7883 fontSize:40,7884 },7885 innerHTML:data.node[i].getAttribute("phone"),7886 });7887 block.contact.appendChild(block.phone);7888 this.appendChild(ASElement({nodeName:"hr"}));7889 }7890 }7891 }7892 7893 function buildPageV_Exco15() {7894 PAGE_V["exco15"]=ASElement({7895 nodeName:"div",7896 wCenter:true,7897 style:{7898 width:VERTICAL_PAGE_WIDTHL,7899 marginBottom:30,7900 },7901 });7902 PAGE_V["exco15"].build=function() {7903 this.wBuild=true;7904 var data=ASGetSourceByName("data0").getNodeByName("exco15");7905 this.block=[];7906 for (var i=0;i<data.node.length;i++) {7907 this.block[i]=ASElement({7908 nodeName:"div",7909 style:{7910 width:VERTICAL_PAGE_WIDTHL,7911 },7912 });7913 var block=this.block[i];7914 this.appendChild(block);7915 block.pic=ASElement({7916 nodeName:"img",7917 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",7918 style:{7919 display:"block",7920 marginLeft:"auto",7921 marginRight:"auto",7922 marginTop:45,7923 marginBottom:30,7924 width:"90%",7925 },7926 });7927 block.appendChild(block.pic);7928 block.post=BasicWord({7929 size:65,7930 sizeE:60,7931 wordC:data.node[i].getAttribute("postC"),7932 wordE:data.node[i].getAttribute("postE"),7933 color:"rgb(200,0,0)",7934 style:{7935 marginBottom:15,7936 width:"100%",7937 textAlign:"center",7938 },7939 });7940 block.appendChild(block.post);7941 block.name=BasicWord({7942 size:100,7943 wordC:data.node[i].getAttribute("nameC"),7944 wordE:data.node[i].getAttribute("nameE"),7945 style:{7946 marginBottom:25,7947 width:"100%",7948 textAlign:"center",7949 },7950 });7951 block.appendChild(block.name);7952 block.intro=BasicWord({7953 size:45,7954 wordC:data.node[i].getAttribute("word"),7955 style:{7956 width:"80%",7957 marginLeft:"10%",7958 marginTop:5,7959 marginBottom:30,7960 textAlign:"justify",7961 },7962 });7963 block.appendChild(block.intro);7964 block.contact=ASElement({7965 nodeName:"div",7966 wCenter:true,7967 style:{7968 width:"85%",7969 marginBottom:45,7970 },7971 });7972 block.appendChild(block.contact);7973 block.emailW=BasicWord({7974 size:40,7975 color:"rgb(200,0,0)",7976 wordC:"郵 件:",7977 wordE:"Email:",7978 style:{7979 marginTop:6,7980 marginRight:8,7981 },7982 });7983 block.contact.appendChild(block.emailW);7984 block.email=ASElement({7985 nodeName:"p",7986 style:{7987 display:"inline-block",7988 fontFamily:DEFAULT_FONT,7989 fontSize:40,7990 color:"rgb(100,100,100)",7991 textDecoration:"underline",7992 cursor:"pointer",7993 },7994 innerHTML:data.node[i].getAttribute("email"),7995 });7996 block.contact.appendChild(block.email);7997 block.contact.appendChild(ASElement("br"));7998 block.phoneW=BasicWord({7999 size:40,8000 color:"rgb(200,0,0)",8001 wordC:"電 話:",8002 wordE:"Phone:",8003 style:{8004 marginTop:6,8005 marginRight:8,8006 },8007 });8008 block.contact.appendChild(block.phoneW);8009 block.phone=ASElement({8010 nodeName:"p",8011 style:{8012 display:"inline-block",8013 fontFamily:DEFAULT_FONT,8014 fontSize:40,8015 },8016 innerHTML:data.node[i].getAttribute("phone"),8017 });8018 block.contact.appendChild(block.phone);8019 this.appendChild(ASElement({nodeName:"hr"}));8020 }8021 }8022 }8023 function buildPage_ExcoB() {8024 var pageName=["exco13","exco12","exco11","exco10","exco09"];8025 for (var o=0;o<pageName.length;o++) {8026 PAGE[pageName[o]]=ASElement({8027 nodeName:"div",8028 wCenter:true,8029 style:{8030 width:DEFAULT_PAGE_WIDTH,8031 marginBottom:30,8032 },8033 num:o,8034 });8035 PAGE[pageName[o]].build=function() {8036 this.wBuild=true;8037 var o=this.num;8038 var data=ASGetSourceByName("data0").getNodeByName(pageName[o]);8039 this.block=[];8040 for (var i=0;i<data.node.length;i++) {8041 this.block[i]=ASElement({8042 nodeName:"div",8043 style:{8044 width:290,8045 height:420,8046 },8047 });8048 this.appendChild(this.block[i]);8049 var block=this.block[i];8050 block.pic=ASElement({8051 nodeName:"img",8052 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",8053 style:{8054 margin:15,8055 width:260,8056 height:260,8057 },8058 });8059 block.appendChild(block.pic);8060 block.name=BasicWord({8061 size:30,8062 sizeE:28,8063 wordC:data.node[i].getAttribute("nameC"),8064 wordE:data.node[i].getAttribute("nameE"),8065 color:"rgb(200,0,0)",8066 style:{8067 marginLeft:20,8068 },8069 });8070 block.appendChild(block.name);8071 block.appendChild(ASElement("br"));8072 block.post=BasicWord({8073 size:24,8074 sizeE:20,8075 wordC:data.node[i].getAttribute("postC"),8076 wordE:data.node[i].getAttribute("postE"),8077 color:"rgb(200,0,0)",8078 style:{8079 marginLeft:20,8080 marginTop:5,8081 },8082 });8083 block.appendChild(block.post);8084 block.appendChild(ASElement("br"));8085 if (data.node[i].getAttribute("email")) {8086 block.email=ASElement({8087 nodeName:"p",8088 style:{8089 fontFamily:DEFAULT_FONT,8090 fontSize:18,8091 color:"rgb(100,100,100)",8092 textDecoration:"underline",8093 marginTop:5,8094 marginLeft:20,8095 cursor:"pointer",8096 },8097 innerHTML:data.node[i].getAttribute("email"),8098 });8099 block.appendChild(block.email);8100 }8101 }8102 }8103 }8104 }8105 function buildPageV_ExcoB() {8106 var pageName=["exco13","exco12","exco11","exco10","exco09"];8107 for (var o=0;o<pageName.length;o++) {8108 PAGE_V[pageName[o]]=ASElement({8109 nodeName:"div",8110 wCenter:true,8111 style:{8112 width:VERTICAL_PAGE_WIDTH,8113 marginBottom:70,8114 },8115 num:o,8116 pageName:pageName[o],8117 });8118 PAGE_V[pageName[o]].build=function() {8119 this.wBuild=true;8120 var o=this.num;8121 var data=ASGetSourceByName("data0").getNodeByName(this.pageName);8122 this.block=[];8123 for (var i=0;i<data.node.length;i++) {8124 this.block[i]=ASElement({8125 nodeName:"div",8126 style:{8127 width:VERTICAL_PAGE_WIDTH/2,8128 },8129 });8130 this.appendChild(this.block[i]);8131 var block=this.block[i];8132 block.pic=ASElement({8133 nodeName:"img",8134 src:data.getAttribute("root")+data.node[i].nodeName+".jpg",8135 style:{8136 margin:25,8137 width:425,8138 },8139 });8140 block.appendChild(block.pic);8141 block.name=BasicWord({8142 size:55,8143 sizeE:42,8144 wordC:data.node[i].getAttribute("nameC"),8145 wordE:data.node[i].getAttribute("nameE"),8146 color:"rgb(200,0,0)",8147 style:{8148 marginLeft:20,8149 },8150 });8151 block.appendChild(block.name);8152 block.appendChild(ASElement("br"));8153 block.post=BasicWord({8154 size:50,8155 sizeE:36,8156 wordC:data.node[i].getAttribute("postC"),8157 wordE:data.node[i].getAttribute("postE"),8158 color:"rgb(200,0,0)",8159 style:{8160 marginLeft:20,8161 marginTop:5,8162 },8163 });8164 block.appendChild(block.post);8165 block.appendChild(ASElement("br"));8166 if (data.node[i].getAttribute("email")) {8167 block.email=ASElement({8168 nodeName:"p",8169 style:{8170 fontFamily:DEFAULT_FONT,8171 fontSize:30,8172 color:"rgb(100,100,100)",8173 textDecoration:"underline",8174 marginTop:30,8175 marginLeft:20,8176 marginBottom:30,8177 cursor:"pointer",8178 },8179 innerHTML:data.node[i].getAttribute("email"),8180 });8181 block.appendChild(block.email);8182 }8183 }8184 }8185 }8186 }8187 function buildPage_SocietyIntroduction() {8188 PAGE["societyIntroduction"]=ASElement({8189 nodeName:"div",8190 wCenter:true,8191 style:{8192 width:DEFAULT_PAGE_WIDTHL,8193 },8194 });8195 PAGE["societyIntroduction"].build=function() {8196 this.wBuild=true;8197 var data=ASGetSourceByName("data0").getNodeByName("societyIntroduction");8198 this.headline=BasicTitle({8199 wordC:data.getAttribute("titleC"),8200 wordE:data.getAttribute("titleE"),8201 style:{8202 marginTop:50,8203 },8204 });8205 this.appendChild(this.headline);8206 this.word=BasicWord({8207 size:22,8208 wordC:data.getAttribute("wordC"),8209 wordE:data.getAttribute("wordE"),8210 style:{8211 display:"block",8212 width:DEFAULT_PAGE_WIDTHL-50,8213 textAlign:"justify",8214 marginTop:50,8215 marginLeft:"auto",8216 marginRight:"auto",8217 marginBottom:50,8218 },8219 });8220 this.appendChild(this.word);8221 }8222 }8223 function buildPageV_SocietyIntroduction() {8224 PAGE_V["societyIntroduction"]=ASElement({8225 nodeName:"div",8226 wCenter:true,8227 style:{8228 width:VERTICAL_PAGE_WIDTHL,8229 },8230 });8231 PAGE_V["societyIntroduction"].build=function() {8232 this.wBuild=true;8233 var data=ASGetSourceByName("data0").getNodeByName("societyIntroduction");8234 this.headline=BasicTitle({8235 size:60,8236 wordC:data.getAttribute("titleC"),8237 wordE:data.getAttribute("titleE"),8238 style:{8239 marginTop:100,8240 },8241 });8242 this.appendChild(this.headline);8243 this.word=BasicWord({8244 size:45,8245 wordC:data.getAttribute("wordC"),8246 wordE:data.getAttribute("wordE"),8247 style:{8248 display:"block",8249 width:VERTICAL_PAGE_WIDTHL-50,8250 textAlign:"justify",8251 marginTop:70,8252 marginLeft:"auto",8253 marginRight:"auto",8254 marginBottom:100,8255 },8256 });8257 this.appendChild(this.word);8258 }8259 }8260 function buildPage_SocietyMission() {8261 PAGE["societyMission"]=ASElement({8262 nodeName:"div",8263 wCenter:true,8264 style:{8265 width:DEFAULT_PAGE_WIDTHL,8266 },8267 });8268 PAGE["societyMission"].build=function() {8269 this.wBuild=true;8270 var data=ASGetSourceByName("data0").getNodeByName("societyMission");8271 this.headline=BasicTitle({8272 wordC:data.getAttribute("titleC"),8273 wordE:data.getAttribute("titleE"),8274 style:{8275 marginTop:50,8276 },8277 });8278 this.appendChild(this.headline);8279 this.word=BasicWord({8280 size:25,8281 sizeE:22,8282 wordC:data.getAttribute("wordC"),8283 wordE:data.getAttribute("wordE"),8284 style:{8285 display:"block",8286 width:DEFAULT_PAGE_WIDTHL-50,8287 textAlign:"justify",8288 marginTop:50,8289 marginLeft:"auto",8290 marginRight:"auto",8291 marginBottom:70,8292 },8293 });8294 this.appendChild(this.word);8295 }8296 }8297 function buildPageV_SocietyMission() {8298 PAGE_V["societyMission"]=ASElement({8299 nodeName:"div",8300 wCenter:true,8301 style:{8302 width:DEFAULT_PAGE_WIDTHL,8303 },8304 });8305 PAGE_V["societyMission"].build=function() {8306 this.wBuild=true;8307 var data=ASGetSourceByName("data0").getNodeByName("societyMission");8308 this.headline=BasicTitle({8309 size:60,8310 wordC:data.getAttribute("titleC"),8311 wordE:data.getAttribute("titleE"),8312 style:{8313 marginTop:100,8314 },8315 });8316 this.appendChild(this.headline);8317 this.word=BasicWord({8318 size:55,8319 sizeE:45,8320 wordC:data.getAttribute("wordC"),8321 wordE:data.getAttribute("wordE"),8322 style:{8323 display:"block",8324 width:DEFAULT_PAGE_WIDTHL-50,8325 textAlign:"justify",8326 marginTop:70,8327 marginLeft:"auto",8328 marginRight:"auto",8329 marginBottom:100,8330 },8331 });8332 this.appendChild(this.word);8333 }8334 }8335 DOCUMENT_NAMES = ["Document/Constitution.pdf", "Document/YearPlan2020-2021.pdf","Document/AnnualFinancialPlan2020_2021.pdf"]8336 function buildPage_Document() {8337 var pageName=["constitution","yearPlan","financialPlan"];8338 var dataName = DOCUMENT_NAMES;8339 for (var o=0;o<pageName.length;o++) {8340 PAGE[pageName[o]]=ASElement({8341 nodeName:"div",8342 wCenter:true,8343 style:{8344 width:695,8345 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_HEAD_MINHEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,8346 },8347 num:o,8348 });8349 PAGE[pageName[o]].build=function() {8350 this.wBuild=true;8351 var o=this.num;8352 this.scrollB=1000,8353 this.resize=function() {8354 this.set({style:{8355 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_HEAD_MINHEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,8356 }});8357 this.content.set({style:{8358 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_HEAD_MINHEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,8359 }});8360 }8361 this.content=ASElement({8362 nodeName:"object",8363 data:dataName[o],8364 type:"application/pdf",8365 style:{8366 width:695,8367 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_HEAD_MINHEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,8368 },8369 });8370 this.appendChild(this.content);8371 }8372 }8373 }8374 function buildPageV_Document() {8375 var pageName=["constitution","yearPlan","financialPlan"];8376 var dataName = DOCUMENT_NAMES;8377 var pageN=[23,90,15];8378 for (var o=0;o<pageName.length;o++) {8379 PAGE_V[pageName[o]]=ASElement({8380 nodeName:"div",8381 wCenter:true,8382 style:{8383 position:"relative",8384 width:VERTICAL_PAGE_WIDTHH,8385 backgroundColor:"rgb(50,50,50)",8386 },8387 num:o,8388 dataName:dataName[o],8389 pageN:pageN[o],8390 });8391 PAGE_V[pageName[o]].resize=function() {8392 this.heightA=Math.min(1200,ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT-VERTICAL_FRAME_HEAD_MINHEIGHT);8393 this.pageF.set({style:{8394 height:this.heightA-185,8395 }});8396 this.next.set({style:{8397 right:((VERTICAL_PAGE_WIDTHH-(this.heightA-185)/1.414)/2-79)/2,8398 top:this.heightA/2-55,8399 }});8400 this.previous.set({style:{8401 left:((VERTICAL_PAGE_WIDTHH-(this.heightA-185)/1.414)/2-79)/2,8402 top:this.heightA/2-55,8403 }});8404 }8405 PAGE_V[pageName[o]].build=function() {8406 this.wBuild=true;8407 var o=this.num;8408 this.heightA=Math.min(1200,ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT-VERTICAL_FRAME_HEAD_MINHEIGHT);8409 this.titleF=BasicWord({8410 size:35,8411 color:"white",8412 wordC:this.dataName+".pdf",8413 style:{8414 width:"100%",8415 textAlign:"center",8416 marginTop:20,8417 },8418 });8419 this.appendChild(this.titleF);8420 this.pageF=ASElement({8421 nodeName:"div",8422 style:{8423 position:"relative",8424 marginTop:20,8425 height:this.heightA-185,8426 width:"100%",8427 }8428 });8429 this.appendChild(this.pageF);8430 this.pageNum=0;8431 this.pageC=ASElement({8432 nodeName:"img",8433 src:"Document/"+this.dataName+"/"+this.dataName+"-"+"01"+".png",8434 style:{8435 display:"block",8436 marginLeft:"auto",8437 marginRight:"auto",8438 height:"100%",8439 },8440 });8441 this.pageF.appendChild(this.pageC);8442 this.fileF=ASElement({8443 nodeName:"a",8444 href:"Document/"+this.dataName+".pdf",8445 target:"_blank",8446 style:{8447 width:"100%",8448 },8449 });8450 this.appendChild(this.fileF);8451 this.file=BasicWord({8452 size:35,8453 color:"white",8454 wordC:"查看原文檔",8455 wordE:"View the original document",8456 style:{8457 width:"100%",8458 marginTop:18,8459 marginBottom:35,8460 textAlign:"center",8461 textDecoration:"underline",8462 color:"white",8463 },8464 });8465 this.fileF.appendChild(this.file);8466 this.next=ASElement({8467 nodeName:"div",8468 style:{8469 position:"absolute",8470 width:79,8471 height:110,8472 right:((VERTICAL_PAGE_WIDTHH-(this.heightA-185)/1.414)/2-79)/2,8473 top:this.heightA/2-55,8474 backgroundImage:"url('Image/Page/Document/pageFlip.png')",8475 backgroundSize:"100%",8476 cursor:"pointer",8477 },8478 root:this,8479 onclick:function() {8480 this.root.pageC.setTarget({8481 transform:{translateX:-VERTICAL_PAGE_WIDTHH},8482 opacity:0,8483 });8484 this.root.pageNum=(this.root.pageNum+1)%this.root.pageN;8485 var name=this.root.pageNum+1;8486 if (this.root.pageNum<9) name="0"+name;8487 name="0"+name;8488 this.root.pageF.removeChild(this.root.pageC);8489 this.root.pageC=ASElement({8490 nodeName:"img",8491 src:"Document/"+this.root.dataName+"/"+this.root.dataName+"-"+name+".png",8492 style:{8493 display:"block",8494 marginLeft:"auto",8495 marginRight:"auto",8496 height:"100%",8497 },8498 });8499 this.root.pageF.appendChild(this.root.pageC);8500 },8501 });8502 this.appendChild(this.next);8503 this.previous=ASElement({8504 nodeName:"div",8505 style:{8506 position:"absolute",8507 width:79,8508 height:110,8509 left:((VERTICAL_PAGE_WIDTHH-(this.heightA-185)/1.414)/2-79)/2,8510 top:this.heightA/2-55,8511 backgroundImage:"url('Image/Page/Document/pageFlip.png')",8512 backgroundSize:"100%",8513 cursor:"pointer",8514 transform:{8515 scaleX:-1,8516 },8517 },8518 root:this,8519 onclick:function() {8520 this.root.pageC.setTarget({8521 transform:{translateX:-VERTICAL_PAGE_WIDTHH},8522 opacity:0,8523 });8524 this.root.pageNum--;8525 if (this.root.pageNum<0) this.root.pageNum=this.root.pageN-1;8526 var name=this.root.pageNum+1;8527 if (this.root.pageNum<9) name="0"+name;8528 name="0"+name;8529 this.root.pageF.removeChild(this.root.pageC);8530 this.root.pageC=ASElement({8531 nodeName:"img",8532 src:"Document/"+this.root.dataName+"/"+this.root.dataName+"-"+name+".png",8533 style:{8534 display:"block",8535 marginLeft:"auto",8536 marginRight:"auto",8537 height:"100%",8538 },8539 });8540 this.root.pageF.appendChild(this.root.pageC);8541 },8542 });8543 this.appendChild(this.previous);8544 }8545 }8546 }8547 function buildPage_MailCuisine() {8548 var data=ASGetSourceByName("data0").getNodeByName("email").getNodeByName("cuisine");8549 for (var o=0;o<data.node.length;o++) {8550 PAGE["cuisine"+o]=ASElement({8551 nodeName:"div",8552 wCenter:true,8553 style:{8554 width:DEFAULT_PAGE_WIDTH,8555 minHeight:1500,8556 marginBottom:25,8557 },8558 o:o,8559 });8560 PAGE["cuisine"+o].setLang=function() {8561 if (!this.wBuild) return;8562 var str="content"+ASLang;8563 sendAJAX({8564 type:"GET",8565 src:"Data/Email/"+data.node[this.o].getAttribute(str)+".txt",8566 root:this,8567 succeed:function() {8568 var str=this.responseText;8569 if (str.indexOf("<content>")>-1) {8570 this.root.innerHTML=str.slice(str.indexOf("<content>")+9,str.indexOf("</content>"));8571 } else {8572 this.root.innerHTML=str;8573 }8574 }8575 });8576 }8577 PAGE["cuisine"+o].build=function() {8578 this.wBuild=true;8579 var data=ASGetSourceByName("data0").getNodeByName("email").getNodeByName("cuisine");8580 var str="content"+ASLang;8581 sendAJAX({8582 type:"GET",8583 src:"Data/Email/"+data.node[this.o].getAttribute(str)+".txt",8584 root:this,8585 succeed:function() {8586 var str=this.responseText;8587 if (str.indexOf("<content>")>-1) {8588 this.root.innerHTML=str.slice(str.indexOf("<content>")+9,str.indexOf("</content>"));8589 } else {8590 this.root.innerHTML=str;8591 }8592 }8593 });8594 }8595 }8596 }8597 function buildPageV_MailCuisine() {8598 var data=ASGetSourceByName("data0").getNodeByName("email").getNodeByName("cuisine");8599 for (var o=0;o<data.node.length;o++) {8600 PAGE_V["cuisine"+o]=ASElement({8601 nodeName:"div",8602 wCenter:true,8603 style:{8604 width:VERTICAL_PAGE_WIDTH,8605 },8606 o:o,8607 });8608 PAGE_V["cuisine"+o].setLang=function() {8609 if (!this.wBuild) return;8610 var str="content"+ASLang;8611 sendAJAX({8612 type:"GET",8613 src:"Data/Email/"+data.node[this.o].getAttribute(str)+".txt",8614 root:this,8615 succeed:function() {8616 var str=this.responseText;8617 if (str.indexOf("<content>")>-1) {8618 this.root.innerHTML=str.slice(str.indexOf("<content>")+9,str.indexOf("</content>"));8619 } else {8620 this.root.innerHTML=str;8621 }8622 }8623 });8624 }8625 PAGE_V["cuisine"+o].build=function() {8626 this.wBuild=true;8627 var data=ASGetSourceByName("data0").getNodeByName("email").getNodeByName("cuisine");8628 var str="content"+ASLang;8629 sendAJAX({8630 type:"GET",8631 src:"Data/Email/"+data.node[this.o].getAttribute(str)+".txt",8632 root:this,8633 succeed:function() {8634 var str=this.responseText;8635 if (str.indexOf("<content>")>-1) {8636 this.root.innerHTML=str.slice(str.indexOf("<content>")+9,str.indexOf("</content>"));8637 } else {8638 this.root.innerHTML=str;8639 }8640 }8641 });8642 }8643 }8644 }8645 function buildPage_Sponsor() {8646 PAGE["sponsor"]=ASElement({8647 nodeName:"div",8648 wCenter:true,8649 style:{8650 width:DEFAULT_PAGE_WIDTHH,8651 marginBottom:30,8652 },8653 });8654 PAGE["sponsor"].build=function() {8655 this.wBuild=true;8656 var data=ASGetSourceByName("data0").getNodeByName("sponsor");8657 this.block=[];8658 for (var i=0;i<data.node.length;i++) {8659 this.block[i]=ASElement({8660 nodeName:"div",8661 style:{8662 width:325,8663 height:270,8664 },8665 });8666 var block=this.block[i];8667 this.appendChild(this.block[i]);8668 block.pic=ASElement({8669 nodeName:"img",8670 src:data.getAttribute("root")+data.node[i].getAttribute("pic"),8671 style:{8672 display:"block",8673 margin:"auto",8674 },8675 onload:function() {8676 var scale=Math.min(300/this.naturalWidth,240/this.naturalHeight);8677 this.set({style:{8678 width:this.naturalWidth*scale,8679 height:this.naturalHeight*scale,8680 marginTop:(240-this.naturalHeight*scale)/2,8681 }});8682 },8683 });8684 block.appendChild(block.pic);8685 }8686 }8687 }8688 function buildPageV_Sponsor() {8689 PAGE_V["sponsor"]=ASElement({8690 nodeName:"div",8691 wCenter:true,8692 style:{8693 width:VERTICAL_PAGE_WIDTH,8694 marginBottom:30,8695 },8696 });8697 PAGE_V["sponsor"].build=function() {8698 this.wBuild=true;8699 var data=ASGetSourceByName("data0").getNodeByName("sponsor");8700 this.block=[];8701 for (var i=0;i<data.node.length;i++) {8702 this.block[i]=ASElement({8703 nodeName:"div",8704 style:{8705 width:410,8706 height:345,8707 margin:20,8708 },8709 });8710 var block=this.block[i];8711 this.appendChild(this.block[i]);8712 block.pic=ASElement({8713 nodeName:"img",8714 src:data.getAttribute("root")+data.node[i].getAttribute("pic"),8715 style:{8716 display:"block",8717 margin:"auto",8718 },8719 onload:function() {8720 var scale=Math.min(410/this.naturalWidth,345/this.naturalHeight);8721 this.set({style:{8722 width:this.naturalWidth*scale,8723 height:this.naturalHeight*scale,8724 marginTop:(345-this.naturalHeight*scale)/2,8725 }});8726 },8727 });8728 block.appendChild(block.pic);8729 }8730 }8731 }8732 function buildPage_Wechat() {8733 PAGE["wechat"]=ASElement({8734 nodeName:"div",8735 wCenter:true,8736 style:{8737 width:DEFAULT_PAGE_WIDTHL,8738 },8739 });8740 PAGE["wechat"].build=function() {8741 this.wBuild=true;8742 this.pic=ASElement({8743 nodeName:"img",8744 src:ASGetSrcByName("CFASQrcode"),8745 style:{8746 display:"block",8747 width:360,8748 height:360,8749 marginLeft:"auto",8750 marginRight:"auto",8751 marginTop:70,8752 },8753 });8754 this.appendChild(this.pic);8755 this.word=BasicWord({8756 size:30,8757 wordC:"掃碼關注民藝公眾號吧~",8758 wordE:"Scan the QR code to get our news on Wechat~",8759 style:{8760 width:"100%",8761 marginTop:25,8762 marginBottom:70,8763 textAlign:"center",8764 },8765 }),8766 this.appendChild(this.word);8767 }8768 }8769 function buildPageV_Wechat() {8770 PAGE_V["wechat"]=ASElement({8771 nodeName:"div",8772 wCenter:true,8773 style:{8774 width:VERTICAL_PAGE_WIDTHL,8775 },8776 });8777 PAGE_V["wechat"].build=function() {8778 this.wBuild=true;8779 this.pic=ASElement({8780 nodeName:"img",8781 src:ASGetSrcByName("CFASQrcode"),8782 style:{8783 display:"block",8784 width:600,8785 height:600,8786 marginLeft:"auto",8787 marginRight:"auto",8788 marginTop:70,8789 },8790 });8791 this.appendChild(this.pic);8792 this.word=BasicWord({8793 size:60,8794 wordC:"掃碼關注民藝公眾號吧~",8795 wordE:"Scan the QR code to get our news on Wechat~",8796 style:{8797 width:"100%",8798 marginTop:25,8799 marginBottom:70,8800 textAlign:"center",8801 },8802 }),8803 this.appendChild(this.word);8804 }8805 }8806 function buildPage_Email() {8807 PAGE["email"]=ASElement({8808 nodeName:"div",8809 wCenter:true,8810 style:{8811 marginTop:20,8812 marginBottom:15,8813 width:DEFAULT_PAGE_WIDTHL,8814 },8815 });8816 PAGE["email"].resize=function() {8817 if (USERDATA=="NULL") {8818 } else {8819 if (USERDATA.place!="E") {8820 var page=this.page[1];8821 page.editor.resize({heightA:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT-DEFAULT_SHELL_BOTTOM_HEIGHT-80});8822 } else {8823 var page=this.page[2];8824 page.editor.resize({heightA:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT-DEFAULT_SHELL_BOTTOM_HEIGHT-80});8825 }8826 }8827 }8828 PAGE["email"].update=function() {8829 this.clearChild();8830 if (USERDATA=="NULL") {8831 this.appendChild(this.page[0]);8832 } else {8833 if (USERDATA.place!="E") {8834 this.appendChild(this.page[1]);8835 } else {8836 this.appendChild(this.page[2]);8837 }8838 }8839 this.setTimeout(function(){if (this.root) this.root.pageResize(this);},30);8840 }8841 PAGE["email"].build=function() {8842 this.wBuild=true;8843 this.page=[];8844 this.page[0]=ASElement({8845 nodeName:"div",8846 root:this,8847 style:{8848 width:DEFAULT_PAGE_WIDTHL,8849 },8850 });8851 var page=this.page[0];8852 page.word=BasicWord({8853 size:60,8854 wordC:"請先登錄",8855 wordE:"Please log in first.",8856 style:{8857 width:"100%",8858 textAlign:"center",8859 marginTop:50,8860 },8861 });8862 page.appendChild(page.word);8863 page.log=BasicButton({8864 size:24,8865 wordC:"登 入",8866 wordE:"Log in",8867 wCenter:true,8868 style:{8869 marginTop:30,8870 },8871 onclick:function() {8872 changeURL("login");8873 },8874 });8875 page.appendChild(page.log);8876 this.page[2]=ASElement({8877 nodeName:"div",8878 style:{8879 position:"relative",8880 width:"100%",8881 },8882 });8883 var page=this.page[2];8884 var re=[{8885 wordC:"全體用戶",8886 wordE:"All users",8887 value:"allUser",8888 },{8889 wordC:"全體會員",8890 wordE:"All members",8891 value:"allMember",8892 },{8893 wordC:"全體Exco",8894 wordE:"All excos",8895 value:"allExco",8896 },{8897 wordC:"全體Subcom",8898 wordE:"All subcoms",8899 value:"allSubcom",8900 }];8901 var data=ASGetSourceByName("data0").getNodeByName("exco14");8902 for (var i=0;i<data.node.length;i++) {8903 re[re.length]={8904 wordC:data.node[i].getAttribute("nameC"),8905 wordE:data.node[i].getAttribute("nameE"),8906 value:data.node[i].getAttribute("itsc")+"@connect.ust.hk",8907 belong:"allExco",8908 };8909 }8910 var data=ASGetSourceByName("data0").getNodeByName("subcom12");8911 for (var i=0;i<data.node.length;i++) {8912 re[re.length]={8913 wordC:data.node[i].getAttribute("nameC"),8914 wordE:data.node[i].getAttribute("nameE"),8915 value:data.node[i].getAttribute("itsc")+"@connect.ust.hk",8916 belong:"allSubcom",8917 };8918 }8919 page.recipent=BasicInput({8920 size:22,8921 sizeW:24*0.9,8922 type:"checkBox",8923 wordC:"收件人",8924 wordE:"Recipent",8925 widthL:100,8926 block:re,8927 col:4,8928 style:{8929 marginTop:10,8930 marginBottom:10,8931 },8932 });8933 page.appendChild(page.recipent);8934 page.appendChild(ASElement({nodeName:"hr",style:{opacity:0.5}}));8935 page.subject=BasicInput({8936 type:"input",8937 wordC:"主 題",8938 wordE:"Subject",8939 widthL:100,8940 hintC:"未填写",8941 hintE:"Undefined",8942 wCompulsory:true,8943 style:{8944 marginTop:8,8945 marginBottom:8,8946 },8947 });8948 page.appendChild(page.subject);8949 page.editor=BasicEditor({8950 heightA:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT-DEFAULT_SHELL_BOTTOM_HEIGHT-113,8951 });8952 page.appendChild(page.editor);8953 page.appendChild(ASElement("br"));8954 page.send=BasicDoubleButton({8955 fx:"up",8956 wAequilate:true,8957 size:20,8958 button0:{8959 wordC:"發 送",8960 wordE:"Send",8961 },8962 button1:{8963 wordC:"取 消",8964 wordE:"Cancel",8965 },8966 style:{8967 marginLeft:5,8968 marginTop:8,8969 },8970 });8971 page.appendChild(page.send);8972 this.appendChild(this.page[0]);8973 }8974 }8975 function buildPage_Setting() {8976 PAGE["setting"]=ASElement({8977 nodeName:"div",8978 wCenter:true,8979 style:{8980 marginTop:50,8981 marginBottom:50,8982 width:DEFAULT_PAGE_WIDTHL-100,8983 },8984 });8985 PAGE["setting"].build=function() {8986 this.wBuild=true;8987 this.title1=BasicTitle({8988 wordC:"基本设置",8989 wordE:"Basic Setting",8990 style:{8991 marginBottom:20,8992 }8993 });8994 this.appendChild(this.title1);8995 this.inputList=["lang"];8996 this.input=[];8997 for (var i=0;i<this.inputList.length;i++) {8998 var p={8999 model:this.inputList[i],9000 style:{9001 marginLeft:30,9002 },9003 };9004 this.input[this.inputList[i]]=BasicInput(p);9005 this.appendChild(this.input[this.inputList[i]]);9006 }9007 this.input["lang"].setValue(ASLang);9008 }9009 }9010 function buildPageV_Setting() {9011 PAGE_V["setting"]=ASElement({9012 nodeName:"div",9013 wCenter:true,9014 style:{9015 marginTop:60,9016 marginBottom:60,9017 width:VERTICAL_PAGE_WIDTHL,9018 },9019 });9020 PAGE_V["setting"].build=function() {9021 this.wBuild=true;9022 this.title1=BasicTitle({9023 size:60,9024 wordC:"基本设置",9025 wordE:"Basic Setting",9026 style:{9027 marginLeft:50,9028 marginBottom:30,9029 }9030 });9031 this.appendChild(this.title1);9032 this.inputList=["lang"];9033 this.input=[];9034 for (var i=0;i<this.inputList.length;i++) {9035 var p={9036 model:this.inputList[i],9037 size:50,9038 widthL:300,9039 widthA:VERTICAL_PAGE_WIDTHL,9040 style:{9041 marginLeft:80,9042 },9043 };9044 this.input[this.inputList[i]]=BasicInput(p);9045 this.appendChild(this.input[this.inputList[i]]);9046 }9047 this.input["lang"].setValue(ASLang);9048 }9049 }9050 function buildPage_Login() {9051 PAGE["login"]=ASElement({9052 nodeName:"div",9053 wCenter:true,9054 style:{9055 width:DEFAULT_PAGE_WIDTHL,9056 },9057 });9058 PAGE["login"].build=function() {9059 this.wBuild=true;9060 this.content=ASElement({9061 nodeName:"iframe",9062 src:"https://cas.ust.hk/cas/login?service=http://ihome.ust.hk/~su_cfas/cgi-bin/",9063 style:{9064 display:"block",9065 marginLeft:"auto",9066 marginRight:"auto",9067 marginBottom:30,9068 width:550,9069 height:680,9070 },9071 });9072 this.appendChild(this.content);9073 }9074 PAGE["login"].appear=function() {9075 this.appendChild(this.content);9076 }9077 }9078 function buildPageV_Login() {9079 PAGE_V["login"]=ASElement({9080 nodeName:"div",9081 wCenter:true,9082 style:{9083 width:DEFAULT_PAGE_WIDTHL,9084 },9085 });9086 PAGE_V["login"].build=function() {9087 this.wBuild=true;9088 this.content=ASElement({9089 nodeName:"iframe",9090 src:"https://cas.ust.hk/cas/login?service=http://ihome.ust.hk/~su_cfas/cgi-bin/",9091 style:{9092 display:"block",9093 marginLeft:"auto",9094 marginRight:"auto",9095 marginBottom:30,9096 width:550,9097 height:680,9098 transformOrigin:"50% 0",9099 transform:{9100 scale:VERTICAL_PAGE_WIDTHL/550,9101 },9102 },9103 });9104 this.appendChild(this.content);9105 }9106 PAGE_V["login"].appear=function() {9107 this.appendChild(this.content);9108 }9109 }9110 function buildPage_Logout() {9111 PAGE["logout"]=ASElement({9112 nodeName:"div",9113 wCenter:true,9114 style:{9115 width:DEFAULT_PAGE_WIDTHL,9116 },9117 });9118 PAGE["logout"].build=function() {9119 this.wBuild=true;9120 this.content=ASElement({9121 nodeName:"iframe",9122 src:"https://cas.ust.hk/cas/logout",9123 style:{9124 display:"block",9125 marginLeft:"auto",9126 marginRight:"auto",9127 marginBottom:30,9128 width:550,9129 height:390,9130 },9131 });9132 this.appendChild(this.content);9133 }9134 PAGE["logout"].appear=function() {9135 this.appendChild(this.content);9136 removeACookie("cfas_user");9137 removeACookie("cfas_ticket");9138 USERDATA="NULL";9139 updateUserData();9140 }9141 }9142 function buildPageV_Logout() {9143 PAGE_V["logout"]=ASElement({9144 nodeName:"div",9145 wCenter:true,9146 style:{9147 width:DEFAULT_PAGE_WIDTHL,9148 },9149 });9150 PAGE_V["logout"].build=function() {9151 this.wBuild=true;9152 this.content=ASElement({9153 nodeName:"iframe",9154 src:"https://cas.ust.hk/cas/logout",9155 style:{9156 display:"block",9157 marginLeft:"auto",9158 marginRight:"auto",9159 marginBottom:30,9160 width:550,9161 height:390,9162 transformOrigin:"50% 0",9163 transform:{9164 scale:VERTICAL_PAGE_WIDTHL/550,9165 },9166 },9167 });9168 this.appendChild(this.content);9169 }9170 PAGE_V["logout"].appear=function() {9171 this.appendChild(this.content);9172 removeACookie("cfas_user");9173 removeACookie("cfas_ticket");9174 USERDATA="NULL";9175 updateUserData();9176 }9177 }9178 function buildPage_UserProfile() {9179 PAGE["userProfile"]=ASElement({9180 nodeName:"div",9181 wCenter:true,9182 style:{9183 width:DEFAULT_PAGE_WIDTHL,9184 marginTop:30,9185 marginBottom:30,9186 },9187 });9188 PAGE["userProfile"].inputList=["nickname","name","place","sex","studentID","school","phone"];9189 PAGE["userProfile"].build=function() {9190 this.wBuild=true;9191 this.titleF=BasicTitle({9192 wordC:"基本信息",9193 wordE:"Basic Information",9194 style:{9195 marginBottom:20,9196 },9197 });9198 this.appendChild(this.titleF);9199 this.input={};9200 for (var i=0;i<this.inputList.length;i++) {9201 this.input[this.inputList[i]]=BasicInput({9202 model:this.inputList[i],9203 widthA:800,9204 style:{9205 marginTop:2,9206 marginBottom:2,9207 marginLeft:30,9208 },9209 });9210 if (USERDATA!="NULL") {9211 this.input[this.inputList[i]].setValue(USERDATA[this.inputList[i]]);9212 }9213 this.appendChild(this.input[this.inputList[i]]);9214 this.appendChild(ASElement("br"));9215 }9216 this.save=BasicButton({9217 size:24,9218 wordC:"保 存",9219 wordE:"Save",9220 style:{9221 position:"relative",9222 left:DEFAULT_PAGE_WIDTHL-100,9223 marginTop:10,9224 visibility:"hidden",9225 },9226 root:this,9227 onclick:function() {9228 var data={};9229 for (var i=0;i<this.root.inputList.length;i++) {9230 data[this.root.inputList[i]]=this.root.input[this.root.inputList[i]].getValue();9231 }9232 postUserData(data);9233 }9234 });9235 this.appendChild(this.save);9236 if (USERDATA!="NULL") this.save.set({style:{visibility:"visible"}});9237 }9238 PAGE["userProfile"].update=function() {9239 if (!this.wBuild) return;9240 if (USERDATA=="NULL") {9241 this.input["nickname"].setValue("");9242 this.input["name"].setValue("");9243 this.input["place"].setValue("N");9244 this.input["sex"].setValue("U");9245 this.input["studentID"].setValue("");9246 this.input["school"].setValue("");9247 this.input["phone"].setValue("");9248 this.save.set({style:{visibility:"hidden"}});9249 } else {9250 for (var i=0;i<this.inputList.length;i++) {9251 this.input[this.inputList[i]].setValue(USERDATA[this.inputList[i]]);9252 }9253 this.save.set({style:{visibility:"visible"}});9254 }9255 }9256 }9257 function buildPageV_UserProfile() {9258 PAGE_V["userProfile"]=ASElement({9259 nodeName:"div",9260 wCenter:true,9261 style:{9262 width:VERTICAL_PAGE_WIDTHL,9263 marginTop:50,9264 marginBottom:50,9265 },9266 });9267 PAGE_V["userProfile"].inputList=["nickname","name","place","sex","studentID","school","phone"];9268 PAGE_V["userProfile"].build=function() {9269 this.wBuild=true;9270 this.titleF=BasicTitle({9271 size:60,9272 wordC:"基本信息",9273 wordE:"Basic Information",9274 widthA:VERTICAL_PAGE_WIDTHL,9275 style:{9276 marginBottom:30,9277 },9278 });9279 this.appendChild(this.titleF);9280 this.input={};9281 for (var i=0;i<this.inputList.length;i++) {9282 var p={9283 size:50,9284 model:this.inputList[i],9285 widthA:VERTICAL_PAGE_WIDTHL-150,9286 widthL:270,9287 style:{9288 position:"relative",9289 left:30,9290 marginTop:20,9291 },9292 };9293 if (this.inputList[i]=="school") {9294 p.type="radioPoint";9295 p.col=2;9296 }9297 this.input[this.inputList[i]]=BasicInput(p);9298 if (USERDATA!="NULL") {9299 this.input[this.inputList[i]].setValue(USERDATA[this.inputList[i]]);9300 }9301 this.appendChild(this.input[this.inputList[i]]);9302 this.appendChild(ASElement("br"));9303 }9304 this.save=BasicButton({9305 size:45,9306 wordC:"保 存",9307 wordE:"Save",9308 style:{9309 position:"relative",9310 left:VERTICAL_PAGE_WIDTHL-140,9311 marginTop:40,9312 visibility:"hidden",9313 },9314 root:this,9315 onclick:function() {9316 var data={};9317 for (var i=0;i<this.root.inputList.length;i++) {9318 data[this.root.inputList[i]]=this.root.input[this.root.inputList[i]].getValue();9319 }9320 postUserData(data);9321 }9322 });9323 this.appendChild(this.save);9324 if (USERDATA!="NULL") this.save.set({style:{visibility:"visible"}});9325 }9326 PAGE_V["userProfile"].update=function() {9327 if (!this.wBuild) return;9328 if (USERDATA=="NULL") {9329 this.input["nickname"].setValue("");9330 this.input["name"].setValue("");9331 this.input["place"].setValue("N");9332 this.input["sex"].setValue("U");9333 this.input["studentID"].setValue("");9334 this.input["school"].setValue("");9335 this.input["phone"].setValue("");9336 this.save.set({style:{visibility:"hidden"}});9337 } else {9338 for (var i=0;i<this.inputList.length;i++) {9339 this.input[this.inputList[i]].setValue(USERDATA[this.inputList[i]]);9340 }9341 this.save.set({style:{visibility:"visible"}});9342 }9343 }9344 }9345 function buildPageV_CookGame() {9346 PAGE_V["cookGame"]=ASElement({9347 nodeName:"div",9348 wCenter:true,9349 style:{9350 width:VERTICAL_SHELL_WIDTH,9351 paddingTop:40,9352 paddingBottom:70,9353 backgroundColor:"#1A00AC",9354 },9355 });9356 PAGE_V["cookGame"].build=function() {9357 this.wBuild=true;9358 setLang("C");9359 this.status="normal";9360 this.set({style:{minHeight:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT}});9361 this.intro=BasicWord({9362 size:45,9363 color:"rgb(255,255,0)",9364 wordC:" 對於廚師而言,良好的刀工是非常重要的。試著將胡蘿蔔切成厚度相同的八片,看看你是否有做神廚的潛力吧~",9365 wordE:"For a chef, the skill of using knife is very important. Try to cut the carrot into eight pieces of same thickness, to see whether you have the potential to be a great chef~",9366 wCenter:true,9367 style:{9368 marginTop:30,9369 width:"85%",9370 },9371 });9372 this.appendChild(this.intro);9373 this.title1=BasicTitle({9374 size:60,9375 color:"rgb(255,255,0)",9376 wordC:"玩 法",9377 wordE:"How to Play",9378 style:{9379 marginTop:40,9380 marginLeft:"5%",9381 },9382 });9383 this.appendChild(this.title1);9384 this.way=BasicWord({9385 size:45,9386 color:"rgb(255,255,0)",9387 wordC:" 點擊按鈕開始遊戲或下刀(共七刀)",9388 wordE:"Click the button to start or cut (7 times in total).",9389 wCenter:true,9390 style:{9391 marginTop:15,9392 width:"85%",9393 },9394 });9395 this.appendChild(this.way);9396 this.title2=BasicTitle({9397 size:60,9398 color:"rgb(255,255,0)",9399 wordC:"提 醒",9400 wordE:"Remind",9401 style:{9402 marginTop:40,9403 marginLeft:"5%",9404 },9405 });9406 this.appendChild(this.title2);9407 this.buttonW2=BasicWord({9408 size:45,9409 wordC:" IPhone用戶請交替點擊按鈕與其他空白區域(推薦用兩根手指hh),防止連點手勢",9410 color:"rgb(255,255,0)",9411 wCenter:true,9412 style:{9413 width:"80%",9414 marginTop:20,9415 },9416 });9417 this.appendChild(this.buttonW2);9418 this.content=ASElement({9419 nodeName:"div",9420 wCenter:"true",9421 style:{9422 position:"relative",9423 width:"90%",9424 height:600,9425 },9426 });9427 this.appendChild(this.content);9428 this.content.plant=ASElement({9429 nodeName:"div",9430 style:{9431 position:"absolute",9432 width:"100%",9433 height:30,9434 backgroundImage:"url('Image/Page/cookGame/plant.png')",9435 backgroundSize:"100% 100%",9436 backgroundRepeat:"no-repeat",9437 bottom:60,9438 },9439 });9440 this.content.appendChild(this.content.plant);9441 this.content.carrot0=ASElement({9442 nodeName:"div",9443 style:{9444 position:"absolute",9445 width:245,9446 height:80,9447 backgroundImage:"url('Image/Page/cookGame/carrot.png')",9448 backgroundSize:"245px 100%",9449 backgroundRepeat:"no-repeat",9450 bottom:90,9451 left:125,9452 transformOrigin:"0 100%",9453 },9454 });9455 this.content.appendChild(this.content.carrot0);9456 this.content.carrot=[];9457 this.content.knife=ASElement({9458 nodeName:"img",9459 src:"Image/Page/cookGame/knife.png",9460 style:{9461 position:"absolute",9462 width:75,9463 left:"50%",9464 bottom:200,9465 transform:{9466 translateX:-34,9467 },9468 },9469 });9470 this.content.appendChild(this.content.knife);9471 this.content.percentW=BasicWord({9472 size:60,9473 wordC:"aa",9474 wordE:"aa",9475 color:"rgb(255,255,100)",9476 wCenter:true,9477 style:{9478 position:"absolute",9479 top:60,9480 width:"100%",9481 textAlign:"center",9482 opacity:0,9483 },9484 });9485 this.content.appendChild(this.content.percentW);9486 this.content.failW=BasicWord({9487 size:80,9488 wordC:"您未能完成",9489 wordE:"You failed",9490 color:"rgb(255,0,0)",9491 wCenter:true,9492 style:{9493 position:"absolute",9494 top:160,9495 width:"100%",9496 textAlign:"center",9497 opacity:0,9498 },9499 });9500 this.content.appendChild(this.content.failW);9501 this.content.successW=BasicWord({9502 size:60,9503 wordC:"aa",9504 wordE:"aa",9505 wCenter:true,9506 color:"rgb(255,255,100)",9507 style:{9508 position:"absolute",9509 top:160,9510 width:"100%",9511 textAlign:"center",9512 opacity:0,9513 },9514 });9515 this.content.appendChild(this.content.successW);9516 this.over=function() {9517 if (this.clickTime<8) {9518 this.status="fail";9519 this.content.knife.set({style:{opacity:0.5}});9520 this.content.failW.set({style:{opacity:1}});9521 this.clickTime=8;9522 } else {9523 this.content.carrot0.set({style:{opacity:0}});9524 this.widthN[8]=245;9525 for (var i=1;i<=8;i++) {9526 this.content.carrot[i]=ASElement({9527 nodeName:"div",9528 i:i,9529 style:{9530 position:"absolute",9531 height:80,9532 width:this.widthN[i]-this.widthN[i-1],9533 backgroundImage:"url('Image/Page/cookGame/carrot.png')",9534 backgroundSize:"245px 100%",9535 backgroundRepeat:"no-repeat",9536 backgroundPosition:-(245-this.widthN[i])+"px 0",9537 bottom:90,9538 left:ASGetElementWidth(this.content)/2+245-this.widthN[i],9539 transformOrigin:"0 100%",9540 },9541 });9542 this.content.appendChild(this.content.carrot[i]);9543 this.content.carrot[i].setTimeout(function() {this.setTarget({9544 opacity:1,9545 speed_alpha:0.1,9546 bottom:90,9547 left:90*(9-this.i),9548 transform:{9549 rotate:-90,9550 },9551 });},300);9552 }9553 this.content.carrot0.setTimeout(function() {this.setTarget({9554 left:90*8,9555 transform:{9556 rotate:-90,9557 },9558 });},300);9559 var mean=245/8;9560 var sq=0;9561 for (var i=1;i<=8;i++) {9562 sq+=Math.pow(this.widthN[i]-this.widthN[i-1]-mean,2);9563 }9564 this.content.percentW.set({style:{9565 opacity:1,9566 }});9567 var point=105-Math.min(105,Math.sqrt(sq)*1.3);9568 var str=point+"";9569 str=str.substr(0,5);9570 this.content.percentW.setWord({9571 wordC:"相似度:"+str+"%",9572 });9573 if (point<60) {9574 this.content.successW.setWord({9575 wordC:"您的刀法...還是來當評委吧^^",9576 });9577 document.title=str+"%!我在民藝坊廚神爭霸之刀工測試中,達到了“评委”水准!";9578 } else {9579 if (point<80) {9580 this.content.successW.setWord({9581 wordC:"不錯哦,可以試試當helper~",9582 });9583 document.title=str+"%!我在民藝坊廚神爭霸之刀工測試中,達到了“Helper”水准!";9584 } else {9585 if (point<90) {9586 this.content.successW.setWord({9587 wordC:"哇塞,您一定是做菜好手,可以報名副廚了hh",9588 });9589 document.title=str+"%!我在民藝坊廚神爭霸之刀工測試中,達到了“副厨”水准!";9590 } else {9591 this.content.successW.setWord({9592 wordC:"天啊,您一定是骨骼精奇之人,快來挑戰主廚吧!",9593 });9594 document.title=str+"%!我在民藝坊廚神爭霸之刀工測試中,達到了“主厨”水准!";9595 }9596 }9597 }9598 this.content.knife.set({style:{opacity:0.5}});9599 this.content.successW.set({style:{opacity:1}});9600 }9601 this.setTimeout(function() {9602 this.status="normal";9603 this.buttonW.setWord({9604 wordC:"再來一次",9605 wordE:"Restart",9606 });9607 },500);9608 }9609 this.buttonW=BasicWord({9610 size:45,9611 wordC:"點擊按鈕開始",9612 wordE:"Click the button to start",9613 color:"rgb(255,255,0)",9614 style:{9615 textAlign:"center",9616 width:"100%",9617 marginTop:20,9618 marginBottom:20,9619 },9620 });9621 this.appendChild(this.buttonW);9622 this.clickTime=0;9623 this.button=ASElement({9624 nodeName:"div",9625 wCenter:true,9626 style:{9627 width:120,9628 height:120,9629 borderRadius:60,9630 boxShadow:"0 0 0px 10px rgb(255,255,100) inset",9631 },9632 root:this,9633 onmouseover:function() {return false;},9634 onmousemove:function() {return false;},9635 onmouseup:function() {return false;},9636 onselectstart:function() {return false;},9637 ondragstart:function() {return false;},9638 onmousedown:function() {9639 if (this.root.status!="normal") return;9640 var timeA=2000;9641 if (this.root.clickTime==0) {9642 this.root.startTime=ASGetTime();9643 this.root.widthN=[0];9644 this.root.content.carrot0.setTarget({9645 type:"linear",9646 left:"50%",9647 time:timeA,9648 });9649 this.root.setTimeout(this.root.over,timeA);9650 }9651 if (this.root.clickTime>0 && this.root.clickTime<8) {9652 this.root.content.knife.set({style:{transform:{9653 translateY:120,9654 }}});9655 this.root.content.knife.setTimeout(function() {this.setTarget({9656 transform:{9657 translateY:0,9658 },9659 time:50,9660 type:"linear",9661 });},0);9662 var time1=ASGetTime()-this.root.startTime;9663 var width1=time1/timeA*245;9664 this.root.widthN[this.root.clickTime]=width1;9665 }9666 if (this.root.clickTime==7) {9667 this.root.status="pause";9668 }9669 if (this.root.clickTime==8) {9670 for (var i=1;i<=8;i++) {9671 if (this.root.content.carrot[i]) {9672 this.root.content.removeChild(this.root.content.carrot[i]);9673 this.root.content.carrot[i]=null;9674 }9675 }9676 this.root.content.carrot0.set({style:{9677 transition:"",9678 }});9679 this.root.content.carrot0.setTimeout(function() {this.set({style:{9680 left:125,9681 width:245,9682 transform:{9683 rotate:0,9684 },9685 opacity:1,9686 }});},10);9687 this.root.content.knife.set({style:{opacity:1}});9688 this.root.content.percentW.set({style:{opacity:0}});9689 this.root.content.failW.set({style:{opacity:0}});9690 this.root.content.successW.set({style:{opacity:0}});9691 }9692 this.root.clickTime++;9693 if (this.root.clickTime>8) this.root.clickTime=0;9694 if (this.root.clickTime==0) {9695 if (this.root.clickTime==0) {9696 this.root.buttonW.setWord({9697 wordC:"點擊按鈕開始",9698 wordE:"Click the button to start",9699 });9700 }9701 } else {9702 this.root.buttonW.setWord({9703 wordC:(this.root.clickTime-1)+"/7",9704 wordE:(this.root.clickTime-1)+"/7",9705 });9706 }9707 },9708 });9709 this.appendChild(this.button);9710 this.button.pic=ASElement({9711 nodeName:"div",9712 style:{9713 marginLeft:20,9714 marginTop:20,9715 width:80,9716 height:80,9717 borderRadius:40,9718 backgroundColor:"rgb(255,255,100)",9719 },9720 });9721 this.button.appendChild(this.button.pic);9722 }9723 }9724 function buildPageV_CookGame2() {9725 PAGE_V["cookGame2"]=ASElement({9726 nodeName:"div",9727 wCenter:true,9728 style:{9729 width:VERTICAL_SHELL_WIDTH,9730 paddingTop:40,9731 paddingBottom:70,9732 backgroundColor:"black",9733 },9734 });9735 PAGE_V["cookGame2"].build=function() {9736 this.wBuild=true;9737 setLang("C");9738 this.status="normal";9739 this.set({style:{minHeight:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT}});9740 this.intro=BasicWord({9741 size:45,9742 color:"rgb(255,255,0)",9743 wordC:" 在菜餚烹調過程中,火候的掌控至關重要。一個優秀的廚師,不僅需要調整火力的大小,還需要準確把控加熱時間,才能烹飪出美味可口的菜品。",9744 wCenter:true,9745 style:{9746 marginTop:30,9747 width:"85%",9748 },9749 });9750 this.appendChild(this.intro);9751 this.content=ASElement({9752 nodeName:"div",9753 wCenter:true,9754 style:{9755 position:"relative",9756 width:345,9757 overflow:"hidden",9758 },9759 });9760 this.appendChild(this.content);9761 this.fire=ASElement({9762 nodeName:"img",9763 src:"Image/Page/cookGame2/fire.gif",9764 wCenter:true,9765 style:{9766 position:"relative",9767 left:-2.5,9768 width:350,9769 opacity:0,9770 },9771 ontouchstart:function() {return false;},9772 ontouchend:function() {return false;},9773 });9774 this.content.appendChild(this.fire);9775 var ontouchstart=function() {9776 this.root.fire.setTarget({opacity:1,speed_alpha:0.1});9777 return false;9778 };9779 var ontouchend=function() {9780 this.root.fire.setTarget({opacity:0,speed_alpha:0.05});9781 return false;9782 }9783 this.button=ASElement({9784 nodeName:"div",9785 wCenter:true,9786 style:{9787 position:"relative",9788 width:100,9789 height:100,9790 top:-155,9791 left:-2,9792 borderRadius:60,9793 boxShadow:"0 0 0px 10px rgba(255,150,50,0.5) inset",9794 backgroundColor:"rgba(255,200,100,0.2)",9795 },9796 root:this,9797 ontouchstart:ontouchstart,9798 ontouchend:ontouchend,9799 onmousedown:ontouchstart,9800 onmouseup:ontouchend,9801 });9802 this.content.appendChild(this.button);9803 }9804 }9805 function buildPageV_LanternGame() {9806 PAGE_V["lanternGame"]=ASElement({9807 nodeName:"div",9808 wCenter:true,9809 style:{9810 width:VERTICAL_SHELL_WIDTH,9811 paddingTop:40,9812 paddingBottom:70,9813 backgroundColor:"black",9814 },9815 });9816 PAGE_V["lanternGame"].build=function() {9817 this.wBuild=true;9818 setLang("C");9819 this.status="normal";9820 this.set({style:{minHeight:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT}});9821 var stageH=VERTICAL_SHELL_WIDTH*1.1;9822 this.stage=ASElement({9823 nodeName:"div",9824 style:{9825 position:"relative",9826 width:VERTICAL_SHELL_WIDTH,9827 height:stageH,9828 },9829 ontouchmove:function(e) {9830 if (!this.bd1 || !this.bd2) return;9831 //alert(e.targetTouches[0].);9832 },9833 });9834 this.appendChild(this.stage);9835 var size=200;9836 this.button1=ASElement({9837 nodeName:"div",9838 style:{9839 position:"absolute",9840 x:VERTICAL_SHELL_WIDTH/2-size-size/20,9841 y:stageH-size,9842 left:VERTICAL_SHELL_WIDTH/2-size-size/20,9843 top:stageH-size,9844 width:size,9845 height:size,9846 borderRadius:size,9847 backgroundColor:"rgba(200,0,0,0.3)",9848 boxShadow:"0 0 0 "+size/10+"px rgba(150,0,0,0.8) inset",9849 },9850 stage:this.stage,9851 ontouchstart:function() {9852 this.stage.bd1=true;9853 },9854 });9855 this.stage.appendChild(this.button1);9856 this.button1.light=ASElement({9857 nodeName:"div",9858 style:{9859 width:size,9860 height:size,9861 borderRadius:size,9862 backgroundColor:"rgba(200,0,0,0.2)",9863 boxShadow:"0 0 25px 10px rgba(200,0,0,1)",9864 opacity:0,9865 },9866 });9867 this.button1.appendChild(this.button1.light);9868 this.button2=ASElement({9869 nodeName:"div",9870 style:{9871 position:"absolute",9872 x:VERTICAL_SHELL_WIDTH/2+size/20,9873 y:stageH-size,9874 left:VERTICAL_SHELL_WIDTH/2+size/20,9875 top:stageH-size,9876 width:size,9877 height:size,9878 borderRadius:size,9879 backgroundColor:"rgba(200,0,0,0.3)",9880 boxShadow:"0 0 0 "+size/10+"px rgba(150,0,0,0.8) inset",9881 },9882 stage:this.stage,9883 ontouchstart:function() {9884 this.stage.bd2=true;9885 },9886 });9887 this.stage.appendChild(this.button2);9888 this.button2.light=ASElement({9889 nodeName:"div",9890 style:{9891 width:size,9892 height:size,9893 borderRadius:size,9894 backgroundColor:"rgba(200,0,0,0.2)",9895 boxShadow:"0 0 25px 10px rgba(200,0,0,1)",9896 opacity:0,9897 },9898 });9899 this.button2.appendChild(this.button2.light);9900 window.addEventListener("touchstart",function(e) {9901 if (e.targetTouches.length>1) alert(e.targetTouches.length);9902 });9903 }9904 }9905 // 添加的 buildPage function 要在这里添加9906 function buildPage() {9907 PAGE=[];9908 buildPage_Image(); // 測試中的一個功能9909 buildPage_News();9910 buildPage_FunctionC();9911 buildPage_FunctionB();9912 buildPage_FunctionS();9913 buildPage_FunctionL();9914 buildPage_FunctionO();9915 buildPage_FunctionODetail(); // 讓老的 Function 可以有一個 Shell 展示活動詳情9916 9917 buildPage_Exco14();9918 buildPage_Exco15();9919 buildPage_Exco16(); // 后添加的两个9920 buildPage_ExcoB();9921 9922 buildPage_Document();9923 buildPage_SocietyIntroduction();9924 buildPage_SocietyMission();9925 buildPage_MailCuisine();9926 buildPage_Sponsor();9927 buildPage_Wechat();9928 buildPage_Email();9929 buildPage_Setting();9930 buildPage_Login();9931 buildPage_Logout();9932 buildPage_UserProfile();9933 PAGE_V=[];9934 buildPageV_News();9935 buildPageV_FunctionC();9936 buildPageV_FunctionB();9937 buildPageV_FunctionS();9938 buildPageV_FunctionO();9939 9940 buildPageV_Exco14();9941 buildPageV_Exco15();9942 buildPageV_Exco16();9943 buildPageV_ExcoB();9944 9945 buildPageV_Document();9946 buildPageV_SocietyIntroduction();9947 buildPageV_SocietyMission();9948 buildPageV_MailCuisine();9949 buildPageV_Sponsor();9950 buildPageV_Wechat();9951 buildPageV_Setting();9952 buildPageV_Login();9953 buildPageV_Logout();9954 buildPageV_UserProfile();9955 buildPageV_CookGame();9956 buildPageV_CookGame2();9957 buildPageV_LanternGame();9958 for (var page in PAGE) PAGE[page].name=page;9959 for (var page in PAGE_V) PAGE_V[page].name=page;9960 // console.log("PAGE", PAGE);9961 }9962 var ShellStr=new function() {9963 this.closeOnmouseover=function() {9964 this.setTarget({transform:{scale:1}});9965 this.pic.setTarget({opacity:1});9966 }9967 this.closeOnmouseout=function() {9968 this.setTarget({transform:{scale:1}});9969 this.pic.setTarget({opacity:0});9970 }9971 this.closeOnmousedown=function() {9972 this.setTarget({transform:{scale:0.9}});9973 this.pic.setTarget({opacity:1});9974 }9975 this.closeOnmouseup=function() {9976 this.setTarget({transform:{scale:1}});9977 this.pic.setTarget({opacity:1});9978 }9979 this.closeOnclick=function() {9980 goBack();9981 }9982 this.removeSelf=function() {9983 this.slideC.scrollTopB=this.slideC.scrollTop;9984 if (this.parentNode) this.parentNode.removeChild(this);9985 }9986 this.resize=function() {9987 this.set({style:{9988 width:ASWindowWidth,9989 height:ASWindowHeight,9990 left:-ASWindowWidth/2,9991 top:-ASWindowHeight/2,9992 }});9993 this.slide.resize({heightA:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT});9994 this.head.set({style:{9995 left:(ASWindowWidth-this.widthA)/2,9996 }});9997 this.slide.set({style:{9998 left:(ASWindowWidth-this.widthA)/2,9999 }});10000 this.bottom.set({style:{10001 minHeight:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT-DEFAULT_SHELL_BOTTOM_HEIGHT,10002 maxHeight:ASWindowHeight-DEFAULT_SHELL_HEAD_HEIGHT,10003 left:(ASWindowWidth-this.widthA)/2,10004 }});10005 this.copyright.set({style:{10006 left:ASWindowWidth/2-500,10007 top:ASWindowHeight-30,10008 }});10009 }10010 this.pageResize=function() {10011 this.slide.onscroll();10012 }10013 this.slideOnscroll=function() {10014 this.root.bottom.set({style:{10015 height:ASGetElementHeight(this.root.context)-this.container.scrollTop-DEFAULT_SHELL_BOTTOM_HEIGHT,10016 }});10017 }10018 this.appear=function() {10019 if (!this.page.wBuild) this.page.build();10020 if (this.page.appear) this.page.appear();10021 this.set({style:{10022 opacity:1,10023 }});10024 this.bottom.setTarget({10025 opacity:1,10026 transform:{10027 translateY:0,10028 }10029 });10030 this.setTimeout(function(){10031 this.head.setTarget({opacity:1,speed_alpha:0.07});10032 },500);10033 this.setTimeout(function(){10034 this.slideC.setTarget({opacity:1,speed_alpha:0.1});10035 },750);10036 this.slideC.scrollTop=this.slideC.scrollTopB;10037 }10038 this.appearFromBottom=function() {10039 this.set({style:{10040 opacity:0,10041 }});10042 this.bottom.set({style:{transform:{10043 translateY:ASWindowHeight,10044 }}});10045 this.head.set({style:{10046 opacity:0,10047 }});10048 this.slideC.set({style:{10049 opacity:0,10050 }});10051 }10052 this.appearEasy=function() {10053 this.set({style:{10054 opacity:0,10055 }});10056 this.bottom.set({style:{10057 opacity:0,10058 transform:{10059 translateY:0,10060 }10061 }});10062 this.head.set({style:{10063 opacity:0,10064 }});10065 this.slideC.set({style:{10066 opacity:0,10067 }});10068 }10069 this.disappear=function() {10070 this.setTarget({10071 opacity:0,10072 });10073 if (this.page.disappear) this.page.disappear();10074 this.setTimeout(this.removeSelf,500);10075 }10076 this.disappearEasy=function() {10077 this.head.setTarget({10078 opacity:0,10079 });10080 this.bottom.setTarget({10081 opacity:0,10082 });10083 this.slideC.setTarget({10084 opacity:0,10085 });10086 if (this.page.disappear) this.page.disappear();10087 this.setTimeout(this.removeSelf,500);10088 }10089 }10090 function Shell(buildP) {10091 if (!("widthA" in buildP)) buildP.widthA=DEFAULT_SHELL_WIDTH;10092 var currentShellHeight;10093 if (!buildP.titleC) {10094 // console.log("No Title")10095 currentShellHeight = DEFAULT_SHELL_HEAD_HEIGHT/4;10096 // currentShellHeight = DEFAULT_SHELL_HEAD_HEIGHT;10097 } else {10098 currentShellHeight = DEFAULT_SHELL_HEAD_HEIGHT;10099 }10100 var target=ASElement({10101 nodeName:"div",10102 style:{10103 position:"absolute",10104 left:-ASWindowWidth/2,10105 top:-ASWindowHeight/2,10106 width:ASWindowWidth,10107 height:ASWindowHeight,10108 backgroundColor:"rgba(100,100,100,0.8)",10109 },10110 });10111 10112 target.type="shell";10113 target.widthA=buildP.widthA;10114 target.name=buildP.name;10115 target.backTo=buildP.backTo;10116 target.page=buildP.pageD;10117 target.page.root=target;10118 target.copyright=ASElement({10119 nodeName:"p",10120 innerHTML:"©2019-2020 Chinese Folk Art Society, HKUSTSU. All Right Reserved.",10121 style:{10122 position:"absolute",10123 fontFamily:DEFAULT_FONT,10124 fontSize:15,10125 color:"white",10126 width:1000,10127 left:ASWindowWidth/2-500,10128 top:ASWindowHeight-30,10129 textAlign:"center",10130 textShadow:"2px 2px 5px rgba(0,0,0,0.8)",10131 pointerEvents:"none",10132 },10133 });10134 target.appendChild(target.copyright);10135 target.bottom=ASElement({10136 nodeName:"div",10137 style:{10138 position:"relative",10139 left:(ASWindowWidth-target.widthA)/2,10140 top:currentShellHeight,10141 backgroundColor:"rgb(250,250,250)",10142 width:target.widthA,10143 minHeight:ASWindowHeight-currentShellHeight-DEFAULT_SHELL_BOTTOM_HEIGHT,10144 maxHeight:ASWindowHeight-currentShellHeight,10145 boxShadow:"0px 0px 20px rgba(0,0,0,0.8)",10146 }10147 });10148 target.appendChild(target.bottom);10149 target.slide=BasicScroll({10150 widthA:target.widthA,10151 heightA:ASWindowHeight-currentShellHeight,10152 style:{10153 position:"absolute",10154 top:currentShellHeight,10155 left:(ASWindowWidth-target.widthA)/2,10156 },10157 onscroll:ShellStr.slideOnscroll,10158 });10159 target.appendChild(target.slide);10160 target.slide.root=target;10161 target.slideC=target.slide.container;10162 target.context=target.slide.context;10163 target.container=ASElement({10164 nodeName:"div",10165 style:{10166 width:"100%",10167 marginBottom:DEFAULT_SHELL_BOTTOM_HEIGHT,10168 },10169 });10170 target.context.appendChild(target.container);10171 if (target.page) {10172 target.container.appendChild(target.page);10173 }10174 target.head=ASElement({10175 nodeName:"div",10176 style:{10177 position:"absolute",10178 left:(ASWindowWidth-target.widthA)/2,10179 top:0,10180 width:target.widthA,10181 height:DEFAULT_SHELL_HEAD_HEIGHT,10182 pointerEvents:"none",10183 },10184 });10185 target.appendChild(target.head);10186 target.head.word=BasicWord({10187 size:75,10188 color:"white",10189 font:"YouYuan",10190 wordC:buildP.titleC,10191 wordE:buildP.titleE,10192 style:{10193 position:"absolute",10194 fontWeight:"bold",10195 left:30,10196 bottom:20,10197 textShadow:"0px 0px 8px rgba(0,0,0,0.8)",10198 letterSpacingC:25,10199 pointerEvents:"none",10200 },10201 });10202 target.head.appendChild(target.head.word);10203 target.close=ASElement({10204 nodeName:"div",10205 style:{10206 position:"absolute",10207 right:20,10208 top:20,10209 transformOrigin:"50% 50%",10210 width:45,10211 height:45,10212 backgroundImage:"url('"+ASGetSrcByName("shellClose1")+"')",10213 backgroundSize:"100% 100%",10214 cursor:"pointer",10215 },10216 onmouseover:ShellStr.closeOnmouseover,10217 onmouseout:ShellStr.closeOnmouseout,10218 onmousedown:ShellStr.closeOnmousedown,10219 onmouseup:ShellStr.closeOnmouseup,10220 onclick:ShellStr.closeOnclick,10221 });10222 target.appendChild(target.close);10223 target.close.pic=ASElement({10224 nodeName:"img",10225 src:ASGetSrcByName("shellClose2"),10226 style:{10227 width:"100%",10228 height:"100%",10229 opacity:0,10230 },10231 });10232 target.close.appendChild(target.close.pic);10233 target.removeSelf=ShellStr.removeSelf;10234 target.resize=ShellStr.resize;10235 target.pageResize=ShellStr.pageResize;10236 target.appear=ShellStr.appear;10237 target.appearFromBottom=ShellStr.appearFromBottom;10238 target.appearEasy=ShellStr.appearEasy;10239 target.disappear=ShellStr.disappear;10240 target.disappearEasy=ShellStr.disappearEasy;10241 delete buildP.page;10242 target.set(buildP);10243 return(target);10244 }10245 var ShellVStr=new function() {10246 this.resize=function() {10247 this.set({style:{10248 width:ASWindowWidth,10249 height:ASWindowHeight,10250 left:-ASWindowWidth/2,10251 top:-ASWindowHeight/2,10252 }});10253 this.slide.resize({heightA:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT});10254 this.head.set({style:{10255 left:(ASWindowWidth-this.widthA)/2,10256 }});10257 this.slide.set({style:{10258 left:(ASWindowWidth-this.widthA)/2,10259 }});10260 this.bottom.set({style:{10261 height:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT,10262 left:(ASWindowWidth-this.widthA)/2,10263 }});10264 this.copyright.set({style:{10265 left:ASWindowWidth/2-500,10266 top:ASWindowHeight-30,10267 }});10268 }10269 }10270 function ShellV(buildP) {10271 if (!("widthA" in buildP)) buildP.widthA=VERTICAL_SHELL_WIDTH;10272 var target=ASElement({10273 nodeName:"div",10274 style:{10275 position:"absolute",10276 left:-ASWindowWidth/2,10277 top:-ASWindowHeight/2,10278 width:ASWindowWidth,10279 height:ASWindowHeight,10280 backgroundColor:"rgba(100,100,100,0.8)",10281 },10282 });10283 target.type="shell";10284 target.widthA=buildP.widthA;10285 target.name=buildP.name;10286 target.backTo=buildP.backTo;10287 target.page=buildP.pageV;10288 target.page.root=target;10289 target.copyright=ASElement({10290 nodeName:"p",10291 innerHTML:"©2019-2020 Chinese Folk Art Society, HKUSTSU. All Right Reserved.",10292 style:{10293 position:"absolute",10294 fontFamily:DEFAULT_FONT,10295 fontSize:15,10296 color:"white",10297 width:1000,10298 left:ASWindowWidth/2-500,10299 top:ASWindowHeight-30,10300 textAlign:"center",10301 textShadow:"2px 2px 5px rgba(0,0,0,0.8)",10302 pointerEvents:"none",10303 },10304 });10305 target.appendChild(target.copyright);10306 target.bottom=ASElement({10307 nodeName:"div",10308 style:{10309 position:"relative",10310 left:(ASWindowWidth-target.widthA)/2,10311 top:VERTICAL_SHELL_HEAD_HEIGHT,10312 backgroundColor:"rgb(250,250,250)",10313 width:target.widthA,10314 height:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT,10315 boxShadow:"0px 0px 20px rgba(0,0,0,0.8)",10316 }10317 });10318 target.appendChild(target.bottom);10319 target.slide=BasicScroll({10320 widthA:target.widthA,10321 heightA:ASWindowHeight-VERTICAL_SHELL_HEAD_HEIGHT-VERTICAL_SHELL_BOTTOM_HEIGHT,10322 style:{10323 position:"absolute",10324 top:VERTICAL_SHELL_HEAD_HEIGHT,10325 left:(ASWindowWidth-target.widthA)/2,10326 },10327 });10328 target.appendChild(target.slide);10329 target.slide.root=target;10330 target.slideC=target.slide.container;10331 target.context=target.slide.context;10332 target.container=ASElement({10333 nodeName:"div",10334 style:{10335 width:"100%",10336 },10337 });10338 target.context.appendChild(target.container);10339 if (target.page) {10340 target.container.appendChild(target.page);10341 }10342 target.head=ASElement({10343 nodeName:"div",10344 style:{10345 position:"absolute",10346 left:(ASWindowWidth-target.widthA)/2,10347 top:0,10348 width:target.widthA,10349 height:VERTICAL_SHELL_HEAD_HEIGHT,10350 pointerEvents:"none",10351 },10352 });10353 target.appendChild(target.head);10354 target.head.word=BasicWord({10355 size:100,10356 color:"white",10357 font:"YouYuan",10358 wordC:buildP.titleC,10359 wordE:buildP.titleE,10360 style:{10361 position:"absolute",10362 fontWeight:"bold",10363 left:50,10364 bottom:40,10365 textShadow:"0px 0px 8px rgba(0,0,0,0.8)",10366 letterSpacingC:25,10367 pointerEvents:"none",10368 },10369 });10370 target.head.appendChild(target.head.word);10371 target.close=ASElement({10372 nodeName:"div",10373 style:{10374 position:"absolute",10375 right:20,10376 top:20,10377 transformOrigin:"50% 50%",10378 width:VERTICAL_SHELL_CLOSE_SIZE,10379 height:VERTICAL_SHELL_CLOSE_SIZE,10380 backgroundImage:"url('"+ASGetSrcByName("shellClose1")+"')",10381 backgroundSize:"100% 100%",10382 cursor:"pointer",10383 },10384 onmouseover:ShellStr.closeOnmouseover,10385 onmouseout:ShellStr.closeOnmouseout,10386 onmousedown:ShellStr.closeOnmousedown,10387 onmouseup:ShellStr.closeOnmouseup,10388 onclick:ShellStr.closeOnclick,10389 });10390 target.appendChild(target.close);10391 target.close.pic=ASElement({10392 nodeName:"img",10393 src:ASGetSrcByName("shellClose2"),10394 style:{10395 width:"100%",10396 height:"100%",10397 opacity:0,10398 },10399 });10400 target.close.appendChild(target.close.pic);10401 target.removeSelf=ShellStr.removeSelf;10402 target.resize=ShellVStr.resize;10403 target.pageResize=ShellStr.pageResize;10404 target.appear=ShellStr.appear;10405 target.appearFromBottom=ShellStr.appearFromBottom;10406 target.appearEasy=ShellStr.appearEasy;10407 target.disappear=ShellStr.disappear;10408 target.disappearEasy=ShellStr.disappearEasy;10409 var page1=target.page;10410 target.set(buildP);10411 target.page=page1;10412 return(target);10413 }10414 function buildShell_FunctionO() {10415 var data=ASGetSourceByName("data0").getNodeByName("functionO");10416 for (var o=0;o<data.node.length;o++) {10417 var year = data.node[o]10418 for (var i=0; i < year.node.length; i++) {10419 10420 var func = year.node[i];10421 10422 var pageName = year.nodeName + "Detail" + i;10423 10424 // 這裡是這個 Shell 的信息,標題在此處修改10425 // 內容是在 buildPage_FunctionODetail 裡面10426 var buildP={10427 name:"Function Detail",10428 titleC:func.getAttribute('nameC'),10429 titleE:func.getAttribute('nameE'),10430 pageD:PAGE[pageName],10431 pageV:PAGE_V[pageName],10432 };10433 SHELL_P[pageName]=buildP;10434 10435 }10436 }10437 }10438 function buildShell() {10439 SHELL={};10440 SHELL_V={};10441 SHELL_P={};10442 var data=ASGetSourceByName("data0").getNodeByName("shell");10443 for (var i=0;i<data.node.length;i++) {10444 var shell=data.node[i];10445 var name=shell.nodeName;10446 var buildP={10447 name:name,10448 titleC:shell.getAttribute("titleC"),10449 titleE:shell.getAttribute("titleE"),10450 pageD:PAGE[shell.getAttribute("page")],10451 pageV:PAGE_V[shell.getAttribute("page")],10452 };10453 if (shell.getAttribute("wLogin")=="true") buildP.wLogin=true;10454 SHELL_P[name]=buildP;10455 }10456 buildShell_FunctionO();10457 // console.log("SHELL_P:", SHELL_P);10458 }10459 var FrameStr=new function() {10460 this.linkOnmouseover=function() {10461 this.bottom.setTarget({opacity:1});10462 this.lineW.setTarget({opacity:1});10463 this.lineB.setTarget({opacity:0});10464 }10465 this.linkOnmouseout=function() {10466 this.bottom.setTarget({opacity:0});10467 this.lineW.setTarget({opacity:1});10468 this.lineB.setTarget({opacity:0});10469 }10470 this.linkOnmousedown=function() {10471 this.bottom.setTarget({opacity:0});10472 this.lineW.setTarget({opacity:0});10473 this.lineB.setTarget({opacity:1});10474 }10475 this.linkOnmouseup=function() {10476 this.bottom.setTarget({opacity:1});10477 this.lineW.setTarget({opacity:1});10478 this.lineB.setTarget({opacity:0});10479 }10480 this.linkOnclick=function() {10481 this.onmouseout();10482 changeURL(this.linkTo);10483 }10484 this.removeSelf=function() {10485 this.slideC.scrollTopB=this.slideC.scrollTop;10486 if (this.parentNode) this.parentNode.removeChild(this);10487 }10488 this.resize=function() {10489 this.set({style:{10490 width:this.widthA,10491 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT,10492 left:-this.widthA/2,10493 top:-ASWindowHeight/2+DEFAULT_HEAD_HEIGHT,10494 }});10495 this.slide.resize({heightA:ASWindowHeight-DEFAULT_HEAD_HEIGHT});10496 this.bottom.set({style:{10497 minHeight:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,10498 maxHeight:ASWindowHeight-DEFAULT_HEAD_HEIGHT,10499 }});10500 this.jump.set({style:{10501 maxHeight:ASWindowHeight-DEFAULT_FRAME_HEAD_MINHEIGHT,10502 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),10503 }});10504 this.jumpC.set({style:{10505 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),10506 }});10507 }10508 this.setPage=function(page) {10509 if (this.pageC==page) return;10510 if (this.pageC) this.pageC.scrollB=this.slideC.scrollTop;10511 if (!page.scrollB) page.scrollB=0;10512 if (this.ASRoot!=ROOT) this.pageC=null;10513 if (!this.pageC) {10514 this.container.clearChild();10515 this.container.appendChild(page);10516 this.bottom.set({style:{10517 height:ASGetElementHeight(this.context)-this.slideC.scrollTop-DEFAULT_FRAME_BOTTOM_HEIGHT,10518 }});10519 this.jump.set({style:{10520 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),10521 }});10522 this.jumpC.set({style:{10523 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),10524 }});10525 if (this.jumpType=="anchor") {10526 this.jump.content.posB=[];10527 for (var i=0;i<page.anchor.length;i++) {10528 this.jump.content.posB[i]=page.anchor[i].pos;10529 }10530 }10531 } else {10532 if (!page.wBuild) page.build();10533 if (page.appear) page.appear();10534 if (this.pageC.disappear) this.pageC.disappear();10535 this.pageC.setTarget({opacity:0});10536 var ruler=ASElement({nodeName:"div",});10537 ruler.appendChild(page);10538 var heightB=ASGetElementHeight(ruler)+this.head.height0-page.scrollB;10539 heightB=Math.max(heightB,ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT);10540 heightB=Math.min(heightB,ASWindowHeight-DEFAULT_HEAD_HEIGHT);10541 this.bottom.setTarget({10542 height:heightB,10543 });10544 var heightH=this.head.height0-page.scrollB;10545 heightH=Math.max(heightH,DEFAULT_FRAME_HEAD_MINHEIGHT);10546 this.head.setTarget({10547 height:heightH,10548 });10549 this.jump.setTarget({10550 top:heightH,10551 height:heightB-heightH,10552 });10553 this.jumpC.setTarget({10554 height:heightB-heightH,10555 });10556 this.setTimeout(function() {10557 this.head.style.transition="";10558 this.jump.style.transition="";10559 this.jumpC.style.transition="";10560 this.bottom.style.transition="";10561 this.container.clearChild();10562 this.container.appendChild(this.pageC);10563 this.pageC.set({style:{opacity:0}});10564 this.slideC.scrollTop=this.pageC.scrollB;10565 this.pageC.setTimeout(function(){this.setTarget({opacity:1});},10);10566 },550);10567 }10568 this.pageC=page;10569 this.pageC.root=this;10570 }10571 this.pageResize=function(page) {10572 if (!page) page=this.pageC;10573 if (page!=this.pageC) return;10574 this.slideC.onscroll();10575 }10576 this.updatePage=function() {10577 var block=[];10578 for (var i=0;i<this.page.length;i++) {10579 if (!this.page[i].wHide) {10580 block[block.length]=this.page[i];10581 }10582 }10583 if (this.jump.content) this.jumpC.removeChild(this.jump.content);10584 this.jump.content=PageList({10585 block:block,10586 style:{10587 position:"relative",10588 left:2.5,10589 top:0,10590 },10591 onchoose:function(w) {10592 this.root.setPage(this.block[w].value);10593 },10594 root:this,10595 });10596 this.jumpC.appendChild(this.jump.content);10597 var k=-1;10598 for (var i=0;i<this.jump.content.block.length;i++) {10599 if (this.jump.content.block[i].value==this.pageC) {10600 k=i;10601 break;10602 }10603 }10604 if (k==-1) this.setPage(this.jump.content.block[0].value);10605 else this.jump.content.changeBlock(k);10606 }10607 this.slideOnscroll=function() {10608 this.root.bottom.set({style:{10609 height:ASGetElementHeight(this.root.context)-this.container.scrollTop-DEFAULT_FRAME_BOTTOM_HEIGHT,10610 }});10611 this.root.head.set({style:{10612 height:this.root.head.height0-this.container.scrollTop,10613 }});10614 if (this.root.head.link) {10615 var s=Math.max(DEFAULT_FRAME_HEAD_MINHEIGHT,this.root.head.height0-this.container.scrollTop);10616 this.root.head.link.set({style:{10617 backgroundPosition:"50% "+(DEFAULT_FRAME_LINK_HEIGHT-s)+"px",10618 }});10619 }10620 this.root.jump.set({style:{10621 top:this.root.head.offsetHeight,10622 }});10623 this.root.jump.resize({10624 heightA:ASGetElementHeight(this.root.bottom)-ASGetElementHeight(this.root.head),10625 });10626 if (this.root.jumpType=="anchor") {10627 for (var i=0;i<this.root.pageC.anchor.length;i++) {10628 if (this.root.pageC.anchor[i].pos0-this.container.scrollTop<0 && this.root.pageC.anchor[i].pos1-this.container.scrollTop>0) {10629 this.root.jump.content.changeBlock(i);10630 }10631 }10632 }10633 }10634 this.dealJumpPros=function() {10635 if (this.jumpType=="page" && JumpPros["page"]) {10636 var k=-1;10637 for (var i=0;i<this.page.length;i++) {10638 if (this.page[i].name==JumpPros["page"]) {10639 k=i;10640 break;10641 }10642 }10643 if (k==-1) return;10644 if (this.page[k].wHide) return;10645 this.setPage(this.page[k]);10646 if (this.jumpType=="page") {10647 for (var i=0;i<this.jump.content.block.length;i++) {10648 if (this.jump.content.block[i].value==this.pageC) {10649 this.jump.content.changeBlock(i);10650 break;10651 }10652 }10653 }10654 }10655 }10656 this.appear=function() {10657 INTERFACE_L.appear();10658 this.setTarget({10659 transform:{10660 rotateY:0,10661 scaleX:1,10662 scaleY:1,10663 translateX:0,10664 translateY:0,10665 },10666 opacity:1,10667 time:1000,10668 });10669 this.bottom.setTarget({transform:{10670 translateY:0,10671 }});10672 this.setTimeout(function(){10673 this.head.setTarget({opacity:1,speed_alpha:0.07});10674 },500);10675 this.setTimeout(function(){10676 this.jump.setTarget({opacity:1,speed_alpha:0.1});10677 },1000);10678 this.setTimeout(function(){10679 this.slideC.setTarget({opacity:1,speed_alpha:0.1});10680 },1250);10681 this.slideC.scrollTop=this.slideC.scrollTopB;10682 if (this.scene) this.setTimeout(function() {10683 SCENE.change(this.scene);10684 },800);10685 }10686 this.appearFromTop=function() {10687 this.set({style:{10688 top:-ASWindowHeight/2+DEFAULT_HEAD_HEIGHT,10689 transform:{10690 translateX:0,10691 translateY:0,10692 scaleX:1,10693 scaleY:1,10694 rotateY:0,10695 },10696 }});10697 this.bottom.set({style:{transform:{10698 translateY:-ASWindowHeight,10699 }}});10700 this.head.set({style:{10701 opacity:0,10702 }});10703 this.jump.set({style:{10704 opacity:0,10705 }});10706 this.slideC.set({style:{10707 opacity:0,10708 }});10709 }10710 this.appearRolling=function(target) {10711 this.set({style:{10712 top:-ASWindowHeight/2+DEFAULT_HEAD_HEIGHT,10713 transform:{10714 translateX:target.x0+target.widthA/2,10715 translateY:target.y0+target.heightA/2,10716 scaleX:target.widthA/this.widthA,10717 scaleY:target.heightA/(ASWindowHeight-DEFAULT_HEAD_HEIGHT),10718 rotateY:-179,10719 },10720 }});10721 this.jump.set({style:{10722 opacity:0,10723 }});10724 this.slideC.set({style:{10725 opacity:0,10726 }});10727 }10728 this.appearTurning=function() {10729 this.set({style:{10730 top:-ASWindowHeight/2+DEFAULT_HEAD_HEIGHT,10731 transform:{10732 translateX:-300,10733 translateY:0,10734 scaleX:0.6,10735 scaleY:0.6,10736 rotateY:30,10737 },10738 opacity:0,10739 }});10740 this.jump.set({style:{10741 opacity:0,10742 }});10743 this.slideC.set({style:{10744 opacity:0,10745 }});10746 }10747 this.disappearToTop=function() {10748 this.setTarget({10749 top:-ASWindowHeight*1.6,10750 });10751 this.setTimeout(this.removeSelf,500);10752 }10753 this.disappearRolling=function(target) {10754 this.set({style:{10755 transform:{10756 rotateY:0,10757 },10758 }});10759 this.setTimeout(function() {this.setTarget({10760 transform:{10761 translateX:target.x0+target.widthA/2,10762 translateY:target.y0+target.heightA/2-DEFAULT_HEAD_HEIGHT*0.5,10763 scaleX:target.widthA/this.widthA,10764 scaleY:target.heightA/(ASWindowHeight-DEFAULT_HEAD_HEIGHT),10765 rotateY:-179,10766 },10767 time:1000,10768 })},30);10769 this.setTimeout(this.removeSelf,130);10770 }10771 this.disappearTurning=function() {10772 this.setTarget({10773 transform:{10774 translateX:300,10775 rotateY:-30,10776 scaleX:0.6,10777 scaleY:0.6,10778 },10779 opacity:0,10780 });10781 this.setTimeout(this.removeSelf,250);10782 }10783 }10784 function Frame(buildP) {10785 var widthA=buildP.widthA;10786 if (!widthA) widthA=DEFAULT_FRAME_WIDTH;10787 var target=ASElement({10788 nodeName:"div",10789 style:{10790 position:"absolute",10791 transformOrigin:"50% 50%",10792 transform:{10793 perspective:ASPerspective,10794 },10795 left:-widthA/2,10796 top:-ASWindowHeight/2+DEFAULT_HEAD_HEIGHT,10797 width:widthA,10798 height:ASWindowHeight-DEFAULT_HEAD_HEIGHT,10799 },10800 });10801 target.type="frame";10802 target.name=buildP.name;10803 target.widthA=widthA;10804 target.backTo=buildP.backTo;10805 target.jumpType=buildP.jumpType;10806 target.page=buildP.pageD;10807 target.bottom=ASElement({10808 nodeName:"div",10809 style:{10810 position:"relative",10811 backgroundColor:"rgb(250,250,250)",10812 overflowX:"hidden",10813 width:target.widthA,10814 minHeight:ASWindowHeight-DEFAULT_HEAD_HEIGHT-DEFAULT_FRAME_BOTTOM_HEIGHT,10815 maxHeight:ASWindowHeight-DEFAULT_HEAD_HEIGHT,10816 boxShadow:"0px 0px 20px rgba(0,0,0,0.8)",10817 }10818 });10819 target.appendChild(target.bottom);10820 target.slide=BasicScroll({10821 heightA:ASWindowHeight-DEFAULT_HEAD_HEIGHT,10822 style:{10823 position:"absolute",10824 top:0,10825 },10826 onscroll:FrameStr.slideOnscroll,10827 });10828 target.appendChild(target.slide);10829 target.slide.root=target;10830 target.slideC=target.slide.container;10831 target.context=target.slide.context;10832 target.container=ASElement({10833 nodeName:"div",10834 style:{10835 width:"100%",10836 marginTop:DEFAULT_FRAME_HEAD_MINHEIGHT,10837 marginBottom:DEFAULT_FRAME_BOTTOM_HEIGHT,10838 },10839 });10840 target.context.appendChild(target.container);10841 target.head=ASElement({10842 nodeName:"div",10843 style:{10844 position:"absolute",10845 left:0,10846 top:0,10847 width:target.widthA,10848 minHeight:DEFAULT_FRAME_HEAD_MINHEIGHT,10849 },10850 });10851 target.appendChild(target.head);10852 target.head.pic=ASElement({10853 nodeName:"img",10854 src:buildP.titleImg,10855 onload:function() {10856 var scale=this.root.widthA/this.naturalWidth;10857 this.root.head.set({style:{10858 backgroundImage:"url("+this.src+")",10859 backgroundSize:this.naturalWidth*scale+"px "+this.naturalHeight*scale+"px",10860 height:this.naturalHeight*scale,10861 }});10862 this.root.head.height0=this.naturalHeight*scale;10863 this.root.container.set({style:{10864 marginTop:this.root.head.height0,10865 }});10866 this.root.bottom.set({style:{10867 height:ASGetElementHeight(this.root.context)-DEFAULT_FRAME_BOTTOM_HEIGHT,10868 }});10869 this.root.jump.set({style:{10870 top:this.root.head.height0,10871 height:ASGetElementHeight(this.root.bottom)-this.root.head.height0,10872 }});10873 this.root.jumpC.set({style:{10874 height:ASGetElementHeight(this.root.bottom)-this.root.head.height0,10875 }});10876 }10877 });10878 target.head.pic.root=target;10879 target.head.divideLine=ASElement({10880 nodeName:"img",10881 src:ASGetSrcByName("frameDivideBar"),10882 style:{10883 position:"absolute",10884 bottom:-1,10885 width:"100%",10886 },10887 });10888 target.head.appendChild(target.head.divideLine);10889 target.head.word=BasicWord({10890 size:65,10891 color:"white",10892 font:"YouYuan",10893 wordC:buildP.titleC,10894 wordE:buildP.titleE,10895 style:{10896 position:"absolute",10897 fontWeight:"bold",10898 right:60,10899 marginBottom:5,10900 bottom:20,10901 textShadow:"0px 0px 8px rgba(0,0,0,0.8)",10902 letterSpacingC:25,10903 pointerEvents:"none",10904 },10905 });10906 target.head.appendChild(target.head.word);10907 var wLink=false;10908 for (;;) {10909 if (!target.backTo) break;10910 var cardBoard=ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(target.backTo);10911 if (!cardBoard) break;10912 var yes=false;10913 var cards=cardBoard.getNodeByName("card");10914 for (var i=0;i<cards.node.length;i++) {10915 if (cards.node[i].getAttribute("linkTo")==target.name) {10916 yes=true;10917 break;10918 }10919 }10920 if (!yes) break;10921 wLink=true;10922 break;10923 }10924 if (wLink) {10925 target.head.word.set({style:{10926 bottom:65,10927 }});10928 target.head.link=ASElement({10929 nodeName:"div",10930 style:{10931 position:"absolute",10932 width:target.widthA,10933 height:DEFAULT_FRAME_LINK_HEIGHT,10934 bottom:12,10935 },10936 });10937 target.head.appendChild(target.head.link);10938 target.head.pic2=ASElement({10939 nodeName:"img",10940 src:buildP.titleImg.replace("title","title2"),10941 onload:function() {10942 var scale=this.root.widthA/this.naturalWidth;10943 this.root.head.link.set({style:{10944 backgroundImage:"url("+this.src+")",10945 backgroundSize:this.naturalWidth*scale+"px "+this.naturalHeight*scale+"px",10946 backgroundPosition:"50% 100%",10947 }});10948 }10949 });10950 target.head.pic2.root=target;10951 target.head.linkC=[];10952 var cardBoard=ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(target.backTo);10953 var cards=cardBoard.getNodeByName("card");10954 var widthA=0;10955 for (var i=0,w=-1;i<cards.node.length;i++) {10956 if (!cards.node[i].getAttribute("linkTo")) continue;10957 if (!ASGetSourceByName("data0").getNodeByName("frame").getNodeByName(cards.node[i].getAttribute("linkTo"))10958 && !ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(cards.node[i].getAttribute("linkTo"))) continue;10959 w++;10960 target.head.linkC[w]=ASElement({10961 nodeName:"div",10962 style:{10963 position:"relative",10964 height:DEFAULT_FRAME_LINK_HEIGHT,10965 textAlign:"center",10966 backgroundColor:"rgba(0,0,0,0.4)",10967 },10968 });10969 target.head.link.appendChild(target.head.linkC[w]);10970 target.head.linkC[w].bottom=ASElement({10971 nodeName:"div",10972 style:{10973 position:"absolute",10974 left:0,10975 opacity:0,10976 width:"100%",10977 height:"100%",10978 backgroundColor:"rgba(255,255,255,0.2)",10979 },10980 });10981 target.head.linkC[w].appendChild(target.head.linkC[w].bottom);10982 target.head.linkC[w].lineW=ASElement({10983 // nodeName:"img",10984 // src:ASGetSrcByName("frameLinkLineW"),10985 // style:{10986 // position:"absolute",10987 // left:0,10988 // opacity:1,10989 // width:"100%",10990 // height:"40%",10991 // },10992 nodeName:"div",10993 style:{10994 position:"absolute",10995 left:0,10996 opacity:1,10997 width:"100%",10998 height:"100%",10999 backgroundColor:"rgba(255,255,255,0.2)",11000 },11001 });11002 target.head.linkC[w].appendChild(target.head.linkC[w].lineW);11003 target.head.linkC[w].lineB=ASElement({11004 // nodeName:"img",11005 // src:ASGetSrcByName("frameLinkLineB"),11006 // style:{11007 // position:"absolute",11008 // left:0,11009 // opacity:0,11010 // width:"100%",11011 // height:"100%",11012 // },11013 style:{11014 position:"absolute",11015 left:0,11016 opacity:0,11017 width:"100%",11018 height:"100%",11019 backgroundColor:"rgba(0,0,0,0.2)",11020 },11021 });11022 target.head.linkC[w].appendChild(target.head.linkC[w].lineB);11023 target.head.linkC[w].word=BasicWord({11024 size:26,11025 wordC:cards.node[i].getAttribute("titleC"),11026 wordE:cards.node[i].getAttribute("titleE"),11027 color:"white",11028 letterSpacingC:15,11029 ignoreM:true,11030 style:{11031 position:"relative",11032 cursor:"pointer",11033 top:7,11034 }11035 });11036 target.head.linkC[w].appendChild(target.head.linkC[w].word);11037 widthA+=target.head.linkC[w].word.widthA;11038 if (cards.node[i].getAttribute("linkTo")!=target.name) {11039 target.head.linkC[w].onmouseover=FrameStr.linkOnmouseover;11040 target.head.linkC[w].onmouseout=FrameStr.linkOnmouseout;11041 target.head.linkC[w].onmousedown=FrameStr.linkOnmousedown;11042 target.head.linkC[w].onmouseup=FrameStr.linkOnmouseup;11043 target.head.linkC[w].onclick=FrameStr.linkOnclick;11044 target.head.linkC[w].linkTo=cards.node[i].getAttribute("linkTo");11045 target.head.linkC[w].set({style:{cursor:"pointer"}});11046 } else {11047 target.head.linkC[w].lineB.set({style:{opacity:1}});11048 target.head.linkC[w].lineW.set({style:{opacity:0}});11049 }11050 }11051 for (var i=0;i<target.head.linkC.length;i++) {11052 target.head.linkC[i].set({style:{11053 width:target.widthA/target.head.linkC.length,11054 }});11055 }11056 }11057 target.jump=BasicScroll({11058 widthA:DEFAULT_FRAME_JUMP_WIDTHL,11059 style:{11060 position:"absolute",11061 left:0,11062 },11063 });11064 target.appendChild(target.jump);11065 target.jumpC=target.jump.container;11066 target.jumpL=ASElement({11067 nodeName:"img",11068 src:ASGetSrcByName("frameDivideLine"),11069 style:{11070 position:"absolute",11071 width:3,11072 height:"100%",11073 right:0,11074 top:0,11075 },11076 });11077 target.jump.appendChild(target.jumpL);11078 if (buildP.jumpType=="anchor") {11079 target.jump.resize({11080 widthA:DEFAULT_FRAME_JUMP_WIDTHA,11081 });11082 target.jump.content=AnchorList({11083 block:target.page[0].anchor,11084 style:{11085 position:"relative",11086 left:5,11087 top:0,11088 },11089 onchoose:function(w) {11090 this.root.slide.scrollTo((this.root.pageC.anchor[w].pos0+this.root.pageC.anchor[w].pos1)/2);11091 },11092 root:target,11093 });11094 target.jumpC.appendChild(target.jump.content);11095 }11096 if (buildP.jumpType=="page") {11097 target.jump.resize({11098 widthA:DEFAULT_FRAME_JUMP_WIDTHA,11099 });11100 target.updatePage=FrameStr.updatePage;11101 }11102 target.slide.resize({widthA:target.widthA-ASGetElementWidth(target.jump)});11103 target.slide.set({style:{left:ASGetElementWidth(target.jump)}});11104 target.removeSelf=FrameStr.removeSelf;11105 target.resize=FrameStr.resize;11106 target.dealJumpPros=FrameStr.dealJumpPros;11107 target.appear=FrameStr.appear;11108 target.appearFromTop=FrameStr.appearFromTop;11109 target.appearRolling=FrameStr.appearRolling;11110 target.appearTurning=FrameStr.appearTurning;11111 target.disappearToTop=FrameStr.disappearToTop;11112 target.disappearRolling=FrameStr.disappearRolling;11113 target.disappearTurning=FrameStr.disappearTurning;11114 target.setPage=FrameStr.setPage;11115 target.pageResize=FrameStr.pageResize;11116 if (target.page[0]) target.setPage(target.page[0]);11117 if (target.jumpType=="page") target.updatePage();11118 target.set(buildP);11119 return(target);11120 }11121 var FrameVStr=new function() {11122 this.resize=function() {11123 this.set({style:{11124 width:this.widthA,11125 height:ASWindowHeight-VERTICAL_HEAD_HEIGHT,11126 left:-this.widthA/2,11127 top:-ASWindowHeight/2+VERTICAL_HEAD_HEIGHT,11128 }});11129 this.slide.resize({heightA:ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT});11130 this.bottom.set({style:{11131 height:ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT,11132 }});11133 this.jump.set({style:{11134 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),11135 }});11136 this.jumpC.set({style:{11137 height:ASGetElementHeight(this.bottom)-ASGetElementHeight(this.head),11138 }});11139 }11140 this.setPage=function(page) {11141 if (this.pageC==page) return;11142 if (this.pageC) this.pageC.scrollB=this.slideC.scrollTop;11143 if (!page.scrollB) page.scrollB=0;11144 if (!this.pageC) {11145 this.container.appendChild(page);11146 if (this.jumpType=="anchor") {11147 this.jump.content.posB=[];11148 for (var i=0;i<page.anchor.length;i++) {11149 this.jump.content.posB[i]=page.anchor[i].pos;11150 }11151 }11152 } else {11153 if (!page.wBuild) page.build();11154 if (page.appear) page.appear();11155 if (this.pageC.disappear) this.pageC.disappear();11156 this.pageC.setTarget({opacity:0});11157 this.setTimeout(function() {11158 this.container.clearChild();11159 this.container.appendChild(this.pageC);11160 this.pageC.set({style:{opacity:0}});11161 this.slideC.scrollTop=this.pageC.scrollB;11162 this.pageC.setTimeout(function(){this.setTarget({opacity:1});},10);11163 },550);11164 }11165 this.pageC=page;11166 this.pageC.frame=this;11167 }11168 this.updatePage=function() {11169 var block=[];11170 for (var i=0;i<this.page.length;i++) {11171 if (!this.page[i].wHide) {11172 block[block.length]=this.page[i];11173 }11174 }11175 if (this.jump.content) this.jumpC.removeChild(this.jump.content);11176 this.jump.content=PageList({11177 size:45,11178 widthA:VERTICAL_FRAME_JUMP_WIDTHA,11179 block:block,11180 style:{11181 position:"relative",11182 left:8,11183 top:0,11184 transform:{11185 translateX:-10,11186 },11187 },11188 onchoose:function(w) {11189 this.root.setPage(this.root.page[w]);11190 },11191 root:this,11192 });11193 this.jumpC.appendChild(this.jump.content);11194 var k=-1;11195 for (var i=0;i<this.jump.content.block.length;i++) {11196 if (this.jump.content.block[i].value==this.pageC) {11197 k=i;11198 break;11199 }11200 }11201 if (k==-1) this.setPage(this.jump.content.block[0].value);11202 else this.jump.content.changeBlock(k);11203 }11204 this.jumpOnmouseover=function() {11205 this.setTarget({11206 width:VERTICAL_FRAME_JUMP_WIDTHA,11207 });11208 this.root.container.setTarget({11209 left:VERTICAL_FRAME_JUMP_WIDTHA-VERTICAL_FRAME_JUMP_WIDTHL,11210 width:this.root.widthA-VERTICAL_FRAME_JUMP_WIDTHA,11211 });11212 }11213 this.jumpOnmouseout=function() {11214 this.setTarget({11215 width:VERTICAL_FRAME_JUMP_WIDTHL,11216 });11217 this.root.container.setTarget({11218 left:0,11219 width:"100%",11220 });11221 }11222 this.appear=function() {11223 INTERFACE_L.appear();11224 this.setTarget({11225 transform:{11226 rotateY:0,11227 scaleX:1,11228 scaleY:1,11229 translateX:0,11230 translateY:0,11231 },11232 opacity:1,11233 time:1000,11234 });11235 this.bottom.setTarget({transform:{11236 translateY:0,11237 }});11238 this.setTimeout(function(){11239 this.head.setTarget({opacity:1,speed_alpha:0.07});11240 },500);11241 this.setTimeout(function(){11242 this.jump.setTarget({opacity:1,speed_alpha:0.1});11243 },1000);11244 this.setTimeout(function(){11245 this.slideC.setTarget({opacity:1,speed_alpha:0.1});11246 },1250);11247 this.slideC.scrollTop=this.slideC.scrollTopB;11248 if (this.scene) this.setTimeout(function() {11249 SCENE.change(this.scene);11250 },800);11251 }11252 this.appearFromTop=function() {11253 this.set({style:{11254 top:-ASWindowHeight/2+VERTICAL_HEAD_HEIGHT,11255 transform:{11256 translateX:0,11257 translateY:0,11258 scaleX:1,11259 scaleY:1,11260 rotateY:0,11261 },11262 }});11263 this.bottom.set({style:{transform:{11264 translateY:-ASWindowHeight,11265 }}});11266 this.head.set({style:{11267 opacity:0,11268 }});11269 this.jump.set({style:{11270 opacity:0,11271 }});11272 this.slideC.set({style:{11273 opacity:0,11274 }});11275 }11276 this.appearRolling=function(target) {11277 this.set({style:{11278 top:-ASWindowHeight/2+VERTICAL_HEAD_HEIGHT,11279 transform:{11280 translateX:target.x0+target.widthA/2,11281 translateY:target.y0+target.heightA/2,11282 scaleX:target.widthA/this.widthA,11283 scaleY:target.heightA/(ASWindowHeight-VERTICAL_HEAD_HEIGHT),11284 rotateY:-179,11285 },11286 }});11287 this.jump.set({style:{11288 opacity:0,11289 }});11290 this.slideC.set({style:{11291 opacity:0,11292 }});11293 }11294 this.appearTurning=function() {11295 this.set({style:{11296 top:-ASWindowHeight/2+VERTICAL_HEAD_HEIGHT,11297 transform:{11298 translateX:-300,11299 translateY:0,11300 scaleX:0.6,11301 scaleY:0.6,11302 rotateY:30,11303 },11304 opacity:0,11305 }});11306 this.jump.set({style:{11307 opacity:0,11308 }});11309 this.slideC.set({style:{11310 opacity:0,11311 }});11312 }11313 this.disappearToTop=function() {11314 this.setTarget({11315 top:-ASWindowHeight*1.6,11316 });11317 this.setTimeout(this.removeSelf,500);11318 }11319 this.disappearRolling=function(target) {11320 this.set({style:{11321 transform:{11322 rotateY:0,11323 },11324 }});11325 this.setTimeout(function() {this.setTarget({11326 transform:{11327 translateX:target.x0+target.widthA/2,11328 translateY:target.y0+target.heightA/2-DEFAULT_HEAD_HEIGHT*0.5,11329 scaleX:target.widthA/this.widthA,11330 scaleY:target.heightA/(ASWindowHeight-DEFAULT_HEAD_HEIGHT),11331 rotateY:-179,11332 },11333 time:1000,11334 })},30);11335 this.setTimeout(this.removeSelf,130);11336 }11337 this.disappearTurning=function() {11338 this.setTarget({11339 transform:{11340 translateX:300,11341 rotateY:-30,11342 scaleX:0.6,11343 scaleY:0.6,11344 },11345 opacity:0,11346 });11347 this.setTimeout(this.removeSelf,250);11348 }11349 }11350 function FrameV(buildP) {11351 var widthA=buildP.widthA;11352 if (!widthA) widthA=VERTICAL_FRAME_WIDTH;11353 var target=ASElement({11354 nodeName:"div",11355 style:{11356 position:"absolute",11357 transformOrigin:"50% 50%",11358 transform:{11359 perspective:ASPerspective,11360 },11361 left:-widthA/2,11362 top:-ASWindowHeight/2+VERTICAL_HEAD_HEIGHT,11363 width:widthA,11364 height:ASWindowHeight-VERTICAL_HEAD_HEIGHT,11365 },11366 });11367 target.type="frame";11368 target.name=buildP.name;11369 target.widthA=widthA;11370 target.backTo=buildP.backTo;11371 target.jumpType=buildP.jumpType;11372 target.page=buildP.pageV;11373 target.bottom=ASElement({11374 nodeName:"div",11375 style:{11376 position:"relative",11377 backgroundColor:"rgb(250,250,250)",11378 overflowX:"hidden",11379 width:target.widthA,11380 height:ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT,11381 boxShadow:"0px 0px 20px rgba(0,0,0,0.8)",11382 }11383 });11384 target.appendChild(target.bottom);11385 target.slide=BasicScroll({11386 heightA:ASWindowHeight-VERTICAL_HEAD_HEIGHT-VERTICAL_FRAME_BOTTOM_HEIGHT,11387 style:{11388 position:"absolute",11389 top:0,11390 },11391 });11392 target.appendChild(target.slide);11393 target.slide.root=target;11394 target.slideC=target.slide.container;11395 target.context=target.slide.context;11396 target.container=ASElement({11397 nodeName:"div",11398 style:{11399 position:"relative",11400 left:0,11401 width:"100%",11402 },11403 });11404 target.context.appendChild(target.container);11405 target.head=ASElement({11406 nodeName:"div",11407 style:{11408 position:"absolute",11409 left:0,11410 top:0,11411 width:target.widthA,11412 },11413 });11414 target.appendChild(target.head);11415 target.head.pic=ASElement({11416 nodeName:"img",11417 src:buildP.titleImg,11418 onload:function() {11419 var scale=Math.max(this.root.widthA/this.naturalWidth,VERTICAL_FRAME_HEAD_MINHEIGHT/this.naturalHeight);11420 this.root.head.set({style:{11421 backgroundImage:"url("+this.src+")",11422 backgroundSize:this.naturalWidth*scale+"px "+this.naturalHeight*scale+"px",11423 height:this.naturalHeight*scale,11424 }});11425 this.root.head.height0=this.naturalHeight*scale;11426 this.root.container.set({style:{11427 marginTop:this.root.head.height0,11428 }});11429 this.root.jump.set({style:{11430 top:this.root.head.height0,11431 height:ASGetElementHeight(this.root.bottom)-this.root.head.height0,11432 }});11433 this.root.jumpC.set({style:{11434 height:ASGetElementHeight(this.root.bottom)-this.root.head.height0,11435 }});11436 }11437 });11438 target.head.pic.root=target;11439 target.head.divideLine=ASElement({11440 nodeName:"img",11441 src:ASGetSrcByName("frameDivideBar"),11442 style:{11443 position:"absolute",11444 bottom:-1,11445 width:"100%",11446 },11447 });11448 target.head.appendChild(target.head.divideLine);11449 target.head.word=BasicWord({11450 size:130,11451 color:"white",11452 font:"YouYuan",11453 wordC:buildP.titleC,11454 wordE:buildP.titleE,11455 style:{11456 position:"absolute",11457 fontWeight:"bold",11458 right:60,11459 marginBottom:5,11460 bottom:20,11461 textShadow:"0px 0px 8px rgba(0,0,0,0.8)",11462 letterSpacingC:25,11463 pointerEvents:"none",11464 },11465 });11466 target.head.appendChild(target.head.word);11467 var wLink=false;11468 for (;;) {11469 if (!target.backTo) break;11470 var cardBoard=ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(target.backTo);11471 if (!cardBoard) break;11472 var yes=false;11473 var cards=cardBoard.getNodeByName("card");11474 for (var i=0;i<cards.node.length;i++) {11475 if (cards.node[i].getAttribute("linkTo")==target.name) {11476 yes=true;11477 break;11478 }11479 }11480 if (!yes) break;11481 wLink=true;11482 break;11483 }11484 if (wLink) {11485 target.head.word.set({style:{11486 bottom:VERTICAL_FRAME_LINK_HEIGHT+20,11487 }});11488 target.head.link=ASElement({11489 nodeName:"div",11490 style:{11491 position:"absolute",11492 width:target.widthA,11493 height:VERTICAL_FRAME_LINK_HEIGHT,11494 bottom:12,11495 },11496 });11497 target.head.appendChild(target.head.link);11498 target.head.pic2=ASElement({11499 nodeName:"img",11500 src:buildP.titleImg.replace("title","title2"),11501 onload:function() {11502 var scale=this.root.widthA/this.naturalWidth;11503 this.root.head.link.set({style:{11504 backgroundImage:"url("+this.src+")",11505 backgroundSize:this.naturalWidth*scale+"px "+this.naturalHeight*scale+"px",11506 backgroundPosition:"50% 100%",11507 }});11508 }11509 });11510 target.head.pic2.root=target;11511 target.head.linkC=[];11512 var cardBoard=ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(target.backTo);11513 var cards=cardBoard.getNodeByName("card");11514 var widthA=0;11515 for (var i=0,w=-1;i<cards.node.length;i++) {11516 if (!cards.node[i].getAttribute("linkTo")) continue;11517 if (!ASGetSourceByName("data0").getNodeByName("frame").getNodeByName(cards.node[i].getAttribute("linkTo"))11518 && !ASGetSourceByName("data0").getNodeByName("cardBoard").getNodeByName(cards.node[i].getAttribute("linkTo"))) continue;11519 w++;11520 target.head.linkC[w]=ASElement({11521 nodeName:"div",11522 style:{11523 position:"relative",11524 height:VERTICAL_FRAME_LINK_HEIGHT,11525 textAlign:"center",11526 backgroundColor:"rgba(0,0,0,0.4)",11527 },11528 });11529 target.head.link.appendChild(target.head.linkC[w]);11530 target.head.linkC[w].bottom=ASElement({11531 nodeName:"div",11532 style:{11533 position:"absolute",11534 left:0,11535 opacity:0,11536 width:"100%",11537 height:"100%",11538 backgroundColor:"rgba(255,255,255,0.2)",11539 },11540 });11541 target.head.linkC[w].appendChild(target.head.linkC[w].bottom);11542 target.head.linkC[w].lineW=ASElement({11543 nodeName:"img",11544 src:ASGetSrcByName("frameLinkLineW"),11545 style:{11546 position:"absolute",11547 left:0,11548 opacity:1,11549 width:"100%",11550 height:"40%",11551 },11552 });11553 target.head.linkC[w].appendChild(target.head.linkC[w].lineW);11554 target.head.linkC[w].lineB=ASElement({11555 nodeName:"img",11556 src:ASGetSrcByName("frameLinkLineB"),11557 style:{11558 position:"absolute",11559 left:0,11560 opacity:0,11561 width:"100%",11562 height:"100%",11563 },11564 });11565 target.head.linkC[w].appendChild(target.head.linkC[w].lineB);11566 target.head.linkC[w].word=BasicWord({11567 size:40,11568 wordC:cards.node[i].getAttribute("titleC"),11569 wordE:cards.node[i].getAttribute("titleE"),11570 color:"white",11571 letterSpacingC:15,11572 ignoreM:true,11573 style:{11574 position:"relative",11575 cursor:"pointer",11576 top:10,11577 }11578 });11579 target.head.linkC[w].appendChild(target.head.linkC[w].word);11580 widthA+=target.head.linkC[w].word.widthA;11581 if (cards.node[i].getAttribute("linkTo")!=target.name) {11582 target.head.linkC[w].onmouseover=FrameStr.linkOnmouseover;11583 target.head.linkC[w].onmouseout=FrameStr.linkOnmouseout;11584 target.head.linkC[w].onmousedown=FrameStr.linkOnmousedown;11585 target.head.linkC[w].onmouseup=FrameStr.linkOnmouseup;11586 target.head.linkC[w].onclick=FrameStr.linkOnclick;11587 target.head.linkC[w].linkTo=cards.node[i].getAttribute("linkTo");11588 target.head.linkC[w].set({style:{cursor:"pointer"}});11589 } else {11590 target.head.linkC[w].lineB.set({style:{opacity:1}});11591 target.head.linkC[w].lineW.set({style:{opacity:0}});11592 }11593 }11594 for (var i=0;i<target.head.linkC.length;i++) {11595 target.head.linkC[i].set({style:{11596 width:target.widthA/target.head.linkC.length,11597 }});11598 }11599 }11600 target.jump=BasicScroll({11601 widthA:VERTICAL_FRAME_JUMP_WIDTHL,11602 style:{11603 left:0,11604 backgroundColor:"rgb(250,250,250)",11605 },11606 root:target,11607 });11608 target.appendChild(target.jump);11609 target.jumpC=target.jump.container;11610 target.jumpL=ASElement({11611 nodeName:"img",11612 src:ASGetSrcByName("frameDivideLine"),11613 style:{11614 position:"absolute",11615 width:3,11616 height:"100%",11617 right:0,11618 top:0,11619 },11620 });11621 target.jump.appendChild(target.jumpL);11622 if (buildP.jumpType=="anchor") {11623 target.jump.resize({11624 widthA:VERTICAL_FRAME_JUMP_WIDTHA,11625 });11626 target.jump.content=AnchorList({11627 size:40,11628 widthA:VERTICAL_FRAME_JUMP_WIDTHA,11629 block:target.page[0].anchor,11630 style:{11631 position:"relative",11632 left:5,11633 top:0,11634 },11635 onchoose:function(w) {11636 this.changeBlock(w);11637 this.root.slide.scrollTo(this.root.pageC.anchor[w].pos0-30);11638 },11639 root:target,11640 });11641 target.jumpC.appendChild(target.jump.content);11642 target.jump.onmouseover=FrameVStr.jumpOnmouseover;11643 target.jump.onmouseout=FrameVStr.jumpOnmouseout;11644 }11645 if (buildP.jumpType=="page") {11646 target.jump.resize({11647 widthA:VERTICAL_FRAME_JUMP_WIDTHA,11648 });11649 target.updatePage=FrameVStr.updatePage;11650 target.jump.onmouseover=FrameVStr.jumpOnmouseover;11651 target.jump.onmouseout=FrameVStr.jumpOnmouseout;11652 }11653 target.jump.set({style:{width:VERTICAL_FRAME_JUMP_WIDTHL}});11654 target.slide.resize({widthA:target.widthA-ASGetElementWidth(target.jump)});11655 target.slide.set({style:{left:ASGetElementWidth(target.jump)}});11656 target.removeSelf=FrameStr.removeSelf;11657 target.resize=FrameVStr.resize;11658 target.dealJumpPros=FrameStr.dealJumpPros;11659 target.appear=FrameVStr.appear;11660 target.appearFromTop=FrameVStr.appearFromTop;11661 target.appearRolling=FrameVStr.appearRolling;11662 target.appearTurning=FrameVStr.appearTurning;11663 target.disappearToTop=FrameVStr.disappearToTop;11664 target.disappearRolling=FrameVStr.disappearRolling;11665 target.disappearTurning=FrameVStr.disappearTurning;11666 target.setPage=FrameVStr.setPage;11667 target.pageResize=FrameStr.pageResize;11668 if (target.page[0]) target.setPage(target.page[0]);11669 if (target.jumpType=="page") target.updatePage();11670 target.set(buildP);11671 return(target);11672 }11673 // 这里是创建 Frame 的地方11674 function buildFrame() {11675 FRAME={};11676 FRAME_V={};11677 FRAME_P={};11678 var data=ASGetSourceByName("data0").getNodeByName("frame");11679 //buildFrameContent11680 for (var i=0;i<data.node.length;i++) {11681 var frame=data.node[i];11682 var name=frame.nodeName;11683 var buildP={11684 name:name,11685 titleC:frame.getAttribute("titleC"),11686 titleE:frame.getAttribute("titleE"),11687 titleImg:frame.getAttribute("titleImg"),11688 jumpType:data.node[i].getAttribute("jumpType"),11689 };11690 if (frame.getAttribute("backTo")) buildP.backTo=frame.getAttribute("backTo");11691 if (frame.getAttribute("scene")) buildP.scene=frame.getAttribute("scene");11692 if (frame.getAttribute("wLogin")=="true") buildP.wLogin=true;11693 if (buildP.jumpType=="page") buildP.jumpData=data.node[i].getNodeByName("page");11694 buildP.pageD=[];11695 buildP.pageV=[];11696 for (var j=0;j<frame.getNodeByName("page").node.length;j++) {11697 buildP.pageD[j]=PAGE[frame.getNodeByName("page").node[j].getAttribute("name")];11698 if (!buildP.pageD[j]) buildP.pageD[j]=ASElement({nodeName:"div"});11699 buildP.pageD[j].nameC=frame.getNodeByName("page").node[j].getAttribute("nameC");11700 buildP.pageD[j].nameE=frame.getNodeByName("page").node[j].getAttribute("nameE");11701 buildP.pageV[j]=PAGE_V[frame.getNodeByName("page").node[j].getAttribute("name")];11702 if (!buildP.pageV[j]) buildP.pageV[j]=ASElement({nodeName:"div"});11703 buildP.pageV[j].nameC=frame.getNodeByName("page").node[j].getAttribute("nameC");11704 buildP.pageV[j].nameE=frame.getNodeByName("page").node[j].getAttribute("nameE");11705 }11706 // console.log(buildP);11707 FRAME_P[name]=buildP;11708 }11709 //test11710 11711 var data=ASGetSourceByName("data0").getNodeByName("functionC");11712 var i = 0;11713 var name=data.node[i].nodeName;11714 var buildP={11715 name:name,11716 titleC:"測試",11717 titleE:"Test",11718 titleImg:"Image/Function/O/title.jpg",11719 backTo:"current",11720 scene:ASGetSourceByName("data0").getNodeByName("frame").getNodeByName("current").getAttribute("scene"),11721 jumpType:"page",11722 pageD:[11723 PAGE[name+"Brief"],11724 PAGE[name+"Brief"],11725 PAGE[name+"Brief"],11726 ],11727 pageV:[11728 PAGE_V[name+"Brief"],11729 ],11730 jumpData:data.node[i].getNodeByName("page"),11731 funcID:data.node[i].nodeName,11732 };11733 buildP.pageD[0].nameC="活動詳情";11734 buildP.pageD[0].nameE="Details";11735 buildP.pageV[0].nameC="活動詳情";11736 buildP.pageV[0].nameE="Details";11737 11738 buildP.update=function() {11739 // var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);11740 // if (data.getAttribute("enroll")=="available" || data.getAttribute("enroll")=="full") {11741 // if (ASVersion=="horizon") {11742 // if (USERDATA=="NULL" || USERDATA.place!="E") {11743 // this.page[2].wHide=true;11744 // } else {11745 // this.page[2].wHide=false;11746 // }11747 // }11748 // }11749 // console.log("Updating Page")11750 this.updatePage();11751 }11752 FRAME_P["test"]=buildP;11753 //function11754 // var data=ASGetSourceByName("data0").getNodeByName("functionC");11755 // for (var i=0;i<data.node.length;i++) {11756 // var name=data.node[i].nodeName;11757 // var buildP={11758 // name:name,11759 // titleC:data.node[i].getAttribute("nameC"),11760 // titleE:data.node[i].getAttribute("nameE"),11761 // titleImg:"Image/Function/"+data.node[i].getAttribute("name")+"/title.jpg",11762 // backTo:"current",11763 // scene:ASGetSourceByName("data0").getNodeByName("frame").getNodeByName("current").getAttribute("scene"),11764 // jumpType:"page",11765 // pageD:[11766 // PAGE[name+"Brief"],11767 // ],11768 // pageV:[11769 // PAGE_V[name+"Brief"],11770 // ],11771 // jumpData:data.node[i].getNodeByName("page"),11772 // funcID:data.node[i].nodeName,11773 // };11774 // buildP.pageD[0].nameC="活動詳情";11775 // buildP.pageD[0].nameE="Details";11776 // buildP.pageV[0].nameC="活動詳情";11777 // buildP.pageV[0].nameE="Details";11778 // if (data.node[i].getAttribute("enroll")=="available" || data.node[i].getAttribute("enroll")=="full") {11779 // buildP.pageD[1]=PAGE[name+"Signup"],11780 // buildP.pageD[1].nameC="報名表";11781 // buildP.pageD[1].nameE="Registration";11782 // buildP.pageV[1]=PAGE_V[name+"Signup"],11783 // buildP.pageV[1].nameC="報名表";11784 // buildP.pageV[1].nameE="Registration";11785 // buildP.pageD[2]=PAGE[name+"List"],11786 // buildP.pageD[2].nameC="報名情況";11787 // buildP.pageD[2].nameE="Registration Status";11788 // buildP.pageD[2].wHide=true;11789 // }11790 // buildP.update=function() {11791 // var data=ASGetSourceByName("data0").getNodeByName("functionC").getNodeByName(this.funcID);11792 // if (data.getAttribute("enroll")=="available" || data.getAttribute("enroll")=="full") {11793 // if (ASVersion=="horizon") {11794 // if (USERDATA=="NULL" || USERDATA.place!="E") {11795 // this.page[2].wHide=true;11796 // } else {11797 // this.page[2].wHide=false;11798 // }11799 // }11800 // }11801 // this.updatePage();11802 // }11803 // FRAME_P[name]=buildP;11804 // }11805 //mail11806 var data=ASGetSourceByName("data0").getNodeByName("email").getNodeByName("cuisine");11807 for (var i=0;i<data.node.length;i++) {11808 FRAME_P["mailCuisine"].pageD[i]=PAGE["cuisine"+i];11809 FRAME_P["mailCuisine"].pageD[i].nameC=data.node[i].getAttribute("nameC");11810 FRAME_P["mailCuisine"].pageD[i].nameE=data.node[i].getAttribute("nameE");11811 FRAME_P["mailCuisine"].pageV[i]=PAGE_V["cuisine"+i];11812 FRAME_P["mailCuisine"].pageV[i].nameC=data.node[i].getAttribute("nameC");11813 FRAME_P["mailCuisine"].pageV[i].nameE=data.node[i].getAttribute("nameE");11814 }11815 // console.log("FRAME_P", FRAME_P);11816 }11817 var CardStr=new function() {11818 // Card Mouse Interaction Animations11819 this.recover=function() {11820 // this.bottomR.set({style:{11821 // transform:{11822 // translateY:this.bottomR.y0,11823 // scaleX:this.bottomR.scaleX0,11824 // scaleY:this.bottomR.scaleY0,11825 // },11826 // }});11827 // this.bottomC.set({style:{11828 // opacity:0,11829 // }});11830 // if (this.titleR) this.titleR.set({style:{11831 // opacity:1,11832 // }});11833 }11834 this.onmouseover=function() {11835 if (this.wBanMouse) return;11836 this.setTarget({11837 transform:{11838 scaleX:.95,11839 scaleY:.95,11840 }11841 });11842 // this.bottomR.setTarget({11843 // transform:{11844 // translateY:0,11845 // scaleX:1,11846 // scaleY:1,11847 // },11848 // });11849 // this.bottomC.setTarget({11850 // opacity:0,11851 // });11852 // if (this.titleR) this.titleR.setTarget({11853 // opacity:0,11854 // });11855 }11856 this.onmouseout=function() {11857 if (this.wBanMouse) return;11858 this.setTarget({11859 transform:{11860 scaleX:1,11861 scaleY:1,11862 }11863 });11864 // this.bottomR.setTarget({11865 // transform:{11866 // translateY:this.bottomR.y0,11867 // scaleX:this.bottomR.scaleX0,11868 // scaleY:this.bottomR.scaleY0,11869 // },11870 // });11871 // this.bottomC.setTarget({11872 // opacity:0,11873 // });11874 // if (this.titleR) this.titleR.setTarget({11875 // opacity:1,11876 // });11877 }11878 this.onmousedown=function() {11879 if (this.wBanMouse) return;11880 this.setTarget({11881 transform:{11882 scaleX:0.95,11883 scaleY:0.95,11884 }11885 });11886 // this.bottomR.setTarget({11887 // transform:{11888 // translateY:0,11889 // scaleX:1,11890 // scaleY:1,11891 // },11892 // });11893 // this.bottomC.setTarget({11894 // opacity:1,11895 // });11896 // if (this.titleR) this.titleR.setTarget({11897 // opacity:0,11898 // });11899 }11900 this.onmouseup=function() {11901 if (this.wBanMouse) return;11902 this.setTarget({11903 transform:{11904 scaleX:1,11905 scaleY:1,11906 }11907 });11908 // this.bottomR.setTarget({11909 // transform:{11910 // translateY:0,11911 // scaleX:1,11912 // scaleY:1,11913 // },11914 // });11915 // this.bottomC.setTarget({11916 // opacity:0,11917 // });11918 // if (this.titleR) this.titleR.setTarget({11919 // opacity:0,11920 // });11921 }11922 this.onclick=function() {11923 if (this.wBanMouse) return;11924 changeURL(this.linkTo);11925 }11926 this.banMouse=function() {11927 this.wBanMouse=true;11928 }11929 this.allowMouse=function() {11930 this.wBanMouse=false;11931 }11932 }11933 function Card(buildP) {11934 if (!buildP.size) buildP.size=26;11935 if (!buildP.timeDelay) buildP.timeDelay=0;11936 var target=ASElement({11937 nodeName:"div",11938 style:{11939 position:"absolute",11940 left:buildP.x,11941 top:buildP.y,11942 width:buildP.widthA,11943 height:buildP.heightA,11944 borderRadius:4,11945 overflow:"hidden",11946 transformOrigin:"50% 50%",11947 transform:{11948 perspective:ASPerspective,11949 },11950 boxShadow:"0 0 10px rgba(0,0,0,0.5)",11951 cursor:"pointer",11952 },11953 });11954 target.x0=buildP.x;11955 target.y0=buildP.y;11956 target.widthA=buildP.widthA;11957 target.heightA=buildP.heightA;11958 target.edge=0;11959 target.titleHeight=0;11960 target.linkTo=buildP.linkTo;11961 target.hyperlink=buildP.hyperlink;11962 target.wBanMouse=false;11963 target.recover=CardStr.recover;11964 target.onmouseover=CardStr.onmouseover;11965 target.onmouseout=CardStr.onmouseout;11966 target.onmousedown=CardStr.onmousedown;11967 target.onmouseup=CardStr.onmouseup;11968 target.banMouse=CardStr.banMouse;11969 target.allowMouse=CardStr.allowMouse;11970 if (buildP.titleC || buildP.titleE) {11971 target.titleHeight=8;11972 target.titleF=ASElement({11973 nodeName:"div",11974 style:{11975 position:"absolute",11976 width:target.widthA-target.edge*2-5,11977 left:target.edge+buildP.size/5,11978 top:target.edge,11979 pointerEvents:"none",11980 margin: 811981 },11982 });11983 target.titleW=BasicWord({11984 wordC:buildP.titleC,11985 wordE:buildP.titleE,11986 font:"FZYaoti",11987 size:buildP.size,11988 color: COLOR_MUTEDRED, // On Hover Card Title Text Color11989 style:{11990 position:"absolute",11991 },11992 });11993 target.titleF.appendChild(target.titleW);11994 target.titleR=BasicWord({11995 wordC:buildP.titleC,11996 wordE:buildP.titleE,11997 font:"FZYaoti",11998 size:buildP.size,11999 color: COLOR_MUTEDRED, // Basic Card Title Text Color12000 style:{12001 position:"absolute",12002 },12003 });12004 target.titleF.appendChild(target.titleR);12005 target.titleHeight+=target.titleR.heightA+4;12006 }12007 target.bottom=ASElement({12008 nodeName:"div",12009 style:{12010 width:target.widthA,12011 height:target.heightA,12012 borderRadius:target.edge,12013 overflow:"hidden",12014 background: COLOR_SOFTWHITE,12015 },12016 });12017 target.appendChild(target.bottom);12018 target.img=FlashImg({12019 widthA:target.widthA-target.edge*2,12020 heightA:target.heightA-target.edge-target.titleHeight,12021 imgSize:buildP.imgSize,12022 img:buildP.img,12023 delay:buildP.timeDelay*50,12024 style:{12025 position:"absolute",12026 left:target.edge,12027 top:target.titleHeight,12028 },12029 });12030 target.appendChild(target.img);12031 if (target.linkTo) {12032 target.onclick=CardStr.onclick;12033 }12034 if (target.hyperlink) {12035 target.region=ASElement({12036 nodeName:"a",12037 href:target.hyperlink,12038 target:"_blank",12039 style:{12040 position:"absolute",12041 left:0,12042 },12043 });12044 target.region.appendChild(ASElement({12045 nodeName:"div",12046 style:{12047 width:target.widthA,12048 height:target.heightA,12049 },12050 }));12051 target.appendChild(target.region);12052 }12053 if (buildP.titleC || buildP.titleE) {12054 target.appendChild(target.titleF);12055 }12056 target.set(buildP);12057 return(target);12058 }12059 var CardBoardStr=new function() {12060 this.removeSelf=function() {12061 this.parentNode.removeChild(this);12062 }12063 this.appear=function() {12064 this.status="appearing";12065 INTERFACE_H.appear();12066 INTERFACE_H.topLogo.setTarget({12067 opacity:1,12068 transform:{12069 translateX:this.buildP.topLogoPos.x,12070 translateY:-this.buildP.topLogoPos.y,12071 scale:this.buildP.topLogoScale,12072 },12073 time:400,12074 });12075 this.setTarget({12076 opacity:1,12077 transform:{12078 scale:1,12079 },12080 time:600,12081 });12082 this.onCard=null;12083 for (var i=0;i<this.card.length;i++) {12084 this.card[i].recover();12085 this.card[i].setTimeout(this.card[i].allowMouse,50);12086 if (this.card[i].jumpTarget) {12087 this.card[i].jumpTarget=false;12088 continue;12089 }12090 this.card[i].setTarget({12091 transform:{12092 rotateY:0,12093 scaleX:1,12094 scaleY:1,12095 translateX:0,12096 translateY:0,12097 },12098 opacity:1,12099 time:400,12100 });12101 }12102 var time=800;12103 if (ASBrowser=="Mobile") time=1500;12104 if (this.scene) this.setTimeout(function() {12105 SCENE.change(this.scene);12106 },time);12107 }12108 this.appearFromBack=function() {12109 this.set({style:{12110 opacity:0,12111 transform:{12112 scale:0.4,12113 },12114 }});12115 for (var i=0;i<this.card.length;i++) {12116 this.card[i].set({style:{12117 transform:{12118 rotateY:0,12119 scaleX:1,12120 scaleY:1,12121 translateX:0,12122 translateY:0,12123 },12124 opacity:1,12125 }});12126 }12127 }12128 this.appearRolling=function(w) {12129 for (var i=0;i<this.card.length;i++) {12130 if (i==w) continue;12131 this.card[i].set({style:{12132 transform:{12133 translateX:-this.card[i].x0*0.6-this.card[i].widthA*0.6/2,12134 translateY:-this.card[i].y0*0.6-this.card[i].heightA*0.6/2,12135 scaleX:0.4,12136 scaleY:0.4,12137 },12138 opacity:0,12139 }});12140 }12141 this.card[w].jumpTarget=true;12142 this.card[w].set({style:{12143 transform:{12144 translateX:-this.card[w].x0-this.card[w].widthA/2,12145 translateY:-this.card[w].y0-this.card[w].heightA/2,12146 scaleX:DEFAULT_FRAME_WIDTH/this.card[w].widthA,12147 scaleY:(ASWindowHeight-DEFAULT_HEAD_HEIGHT)/this.card[w].heightA,12148 rotateY:179,12149 },12150 opacity:1,12151 visibility:"hidden",12152 }});12153 this.card[w].setTimeout(function() {this.setTarget({12154 transform:{12155 scaleX:1,12156 scaleY:1,12157 translateX:0,12158 translateY:0,12159 rotateY:0,12160 },12161 time:1000,12162 });},10);12163 this.card[w].setTimeout(function() {this.set({style:{visibility:"visible"}});},125);12164 }12165 this.wDisappear=function() {12166 if (this.style.opacity=="0") return(true);12167 for (var i=0;i<this.cardN;i++) {12168 if (this.card[i].pos.vz.z<0) return(true);12169 }12170 return(false);12171 }12172 this.disappearToBack=function() {12173 this.setTarget({12174 opacity:0,12175 transform:{12176 scale:0.4,12177 },12178 });12179 this.setTimeout(this.removeSelf,200);12180 }12181 this.disappearRolling=function(w) {12182 for (var i=0;i<this.card.length;i++) {12183 this.card[i].banMouse();12184 if (i==w) continue;12185 this.card[i].setTarget({12186 transform:{12187 translateX:-this.card[i].x0*0.6-this.card[i].widthA*0.6/2,12188 translateY:-this.card[i].y0*0.6-this.card[i].heightA*0.6/2,12189 scaleX:0.4,12190 scaleY:0.4,12191 },12192 opacity:0,12193 time:400,12194 });12195 }12196 this.card[w].setTarget({12197 transform:{12198 translateX:-this.card[w].x0-this.card[w].widthA/2,12199 translateY:-this.card[w].y0-this.card[w].heightA/2,12200 scaleX:DEFAULT_FRAME_WIDTH/this.card[w].widthA,12201 scaleY:(ASWindowHeight-DEFAULT_HEAD_HEIGHT)/this.card[w].heightA,12202 rotateY:-180,12203 },12204 time:1000,12205 });12206 this.setTimeout(this.removeSelf,105);12207 }12208 }12209 function CardBoard(buildP) {12210 if (!("wLogo" in buildP)) buildP.wLogo=true;12211 if (!("widthL" in buildP)) buildP.widthL=DEFAULT_CARDBOARD_WIDTH_L;12212 if (!("heightL" in buildP)) buildP.heightL=DEFAULT_CARDBOARD_HEIGHT_L;12213 if (!("space" in buildP)) buildP.space=DEFAULT_CARDBOARD_SPACE;12214 if (!("cardPos" in buildP)) buildP.cardPos=new PointO(0,0);12215 if (!("topLogoScale" in buildP)) buildP.topLogoScale=1;12216 if (!("topLogoPos" in buildP)) buildP.topLogoPos=new PointO(0,0);12217 var target=ASElement({12218 nodeName:"div",12219 style:{12220 position:"absolute",12221 },12222 });12223 target.type="cardBoard";12224 target.status="disappear";12225 target.buildP=buildP;12226 target.name=buildP.name;12227 target.backTo=buildP.backTo;12228 target.onCard=null;12229 target.card=[];12230 var card1;12231 for (card1 in buildP){12232 if (typeof(buildP[card1])!="object" ||12233 (!(12234 ("widthA" in buildP[card1])12235 && ("heightA" in buildP[card1])12236 && ("blockX" in buildP[card1])12237 && ("blockY" in buildP[card1])))) {12238 continue;12239 }12240 buildP[card1].name=card1;12241 buildP[card1].x=buildP[card1].blockX*(buildP.widthL+buildP.space)+buildP.space*0.5+buildP.cardPos.x;12242 buildP[card1].y=-(buildP[card1].blockY*(buildP.heightL+buildP.space)+buildP.space*0.5+buildP.cardPos.y);12243 buildP[card1].widthA=buildP[card1].widthA*buildP.widthL+(buildP[card1].widthA-1)*buildP.space;12244 buildP[card1].heightA=buildP[card1].heightA*buildP.heightL+(buildP[card1].heightA-1)*buildP.space;12245 target[card1]=Card(buildP[card1]);12246 target.appendChild(target[card1]);12247 target.card[target.card.length]=target[card1];12248 }12249 target.removeSelf=CardBoardStr.removeSelf;12250 target.appear=CardBoardStr.appear;12251 target.appearFromBack=CardBoardStr.appearFromBack;12252 target.appearRolling=CardBoardStr.appearRolling;12253 target.wDisappear=CardBoardStr.wDisappear;12254 target.disappearToBack=CardBoardStr.disappearToBack;12255 target.disappearRolling=CardBoardStr.disappearRolling;12256 target.set(buildP);12257 target.topLogoScale=buildP.topLogoScale;12258 target.topLogoPos=buildP.topLogoPos;12259 return(target);12260 }12261 function CardBoardV(buildP) {12262 if (!("wLogo" in buildP)) buildP.wLogo=true;12263 if (!("widthL" in buildP)) buildP.widthL=DEFAULT_CARDBOARD_WIDTH_L;12264 if (!("heightL" in buildP)) buildP.heightL=DEFAULT_CARDBOARD_HEIGHT_L;12265 if (!("space" in buildP)) buildP.space=DEFAULT_CARDBOARD_SPACE;12266 if (!("cardPos" in buildP)) buildP.cardPos=new PointO(0,0);12267 if (!("topLogoScale" in buildP)) buildP.topLogoScale=1.3;12268 if (!("topLogoPos" in buildP)) buildP.topLogoPos=new PointO(0,0);12269 var target=ASElement({12270 nodeName:"div",12271 style:{12272 position:"absolute",12273 },12274 });12275 target.type="cardBoard";12276 target.status="disappear";12277 target.buildP=buildP;12278 target.name=buildP.name;12279 target.backTo=buildP.backTo;12280 target.onCard=null;12281 target.card=[];12282 var card1;12283 for (card1 in buildP){12284 if (typeof(buildP[card1])!="object" ||12285 (!(12286 ("widthA" in buildP[card1])12287 && ("heightA" in buildP[card1])12288 && ("blockX" in buildP[card1])12289 && ("blockY" in buildP[card1])))) {12290 continue;12291 }12292 buildP[card1].name=card1;12293 buildP[card1].size=50;12294 buildP[card1].x=buildP[card1].blockX*(buildP.widthL+buildP.space)+buildP.space*0.5+buildP.cardPos.x;12295 buildP[card1].y=-(buildP[card1].blockY*(buildP.heightL+buildP.space)+buildP.space*0.5+buildP.cardPos.y);12296 buildP[card1].widthA=buildP[card1].widthA*buildP.widthL+(buildP[card1].widthA-1)*buildP.space;12297 buildP[card1].heightA=buildP[card1].heightA*buildP.heightL+(buildP[card1].heightA-1)*buildP.space;12298 target[card1]=Card(buildP[card1]);12299 target.appendChild(target[card1]);12300 target.card[target.card.length]=target[card1];12301 }12302 target.removeSelf=CardBoardStr.removeSelf;12303 target.appear=CardBoardStr.appear;12304 target.appearFromBack=CardBoardStr.appearFromBack;12305 target.appearRolling=CardBoardStr.appearRolling;12306 target.wDisappear=CardBoardStr.wDisappear;12307 target.disappearToBack=CardBoardStr.disappearToBack;12308 target.disappearRolling=CardBoardStr.disappearRolling;12309 target.set(buildP);12310 target.topLogoScale=buildP.topLogoScale;12311 target.topLogoPos=buildP.topLogoPos;12312 return(target);12313 }12314 // 創建 Cardboard 類型的頁面(首頁等)12315 function buildCardBoard() {12316 CARDBOARD={};12317 CARDBOARD_V={};12318 CARDBOARD_P={};12319 CARDBOARD_PV={};12320 var data=ASGetSourceByName("data0").getNodeByName("cardBoard");12321 var cardAttribute=["widthA","heightA","blockX","blockY","imgSize","timeDelay","titleC","titleE","linkTo","hyperlink"];12322 var cardAttributeType=["num","num","num","num","str","num","str","str","str","str"];12323 //buildCardBoardContent12324 for (var i=0;i<data.node.length;i++) {12325 var cardBoard=data.node[i];12326 var name=cardBoard.nodeName;12327 var buildP={12328 name:name,12329 scene:cardBoard.getAttribute("scene"),12330 widthL:parseFloat(cardBoard.getAttribute("widthL")),12331 heightL:parseFloat(cardBoard.getAttribute("heightL")),12332 space:parseFloat(cardBoard.getAttribute("space")),12333 cardPos:new PointO(parseFloat(cardBoard.getAttribute("cardPosX")),parseFloat(cardBoard.getAttribute("cardPosY"))),12334 topLogoPos:new PointO(parseFloat(cardBoard.getAttribute("topLogoPosX")),parseFloat(cardBoard.getAttribute("topLogoPosY"))),12335 };12336 if (cardBoard.getAttribute("backTo")) buildP.backTo=cardBoard.getAttribute("backTo");12337 for (var j=0;j<cardBoard.getNodeByName("card").node.length;j++) {12338 var card=cardBoard.getNodeByName("card").node[j];12339 var nameC=card.nodeName;12340 buildP[nameC]={};12341 for (var k=0;k<cardAttribute.length;k++) {12342 if (card.getAttribute(cardAttribute[k])) {12343 if (cardAttributeType[k]=="str") {12344 buildP[nameC][cardAttribute[k]]=card.getAttribute(cardAttribute[k]);12345 }12346 if (cardAttributeType[k]=="num") {12347 buildP[nameC][cardAttribute[k]]=parseFloat(card.getAttribute(cardAttribute[k]));12348 }12349 }12350 }12351 buildP[nameC].img=[];12352 for (var k=0;k<card.getNodeByName("img").node.length;k++) {12353 buildP[nameC].img[k]=card.getNodeByName("img").getAttribute("root")+card.getNodeByName("img").node[k].getAttribute("name");12354 }12355 }12356 CARDBOARD_P[name]=buildP;12357 }12358 var data=ASGetSourceByName("data0").getNodeByName("cardBoardV");12359 var cardAttribute=["widthA","heightA","blockX","blockY","imgSize","timeDelay","titleC","titleE","linkTo","hyperlink"];12360 var cardAttributeType=["num","num","num","num","str","num","str","str","str","str"];12361 //buildCardBoardContent12362 for (var i=0;i<data.node.length;i++) {12363 var cardBoard=data.node[i];12364 var name=cardBoard.nodeName;12365 var buildP={12366 name:name,12367 scene:cardBoard.getAttribute("scene"),12368 widthL:parseFloat(cardBoard.getAttribute("widthL")),12369 heightL:parseFloat(cardBoard.getAttribute("heightL")),12370 space:parseFloat(cardBoard.getAttribute("space")),12371 cardPos:new PointO(parseFloat(cardBoard.getAttribute("cardPosX")),parseFloat(cardBoard.getAttribute("cardPosY"))),12372 topLogoPos:new PointO(parseFloat(cardBoard.getAttribute("topLogoPosX")),parseFloat(cardBoard.getAttribute("topLogoPosY"))),12373 };12374 if (cardBoard.getAttribute("backTo")) buildP.backTo=cardBoard.getAttribute("backTo");12375 for (var j=0;j<cardBoard.getNodeByName("card").node.length;j++) {12376 var card=cardBoard.getNodeByName("card").node[j];12377 var nameC=card.nodeName;12378 buildP[nameC]={};12379 for (var k=0;k<cardAttribute.length;k++) {12380 if (card.getAttribute(cardAttribute[k])) {12381 if (cardAttributeType[k]=="str") {12382 buildP[nameC][cardAttribute[k]]=card.getAttribute(cardAttribute[k]);12383 }12384 if (cardAttributeType[k]=="num") {12385 buildP[nameC][cardAttribute[k]]=parseFloat(card.getAttribute(cardAttribute[k]));12386 }12387 }12388 }12389 buildP[nameC].img=[];12390 for (var k=0;k<card.getNodeByName("img").node.length;k++) {12391 buildP[nameC].img[k]=card.getNodeByName("img").getAttribute("root")+card.getNodeByName("img").node[k].getAttribute("name");12392 }12393 }12394 CARDBOARD_PV[name]=buildP;12395 }12396 }12397 function buildInterfaceH() {12398 INTERFACE_H=ASElement({12399 nodeName:"div",12400 style:{12401 position:"absolute",12402 opacity:0,12403 display:"none",12404 left:ASWindowWidth/2,12405 top:ASWindowHeight/2,12406 },12407 });12408 ROOT.appendChild(INTERFACE_H);12409 INTERFACE_H.resize=function() {12410 this.set({style:{12411 left:ASWindowWidth/2,12412 top:ASWindowHeight/2,12413 }});12414 this.back.set({style:{12415 left:-ASWindowWidth/2+20,12416 top:-ASWindowHeight/2+20,12417 }});12418 // this.user.set({style:{12419 // right:-ASWindowWidth/2+10,12420 // top:-ASWindowHeight/2+10,12421 // }});12422 }12423 INTERFACE_H.changeVersion=function() {12424 if (ASVersion=="horizon") {12425 this.back.set({style:{12426 width:89,12427 height:62,12428 }});12429 // this.user.set({style:{12430 // transform:{12431 // translateX:0,12432 // }12433 // }});12434 // this.user.word.set({style:{12435 // top:0,12436 // transform:{scale:1},12437 // }});12438 // this.user.log.set({style:{12439 // top:0,12440 // transform:{scale:1},12441 // }});12442 } else {12443 this.back.set({style:{12444 width:120,12445 height:84,12446 }});12447 // this.user.set({style:{12448 // transform:{12449 // translateX:120,12450 // }12451 // }});12452 // this.user.word.set({style:{12453 // top:-30,12454 // transform:{scale:2},12455 // }});12456 // this.user.log.set({style:{12457 // top:-30,12458 // transform:{scale:2},12459 // }});12460 }12461 }12462 INTERFACE_H.appear=function() {12463 this.set({style:{12464 display:"inline-block",12465 }});12466 this.setTarget({12467 opacity:1,12468 speed_alpha:0.15,12469 });12470 if (INTERFACE_C.active.name=="main") {12471 this.back.set({style:{12472 visibility:"hidden",12473 }});12474 } else {12475 this.back.set({style:{12476 visibility:"visible",12477 }});12478 }12479 }12480 INTERFACE_H.hide=function() {12481 if (this.style.opacity=="0") this.set({style:{display:"none"}});12482 }12483 INTERFACE_H.disappear=function() {12484 this.setTarget({12485 opacity:0,12486 speed_alpha:0.15,12487 });12488 this.setTimeout(this.hide,500);12489 }12490 INTERFACE_H.topLogo=ASElement({12491 nodeName:"img",12492 src:ASGetSrcByName("TopLogo"),12493 style:{12494 position:"absolute",12495 left:-DEFAULT_TOPLOGO_WIDTH/2,12496 top:-DEFAULT_TOPLOGO_HEIGHT/2,12497 width:DEFAULT_TOPLOGO_WIDTH,12498 height:DEFAULT_TOPLOGO_HEIGHT,12499 },12500 });12501 INTERFACE_H.appendChild(INTERFACE_H.topLogo);12502 INTERFACE_H.back=ASElement({12503 nodeName:"div",12504 style:{12505 position:"absolute",12506 left:-ASWindowWidth/2+20,12507 top:-ASWindowHeight/2+20,12508 width:89,12509 height:62,12510 backgroundImage:"url('"+ASGetSrcByName("cardBoardBack1")+"')",12511 backgroundSize:"100% 100%",12512 transformOrigin:"50% 50%",12513 cursor:"pointer",12514 },12515 onmouseover:function() {12516 this.setTarget({transform:{scale:1}});12517 this.pic1.setTarget({opacity:1});12518 this.pic2.setTarget({opacity:0});12519 },12520 onmouseout:function() {12521 this.setTarget({transform:{scale:1}});12522 this.pic1.setTarget({opacity:0});12523 this.pic2.setTarget({opacity:0});12524 },12525 onmousedown:function() {12526 this.setTarget({transform:{scale:0.9}});12527 this.pic1.setTarget({opacity:1});12528 this.pic2.setTarget({opacity:1});12529 },12530 onmouseup:function() {12531 this.setTarget({transform:{scale:1}});12532 this.pic1.setTarget({opacity:1});12533 this.pic2.setTarget({opacity:0});12534 },12535 onclick:function() {12536 changeURL(INTERFACE_C.active.backTo);12537 },12538 });12539 INTERFACE_H.appendChild(INTERFACE_H.back);12540 INTERFACE_H.back.pic1=ASElement({12541 nodeName:"img",12542 src:ASGetSrcByName("cardBoardBack2"),12543 style:{12544 opacity:0,12545 width:"100%",12546 height:"100%",12547 },12548 });12549 INTERFACE_H.back.appendChild(INTERFACE_H.back.pic1);12550 INTERFACE_H.back.pic2=ASElement({12551 nodeName:"img",12552 src:ASGetSrcByName("cardBoardBack3"),12553 style:{12554 position:"relative",12555 top:"-100%",12556 opacity:0,12557 width:"100%",12558 height:"100%",12559 cursor:"pointer",12560 },12561 });12562 INTERFACE_H.back.appendChild(INTERFACE_H.back.pic2);12563 // INTERFACE_H.user=ASElement({12564 // nodeName:"div",12565 // style:{12566 // position:"absolute",12567 // width:500,12568 // height:150,12569 // right:-ASWindowWidth/2+10,12570 // top:-ASWindowHeight/2+10,12571 // },12572 // });12573 // INTERFACE_H.appendChild(INTERFACE_H.user);12574 // INTERFACE_H.user.head=ASElement({12575 // nodeName:"div",12576 // style:{12577 // float:"right",12578 // width:DEFAULT_USER_IMG_WIDTH,12579 // height:DEFAULT_USER_IMG_HEIGHT,12580 // backgroundImage:"url('"+ASGetSrcByName("userHead1")+"')",12581 // backgroundSize:"100% 100%",12582 // cursor:"pointer",12583 // },12584 // onmouseover:function() {12585 // this.setTarget({transform:{scale:1.05}});12586 // this.pic.setTarget({opacity:1});12587 // },12588 // onmouseout:function() {12589 // this.setTarget({transform:{scale:1}});12590 // this.pic.setTarget({opacity:0});12591 // },12592 // onmousedown:function() {12593 // this.setTarget({transform:{scale:0.95}});12594 // this.pic.setTarget({opacity:1});12595 // },12596 // onmouseup:function() {12597 // this.setTarget({transform:{scale:1.05}});12598 // this.pic.setTarget({opacity:1});12599 // },12600 // onclick:function() {12601 // changeURL("myspace");12602 // },12603 // });12604 // INTERFACE_H.user.appendChild(INTERFACE_H.user.head);12605 // INTERFACE_H.user.head.pic=ASElement({12606 // nodeName:"img",12607 // src:ASGetSrcByName("userHead2"),12608 // style:{12609 // width:"100%",12610 // height:"100%",12611 // opacity:0,12612 // cursor:"pointer",12613 // },12614 // });12615 // INTERFACE_H.user.head.appendChild(INTERFACE_H.user.head.pic);12616 // INTERFACE_H.user.word=BasicWord({12617 // size:28,12618 // color:"white",12619 // wordC:"遊 客",12620 // wordE:"Visitor",12621 // style:{12622 // position:"relative",12623 // float:"right",12624 // marginTop:68,12625 // width:350,12626 // textAlign:"right",12627 // textShadow:"0 0 5px rgba(0,0,0,0.8)",12628 // transformOrigin:"100% 100%",12629 // cursor: "pointer",12630 // visibility: "hidden"12631 // },12632 // onclick:function() {12633 // changeURL("myspace");12634 // },12635 // });12636 // INTERFACE_H.user.appendChild(INTERFACE_H.user.word);12637 // INTERFACE_H.user.log=BasicWord({12638 // size:20,12639 // color:"white",12640 // wordC:"登 入",12641 // wordE:"Log in",12642 // ignoreM:true,12643 // style:{12644 // position:"relative",12645 // float:"right",12646 // textShadow:"0 0 5px rgba(0,0,0,0.8)",12647 // cursor:"pointer",12648 // transformOrigin: "100% 0",12649 // visibility: "hidden"12650 // },12651 // onclick:function() {12652 // changeURL("login");12653 // },12654 // });12655 // INTERFACE_H.user.appendChild(INTERFACE_H.user.log);12656 // INTERFACE_H.user.update=function() {12657 // if (USERDATA=="NULL") {12658 // this.word.setWord({12659 // wordC:"遊 客",12660 // wordE:"Visitor",12661 // });12662 // this.log.setWord({12663 // wordC:"登 入",12664 // wordE:"Log in",12665 // });12666 // this.log.onclick=function() {12667 // changeURL("login");12668 // };12669 // } else {12670 // var name=USERDATA.name;12671 // if (USERDATA.nickname) name=USERDATA.nickname;12672 // this.word.setWord({12673 // wordC:name,12674 // wordE:name,12675 // });12676 // this.log.setWord({12677 // wordC:"登 出",12678 // wordE:"Log out",12679 // });12680 // this.log.onclick=function() {12681 // changeURL("logout");12682 // };12683 // }12684 // }12685 INTERFACE_H.changeVersion();12686 }12687 // Reworked Color Palette12688 COLOR_MUTEDRED = '#c80000'12689 COLOR_LIGHTRED = '#ff3333'12690 COLOR_SOFTWHITE = '#fff7f0'12691 function buildInterfaceL() {12692 INTERFACE_L=ASElement({12693 nodeName:"div",12694 style:{12695 position:"absolute",12696 display:"none",12697 },12698 });12699 ROOT.appendChild(INTERFACE_L);12700 INTERFACE_L.resize=function() {12701 this.head.set({style:{12702 width:ASWindowWidth,12703 }});12704 var width=DEFAULT_FRAME_WIDTH;12705 if (ASVersion=="vertical") width=VERTICAL_FRAME_WIDTH;12706 this.head.backF.set({style:{12707 width:(ASWindowWidth-width)/2,12708 }});12709 this.head.userF.set({style:{12710 minWidth:(ASWindowWidth-width)/2,12711 }});12712 }12713 INTERFACE_L.changeVersion=function() {12714 if (ASVersion=="horizon") {12715 this.head.set({style:{12716 height:DEFAULT_HEAD_HEIGHT,12717 }});12718 this.head.backF.set({style:{12719 minWidth:DEFAULT_HEAD_ICON_SIZE,12720 }});12721 for (var item in this.head.icon) {12722 this.head.icon[item].set({style:{12723 width:DEFAULT_HEAD_ICON_SIZE,12724 height:DEFAULT_HEAD_ICON_SIZE,12725 marginTop:0,12726 }});12727 }12728 this.head.label.set({style:{12729 transform:{12730 scale:1,12731 translateY:0,12732 },12733 }});12734 } else {12735 this.head.set({style:{12736 height:VERTICAL_HEAD_HEIGHT,12737 }});12738 this.head.backF.set({style:{12739 minWidth:VERTICAL_HEAD_ICON_SIZE,12740 }});12741 for (var item in this.head.icon) {12742 this.head.icon[item].set({style:{12743 width:VERTICAL_HEAD_ICON_SIZE,12744 height:VERTICAL_HEAD_ICON_SIZE,12745 marginTop:1,12746 }});12747 }12748 this.head.label.set({style:{12749 transform:{12750 scale:2,12751 translateY:15,12752 },12753 }});12754 }12755 }12756 INTERFACE_L.appear=function() {12757 this.set({style:{12758 display:"inline-block",12759 }});12760 this.head.setTarget({12761 top:0,12762 });12763 }12764 INTERFACE_L.hide=function() {12765 if (this.head.style.top==(-DEFAULT_HEAD_HEIGHT*2)+"px") this.set({style:{display:"none"}});12766 }12767 INTERFACE_L.disappear=function() {12768 this.head.setTarget({12769 top:-DEFAULT_HEAD_HEIGHT*2,12770 });12771 this.setTimeout(this.hide,500);12772 }12773 // Interface HEAD12774 INTERFACE_L.head=ASElement({12775 nodeName:"div",12776 style:{12777 position:"relative",12778 top:-DEFAULT_HEAD_HEIGHT*2,12779 width:ASWindowWidth,12780 height:DEFAULT_HEAD_HEIGHT,12781 backgroundColor:COLOR_MUTEDRED,12782 // backgroundImage:"url('"+ASGetSrcByName("headBack")+"')",12783 backgroundSize:"100% 100%",12784 // boxShadow:"0 0 15px rgba(0,0,0,0.8)",12785 },12786 });12787 INTERFACE_L.appendChild(INTERFACE_L.head);12788 var head=INTERFACE_L.head;12789 var data=ASGetSourceByName("data0").getNodeByName("head").getNodeByName("icon");12790 head.icon={};12791 head.backF=ASElement({12792 nodeName:"div",12793 style:{12794 marginTop:3,12795 width:(ASWindowWidth-DEFAULT_FRAME_WIDTH)/2,12796 minWidth:DEFAULT_HEAD_ICON_SIZE,12797 },12798 });12799 head.appendChild(head.backF);12800 head.icon.back=HeadIcon({12801 src:data.getAttribute("root")+"back",12802 onclick:function() {12803 if (INTERFACE_C.active.type=="frame") {12804 changeURL(INTERFACE_C.active.backTo);12805 }12806 }12807 });12808 head.backF.appendChild(head.icon.back);12809 head.leftF=ASElement({12810 nodeName:"div",12811 style:{12812 marginTop:4,12813 }12814 });12815 head.appendChild(head.leftF);12816 for (var i=0;i<data.getNodeByName("left").node.length;i++) {12817 var name=data.getNodeByName("left").node[i].getAttribute("name");12818 head.icon[name]=HeadIcon({12819 src:data.getAttribute("root")+name,12820 nameC:data.getNodeByName("left").node[i].getAttribute("nameC"),12821 nameE:data.getNodeByName("left").node[i].getAttribute("nameE"),12822 linkTo:data.getNodeByName("left").node[i].getAttribute("linkTo"),12823 hyperlink:data.getNodeByName("left").node[i].getAttribute("hyperlink"),12824 });12825 head.leftF.appendChild(head.icon[name]);12826 }12827 head.userF=ASElement({12828 nodeName:"div",12829 style:{12830 marginTop:3,12831 float:"right",12832 minWidth:(ASWindowWidth-DEFAULT_FRAME_WIDTH)/2,12833 },12834 });12835 head.appendChild(head.userF);12836 head.userF.log=BasicWord({12837 size:18,12838 color:"white",12839 wordC:"登 入",12840 wordE:"Log in",12841 ignoreM:true,12842 style:{12843 float:"right",12844 marginRight:15,12845 marginTop:9,12846 cursor: "pointer",12847 visibility: "hidden"12848 },12849 onclick:function() {12850 changeURL("login");12851 },12852 });12853 head.userF.appendChild(head.userF.log);12854 head.userF.user=BasicWord({12855 size:26,12856 color:"white",12857 wordC:"遊 客",12858 wordE:"Visitor",12859 ignoreM:true,12860 style:{12861 float:"right",12862 marginTop:3.5,12863 marginRight:15,12864 marginLeft:20,12865 cursor: "pointer",12866 visibility: "hidden"12867 },12868 onclick:function() {12869 changeURL("myspace");12870 },12871 });12872 head.userF.appendChild(head.userF.user);12873 head.userF.update=function() {12874 if (USERDATA=="NULL") {12875 this.log.setWord({12876 wordC:"登 入",12877 wordE:"Log in",12878 });12879 this.user.setWord({12880 wordC:"遊 客",12881 wordE:"Visitor",12882 });12883 this.log.onclick=function() {12884 changeURL("login");12885 };12886 this.user.onclick=function() {12887 changeURL("login");12888 };12889 } else {12890 this.log.setWord({12891 wordC:"登 出",12892 wordE:"Log out",12893 });12894 var name=USERDATA.name;12895 if (USERDATA.nickname) name=USERDATA.nickname;12896 this.user.setWord({12897 wordC:name,12898 wordE:name,12899 });12900 this.log.onclick=function() {12901 changeURL("logout");12902 };12903 this.user.onclick=function() {12904 changeURL("myspace");12905 };12906 }12907 }12908 head.rightF=ASElement({12909 nodeName:"div",12910 style:{12911 marginTop:4,12912 float:"right",12913 },12914 });12915 head.appendChild(head.rightF);12916 for (var i=0;i<data.getNodeByName("right").node.length;i++) {12917 var name=data.getNodeByName("right").node[i].getAttribute("name");12918 head.icon[name]=HeadIcon({12919 src:data.getAttribute("root")+name,12920 nameC:data.getNodeByName("right").node[i].getAttribute("nameC"),12921 nameE:data.getNodeByName("right").node[i].getAttribute("nameE"),12922 linkTo:data.getNodeByName("right").node[i].getAttribute("linkTo"),12923 hyperlink:data.getNodeByName("right").node[i].getAttribute("hyperlink"),12924 });12925 head.rightF.appendChild(head.icon[name]);12926 }12927 head.label=ASElement({12928 nodeName:"div",12929 style:{12930 position:"absolute",12931 transformOrigin:"50% 0",12932 backgroundColor:"rgb(230,0,0)", // Label Tooltip Color12933 padding:"3px 10px",12934 borderRadius:3,12935 visibility:"hidden",12936 opacity:0,12937 },12938 });12939 head.appendChild(head.label);12940 head.label.word=ASElement({12941 nodeName:"div",12942 });12943 head.label.appendChild(head.label.word);12944 head.label.point=ASElement({12945 nodeName:"div",12946 style:{12947 position:"absolute",12948 left:"50%",12949 top:-5,12950 width:10,12951 height:10,12952 backgroundColor:"rgb(230,0,0)", // Label Tooltip Diamond Color12953 transformOrigin:"0 0",12954 transform:{12955 rotate:45,12956 },12957 },12958 });12959 head.label.appendChild(head.label.point);12960 head.changeLabel=function(target) {12961 if (target && !target.nameC) target=null;12962 if (!target) {12963 this.label.setTimeout(function() {12964 for (var item in INTERFACE_L.head.icon) {12965 if (INTERFACE_L.head.icon[item].nameC && INTERFACE_L.head.icon[item].wMouseOver) return;12966 }12967 this.setTarget({opacity:0});12968 },100);12969 this.label.setTimeout(function() {12970 for (var item in INTERFACE_L.head.icon) {12971 if (INTERFACE_L.head.icon[item].nameC && INTERFACE_L.head.icon[item].wMouseOver) return;12972 }12973 if (this.style.opacity=="0") this.style.visibility="hidden";12974 },400);12975 return;12976 }12977 this.label.removeChild(this.label.word);12978 this.label.word=target.word;12979 this.label.appendChild(this.label.word);12980 var top=DEFAULT_HEAD_HEIGHT-5;12981 if (this.label.style.visibility=="visible") top=DEFAULT_HEAD_HEIGHT+5;12982 this.label.set({style:{12983 left:target.offsetLeft+ASGetElementWidth(target)/2-ASGetElementWidth(this.label)/2+3,12984 top:top,12985 visibility:"visible",12986 }});12987 this.label.setTimeout(function() {this.setTarget({12988 opacity:1,12989 top:DEFAULT_HEAD_HEIGHT+5,12990 })},10);12991 }12992 INTERFACE_L.changeVersion();12993 }12994 // 管理整體顯示 INTERFACE_C12995 function buildInterfaceC() {12996 INTERFACE_C=ASElement({12997 nodeName:"div",12998 style:{12999 position:"absolute",13000 left:ASWindowWidth/2,13001 top:ASWindowHeight/2,13002 },13003 });13004 ROOT.appendChild(INTERFACE_C);13005 INTERFACE_C.active=null;13006 INTERFACE_C.wait=null;13007 INTERFACE_C.history=[];13008 INTERFACE_C.maxHistoryLength = 5;13009 INTERFACE_C.resize=function() {13010 this.set({style:{13011 left:ASWindowWidth/2,13012 top:ASWindowHeight/2,13013 }});13014 for (var item in FRAME) FRAME[item].resize();13015 for (var item in SHELL) SHELL[item].resize();13016 for (var item in FRAME_V) FRAME_V[item].resize();13017 for (var item in SHELL_V) SHELL_V[item].resize();13018 }13019 // 主要的页面构筑逻辑13020 INTERFACE_C.call=function(name) {13021 var target;13022 if (ASVersion=="horizon") {13023 if (CARDBOARD[name]) target=CARDBOARD[name];13024 if (FRAME[name]) target=FRAME[name];13025 if (SHELL[name]) target=SHELL[name];13026 if (!target) {13027 if (CARDBOARD_P[name]) {13028 CARDBOARD[name]=CardBoard(CARDBOARD_P[name]);13029 target=CARDBOARD[name];13030 }13031 if (FRAME_P[name]) {13032 FRAME[name]=Frame(FRAME_P[name]);13033 target=FRAME[name];13034 }13035 if (SHELL_P[name]) {13036 SHELL[name]=Shell(SHELL_P[name]);13037 target=SHELL[name];13038 }13039 }13040 }13041 if (ASVersion=="vertical") {13042 if (CARDBOARD_V[name]) target=CARDBOARD_V[name];13043 if (FRAME_V[name]) target=FRAME_V[name];13044 if (SHELL_V[name]) target=SHELL_V[name];13045 if (!target) {13046 if (CARDBOARD_PV[name]) {13047 CARDBOARD_V[name]=CardBoardV(CARDBOARD_PV[name]);13048 target=CARDBOARD_V[name];13049 }13050 if (FRAME_P[name]) {13051 FRAME_V[name]=FrameV(FRAME_P[name]);13052 target=FRAME_V[name];13053 }13054 if (SHELL_P[name]) {13055 SHELL_V[name]=ShellV(SHELL_P[name]);13056 target=SHELL_V[name];13057 }13058 }13059 }13060 if (!target) return;13061 if (target.update) target.update();13062 if (this.active && this.active==target) {13063 if (this.active.dealJumpPros) this.active.dealJumpPros();13064 return;13065 }13066 if (target.type=="frame") {13067 target.dealJumpPros();13068 if (!target.pageC.wBuild) {13069 target.pageC.build();13070 }13071 }13072 if (target.type=="shell") {13073 if (!target.page.wBuild) {13074 target.page.build();13075 target.slideC.onscroll();13076 }13077 }13078 if (!this.active) {13079 if (target.type=="cardBoard") {13080 this.appendChild(target);13081 target.appearFromBack();13082 }13083 if (target.type=="frame") {13084 this.appendChild(target);13085 target.appearFromTop();13086 }13087 if (target.type=="shell") {13088 this.appendChild(target);13089 target.appearFromBottom();13090 }13091 target.setTimeout(function(){this.appear();},10);13092 this.active=target;13093 return;13094 }13095 if (this.active.type=="cardBoard" && target.type=="cardBoard") {13096 this.active.disappearToBack();13097 this.appendChild(target);13098 target.appearFromBack();13099 target.setTimeout(function(){this.appear();},200);13100 }13101 if (this.active.type=="cardBoard" && target.type=="frame") {13102 INTERFACE_H.disappear();13103 var k=-1;13104 for (var i=0;i<this.active.card.length;i++) {13105 if (this.active.card[i].linkTo==target.name) {13106 k=i;13107 break;13108 }13109 }13110 if (k==-1 || ASBrowser=="Mobile") {13111 this.active.disappearToBack();13112 this.appendChild(target);13113 target.appearFromTop();13114 this.setTimeout(function() {this.active.appear();},250);13115 } else {13116 this.active.disappearRolling(k);13117 this.appendChild(target);13118 target.appearRolling(this.active.card[k]);13119 target.set({style:{visibility:"hidden"}});13120 target.appear();13121 this.setTimeout(function() {this.active.set({style:{visibility:"visible"}});},125);13122 }13123 }13124 if (this.active.type=="cardBoard" && target.type=="shell") {13125 INTERFACE_H.disappear();13126 target.appearFromBottom();13127 this.appendChild(target);13128 this.setTimeout(function() {this.active.appear();},10);13129 }13130 if (this.active.type=="frame" && target.type=="cardBoard") {13131 INTERFACE_L.disappear();13132 var k=-1;13133 for (var i=0;i<target.card.length;i++) {13134 if (target.card[i].linkTo==this.active.name) {13135 k=i;13136 break;13137 }13138 }13139 if (k==-1 || ASBrowser=="Mobile") {13140 this.active.disappearToTop();13141 this.appendChild(target);13142 target.appearFromBack();13143 this.setTimeout(function() {this.active.appear();},250);13144 } else {13145 this.active.disappearRolling(target.card[k]);13146 this.appendChild(target);13147 target.appearRolling(k);13148 this.setTimeout(function() {this.active.appear();},10);13149 }13150 }13151 if (this.active.type=="frame" && target.type=="frame") {13152 if (this.active.backTo && target.backTo && this.active.backTo==target.backTo) {13153 this.active.disappearTurning();13154 this.appendChild(target);13155 target.appearTurning();13156 this.setTimeout(function() {this.active.appear();},200);13157 } else {13158 this.active.disappearToTop();13159 this.appendChild(target);13160 target.appearFromTop();13161 this.setTimeout(function() {this.active.appear();},250);13162 }13163 }13164 if (this.active.type=="frame" && target.type=="shell") {13165 INTERFACE_L.disappear();13166 target.appearFromBottom();13167 this.appendChild(target);13168 this.setTimeout(function() {this.active.appear();},10);13169 }13170 if (this.active.type=="shell" && target.type=="cardBoard") {13171 this.setTimeout(function() {INTERFACE_H.appear();},10);13172 this.active.disappear();13173 if (target.parentNode!=this) {13174 this.appendChild(target);13175 target.appearFromBack();13176 this.setTimeout(function() {this.active.appear();},150);13177 }13178 }13179 if (this.active.type=="shell" && target.type=="frame") {13180 this.setTimeout(function() {INTERFACE_L.appear();},10);13181 this.active.disappear();13182 if (target.parentNode!=this) {13183 this.appendChild(target);13184 target.appearFromTop();13185 this.setTimeout(function() {this.active.appear();},150);13186 }13187 }13188 if (this.active.type=="shell" && target.type=="shell") {13189 this.active.disappearEasy();13190 if (target.parentNode!=this) {13191 this.appendChild(target);13192 target.appearEasy();13193 this.setTimeout(function() {this.active.appear();},250);13194 }13195 }13196 this.active=target;13197 }13198 buildPage();13199 buildShell();13200 buildFrame();13201 buildCardBoard();13202 }13203 function setLang(l) {13204 ASLang=l;13205 if (ASLang=="C") {13206 document.title="中國民間藝術坊";13207 } else {13208 document.title="Chinese Folk Art Society";13209 }13210 for (var i=0;i<BasicWordList.length;i++) BasicWordList[i].setLang(l);13211 for (var i=0;i<BasicEditToolList.length;i++) BasicEditToolList[i].setLang(l);13212 for (var i=0;i<AnchorListList.length;i++) AnchorListList[i].resize();13213 for (var i=0;i<PageListList.length;i++) PageListList[i].resize();13214 if (typeof(PAGE)!="undefined") for (var page in PAGE) {13215 if (PAGE[page].setLang) PAGE[page].setLang();13216 }13217 if (typeof(PAGE_V)!="undefined") for (var page in PAGE_V) {13218 if (PAGE_V[page].setLang) PAGE_V[page].setLang();13219 }13220 if (typeof(INTERFACE_C)!="undefined" && INTERFACE_C.active && INTERFACE_C.active.type=="frame") {13221 if (INTERFACE_C.active.pageResize) INTERFACE_C.active.pageResize();13222 }13223 }13224 function ASChangeVersion() {13225 if (typeof(SCENE)!="undefined") SCENE.changeVersion();13226 if (typeof(INTERFACE_L)!="undefined") INTERFACE_L.changeVersion();13227 if (typeof(INTERFACE_H)!="undefined") INTERFACE_H.changeVersion();13228 if (INTERFACE_C.active) {13229 ROOT.setTimeout(function() {INTERFACE_C.call(INTERFACE_C.active.name);},500);13230 }13231 }13232 function ASResize() {13233 if (typeof(SCENE)!="undefined") SCENE.resize();13234 if (typeof(INTERFACE_H)!="undefined") INTERFACE_H.resize();13235 if (typeof(INTERFACE_C)!="undefined") INTERFACE_C.resize();13236 if (typeof(INTERFACE_L)!="undefined") INTERFACE_L.resize();13237 if (typeof(PAGE)!="undefined") for (var item in PAGE) {13238 if (PAGE[item].wBuild && PAGE[item].resize) PAGE[item].resize();13239 }13240 if (typeof(PAGE_V)!="undefined") for (var item in PAGE_V) {13241 if (PAGE_V[item].wBuild && PAGE_V[item].resize) PAGE_V[item].resize();13242 }13243 }13244 function userLogin(user,ticket) {13245 addACookie("cfas_user",user,8*3600);13246 addACookie("cfas_ticket",ticket,8*3600);13247 sendAJAX({13248 type:"POST",13249 src:"cgi-bin/operateData.php",13250 data:{13251 user:user,13252 ticket:ticket,13253 action:"getUserData",13254 },13255 });13256 }13257 function userComeback(user,ticket) {13258 sendAJAX({13259 type:"POST",13260 src:"cgi-bin/operateData.php",13261 data:{13262 user:user,13263 ticket:ticket,13264 action:"getUserData",13265 },13266 });13267 }13268 function getUserData(data) {13269 USERDATA=data;13270 for (var item in USERDATA) {13271 if (item=="func") continue;13272 USERDATA[item]=decodeWord(USERDATA[item]);13273 }13274 for (var item in USERDATA.func) {13275 for (var itemS in USERDATA.func[item]) {13276 USERDATA.func[item][itemS]=decodeWord(USERDATA.func[item][itemS]);13277 }13278 }13279 updateUserData();13280 if (location.href.indexOf("#!login")!=-1) {13281 goBack();13282 setTimeout(function(){13283 if (location.href.indexOf("#!login")!=-1) goBack();13284 },50);13285 }13286 }13287 function getTargetData(data) {13288 if (!data) {13289 TARGETDATA="NULL";13290 } else {13291 TARGETDATA=data;13292 for (var item in TARGETDATA) {13293 if (item=="func") continue;13294 TARGETDATA[item]=decodeWord(TARGETDATA[item]);13295 }13296 for (var item in TARGETDATA.func) {13297 for (var itemS in TARGETDATA.func[item]) {13298 TARGETDATA.func[item][itemS]=decodeWord(TARGETDATA.func[item][itemS]);13299 }13300 }13301 }13302 }13303 function getFuncData(data) {13304 FUNCDATA=data;13305 for (var i=0;i<FUNCDATA.length;i++) {13306 var data=FUNCDATA[i];13307 for (var item in data) {13308 data[item]=decodeWord(data[item]);13309 }13310 }13311 }13312 function requestTargetData(target,callback) {13313 if (USERDATA=="NULL") return;13314 if (!callback) callback="";13315 sendAJAX({13316 type:"POST",13317 src:"cgi-bin/operateData.php",13318 callback:callback,13319 data:{13320 user:USERDATA.user,13321 ticket:USERDATA.ticket,13322 target:target,13323 action:"getTargetData",13324 },13325 });13326 }13327 function userLoginTimeIn() {13328 USERDATA.wChecking=false;13329 }13330 function userLoginTimeout(wHide) {13331 USERDATA="NULL";13332 updateUserData();13333 if (!wHide) location.href="#loginTimeout";13334 }13335 function checkUserLogin() {13336 var user=getACookie("cfas_user");13337 var ticket=getACookie("cfas_ticket");13338 if (!user || !ticket) return(false);13339 sendAJAX({13340 type:"POST",13341 data:{13342 user:user,13343 ticket:ticket,13344 },13345 src:"cgi-bin/checkUserLogin.php",13346 });13347 }13348 function updateUserData() {13349 INTERFACE_H.user.update();13350 INTERFACE_L.head.userF.update();13351 if (typeof(FRAME)!="undefined") {13352 for (var page in FRAME) {13353 if (FRAME[page].update) FRAME[page].update();13354 }13355 }13356 if (typeof(FRAME_V)!="undefined") {13357 for (var page in FRAME_V) {13358 if (FRAME_V[page].update) FRAME_V[page].update();13359 }13360 }13361 if (typeof(PAGE)!="undefined") {13362 for (var page in PAGE) {13363 if (PAGE[page].update && PAGE[page].wBuild) PAGE[page].update();13364 }13365 }13366 if (typeof(PAGE_V)!="undefined") {13367 for (var page in PAGE_V) {13368 if (PAGE_V[page].update && PAGE_V[page].wBuild) PAGE_V[page].update();13369 }13370 }13371 }13372 function postUserDataFail() {13373 alert("postUserDataFail!");13374 }13375 function postUserDataSucceed() {13376 if (PostDataR.banDefault) return;13377 for (var item in PostDataR) USERDATA[item]=PostDataR[item];13378 updateUserData();13379 PostDataR=null;13380 }13381 function postUserData(data,callback) {13382 if (USERDATA=="NULL") return;13383 if (!callback) callback="";13384 var data1={};13385 data1.user=USERDATA.user;13386 data1.ticket=USERDATA.ticket;13387 data1.action="postUserData";13388 for (var i=0;i<UserDataList.length;i++) {13389 if (UserDataList[i] in data) {13390 data1[UserDataList[i]]=data[UserDataList[i]];13391 }13392 }13393 PostDataR=data1;13394 sendAJAX({13395 type:"POST",13396 src:"cgi-bin/operateData.php",13397 data:data1,13398 callback:callback,13399 });13400 }13401 // 这里是有关于页面 URL 更改,怎么改变页面显示的逻辑13402 window.onhashchange=function() {13403 var href=location.href;13404 var target="main";13405 JumpPros={};13406 var typeP={};13407 for (;;) {13408 var s1=href.indexOf("#");13409 if (s1<0) break;13410 if (href.charAt(s1+1)=="!") s1++;13411 var code=href.substr(s1+1);13412 var s2=code.indexOf("?");13413 if (s2<0) {13414 target=code;13415 break;13416 }13417 target=code.substr(0,s2);13418 var pros=code.substr(s2+1);13419 for (;pros.length>0;) {13420 var s3=pros.indexOf("=");13421 var s4=pros.indexOf("&");13422 if (s4<0) s4=pros.length;13423 JumpPros[pros.substr(0,s3)]=pros.substr(s3+1,s4-s3-1);13424 pros=pros.substr(s4+1);13425 }13426 break;13427 }13428 var yes=false;13429 // 检测页面是否存在,是那种页面13430 if (CARDBOARD_P[target]) yes=true;13431 if (FRAME_P[target]) yes=true;13432 if (SHELL_P[target]) yes=true;13433 if (yes) {13434 // 添加到歷史裡面13435 INTERFACE_C.history.push(target);13436 if (INTERFACE_C.history.length > INTERFACE_C.maxHistoryLength) {13437 INTERFACE_C.history.shift()13438 }13439 // 构筑那个页面13440 INTERFACE_C.call(target,typeP);13441 } else {13442 // 返回主界面13443 INTERFACE_C.call("main");13444 }13445 }13446 function goBack() {13447 // if (history.length>ASHistoryStartN) {13448 // history.back();13449 // } else {13450 // changeURL("main");13451 // }13452 var current = INTERFACE_C.history.pop()13453 // SHELL_P[current] = null;13454 // SHELL[current] = null;13455 var last = INTERFACE_C.history.pop()13456 if (last)13457 changeURL(last)13458 else 13459 changeURL("main")13460 }13461 function changeURL(url) {13462 location.href="#!"+url;13463 }13464 function ASCustomF() {13465 buildScene();13466 }13467 // 一切的接入口13468 function ASCustom() {13469 // 构造一切的开始13470 buildMain=function() {13471 //if (location.href.indexOf("#")==-1) SCENE.change("autumn1.jpg");13472 // 这里几种不同的构筑是针对不同屏幕大小的……吧?13473 buildInterfaceC();13474 buildInterfaceL();13475 buildInterfaceH();13476 }13477 checkUserLogin();13478 if (!getACookie("cfas_lang")) {13479 // Default to Chinese13480 addACookie("cfas_lang","C",10*365*24*3600);13481 setLang("C");13482 buildMain();13483 window.onhashchange();13484 // Old Splash Page13485 // SCENE.change("Origin/main.png");13486 // FORE=ASElement({13487 // nodeName:"div",13488 // style:{13489 // position:"absolute",13490 // width:"100%",13491 // height:"100%",13492 // },13493 // });13494 // ROOT.appendChild(FORE);13495 // FORE.clearSelf=function() {13496 // this.setTarget({13497 // opacity:0,13498 // speed_alpha:0.05,13499 // });13500 // FORE.setTimeout(function(){13501 // this.parentNode.removeChild(this);13502 // },1000);13503 // }13504 // FORE.logo=ASElement({13505 // nodeName:"img",13506 // src:ASGetSrcByName("logo"),13507 // style:{13508 // marginLeft:25,13509 // marginTop:25,13510 // width:100,13511 // opacity:0,13512 // pointerEvents:"none",13513 // transformOrigin:"0 0",13514 // },13515 // });13516 // FORE.appendChild(FORE.logo);13517 // FORE.logo.setTarget({13518 // opacity:1,13519 // speed_alpha:0.05,13520 // });13521 // if (ASVersion=="vertical") {13522 // FORE.logo.set({style:{transform:{scale:1.5}}});13523 // }13524 // FORE.wordF=ASElement({13525 // nodeName:"div",13526 // style:{13527 // position:"absolute",13528 // width:500,13529 // height:360,13530 // right:0,13531 // bottom:0,13532 // transformOrigin:"100% 100%",13533 // },13534 // })13535 // FORE.appendChild(FORE.wordF);13536 // if (ASVersion=="vertical") {13537 // FORE.wordF.set({style:{transform:{scale:1.5}}});13538 // }13539 // FORE.word1=ASElement({13540 // nodeName:"p",13541 // innerHTML:"民 藝<br><span style='font-size:40px'>Folk Art</span>",13542 // style:{13543 // position:"relative",13544 // textAlign:"right",13545 // right:-400,13546 // fontFamily:DEFAULT_FONT,13547 // fontSize:50,13548 // color:"white",13549 // textShadow:"0 0 15px rgba(0,0,0,0.8)",13550 // pointerEvents:"none",13551 // },13552 // });13553 // FORE.wordF.appendChild(FORE.word1);13554 // FORE.word1.setTimeout(function(){13555 // this.setTarget({13556 // right:40,13557 // time:500,13558 // });13559 // },1000);13560 // FORE.word2=ASElement({13561 // nodeName:"p",13562 // innerHTML:"其實並不遙遠<br><span style='font-size:40px'>Is on our side</span>",13563 // style:{13564 // position:"relative",13565 // textAlign:"right",13566 // right:-400,13567 // fontFamily:DEFAULT_FONT,13568 // fontSize:50,13569 // color:"white",13570 // textShadow:"0 0 15px rgba(0,0,0,0.8)",13571 // pointerEvents:"none",13572 // },13573 // });13574 // FORE.wordF.appendChild(FORE.word2);13575 // FORE.word2.setTimeout(function(){13576 // this.setTarget({13577 // right:40,13578 // time:500,13579 // });13580 // },1500);13581 // FORE.buttonC=BasicButton({13582 // size:30,13583 // wordC:"進 入",13584 // style:{13585 // marginTop:20,13586 // marginLeft:230,13587 // opacity:0,13588 // },13589 // onclick:function() {13590 // addACookie("cfas_lang","C",10*365*24*3600);13591 // setLang("C");13592 // FORE.clearSelf();13593 // buildMain();13594 // window.onhashchange();13595 // },13596 // });13597 // FORE.wordF.appendChild(FORE.buttonC);13598 // FORE.buttonC.setTimeout(function(){13599 // this.setTarget({13600 // opacity:1,13601 // speed_alpha:0.05,13602 // });13603 // },2000);13604 // FORE.buttonE=BasicButton({13605 // size:30,13606 // wordE:"Enter",13607 // style:{13608 // marginLeft:15,13609 // opacity:0,13610 // },13611 // onclick:function() {13612 // addACookie("cfas_lang","E",10*365*24*3600);13613 // setLang("E");13614 // FORE.clearSelf();13615 // buildMain();13616 // window.onhashchange();13617 // },13618 // });13619 // FORE.wordF.appendChild(FORE.buttonE);13620 // FORE.buttonE.setTimeout(function(){13621 // this.setTarget({13622 // opacity:1,13623 // speed_alpha:0.05,13624 // });13625 // },2500);13626 } else {13627 /*13628 sendAJAX({13629 type:"GET",13630 src:"functionC.html",13631 succeed:function() {13632 var str=this.responseText;13633 var s=str.indexOf("<noscript>")+10;13634 var e=str.indexOf("</noscript>");13635 str=str.slice(s,e);13636 var dom=(new DOMParser()).parseFromString(str,"text/xml");13637 console.log(dom);13638 },13639 });13640 */13641 var lang=getACookie("cfas_lang");13642 if (lang!="C" && lang!="E") lang="C";13643 setLang(lang);13644 if (location.href.indexOf("cookGame")!=-1) {13645 var titleImgC=ASElement({13646 nodeName:"div",13647 style:{13648 position:"absolute",13649 display:"none",13650 },13651 });13652 ROOT.appendChild(titleImgC);13653 var titleImg=ASElement({13654 nodeName:"img",13655 src:"Image/Page/cookGame/title.jpg?aa=233",13656 style:{13657 position:"absolute",13658 opacity:0.5,13659 },13660 });13661 titleImgC.appendChild(titleImg);13662 }13663 buildMain();13664 // changeURL("lanternGame");13665 window.onhashchange();13666 }...

Full Screen

Full Screen

page.js

Source:page.js Github

copy

Full Screen

...56 <header>57 ${intro({58 badge: badge,59 title: asText(doc.data.title),60 text: asElement(doc.data.description)61 })}62 </header>63 ${body}64 </div>65 `66 })}67 </div>68 </main>69 `70 // render slice as element71 // (obj, num) -> Element72 function asSlice (slice, index, list) {73 switch (slice.slice_type) {74 case 'text': {75 const items = slice.items.filter((item) => item.text.length)76 if (!slice.primary.text.length && !items.length) return null77 console.log(items.length)78 return html`79 <div class="u-spaceV6">80 ${slice.primary.text.length ? html`81 <div class="Text Text--large">82 ${asElement(slice.primary.text, resolve, serialize)}83 </div>84 ` : null}85 ${items.length ? (items.length > 1 ? grid({ size: { md: '1of2' } }, items.map((item) => html`86 <div class="Text Text--large u-spaceB2">87 ${asElement(item.text, resolve, cap('h4'))}88 </div>89 `)) : html`90 <div class="Text Text--large">91 ${asElement(items[0].text, resolve, serialize)}92 </div>93 `) : null}94 </div>95 `96 }97 case 'heading': {98 if (!slice.primary.heading.length) return null99 return html`100 <div class="Text Text--large u-spaceB5 u-pushDown">101 <h2>${asText(slice.primary.heading)}</h2>102 ${slice.primary.text && slice.primary.text.length ? asElement(slice.primary.text, resolve, serialize) : null}103 </div>104 `105 }106 case 'quote': {107 const blockquote = state.cache(Blockquote, `${state.params.slug}-${index}`)108 return html`109 <div class="u-spaceV5">110 ${blockquote.render({111 large: true,112 content: asElement(slice.primary.text, resolve, serialize),113 caption: asElement(slice.primary.cite, resolve, serialize)114 })}115 </div>116 `117 }118 case 'image': {119 if (!slice.primary.image.url) return null120 const sources = srcset(slice.primary.image.url, [400, 600, 900, [1600, 'q_60'], [3000, 'q_50']])121 const attrs = Object.assign({122 sizes: '100vw',123 srcset: sources,124 src: sources.split(' ')[0],125 alt: slice.primary.image.alt || ''126 }, slice.primary.image.dimensions)127 return html`128 <figure class="Text Text--large ${slice.primary.smaller ? '' : 'u-sizeFull'} u-spaceV6">129 <img ${attrs}>130 ${slice.primary.image.copyright ? html`131 <figcaption>132 <small class="Text-muted">${slice.primary.image.copyright}</small>133 </figcaption>134 ` : null}135 </figure>136 `137 }138 case 'video': {139 const items = slice.items.filter((item) => item.video.embed_url)140 return html`141 <div class="u-spaceT7">142 ${slice.primary.video.embed_url ? video(slice.primary.video, {143 large: true144 }) : null}145 ${items.length ? html`146 <div class="u-md-uncontain u-spaceT6">147 ${grid({148 carousel: true,149 size: {150 md: `1of${items.length % 3 ? 2 : 3}`151 }152 }, items.map((item) => video(item.video)))}153 </div>154 ` : null}155 </div>156 `157 }158 case 'author': {159 return html`160 <div class="u-spaceV6">161 ${byline({162 heading: asText(slice.primary.heading),163 body: asElement(slice.primary.text, resolve, reset),164 image: slice.primary.image.url ? Object.assign({165 src: srcset(166 slice.primary.image.url,167 [200, 'c_thumb'],168 { aspect: 278 / 195 }169 ).split(' ')[0],170 sizes: '15rem',171 srcset: srcset(172 slice.primary.image.url,173 [200, 400, [800, 'q_50,c_thumb']],174 { transforms: 'c_thumb', aspect: 278 / 195 }175 ),176 alt: slice.primary.image.alt || ''177 }, slice.primary.image.dimensions) : null178 })}179 </div>180 `181 }182 case 'accordion': {183 return html`184 <section class="u-spaceV6">185 <div class="Text u-sizeFull">186 ${slice.items.map(function (item) {187 if (!item.heading.length) return null188 return html`189 <details>190 <summary><h3>${asText(item.heading)}</h3></summary>191 <div class="Text Text--large">192 ${asElement(item.text)}193 </div>194 </details>195 `196 }).filter(Boolean)}197 </div>198 </section>199 `200 }201 case 'team': {202 if (!slice.items.length) return203 const opts = { size: { lg: '1of4' } }204 const hasImage = slice.items.find((item) => item.image.url)205 if (hasImage) opts.size.xs = '1of2'206 else opts.size.md = '1of2'207 return grid(opts, slice.items.map(teamMember))208 }209 case 'newsletter': {210 return html`211 <div>212 ${index !== 0 ? html`<hr class="u-invisible">` : null}213 ${state.cache(Subscribe, `${state.params.slug}-${index}`).render({214 action: state.newsletter,215 title: asText(slice.primary.heading),216 body: slice.primary.text && slice.primary.text.length ? asElement(slice.primary.text, resolve, serialize) : null,217 success: slice.primary.success_message && slice.primary.success_message.length ? asElement(slice.primary.success_message, resolve, serialize) : null218 })}219 ${index < list.length - 1 ? html`<hr />` : null}220 </div>221 `222 }223 case 'link_blurb': {224 let link = slice.primary.link225 if (!link.id || link.isBroken) return null226 if (link.type === 'page') {227 link = state.prismic.getByUID('page', link.uid, function (err, doc) {228 if (err) return null229 return doc230 })231 }232 if (!link) {233 blurbs.push(card.loading())234 } else {235 blurbs.push(asCard({236 title: link.data.title,237 body: link.data.description,238 image: link.data.featured_image,239 color: slice.primary.color || link.data.theme,240 link: {241 href: resolve(link),242 text: link.data.cta243 }244 }))245 }246 return blurbs247 }248 case 'file_blurb': {249 const { primary } = slice250 if (!primary.file.url || primary.file.isBroken) return null251 blurbs.push(asCard({252 file: true,253 image: primary.image,254 title: primary.title,255 body: primary.text,256 color: primary.color,257 link: {258 href: primary.file.url,259 onclick: () => emit('track:view_item', asText(primary.title), 'Media', 'Download media')260 }261 }))262 return blurbs263 }264 case 'any_blurb': {265 const { primary } = slice266 const { link } = primary267 if ((!link.url && !link.id) || link.isBroken) return null268 blurbs.push(asCard({269 image: primary.image,270 title: primary.title,271 body: primary.text,272 color: primary.color,273 link: {274 href: resolve(link),275 external: link.target === '_blank'276 }277 }))278 return blurbs279 }280 case 'button': {281 if (!slice.primary.text && !slice.primary.link) return282 return html`283 <div class="u-spaceV5">284 ${button({285 primary: true,286 external: slice.primary.link.link_type === 'Web',287 href: resolve(slice.primary.link),288 text: slice.primary.text289 })}290 </div>291 `292 }293 default: return null294 }295 }296 // render oembed object as embeded video297 // obj -> Element298 function video (props, opts = {}) {299 var provider = props.provider_name.toLowerCase()300 var id = embed.id(props)301 if (!id) return null302 return embed(Object.assign({303 url: props.embed_url,304 title: props.title,305 onplay: () => emit('track:view_item', props.embed_url, 'Media', 'Play video'),306 src: `/media/${provider}/w_${opts.large ? 900 : 400}/${id}`,307 width: props.thumbnail_width,308 height: props.thumbnail_height,309 sizes: opts.large ? '100vw' : '(min-width: 600px) 50vw, 100vw',310 srcset: srcset(id, [400, 900, 1800, [2600, 'q_50']], { type: provider })311 }, opts))312 }313}314// render team member315// obj -> Element316function teamMember (props) {317 var image318 if (props.image.url) {319 const sources = srcset(props.image.url, [200, 400, [800, 'q_50']])320 image = Object.assign({321 class: 'u-spaceB2',322 sizes: '13em',323 srcset: sources,324 style: 'max-width: 13em;',325 alt: props.image.alt || '',326 src: sources.split(' ')[0]327 }, props.image.dimensions)328 }329 return html`330 <article class="Text Text--fat">331 ${image ? html`<img ${image} />` : null}332 ${props.label ? html`333 <strong class="Text-label">334 ${props.label}335 </strong>336 ` : null}337 ${props.text.length ? html`338 <div>339 ${asElement(props.text, resolve, serialize)}340 </div>341 ` : null}342 </article>343 `344}345// render linked document as card346// obj -> Element347function asCard (props) {348 props = Object.assign({}, props, {349 title: asText(props.title),350 body: asText(props.body)351 })352 if (props.image && props.image.url) {353 const sources = srcset(...

Full Screen

Full Screen

thread.js

Source:thread.js Github

copy

Full Screen

...94 ${grid([95 grid.cell({ size: { lg: '2of3' } }, html`96 <div class="Text">97 <h2>${text`Inledning`}</h2>98 ${asElement(doc.data.body, resolve, serialize)}99 </div>100 `),101 grid.cell({ size: { lg: '1of3' } }, html`102 <div>103 <div style="margin-bottom: 1.5rem">104 ${doc.data.goal.id && !doc.data.goal.isBroken ? card({105 panel: goal.heading({106 title: asText(doc.data.goal.data.title),107 number: doc.data.goal.data.number108 }),109 title: text`${asText(doc.data.title)} och mål ${doc.data.goal.data.number}`,110 body: more(html`111 <div class="Text Text--static">112 ${asElement(doc.data.goal_text.slice(0, 1), resolve, serialize)}113 </div>114 `, html`115 <div class="Text Text--static">116 ${asElement(doc.data.goal_text, resolve, serialize)}117 </div>118 `)119 }) : null}120 </div>121 <div style="margin-bottom: 1.5rem">122 ${doc.data.goal_secound.id && !doc.data.goal_secound.isBroken ? card({123 panel: goal.heading({124 title: asText(doc.data.goal_secound.data.title),125 number: doc.data.goal_secound.data.number126 }),127 title: text`${asText(doc.data.title)} och mål ${doc.data.goal_secound.data.number}`,128 body: more(html`129 <div class="Text Text--static">130 ${asElement(doc.data.goal_secound_text.slice(0, 1), resolve, serialize)}131 </div>132 `, html`133 <div class="Text Text--static">134 ${asElement(doc.data.goal_secound_text, resolve, serialize)}135 </div>136 `)137 }) : null}138 </div>139 <div style="margin-bottom: 1.5rem">140 ${doc.data.goal_third.id && !doc.data.goal_third.isBroken ? card({141 panel: goal.heading({142 title: asText(doc.data.goal_third.data.title),143 number: doc.data.goal_third.data.number144 }),145 title: text`${asText(doc.data.title)} och mål ${doc.data.goal_third.data.number}`,146 body: more(html`147 <div class="Text Text--static">148 ${asElement(doc.data.goal_third_text.slice(0, 1), resolve, serialize)}149 </div>150 `, html`151 <div class="Text Text--static">152 ${asElement(doc.data.goal_third_text, resolve, serialize)}153 </div>154 `)155 }) : null}156 </div>157 </div>158 `)159 ])}160 </div>161 </div>162 ${doc.data.facts.length ? html`163 <div class="u-container View-panel" id="facts">164 <div class="Text" >165 <h2>${text`Fakta`}</h2>166 </div>167 ${lesson({168 title: asText(doc.data.facts_title) || text`Fakta`,169 subtitle: text`Inför arbetspassen`,170 main: asElement(doc.data.facts, resolve, serialize),171 id: 'facts-box'172 })}173 </div>174 ` : null}175 ${doc.data.lessons.length ? html`176 <div class="u-container View-panel" id="lessons">177 <div class="Text">178 <h2>${special ? text`Moment` : text`Arbetspass`}</h2>179 </div>180 ${doc.data.lessons.map(function (slice, index) {181 if (slice.slice_type !== 'lesson') return null182 return lesson({183 title: asText(slice.primary.name) || (special ? text`Moment` : text`Arbetspass`),184 extra: slice.primary.extra,185 subtitle: slice.primary.label,186 time: slice.primary.duration,187 main: slice.primary.description && asText(slice.primary.description) && asText(slice.primary.description).length > 8 ? asElement(slice.primary.description, resolve, serialize) : null,188 preparation: slice.primary.preparation.length ? asElement(slice.primary.preparation, resolve, serialize) : null,189 file: slice.primary.resource && slice.primary.resource.url ? slice.primary.resource : false,190 id: 'lesson-' + index,191 steps: slice.items.map(function (step) {192 return {193 body: asElement(step.text, resolve, serialize),194 note: asText(step.note) ? asElement(step.note, resolve, serialize) : null195 }196 })197 })198 }).filter(Boolean)}199 </div>200 ` : null}201 ${hasResources ? html`202 <div class="View-panel View-panel--white" id="material">203 <div class="u-container u-nbfc">204 <div class="Text Text--small Text--wide">205 <h2>${text`Material & media`}</h2>206 </div>207 <div class="View-threads View-threads--wide">208 ${doc.data.resources.map(function (download) {209 var hasImage = (download.file_image && download.file_image.url)210 return html`211 <div class="View-thread">212 ${card({213 image: hasImage ? img(download.file_image, { sizes: '35rem' }, {214 sizes: [400, 800, 1000, 1200]215 }) : img(doc.data.image, { sizes: '35rem' }, {216 sizes: [400, 800, 1000, 1200]217 }),218 file: true,219 title: download.file_tile ? asText(download.file_tile) : download.file.name,220 link: download.file.url,221 body: html`222 <div>${download.file_desc ? asText(download.file_desc) : ''}</div>223 <div><strong>Ladda ner</strong> (${bytesToSize(download.file.size)})</div>224 `225 })}226 </div>227 `228 })}229 ${doc.data.external_resources ? html`230 <div class="View-thread">231 ${card({232 plain: true,233 body: html`<div class="Text">${asElement(doc.data.external_resources, resolve, serialize)}</div>`234 })}235 </div>236 ` : null}237 </div>238 </div>239 </div>240 ` : null}241 ${hasGallery ? html`242 <div class="View-panel View-panel--white" id="gallery">243 <div class="u-container u-nbfc" id="thread-gallery">244 ${gallery({ title: text`Inspiration`, items: doc.data.inspo })}245 </div>246 </div>247 ` : null}248 ${hasPlan ? html`249 <div class="View-panel View-panel--white" id="rules">250 <div class="u-container u-nbfc">251 <div class="Text Text--small Text--wide">252 <h2>${text`Koppling till läroplanen`}</h2>253 <div class="Text-columns">254 ${doc.data.rules_1 && doc.data.rules_1.length ? html`255 <div class="Text-column">256 ${asElement(doc.data.rules_1, resolve, serialize)}257 </div>258 ` : null}259 ${doc.data.rules_2 && doc.data.rules_2.length ? html`260 <div class="Text-column">261 ${asElement(doc.data.rules_2, resolve, serialize)}262 </div>263 ` : null}264 </div>265 </div>266 </div>267 </div>268 ` : null}269 ${hasFAQ ? html`270 <div class="View-panel View-panel--white" id="faq">271 <div class="u-container u-nbfc">272 ${state.cache(Accordion, 'thread-faq').render({273 title: text`Vanliga frågor`,274 items: doc.data.faq.map(function (item) {275 return {276 title: asText(item.faq_title),277 body: asElement(item.faq_body, resolve, serialize)278 }279 })280 })}281 </div>282 </div>283 ` : null}284 ${state.prismic.getSingle('website', function (err, website) {285 if (err) throw HTTPError(404, err)286 if (!website) return null287 return html`288 <div id="feedback">289 ${callout({290 title: asText(website.data.outro_heading),291 body: asElement(website.data.outro_body, resolve, serialize),292 link: website.data.outro_link.url,293 linkText: website.data.outro_link_text294 })}295 </div>296 `297 })}298 </main>299 `300 })301}302function meta (state) {303 return state.prismic.getByUID('thread', state.params.uid, function (err, doc) {304 if (err) throw HTTPError(404, err)305 if (!doc) return null...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...67 const elTitle = await page.$('.s-access-title');68 if (!elTitle) {69 throw new Error('Product not found.');70 }71 const title = await page.evaluate(el => el.innerHTML, await elTitle.asElement());72 res.title = title.trim();73 await Promise.all([74 page.click('#atfResults .s-access-image'),75 page.waitForNavigation(),76 ]);77 // product page78 res.link = page.url();79 // asin80 const matchAsin = res.link.match(/\/dp\/([a-zA-Z0-9]*)\/?/);81 res.asin = matchAsin[1];82 const elPrice = await page.$('#priceblock_ourprice');83 const elDealPrice = await page.$('#priceblock_dealprice');84 const elSalePrice = await page.$('#priceblock_saleprice');85 const elOlpNewPrice = await page.$('#olp_feature_div .olp-padding-right .a-color-price');86 const elRatingTrigger = await page.$('#acrPopover');87 const elRankings = await page.$$('.zg_hrsr .zg_hrsr_item');88 const elBestSeller = await page.$('.badge-wrapper');89 const elBestSellerAmazon = await page.$('.ac-badge-wrapper');90 const elReviews = await page.$('#acrCustomerReviewText');91 const elReviewReplies = await page.$('#askATFLink span');92 const elBulletPoints = await page.$$('#feature-bullets li:not(.aok-hidden) .a-list-item');93 const elAplusPage = await page.$('#aplus');94 const elDateFirstAvailable = await page.$('tr.date-first-available .value');95 let price = null;96 if (elPrice) {97 price = await page.evaluate(el => el.innerHTML, await elPrice.asElement());98 }99 if (!price && elDealPrice) {100 price = await page.evaluate(el => el.innerHTML, await elDealPrice.asElement());101 }102 if (!price && elSalePrice) {103 price = await page.evaluate(el => el.innerHTML, await elSalePrice.asElement());104 }105 if (!price && elOlpNewPrice) {106 price = await page.evaluate(el => el.innerHTML, await elOlpNewPrice.asElement());107 }108 res.price = parsePrice(price);109 res.currency = getCurrency(price);110 // rating111 let rating = -1;112 if (elRatingTrigger) {113 await page.click('#acrPopover');114 // rating is now computed115 const elRating = await page.$('#acrPopover .a-icon-alt');116 rating = await page.evaluate(el => el.innerHTML, await elRating.asElement());117 if (rating) {118 const matchStars = rating.match(/^([0-9.,]{1,3})/);119 if (matchStars && matchStars[1]) {120 rating = parseFloat(matchStars[1]);121 }122 }123 }124 let bestSeller = false;125 if (elBestSeller || elBestSellerAmazon) {126 bestSeller = true;127 }128 if (elDateFirstAvailable) {129 res.dateFirstAvailable = await page130 .evaluate(el => el.innerHTML, await elDateFirstAvailable.asElement());131 }132 const rankings = [];133 for (const ranking of elRankings) {134 const elScore = await ranking.$('.zg_hrsr_rank');135 const elCategory = await ranking.$('.zg_hrsr_ladder a:last-child');136 const score = await page.evaluate(el => el.innerHTML, await elScore.asElement());137 const category = await page.evaluate(el => el.innerHTML, await elCategory.asElement());138 const scoreInfo = `${score.trim()} in ${category.trim()}`139 .replace('Nr. ', '#') // DE140 .replace('n°', '#') // FR141 .replace('n.° ', '#') // ES142 .replace('n.', '#'); // IT143 rankings.push(scoreInfo);144 }145 // number of reviews146 let reviews = 0;147 if (elReviews) {148 const reviewsText = await page.evaluate(el => el.innerHTML, await elReviews.asElement());149 const matchReviews = reviewsText.trim().match(/^([0-9.,]{1,6})/);150 if (matchReviews && matchReviews[1]) {151 reviews = parseFloat(matchReviews[1].replace(',', '').replace('\'', '').replace('.', '')) || 0;152 }153 }154 let replies = 0;155 if (elReviewReplies) {156 const repliesText = await page157 .evaluate(el => el.innerHTML, await elReviewReplies.asElement());158 const matchReplies = repliesText.trim().match(/^([0-9.,]{1,6})/);159 if (matchReplies && matchReplies[1]) {160 replies = parseFloat(matchReplies[1]) || 0;161 }162 }163 // bullet points164 const bulletPoints = [];165 for (const elBulletPoint of elBulletPoints) {166 const text = await page.evaluate(el => el.innerHTML, await elBulletPoint.asElement());167 bulletPoints.push(text.trim().replace(/&nbsp;/g, ' '));168 }169 // images and videos are in a modal170 await Promise.all([171 page.click('#imgTagWrapperId img'),172 ]);173 // wait on modal174 await page.waitForSelector('.a-modal-scroller');175 // force click on the Images tab176 // warning it does not exist if there is no video!177 await page.waitForSelector('#ivImagesTabHeading a', {178 timeout: 1500,179 visible: true,180 }).then(async () => {181 await Promise.all([182 page.click('#ivImagesTabHeading a'),183 page.waitForSelector('#ivImagesTab'),184 ]);185 }).catch(() => {186 console.log('No image tab');187 });188 const totalImages = await page.$$eval('#ivThumbs .ivRow .ivThumb', imgs => imgs.length);189 // videos190 await page.waitForSelector('#ivVideosTabHeading a', {191 timeout: 500,192 visible: true,193 }).then(async () => {194 await Promise.all([195 page.click('#ivVideosTabHeading a'),196 page.waitForSelector('#ivVideosTab'),197 ]);198 }).catch(() => {199 console.log('No video tab');200 });201 let totalVideos = 0;202 const elVideos = await page.$$('#vse-ib-rv ol li.a-carousel-card');203 if (elVideos) {204 totalVideos = await page.$$eval('#vse-ib-rv ol li.a-carousel-card', videos => videos.length);205 }206 res.rating = rating;207 res.rankings = rankings;208 res.bestSeller = bestSeller;209 res.reviews = reviews;210 res.replies = replies;211 res.bulletPoints = bulletPoints;212 res.images = totalImages;213 res.videos = totalVideos;214 res.detailPage = elAplusPage !== null;215 const elSoldByInfo = await page.$('#merchant-info');216 const elSoldBySeller = await page.$('#merchant-info a');217 await page.reload({ waitUntil: ['networkidle2'] });218 /*219 * seller info: the link (#olp_feature_div a) is not always available220 */221 await page.goto(`${url}/gp/offer-listing/${res.asin}/ref=olp_f_new?ie=UTF8&f_new=true`, {222 waitUntil: ['networkidle2'],223 });224 res.lostBuyBox = false;225 let sellerName = '';226 let sellerLink = '';227 let sellerPrice = '';228 const details = [];229 // get first seller (owner of the buy box)230 // the product can be unavailable231 const elBuyBoxSeller = await page.$('#olpOfferList .olpPriceColumn span');232 if (elBuyBoxSeller) {233 const elSeller = await page.$('#olpOfferList .olpSellerColumn');234 const elAmazonAsSeller = await elSeller.$('img');235 const elSellerLink = await elSeller.$('.olpSellerName a');236 if (elSellerLink) {237 sellerName = await page.evaluate(el => el.innerHTML, await elSellerLink.asElement());238 sellerLink = url + await page.evaluate(el => el.getAttribute('href'), await elSellerLink.asElement());239 }240 sellerPrice = await page.evaluate(el => el.innerHTML, await elBuyBoxSeller.asElement());241 // if there is an image, it is Amazon242 // no details link243 if (elAmazonAsSeller) {244 sellerName = 'Amazon';245 sellerLink = url;246 details.push(url);247 }248 /*249 * when Amazon should be the top seller, there is a lost buy box if:250 * [1] Amazon is not the provider (typical message is "Sold by Amazon" on the product page)251 * [2] Amazon doesn't sell the product252 */253 if (getPreference('reseller').toLowerCase().indexOf('amazon') > -1) {254 // [1] and [2]255 if ((elSoldByInfo && elSoldBySeller) && sellerName !== getPreference('reseller')) {256 res.lostBuyBox = true;257 }258 } else {259 res.lostBuyBox = sellerName !== getPreference('reseller');260 }261 // get detailed seller information (only if the best reseller is not Amazon)262 if (!elAmazonAsSeller) {263 await Promise.all([264 page.click('#olpOfferList .olpSellerColumn .olpSellerName a'),265 page.waitForNavigation(),266 ]);267 // address268 const elSellerFullAddress = await page.$$('#seller-profile-container ul.a-unordered-list ul .a-list-item');269 for (const elInfo of elSellerFullAddress) {270 const info = await page.evaluate(el => el.innerHTML, await elInfo.asElement());271 details.push(info);272 }273 await page.goBack({ waitUntil: ['networkidle2'] });274 }275 }276 // find the product price from the owner277 const elSellerRows = await page.$$('#olpOfferList .olpOffer');278 if (elSellerRows) {279 for (const sellerRow of elSellerRows) {280 const elSeller = await sellerRow.$('.olpSellerColumn');281 const elAmazonAsSeller = await elSeller.$('img');282 const elSellerPrice = await sellerRow.$('.olpPriceColumn span');283 const elSellerLink = await sellerRow.$('.olpSellerName a');284 let sellerName = '';285 if (elSellerLink) {286 sellerName = await page.evaluate(el => el.innerHTML, await elSellerLink.asElement());287 }288 const sellerPrice = await page289 .evaluate(el => el.innerHTML, await elSellerPrice.asElement());290 if ((getPreference('reseller').toLowerCase().indexOf('amazon') > -1 && elAmazonAsSeller)291 || getPreference('reseller').toLowerCase() === sellerName.toLowerCase().trim()) {292 res.ownerPrice = parsePrice(sellerPrice);293 break;294 }295 }296 }297 // add lost buy box data298 res.buyBoxSeller = {299 name: sellerName.trim(),300 link: sellerLink,301 price: parsePrice(sellerPrice),302 details: details.toString(),303 };...

Full Screen

Full Screen

vacuna.js

Source:vacuna.js Github

copy

Full Screen

...17async function startFill() {18 const page = await configureBrowser();19 await delay(1000);20 21 var enllac = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-error").shadowRoot.querySelector("div > div.subtitle > a")`)).asElement();22 while(enllac == null){23 enllac = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-error").shadowRoot.querySelector("div > div.subtitle > a")`)).asElement();24 }25 enllac.click();26 console.log("Click Enllaç");27 await delay(1000);28 var demanar = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-onboarding").shadowRoot.querySelector("#dismiss-btn").shadowRoot.querySelector("#button")`)).asElement();29 while(demanar == null){30 demanar = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-onboarding").shadowRoot.querySelector("#dismiss-btn").shadowRoot.querySelector("#button")`)).asElement();31 }32 demanar.click();33 console.log("Click Demanar");34 await delay(1000);35 var dniSelect = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#mdc-tab-2").shadowRoot.querySelector("button")`)).asElement();36 while(dniSelect == null){37 dniSelect = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#mdc-tab-2").shadowRoot.querySelector("button")`)).asElement();38 }39 dniSelect.click();40 console.log("Click DNI Select");41 await delay(1000);42 //DNI43 var dniButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#documentID").shadowRoot.querySelector("label > input")`)).asElement();44 while(dniButton == null){45 dniButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#documentID").shadowRoot.querySelector("label > input")`)).asElement();46 }47 dniButton.click();48 await delay(100);49 await page.keyboard.type(dni);50 51 //Mobil52 const mobilButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#phone").shadowRoot.querySelector("label > input")`)).asElement();53 mobilButton.click();54 await delay(100);55 await page.keyboard.type(mobil);56 //Nom57 const nomButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#name").shadowRoot.querySelector("label > input")`)).asElement();58 nomButton.click();59 await delay(100);60 await page.keyboard.type(nom);61 //Cognom62 const cognomButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#surname").shadowRoot.querySelector("label > input")`)).asElement();63 cognomButton.click();64 await delay(100);65 await page.keyboard.type(cognom1);66 //Cognom267 const cognom2Button = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#surname2").shadowRoot.querySelector("label > input")`)).asElement();68 cognom2Button.click();69 await delay(100);70 await page.keyboard.type(cognom2);71 //Email72 const emailButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#mail").shadowRoot.querySelector("label > input")`)).asElement();73 emailButton.click();74 await delay(100);75 await page.keyboard.type(email);76 await delay(500);77 //Acceptar78 const acceptaButton = await (await page.evaluateHandle(`document.querySelector("body > vaccinapp-app").shadowRoot.querySelector("#pages > vaccinapp-shell").shadowRoot.querySelector("#main-shell-content > appointment-shell").shadowRoot.querySelector("#appointment-shell-content > appointment-user-registration").shadowRoot.querySelector("#accept-btn").shadowRoot.querySelector("#button")`)).asElement();79 acceptaButton.click();80 81 await delay(1000000)82}83function delay(time) {84 return new Promise(function(resolve) { 85 setTimeout(resolve, time)86 });87 }...

Full Screen

Full Screen

base.js

Source:base.js Github

copy

Full Screen

1import { event, select, selectAll } from "d3-selection";2import "d3-transition";3import { viewRequireFrom, viewResolve } from "../require";4import { jsonResponse, textResponse } from "../utils/http";5import providers from "../utils/providers";6import asSelect from "../utils/select";7import { htmlElement, template } from "../utils/template";8//9// Base d3-view Object10// =====================11//12export default {13 // available once mounted14 // this is the browser window.document unless we are mounting on jsdom15 ownerDocument: null,16 //17 // d3-view object18 isd3: true,19 //20 providers: providers,21 //22 // Create a view element from a template and optional context23 viewElement(source, context, ownerDocument) {24 return htmlElement(source, context, ownerDocument || this.ownerDocument);25 },26 //27 select(selector) {28 if (typeof selector === "string")29 return select(this.ownerDocument || document).select(selector);30 return select(selector);31 },32 //33 selectAll(selector) {34 if (typeof selector === "string")35 return select(this.ownerDocument || document).selectAll(selector);36 return selectAll(selector);37 },38 //39 // Shortcut for fetch function in providers40 fetch(url, options) {41 var fetch = providers.fetch;42 return arguments.length == 1 ? fetch(url) : fetch(url, options);43 },44 //45 fetchText(url, ...x) {46 return this.fetch(url, ...x).then(textResponse);47 },48 //49 json(url, ...x) {50 return this.fetch(url, ...x).then(jsonResponse);51 },52 //53 // render a template from a url54 renderFromUrl(url, context, asElement = true) {55 var cache = this.cache;56 if (cache.has(url))57 return Promise.resolve(render(cache.get(url), context, asElement));58 return this.fetchText(url).then(response => {59 cache.set(url, response.data);60 return render(response.data, context, asElement);61 });62 },63 //64 // render from a distribution name. Use d3-require resolve method to find the url65 renderFromDist(dist, path, context, asElement = true) {66 var resolve = providers.resolve;67 return this.renderFromUrl(68 resolve(dist, { path: path }),69 context,70 asElement71 );72 },73 //74 on(el, name, callback) {75 el = asSelect(el);76 if (callback === null) return el.on(name, null);77 else el.on(name, () => callback(event));78 },79 //80 selectChildren(el) {81 if (!arguments.length) el = this.el;82 return this.selectAll(Array.prototype.slice.call(el.children));83 },84 //85 domEvent() {86 return event;87 },88 //89 logError(err) {90 if (err.stack) providers.logger.error(err);91 else providers.logger.error(`[${this.name}] ${err}`);92 return this;93 },94 //95 logWarn(msg) {96 providers.logger.warn(`[${this.name}] ${msg}`);97 return this;98 },99 //100 logInfo(msg) {101 providers.logger.info(`[${this.name}] ${msg}`);102 return this;103 },104 //105 logDebug(msg) {106 if (providers.logger.debug) providers.logger.debug(`[${this.name}] ${msg}`);107 return this;108 },109 require() {110 const root = this.ownerDocument.defaultView;111 if (!root.d3) root.d3 = {};112 let require = root.d3.require;113 if (!require) {114 if (this.providers.require.root() === root)115 require = this.providers.require;116 else require = viewRequireFrom(viewResolve, root);117 root.d3.require = require;118 }119 return require.apply(undefined, arguments);120 }121};122const render = (text, context, asElement) =>...

Full Screen

Full Screen

pdfjs-dom.js

Source:pdfjs-dom.js Github

copy

Full Screen

...9 elm instanceof HTMLCanvasElement ||10 elm instanceof getWindow(elm).HTMLCanvasElement;11export const asElement = (x: any): HTMLElement => (x: HTMLElement);12export const getPageFromElement = (target: HTMLElement) => {13 const node = asElement(target.closest(".page"));14 if (!node || !isHTMLElement(node)) {15 return null;16 }17 const number = Number(asElement(node).dataset.pageNumber);18 return { node, number };19};20export const getPageFromRange = (range: Range) => {21 const parentElement = range.startContainer.parentElement;22 if (!isHTMLElement(parentElement)) {23 return;24 }25 return getPageFromElement(asElement(parentElement));26};27export const findOrCreateContainerLayer = (28 container: HTMLElement,29 className: string30) => {31 const doc = getDocument(container);32 let layer = container.querySelector(`.${className}`);33 if (!layer) {34 layer = doc.createElement("div");35 layer.className = className;36 container.appendChild(layer);37 }38 return layer;39};

Full Screen

Full Screen

asElement.test.js

Source:asElement.test.js Github

copy

Full Screen

1import React from "react";2import { render } from "@testing-library/react";3import AsElement from "./AsElement";4describe("AsElement", () => {5 it("renders the given element", () => {6 const elementType = "p";7 render(<AsElement elementType={elementType} />);8 expect(document.querySelector(elementType)).toBeInTheDocument();9 });10 it("passes through any additional props", () => {11 const elementType = "p";12 const testClass = "color--azul";13 render(<AsElement elementType={elementType} className={testClass} />);14 expect(document.querySelector(elementType)).toHaveClass(testClass);15 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const element = await page.$('#id');6 const asElement = await element.asElement();7 console.log(asElement);8 await browser.close();9})();10const puppeteer = require('puppeteer');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 const element = await page.$('#id');15 const asElement = await element.asElement();16 console.log(asElement);17 await browser.close();18})();19const puppeteer = require('puppeteer');20(async () => {21 const browser = await puppeteer.launch();22 const page = await browser.newPage();23 const element = await page.$('#id');24 const asElement = await element.asElement();25 console.log(asElement);26 await browser.close();27})();28const puppeteer = require('puppeteer');29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 const element = await page.$('#id');33 const asElement = await element.asElement();34 console.log(asElement);35 await browser.close();36})();37const puppeteer = require('puppeteer');38(async () => {39 const browser = await puppeteer.launch();40 const page = await browser.newPage();41 const element = await page.$('#id');42 const asElement = await element.asElement();43 console.log(asElement);44 await browser.close();45})();46const puppeteer = require('puppeteer');47(async () => {48 const browser = await puppeteer.launch();49 const page = await browser.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 const screenshot = await page.screenshot();6 await browser.close();7})();8const puppeteer = require('puppeteer');9(async () => {10 const browser = await puppeteer.launch({headless: false});11 const page = await browser.newPage();12 const screenshot = await page.screenshot();13 await browser.close();14})();15const puppeteer = require('puppeteer');16(async () => {17 const browser = await puppeteer.launch({headless: false});18 const page = await browser.newPage();19 const screenshot = await page.screenshot();20 await browser.close();21})();22const puppeteer = require('puppeteer');23(async () => {24 const browser = await puppeteer.launch({headless: false});25 const page = await browser.newPage();26 const screenshot = await page.screenshot();27 await browser.close();28})();29const puppeteer = require('puppeteer');30(async () => {31 const browser = await puppeteer.launch({headless: false});32 const page = await browser.newPage();33 const screenshot = await page.screenshot();34 await browser.close();35})();36const puppeteer = require('puppeteer');37(async () => {38 const browser = await puppeteer.launch({headless: false});39 const page = await browser.newPage();40 const screenshot = await page.screenshot();41 await browser.close();42})();43const puppeteer = require('puppeteer');44(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 const element = await page.$('h1');7 const screenshot = await element.screenshot();8 fs.writeFileSync('example.png', screenshot);9 await browser.close();10})();11const playwright = require('playwright');12const fs = require('fs');13(async () => {14 const browser = await playwright.chromium.launch();15 const context = await browser.newContext();16 const page = await context.newPage();17 const element = await page.$('h1');18 const screenshot = await element.screenshot();19 fs.writeFileSync('example.png', screenshot);20 await browser.close();21})();22const puppeteer = require('puppeteer');23const fs = require('fs');24(async () => {25 const browser = await puppeteer.launch();26 const page = await browser.newPage();27 const element = await page.$('h1');28 const screenshot = await element.screenshot();29 fs.writeFileSync('example.png', screenshot);30 await browser.close();31})();32const playwright = require('playwright');33const fs = require('fs');34(async () => {35 const browser = await playwright.chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 const element = await page.$('h1');39 const screenshot = await element.screenshot();40 fs.writeFileSync('example.png', screenshot);41 await browser.close();42})();43const puppeteer = require('puppeteer');44const fs = require('fs');45(async () => {46 const browser = await puppeteer.launch();47 const page = await browser.newPage();48 const element = await page.$('h1');49 const screenshot = await element.screenshot();50 fs.writeFileSync('example.png', screenshot);

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const element = await page.$('h1');6 const asElement = await element.asElement();7 console.log(asElement);8 await browser.close();9})();10const puppeteer = require('puppeteer');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 const element = await page.$('h1');15 const asElement = await element.asElement();16 console.log(asElement);17 await browser.close();18})();19const puppeteer = require('puppeteer');20(async () => {21 const browser = await puppeteer.launch();22 const page = await browser.newPage();23 const element = await page.$('h1');24 const asElement = await element.asElement();25 console.log(asElement);26 await browser.close();27})();28const puppeteer = require('puppeteer');29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 const element = await page.$('h1');33 const asElement = await element.asElement();34 console.log(asElement);35 await browser.close();36})();37const puppeteer = require('puppeteer');38(async () => {39 const browser = await puppeteer.launch();40 const page = await browser.newPage();41 const element = await page.$('h1');

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({4 });5 const page = await browser.newPage();6 await page.screenshot({ path: 'google.png' });7 const html = await page.content();8 const element = await page.$('a');9 const elementHandle = await element.asElement();10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const element = await page.$('input[name="q"]');6 await element.asElement().focus();7 await page.keyboard.type('Hello World!');8 await browser.close();9})();10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const page = await browser.newPage();14 const element = await page.$('input[name="q"]');15 await element.asElement().focus();16 await page.keyboard.type('Hello World!');17 await browser.close();18})();19const { Builder, By, Key, until } = require('selenium-webdriver');20const chrome = require('selenium-webdriver/chrome');21const path = require('chromedriver').path;22const service = new chrome.ServiceBuilder(path).build();23chrome.setDefaultService(service);24(async function example() {25 let driver = await new Builder().forBrowser('chrome').build();26 try {27 await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);28 await driver.wait(until.titleIs('webdriver - Google Search'), 1000);29 } finally {30 await driver.quit();31 }32})();33import { Selector } from 'testcafe';34test('My first test', async t => {35 .typeText('#developer-name', 'John Smith')36 .click('#submit-button');37 const articleHeader = await Selector('.result-content').find('h1');38 let headerText = await articleHeader.innerText;39});

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require("puppeteer");2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const element = await page.$("body");6 const asElement = await element.asElement();7 console.log(asElement);8 await browser.close();9})();10const puppeteer = require("puppeteer");11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 const element = await page.$("body");15 const asElement = await element.asElement();16 console.log(asElement);17 await browser.close();18})();19const puppeteer = require("puppeteer");20(async () => {21 const browser = await puppeteer.launch();22 const page = await browser.newPage();23 const element = await page.$("body");24 const asElement = await element.asElement();25 console.log(asElement);26 await browser.close();27})();28const puppeteer = require("puppeteer");29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 const element = await page.$("body");33 const asElement = await element.asElement();34 console.log(asElement);35 await browser.close();36})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({ headless: false });4 const page = await browser.newPage();5 await page.goto(url, { waitUntil: 'networkidle2' });6 const html = await page.content();7 console.log(html);8 await browser.close();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const fs = require('fs');3const path = require('path');4const { PNG } = require('pngjs');5const pixelmatch = require('pixelmatch');6const { promisify } = require('util');7const writeFile = promisify(fs.writeFile);8const mkdir = promisify(fs.mkdir);9const access = promisify(fs.access);10const unlink = promisify(fs.unlink);11const readdir = promisify(fs.readdir);12const rimraf = promisify(require('rimraf'));13const test = async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 const element = await page.$('img');17 const elementPng = await element.screenshot();18 await writeFile(path.join(__dirname, 'image.png'), elementPng);19 await browser.close();20};21test();22const puppeteer = require('puppeteer');23const fs = require('fs');24const path = require('path');25const { PNG } = require('pngjs');26const pixelmatch = require('pixelmatch');27const { promisify } = require('util');28const writeFile = promisify(fs.writeFile);29const mkdir = promisify(fs.mkdir);30const access = promisify(fs.access);31const unlink = promisify(fs.unlink);32const readdir = promisify(fs.readdir);33const rimraf = promisify(require('rimraf'));34const test = async () => {35 const browser = await puppeteer.launch();36 const page = await browser.newPage();37 const element = await page.$('img');38 const elementPng = await element.screenshot();39 await writeFile(path.join(__dirname, 'image.png'), elementPng);40 await browser.close();41};42test();43const puppeteer = require('puppeteer');44const fs = require('fs');45const path = require('path');46const { PNG } = require('pngjs');47const pixelmatch = require('pixelmatch');48const { promisify } = require('util');49const writeFile = promisify(fs.writeFile);50const mkdir = promisify(fs.mkdir);51const access = promisify(fs.access);52const unlink = promisify(fs.unlink);53const readdir = promisify(fs.readdir);54const rimraf = promisify(require('rimraf'));55const test = async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const $ = require('cheerio');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.goto(url);7 await browser.close();8})();9const puppeteer = require('puppeteer');10const $ = require('cheerio');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 await page.goto(url);15 await browser.close();16})();17const puppeteer = require('puppeteer');18const $ = require('cheerio');19(async () => {20 const browser = await puppeteer.launch();21 const page = await browser.newPage();22 await page.goto(url);23 await browser.close();24})();25const puppeteer = require('puppeteer');26const $ = require('cheerio');27(async () => {28 const browser = await puppeteer.launch();29 const page = await browser.newPage();30 await page.goto(url);31 await browser.close();32})();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful