1// 1 2 3(function (a) { 4 Amblyopia.fn.apply( 5 Amblyopia.fn, { 6 _isRead: false, 7 _volume: 100, 8 _volume_step: 20, 9 _volume_max: 100, 10 _volume_min: 20, 11 _speed: 0, 12 _speed_step: 2, 13 _speed_max: 2, 14 _speed_min: -2, 15 _dataUrl: "/s/default.aspx", 16 _dataMp3: "/s/mp3/", 17 _breakInterval: 0, 18 _repeatInterval: 0, 19 _breakTimer: 1000, 20 _repeatTimer: 1000, 21 _repeatIndex: 0, 22 _repeatFlag: false, 23 _repeatNodes: [], 24 _repeatNode: "", 25 _repeatNum: 0, 26 _runTwice: true, 27 _req: true, 28 _model: 0, 29 _repeatTagNames: ["A", "IMG", "BUTTON", "INPUT", "LABEL", "AREA", "OBJECT", "EMBED", "SELECT", "TEXTAREA"], 30 _attachEvent: function () { 31 32 var b = this; 33 a(document).bind("mousedown", this._pageClick); 34 // a("#x-toolbar > a").mousedown( 35 a("div#x-toolbar ul.piclist a").mousedown(function (c) { 36 if (!this.id) { // æ·»å é¼ æ éå·¦é®éå¶ 37 return 38 } 39 if (a.inArray(this.id, ["x-sound-more", "x-palette", "x-palette-more"]) == -1) { 40 b._pageClick() 41 } 42 switch (this.id) { 43 case "x-reset": 44 b._reset(); 45 break; 46 case "x-undo": 47 b._undo(); 48 break; 49 case "x-redo": 50 b._redo(); 51 break; 52 case "x-font-max": 53 b._addFont(); 54 break; 55 case "x-font-min": 56 b._removeFont(); 57 break; 58 case "x-refresh": 59 b._refresh(); 60 break; 61 case "x-view": 62 b._view(); 63 break; 64 case "x-tips": 65 b.tips_start(); 66 break; 67 case "x-sound": 68 b._sound(); 69 break; 70 case "x-sound-more": 71 b._close_panel("x-palette-panel"); 72 b._soundMore(); 73 break; 74 case "x-palette": 75 case "x-palette-more": 76 b._close_panel("x-sound-panel"); 77 b._palette(); 78 break; 79 case "x-zoom-in": 80 b._zoomIn(); 81 break; 82 case "x-zoom-out": 83 b._zoomOut(); 84 break; 85 case "x-break": 86 b._break(); 87 break; 88 case "x-repeat": 89 b._repeat(); 90 break; 91 case "x-state": 92 b._state_start(); 93 break; 94 default: 95 } 96 c.preventDefault(); 97 c.stopPropagation() 98 }); 99 a(".panel").mousedown(function (i) { 100 101 var g = b._getDom(i.target); 102 if (!this.id || !g || !g.id) { 103 return 104 } 105 switch (this.id) { 106 case "x-sound-panel": 107 switch (g.id) { 108 case "x-volume-add": 109 b._volume_add(); 110 break; 111 case "x-volume-sub": 112 b._volume_sub(); 113 break; 114 case "x-speed-add": 115 b._speed_add(); 116 break; 117 case "x-speed-sub": 118 b._speed_sub(); 119 break 120 } 121 break; 122 case "x-palette-panel": 123 124 b._selectColor(g); 125 // var c = g.id.split("_"); 126 // b._fontcolor = c[0]; 127 // b._bgcolor = c[1]; 128 // b._linkcolor = c[2]; 129 // var h = b._fontcolor + "_" 130 // + b._bgcolor + "_" 131 // + b._linkcolor; 132 // var f = b._fontcolor 133 // .split("#")[1] 134 // + "_" 135 // + b._bgcolor 136 // .split("#")[1]; 137 // var d = a.cookie("color"); 138 // if (h == d) { 139 // return 140 // } 141 // a.cookie("color", h); 142 // a(g).parent().children() 143 // .removeClass( 144 // "active") 145 // .end().end() 146 // .addClass("active"); 147 // b._read_color(); 148 // if (h == "other_other_other") { 149 // b 150 // ._tool_play( 151 // "color/other_other.mp3", 152 // true, 153 // function() { 154 // a( 155 // document) 156 // .unmask(); 157 // b 158 // ._reload() 159 // }); 160 // b._call(b._reload); 161 // b 162 // ._close_palette_panel(false); 163 // a.cookie("palette", 164 // null); 165 // b._init_color(); 166 // return 167 // } 168 // b._init_color(); 169 // b 170 // ._dom( 171 // document 172 // .getElementById("frame-main"), 173 // b._changeColor, 174 // function(e) { 175 // return Amblyopia.fn 176 // ._leafNode(e) 177 // }, 0); 178 // b._tool_play("color/" + f 179 // + ".mp3"); 180 // b 181 // ._close_palette_panel(false); 182 // a.cookie("palette", null); 183 break 184 } 185 i.preventDefault(); 186 i.stopPropagation() 187 }); 188 var panel = a('#tooltips'); 189 panel.find('.tooltips-close').click(function() { 190 a.cookie('state', null); 191 b._state_close(); 192 b._un_state(); 193 b._tool_play('amblyopia/_state_close.mp3'); 194 }); 195 var triggers = panel.find('.tooltips-row > a'); 196 triggers.click(function() { 197 var el = a(this); 198 var id = el.attr('id'); 199 triggers.removeClass('cur'); 200 201 el.addClass('cur'); 202 203 switch (id) { 204 case 'x-simplified' : 205 a.cookie('lang', 'zh'); 206 b._tooltips('已转为ç®ä½'); 207 b._tool_play('screen/zh.mp3'); 208 break; 209 case 'x-traditional' : 210 a.cookie('lang', 'tw'); 211 b._tool_play('screen/tw.mp3'); 212 break; 213 case 'x-pinyin' : 214 a.cookie('lang', 'py'); 215 b._tool_play('screen/pinyin.mp3'); 216 break; 217 } 218 }); 219 a("#tooltips .tooltips-close").click(function () { 220 a.cookie("state", null); 221 b._state_close(); 222 b._un_state(); 223 b._tool_play("amblyopia/_state_close.mp3") 224 }); 225 }, 226 _selectColor: function (g) { // add by andrew 227 var b = this; 228 var c = g.id.split("_"); 229 b._fontcolor = c[0]; 230 b._bgcolor = c[1]; 231 b._linkcolor = c[2]; 232 var h = b._fontcolor + "_" + b._bgcolor + "_" + b._linkcolor; 233 var f = b._fontcolor.split("#")[1] + "_" + b._bgcolor.split("#")[1]; 234 var d = a.cookie("color"); 235 if (h == d) { 236 return 237 } 238 239 a.cookie("color", h); 240 a(g).parent().children().removeClass("active").end().end().addClass("active"); 241 b._read_color(); 242 if (h == "other_other_other") { 243 b._tool_play("color/other_other.mp3", true, function () { 244 a( 245 document).unmask(); 246 b._reload() 247 }); 248 b._call(b._reload); 249 b._close_palette_panel(false); 250 a.cookie("palette", null); 251 b._init_color(); 252 return 253 } 254 b._init_color(); 255 b._dom( 256 document.getElementById("frame-main"), b._changeColor, function (e) { 257 return Amblyopia.fn._leafNode(e) 258 }, 0); 259 b._tool_play("color/" + f + ".mp3"); 260 b._close_palette_panel(false); 261 a.cookie("palette", null); 262 263 }, 264 _reset: function () { 265 var c = ["history", "historyIndex", "historyVisitPage", "view", "font", "read", "sound", "tips", "palette", "color", "zoom", "pause", "state"], 266 b = new Date(), 267 e = this, 268 d = function () { 269 b.setTime(77771564221); 270 a.each(c, function () { 271 a.cookie(this, null, { 272 expires: b.toGMTString() 273 }) 274 }); 275 e.tips_close(); 276 e._sound_close(); 277 e._font = e._size; 278 e._activeFont(); 279 e._activeZoom(1);
280 e._state_close(); 281 e._init_color(); 282 e._reload() 283 }; 284 this._tool_play("amblyopia/_reset.mp3", true, function () { 285 a(document).unmask(); 286 d() 287 }); 288 this._call(d) 289 }, 290 _break: function () { 291 292 if (a.cookie("sound") != "true" || a.cookie("read") == "break") { 293 return 294 } 295 a("#x-break").addClass("btn-ico-active"); 296 297 a.cookie("read", "break"); 298 299 a("#x-repeat").removeClass("btn-ico-active").find("ins").removeClass("x_pause x_play").addClass("x_repeat"); 300 301 this._break_open(); 302 this._tool_play("amblyopia/_break.mp3") 303 }, 304 _repeat: function () { 305 if (a.cookie("sound") != "true") { 306 return 307 } 308 309 var c = a("#x-break"), 310 b = a("#x-repeat"), 311 e = b.find("ins"); 312 c.removeClass("btn-ico-active"); 313 b.addClass("btn-ico-active"); 314 315 316 if (e.hasClass("x_repeat")) { 317 var d = a.cookie("read"); 318 if (d == "repeat") { 319 return 320 } 321 a.cookie("read", "repeat"); 322 e.removeClass("x_repeat").addClass("x_pause"); 323 this._repeat_open(); 324 this._tool_play("amblyopia/_repeat.mp3") 325 } else { 326 if (e.hasClass("x_pause")) { 327 e.removeClass("x_pause").addClass("x_play"); 328 this._pause_start(); 329 this._tool_play("amblyopia/_pause.mp3") 330 } else { 331 if (e.hasClass("x_play")) { 332 e.removeClass("x_play").addClass("x_pause"); 333 this._pause_open() 334 } 335 } 336 } 337 }, 338 _pause_start: function () { 339 var c = a.cookie("sound"), 340 b = a.cookie("read"); 341 if (c != "true" || b == "break") { 342 return 343 } 344 if (a.cookie("pause")) { 345 this._pause_close() 346 } else { 347 this._pause_open() 348 } 349 }, 350 _pause_open: function () { 351 this._tool_play("amblyopia/_pause_open.mp3"); 352 a.cookie("pause", "true"); 353 this._pauseAll(); 354 if (a.cookie("read") == "repeat") { 355 this._repeatFlag = false 356 } 357 }, 358 _pause_close: function () { 359 this._tool_play("amblyopia/_pause_close.mp3"); 360 a.cookie("pause", null); 361 this._resumeAll(); 362 this._repeat_start(); 363 if (a.cookie("read") == "repeat") { 364 this._repeatFlag = true 365 } 366 }, 367 _close_panel: function (b) { 368 switch (b) { 369 case "x-sound-panel": 370 Amblyopia.fn._close_sound_panel(); 371 a.cookie("soundMange", null); 372 break; 373 case "x-palette-panel": 374 Amblyopia.fn._close_palette_panel(); 375 a.cookie("palette", null); 376 break; 377 default: 378 } 379 }, 380 _sound: function () { 381 382 if (a.cookie("sound") == "true") { 383 384 a.cookie("sound", "false"); 385 386 this._sound_close(); 387 if (a.cookie("state")) { 388 this._on_state() 389 } 390 this._readyToPlay("amblyopia/_sound_close.mp3", true, function () { 391 392 }) 393 } else { 394 a.cookie("sound", "true"); 395 this._sound_open(); 396 this._un_state(); 397 this._tool_play("amblyopia/_sound_open.mp3") 398 } 399 }, 400 _volume_add: function () { 401 if (a.cookie("sound") != "true") { 402 return 403 } 404 this._volume = Number(a.cookie("volume")) || this._volume;
405 this._volume += this._volume_step; 406 if (this._volume >= this._volume_max) { 407 this._volume = this._volume_max 408 } 409 a.cookie("volume", this._volume); 410 var c = this._volume / this._volume_step; 411 var b = ""; 412 switch (c) { 413 case 1: 414 b = "\u589e\u52a0\u4e3a\u4e00"; 415 break; 416 case 2: 417 b = "\u589e\u52a0\u4e3a\u4e8c"; 418 break; 419 case 3: 420 b = "\u589e\u52a0\u4e3a\u4e09"; 421 break; 422 case 4: 423 b = "\u589e\u52a0\u4e3a\u56db"; 424 break; 425 case 5: 426 b = "\u5df2\u589e\u81f3\u6700\u5927"; 427 break 428 } 429 this._tool_play("amblyopia/_volume_add_" + c + ".mp3"); 430 this._tooltips("\u97f3\u91cf" + b) 431 }, 432 _volume_sub: function () { 433 if (a.cookie("sound") != "true") { 434 return 435 } 436 this._volume = Number(a.cookie("volume")) || this._volume; 437 this._volume -= this._volume_step; 438 if (this._volume <= this._volume_min) { 439 this._volume = this._volume_min 440 } 441 a.cookie("volume", this._volume); 442 var c = this._volume / this._volume_step; 443 var b = ""; 444 switch (c) { 445 case 1: 446 b = "\u5df2\u51cf\u81f3\u6700\u5c0f"; 447 break; 448 case 2: 449 b = "\u51cf\u5c11\u4e3a\u4e8c"; 450 break; 451 case 3: 452 b = "\u51cf\u5c11\u4e3a\u4e09"; 453 break; 454 case 4: 455 b = "\u51cf\u5c11\u4e3a\u56db"; 456 break; 457 case 5: 458 b = "\u51cf\u5c11\u4e3a\u4e94"; 459 break 460 } 461 this._tool_play("amblyopia/_volume_sub_" + c + ".mp3"); 462 this._tooltips("\u97f3\u91cf" + b) 463 }, 464 _speed_add: function () { 465 if (a.cookie("sound") != "true") { 466 return 467 } 468 this._speed = Number(a.cookie("speed")) || this._speed; 469 this._speed += this._speed_step; 470 if (this._speed >= this._speed_max) { 471 this._speed = this._speed_max 472 } 473 a.cookie("speed", this._speed); 474 var b = (this._speed + this._speed_max) / this._speed_step + 1; 475 var c = ""; 476 switch (b) { 477 case 1: 478 c = "\u589e\u52a0\u4e3a\u4e00"; 479 break; 480 case 2: 481 c = "\u589e\u52a0\u4e3a\u4e8c"; 482 break; 483 case 3: 484 c = "\u589e\u81f3\u6700\u5feb"; 485 break 486 } 487 this._tool_play("amblyopia/_speed_add_" + b + ".mp3"); 488 this._tooltips("\u8bed\u901f" + c) 489 }, 490 _speed_sub: function () { 491 if (a.cookie("sound") != "true") { 492 return 493 } 494 this._speed = Number(a.cookie("speed")) || this._speed; 495 this._speed -= this._speed_step; 496 if (this._speed <= this._speed_min) { 497 this._speed = this._speed_min 498 } 499 a.cookie("speed", this._speed); 500 var b = (this._speed + this._speed_max) / this._speed_step + 1; 501 var c = ""; 502 switch (b) { 503 case 1: 504 c = "\u51cf\u81f3\u6700\u6162"; 505 break; 506 case 2: 507 c = "\u51cf\u5c11\u4e3a\u4e8c"; 508 break; 509 case 3: 510 c = "\u51cf\u5c11\u4e3a\u4e09"; 511 break 512 } 513 this._tool_play("amblyopia/_speed_sub_" + b + ".mp3"); 514 this._tooltips("\u8bed\u901f" + c) 515 }, 516 _pauseAll: function () { 517 soundManager.pauseAll() 518 }, 519 _resumeAll: function () { 520 soundManager.resumeAll() 521 }, 522 _break_over: function () { 523 if (this.tagName == Amblyopia.fn._tagName.toUpperCase() && this.getAttribute("class") != Amblyopia.fn._tagClass) { 524 return 525 } 526 var b = a(this); 527 528 var c = Amblyopia.fn.handleNode(this, true); 529 if (!c) { 530 c = b.text() 531 } 532 533 if (c) { 534 Amblyopia.fn._nodeText.push(c) 535 } 536 537 switch (this.tagName) { 538 case "SELECT": 539 break; 540 case "IMG": 541 // æ¸ é¤å¾çæ ·å¼ 542 // b.css("border", "2px solid " + Amblyopia.fn._break_bgcolor); 543 break; 544 default: 545 546 Amblyopia.fn._textColor = this.style.color; 547 Amblyopia.fn._backColor = this.style.background; // b.css("background-color"); 548 b.css({ 549 // æ¸ é¤aæ ç¾æ ·å¼ æ¥éª¤1 550 // color: Amblyopia.fn._break_color, 551 // "background-color" : 552 // Amblyopia.fn._break_bgcolor, 553 // background: Amblyopia.fn._break_bgcolor, 554 // cursor: "default" 555 }) 556 } 557 558 Amblyopia.fn._tooltips(c); 559 if (this.tagName == "A" && (this.href != "#" || this.href.toLowerCase().indexOf("javascript") == -1) && this.href != "") { 560 // æ¸ é¤aæ ç¾æ ·å¼ æ¥éª¤2 561 // Amblyopia.fn._href = this.href 562 }
563 b.focus() 564 }, 565 _break_out: function () { 566 var b = a(this); 567 switch (this.tagName) { 568 case "SELECT": 569 break; 570 case "IMG": 571 b.css("border", ""); 572 break; 573 default: 574 b.css({ 575 color: Amblyopia.fn._textColor, 576 // "background-color" : 577 // Amblyopia.fn._backColor, 578 background: Amblyopia.fn._backColor, 579 cursor: "" 580 }) 581 } 582 Amblyopia.fn._href = ""; 583 Amblyopia.fn._clearAll() 584 }, 585 _over_object: function () { 586 var b = a(this); 587 var c = Amblyopia.fn.handleNode(b.children("object").get(0), true); 588 if (!c) { 589 c = b.text() 590 } 591 if (c) { 592 Amblyopia.fn._nodeText.push(c) 593 } 594 Amblyopia.fn._tooltips(c) 595 }, 596 _out_object: function () { 597 Amblyopia.fn._clearAll() 598 }, 599 _getData: function (c, d) { 600 var b = ""; 601 a.ajax({ 602 url: Amblyopia.fn._dataUrl, 603 data: { 604 s: c.s, 605 speed: c.speed, 606 domain: Amblyopia.fn._domain || "" 607 }, 608 dataType: "jsonp", 609 jsonp: "callback", 610 success: function (e) { 611 if (e && (e.success == true || e.success == 'true') && e.msg != "") { 612 b = Amblyopia.fn._dataMp3 + e.msg 613 } else { 614 b = Amblyopia.fn._mp3 + "amblyopia/error.mp3" 615 } 616 Amblyopia.fn._play(c.s, b, true, false, d) 617 }, 618 error: function () {} 619 }) 620 }, 621 _un_break: function () { 622 clearInterval(this._breakInterval); 623 this._clearAll(); 624 //add by andrew 625 var exp = "a, img, button, input, area," + this._tagName.toUpperCase() + ", select, textarea" 626 a("#frame-main").contents().find(exp).filter( 627 628 function (b) { 629 return Amblyopia.fn._isOnlyImg(this) 630 }).unbind(".Break").end().end().find("object").parent().unbind(".Break").end().end().find("embed[id!=sm2movie]").parent().filter(function () { 631 return this.tagName != "OBJECT" 632 }).unbind(".Break").end().end().end().find("frame, iframe").filter( 633 634 function (b) { 635 return Amblyopia.fn._isThisHref(a(this).attr("src")) 636 }).contents().find(exp).filter(function (b) { 637 return Amblyopia.fn._isOnlyImg(this) 638 }).unbind(".Break").end().end().find("object").parent().unbind(".Break").end().end().find("embed[id!=sm2movie]").parent().filter(function () { 639 return this.tagName != "OBJECT" 640 }).unbind(".Break") 641 }, 642 _un_repeat: function () { 643 if (this._repeatIndex) { 644 var b = this._repeatNodes[this._repeatIndex]; 645 if (b.tagName == "A") { 646 b.style.color = this._readed_linkcolor 647 } else { 648 if (b.tagName == "IMG") { 649 b.style.border = "" 650 } else { 651 b.style.color = this._readed_fontcolor 652 } 653 } 654 b.style.background = this._readed_bgcolor; // b.style.backgroundColor 655 // = 656 // this._readed_bgcolor 657 } 658 this._repeatFlag = false; 659 this._repeatIndex = 0; 660 this._repeatNodes = []; 661 clearInterval(this._repeatInterval); 662 this._repeatNode = ""; 663 this._repeatNum = 0; 664 665 a("#frame-main").contents().find("a, img, button, input, " + this._tagName.toUpperCase() + ", select, textarea").unbind(".Repeat").end().find("frame, iframe").filter( 666 667 function (c) { 668 return Amblyopia.fn._isThisHref(a(this).attr("src")) 669 }).contents().find("a, img, button, input, " + this._tagName.toUpperCase() + ", select, textarea").unbind(".Repeat") 670 }, 671 _break_open: function () { 672 if (a.cookie("sound") != "true") { 673 return 674 } 675 this._clearAll(); 676 this._un_repeat(); 677 this._breakRead() 678 }, 679 _bind: function () { 680 var med = "mouseenter.Break"; 681 var mld = "mouseleave.Break"; 682 683 var xpre = "a,img, button, input,area," + this._tagName.toUpperCase() + ", select, textarea"; 684 685 686 var para1 = a("#frame-main").contents().find(xpre).filter( 687 688 function (b) { 689 return a("img", this).length == 0 690 }).unbind(med).bind(med, this._break_over).unbind(mld).bind(mld, this._break_out).end().end(); 691 692 693 694 695 para1 = para1.find("object").parent().unbind(med).bind(med, this._over_object).unbind(mld).bind(mld, this._out_object).end().end().find("embed[id!=sm2movie]").parent().filter(function () { 696 return this.tagName != "OBJECT" 697 }).unbind(med).bind(med, this._over_object).unbind(mld).bind(mld, this._out_object).end().end().end(); 698 699 700 701 para1 = para1.find("frame, iframe").filter( 702 703 function (b) { 704 return Amblyopia.fn._isThisHref(a(this).attr("src")) 705 }).contents().find(xpre).filter(function (b) { 706 return a("img", this).length == 0 707 }).unbind(med).bind(med, this._break_over).unbind(mld).bind(mld, this._break_out).end().end(); 708 709 710 para1.find("object").parent().unbind(med).bind(med, this._over_object).unbind(mld).bind( 711 mld, this._out_object).end().end().find("embed[id!=sm2movie]").parent().filter(function () { 712 return this.tagName != "OBJECT" 713 }).unbind(med).bind(med, this._over_object).unbind(mld).bind(mld, this._out_object) 714 }, 715 _breakRead: function () { 716 this._bind(); 717 this._readArray(); 718 return; 719 }, 720 _readArray: function () { 721 this._breakInterval = setInterval(function () { 722 var b = Amblyopia.fn._nodeText.pop(); //changed by andrew 723 if (b) { 724 Amblyopia.fn._stopAll(); 725 Amblyopia.fn._readyToPlay(b, false, Amblyopia.fn._stopAll); 726 } 727 728 // if (Amblyopia.fn._nodeText.length > 0) { 729 // var b = Amblyopia.fn._nodeText.pop();
730 // Amblyopia.fn._clearAll(); 731 // Amblyopia.fn._readyToPlay(b, false, 732 // function() { 733 // Amblyopia.fn._clearAll() 734 // }) 735 // } 736 }, this._breakTimer) 737 }, 738 _repeat_open: function () { 739 if (a.cookie("sound") != "true" || a.cookie("pause")) { 740 return 741 } 742 this._clearAll(); 743 this._un_break(); 744 this._repeat_ready() 745 }, 746 _repeat_ready: function () { 747 this._clearAll(); 748 this._repeatIndex = 0; 749 this._repeatFlag = true; 750 this._repeatNodes = []; 751 this._repeatRead(); 752 }, 753 _getRepeatNodes: function () { 754 this._repeatNodes = this._nodes 755 }, 756 _repeatRead: function () { 757 this._read_color(); 758 this._getRepeatNodes(); 759 var exp = "a, img, button, input,area, " + this._tagName.toUpperCase() + ", select, textarea" 760 a("#frame-main").contents().find(exp).filter( 761 762 function (b) { 763 return a("img, textarea, select", this).length == 0 764 }).unbind("mouseenter.Repeat").bind("mouseenter.Repeat", this._repeat_over).unbind("mouseleave.Repeat").bind("mouseleave.Repeat", this._repeat_out).end().end().find("frame, iframe").filter( 765 766 function (b) { 767 return Amblyopia.fn._isThisHref(a(this).attr("src")) 768 }).contents().find(exp).filter( 769 770 function (b) { 771 return a("img, textarea, select", this).length == 0 772 }).unbind("mouseenter.Repeat").bind("mouseenter.Repeat", this._repeat_over).unbind("mouseleave.Repeat").bind("mouseleave.Repeat", this._repeat_out); 773 this._repeatIntervalRead() 774 }, 775 _repeat_over: function () { 776 if (this.tagName == Amblyopia.fn._tagName.toUpperCase() && this.getAttribute("class") != Amblyopia.fn._tagClass) { 777 return 778 } 779 this._runTwice = true; 780 if (a.inArray(this.tagName, Amblyopia.fn._repeatTagNames) == -1) { 781 return 782 } 783 Amblyopia.fn._repeatNode = this 784 }, 785 _repeat_out: function () { 786 Amblyopia.fn._repeatNode = "" 787 }, 788 _repeatIntervalRead: function () { 789 790 var b = this; 791 this._repeatInterval = setInterval( 792 793 function () { 794 795 if (!b._repeatFlag) { 796 return 797 } 798 799 if (b._runTwice) { 800 b._runTwice = false 801 } else { 802 b._runTwice = true 803 } 804 if (typeof b._repeatNode == "object" && b._runTwice) { 805 806 var c = b._getRepeatIndex(b._repeatNode); 807 if (c) { 808 b._repeatNum++; 809 var d = b._repeatNodes[b._repeatIndex]; 810 if (d.tagName == "A") { 811 d.style.color = b._readed_linkcolor 812 } else { 813 if (d.tagName == "IMG") { 814 d.style.border = "" 815 } else { 816 d.style.color = b._readed_fontcolor 817 } 818 } 819 b._href = ""; 820 b._repeatNodes[b._repeatIndex].style.background = b._readed_bgcolor; // b._repeatNodes[b._repeatIndex].style.backgroundColor 821 // = 822 // b._readed_bgcolor; 823 b._repeat_reset(); 824 b._repeatIndex = c; 825 b._repeat_start() 826 } 827 b._repeatNode = "" 828 } 829 }, this._repeatTimer) 830 }, 831 _repeat_reset: function () { 832 this._queue = []; 833 this._req = true 834 }, 835 _repeat_start: function () { 836 if (this._repeatNum == 0) { 837 return 838 } 839 var b = this._repeatNodes[this._repeatIndex]; 840 if (b == undefined || this._repeatIndex >= this._repeatNodes.length) { 841 if (this._repeatIndex >= this._repeatNodes.length) { 842 this._repeatIndex-- 843 } 844 return 845 } 846 if (!this.isVisible(b)) { 847 this._repeatIndex++; 848 this._repeat_start(); 849 return 850 } 851 if (!this._repeatFlag) { 852 this._repeatFlag = false; 853 return 854 } 855 this._scroll(b); 856 var d = this.handleNode(b, true); 857 if (!d) { 858 d = b.innerText == undefined ? b.textContent : b.innerText 859 } 860 var c = this._chr(d); 861 if (c) { 862 if (b.tagName == "IMG") { 863 b.style.border = "2px solid " + this._repeat_bgcolor 864 } else { 865 b.style.color = this._repeat_color; 866 b.style.background = this._repeat_bgcolor; // b.style.backgroundColor 867 // = 868 // this._repeat_bgcolor 869 } 870 if (b.tagName == "A" && (b.href != "#" || b.href.toLowerCase().indexOf("javascript") == -1) && b.href != "") { 871 this._href = b.href 872 } 873 a(b).focus(); 874 this._tooltips(d); 875 if (this._req) { 876 this._readyToPlay(c, false, "callback"); 877 this._req = false 878 } 879 this._repeat_play(b) 880 } else { 881 this._repeatIndex++; 882 this._repeat_start() 883 } 884 }, 885 _repeat_play: function (b) { 886 887 var d = this, 888 c = this._queue.shift(); 889 //alert(c) 890 if (c) { 891 this._clearAll(); 892 c.play({ 893 onfinish: function () { 894 d._stopAll(); 895 d._repeatIndex++; 896 if (b.tagName == "A") { 897 b.style.color = d._readed_linkcolor 898 } else { 899 if (b.tagName == "IMG") { 900 b.style.border = "" 901 } else { 902 b.style.color = d._readed_fontcolor 903 } 904 } 905 d._href = ""; 906 // b.style.backgroundColor = 907 // d._readed_bgcolor; 908 b.style.background = d._readed_bgcolor; 909 this.destruct(); //add by andrew 910 d._repeat_start() 911 }, 912 onload: function () { 913 if (d._repeatNum == 0) { 914 return 915 } 916 var f = d._repeatIndex; 917 var e = d._repeatNodes[f + 1]; 918 919 920 921 while (!d.isVisible(e)) { 922 f++; 923 e = d._repeatNodes[f]; 924 /** 925 * add by andrew 926 */ 927 if (!e || f >= d._repeatNodes.length - 1) { 928 return 929 } 930 } 931 932 if (!e || f >= d._repeatNodes.length - 1) { 933 return 934 } 935 936 if (!d._repeatFlag) { 937 d._repeatFlag = false; 938 return 939 } 940 var g = d.handleNode(e, true); 941 if (!g) { 942 g = e.innerText == undefined ? e.textContent : e.innerText 943 } 944 g = d._chr(g); 945 946 d._readyToPlay(g, false, "callback") 947 } 948 }) 949 } else { 950 951 setTimeout(function () { 952 d._repeat_play(b) 953 }, 100) 954 } 955 }, 956 _readyToPlay: function (g, c, h) { 957 g = this._chr(g); 958 if (g == "") { 959 return false 960 } 961 var d = g; 962 var f = a.cookie("speed") || this._speed; 963 var e = { 964 s: encodeURIComponent(d), 965 speed: f 966 }; 967 if (c) { 968 var d = Amblyopia.fn._mp3 + d; 969 Amblyopia.fn._play(g, d, true, false, h) 970 } else { 971 this._getData(e, h) 972 } 973 }, 974 _scroll: function (f) { 975 var i = a("#frame-main"); 976 var e = a(f).offset().top; 977 var h = f.ownerDocument; 978 var g = h.parentWindow || h.defaultView; 979 if (g != window.frames["frame-main"]) { 980 e += g.frameElement.offsetTop 981 } 982 var d = i.get(0).contentWindow.document.documentElement.scrollTop; 983 var j = i.height(); 984 if (e - d > j / 2 || d > e) { 985 i.get(0).contentWindow.document.documentElement.scrollTop = (e - j / 2) 986 } 987 }, 988 _getRepeatIndex: function (e) { 989 var c = 0; 990 for (var d = 0, b = this._repeatNodes.length; d < b; d++) { 991 if (this._repeatNodes[d] == e) { 992 c = d; 993 break 994 } 995 } 996 return c 997 }, 998 _sound_open: function () { 999 a("#x-sound").addClass("btn-ico-active").find("ins").removeClass("x_sound_no").addClass("x_sound"); 1000 var b = a.cookie("read"); 1001 a("#x-break, #x-repeat").removeClass("btn-ico-active"); 1002 switch (b) { 1003 case "repeat": 1004 a("#x-repeat").addClass("btn-ico-active").find("ins").removeClass("x_repeat x_play").addClass("x_pause"); 1005 this._repeat_open(); 1006 break; 1007 case "break": 1008 default: 1009 a("#x-break").addClass("btn-ico-active"); 1010 this._break_open() 1011 } 1012 }, 1013 _sound_close: function () { 1014 a("#x-sound").removeClass("btn-ico-active").find("ins").removeClass("x_sound").addClass("x_sound_no"); 1015 a("#x-break, #x-repeat").removeClass("btn-ico-active"); 1016 a("#x-repeat").find("ins").removeClass("x_pause x_play").addClass("x_repeat"); 1017 1018 1019 this._un_break(); 1020 this._un_repeat() 1021 }, 1022 _soundMore: function () { 1023 if (a.cookie("soundMange")) { 1024 a.cookie("soundMange", null); 1025 this._close_sound_panel() 1026 } else { 1027 a.cookie("soundMange", "true"); 1028 this._show_sound_panel() 1029 } 1030 }, 1031 _show_sound_panel: function () { 1032 var b = a("#x-sound-panel"), 1033 c = a("#x-sound").offset(); 1034 b.css("left", c.left).slideDown("slow", function () { 1035 var f = a(this), 1036 d = f.outerWidth(true), 1037 e = f.outerHeight(true); 1038 if (a.browser.msie) { 1039 a(".bg-iframe").css({ 1040 left: c.left, 1041 width: d, 1042 height: e 1043 }).show() 1044 } 1045 }); 1046 a("#x-sound-more").addClass("btn-ico-active"); 1047 this._tool_play("amblyopia/_sound_panel_open.mp3") 1048 }, 1049 _close_sound_panel: function (c) { 1050 a(".bg-iframe").hide(); 1051 a("#x-sound-panel").slideUp("slow"); 1052 a("#x-sound-more").removeClass("btn-ico-active"); 1053 this._tool_play("amblyopia/_sound_panel_close.mp3") 1054 }, 1055 _getNodes: function (b) { 1056 if (b.tagName == "undefined") { 1057 return 1058 } 1059 if (b.tagName == Amblyopia.fn._tagName.toUpperCase() && b.getAttribute("class") != Amblyopia.fn._tagClass) { 1060 return 1061 } 1062 if (a.inArray(b.tagName, Amblyopia.fn._repeatTagNames) == -1) { 1063 return 1064 } 1065 if (b.style.display == "none") { 1066 return 1067 } 1068 if (b.tagName == "IMG" && (b.width < 50 || b.height < 50)) { 1069 return 1070 } 1071 var c = Amblyopia.fn.handleNode(b, true); 1072 if (!c) { 1073 c = b.innerText == undefined ? b.textContent : b.innerText 1074 } 1075 c = Amblyopia.fn._chr(c); 1076 if (!c) { 1077 return 1078 } 1079 Amblyopia.fn._nodes.push(b) 1080 }, 1081 _bind_keyBoard: function (h) { 1082 var i = document.getElementById("frame-main"), 1083 g = i.contentWindow; 1084 var h = h || g.event; 1085 var b = h.which || h.keyCode; 1086 if (h.shiftKey) { 1087 if (b == 13) { 1088 if (a.cookie("sound") != "true") { 1089 a("#x-sound").trigger("mousedown"); 1090 Amblyopia.fn._tool_play("amblyopia/_amblyopia.mp3") 1091 } 1092 } 1093 } else { 1094 switch (b) { 1095 case 13: 1096 Amblyopia.fn._open_url(Amblyopia.fn._href); 1097 break; 1098 case 32: 1099 h.preventDefault ? h.preventDefault() : h.returnValue = false; 1100 var f = a.cookie("sound"), 1101 c = a.cookie("read"); 1102 if (f != "true" || c != "repeat") { 1103 return 1104 } 1105 var d = a("#x-repeat ins"); 1106 d.removeClass("x_repeat"); 1107 if (d.hasClass("x_pause")) { 1108 d.removeClass("x_pause").addClass("x_play"); 1109 Amblyopia.fn._pause_start(); 1110 Amblyopia.fn._tool_play("amblyopia/_pause.mp3") 1111 } else { 1112 if (d.hasClass("x_play")) { 1113 d.removeClass("x_play").addClass("x_pause"); 1114 Amblyopia.fn._pause_start() 1115 } 1116 } 1117 break 1118 } 1119 } 1120 }, 1121 _keyBoard: function () { 1122 a("body").focus(); 1123 this._nodes = [];
1124 //a(document).unbind("keydown", this._bind_keyBoard); 1125 a(document).unbind("keydown").bind("keydown", this._bind_keyBoard); 1126 var d = document.getElementById("frame-main"), 1127 c = d.contentWindow, 1128 b = c.document; 1129 b.documentElement.onkeydown = this._bind_keyBoard; 1130 this._dom(b ? b.body : d, this._getNodes, function ( 1131 e) { 1132 return Amblyopia.fn._leafNode(e) 1133 }, 0) 1134 }, 1135 _tool_play: function (d, c, e) { 1136 if (!e || typeof e != "function") { 1137 if (a.cookie("read") == "repeat") { 1138 e = function () { 1139 Amblyopia.fn._repeat_reset(); 1140 Amblyopia.fn._repeat_start() 1141 } 1142 } else { 1143 e = function () {} 1144 } 1145 } 1146 c = c == null ? true : c; 1147 if (a.cookie("sound") == "true" || this._tool_tips) { 1148 this._clearAll(); 1149 this._readyToPlay(d, c, e) 1150 } 1151 }, 1152 _queryIframe: function () { 1153 if (typeof this.cookieEnabled == "undefined") { 1154 this.cookieEnabled = this.isCookieEnabled() 1155 } 1156 if (!this.cookieEnabled) { 1157 return 1158 } 1159 1160 var c = document.getElementById("frame-main").contentWindow; 1161 this._domain = c.location.host; 1162 this._frameDepth = 0; 1163 this._clearAll(); 1164 1165 this._record(); 1166 this._setColor(); 1167 this._ready(); 1168 this._keyBoard(); 1169 this._remove(); 1170 this._getCookieIframe(); 1171 this._changeScreen(); 1172 a("#frame-main").contents().find("body").bind("mousedown", this._pageClick); 1173 var b = true; 1174 soundManager.url = this._url; 1175 soundManager.debugMode = (/debug=true/i).test(window.location.search) ? true : false; 1176 soundManager.onready(function (d) { 1177 if (d.success) { 1178 if (b) { 1179 Amblyopia.fn._report(); 1180 b = false 1181 } 1182 } 1183 }) 1184 }, 1185 _getCookieIframe: function () { 1186 1187 this._changeHistory(); 1188 if (a.cookie("tips")) { 1189 this.tips_open() 1190 } 1191 1192 if (a.cookie("view")) { 1193 a("#x-view").attr("title", "\u89c6\u56fe\u6a21\u5f0f").find("ins").removeClass("x_view_text").addClass("x_view_data"); 1194 this._view_text() 1195 } 1196 if (a.cookie("font")) { 1197 this._changeFont() 1198 } 1199 var lang; 1200 if (lang = a.cookie('lang')) { 1201 a('#tooltips .tooltips-row > a').removeClass('cur'); 1202 var el; 1203 switch (lang) { 1204 case 'zh' : 1205 el = '#x-simplified'; 1206 break; 1207 case 'tw' : 1208 el = '#x-traditional'; 1209 break; 1210 case 'py' : 1211 el = '#x-pinyin'; 1212 break; 1213 } 1214 el && a(el).addClass('cur'); 1215 } 1216 if (a.cookie("state") && a.cookie("sound") != "true") { 1217 this._on_state() 1218 } 1219 if (a.cookie("zoom")) { 1220 var b = a.cookie("zoom"); 1221 this._activeZoom(b); 1222 this._zoom(b) 1223 } 1224 1225 if (!a.cookie("sound") && this._isRead) { 1226 a.cookie("sound", "true") 1227 } 1228 1229 if (a.cookie("sound") == "true") { 1230 this._sound_open() 1231 } else { 1232 this._sound_close(); 1233 } 1234 } 1235 }) 1236})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.