1var popupviewer = function(showContent, isImage, width, height) { 2 3 if ( jQuery ) { 4 var $ = jQuery; 5 } 6 7 this.screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 8 this.screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 9 this.contentDiv = null; 10 this.controlDiv = null; 11 this.maxWidthFactor = 0.7; 12 this.maxHeightFactor = 0.8; 13 this.maxWidth = null; 14 this.maxHeight = null; 15 this.endWidth = 0; 16 this.endHeight = 0; 17 this.endMarginTop = 0; 18 this.endMarginLeft = 0; 19 this.isImage = false; 20 this.additionalContent = null; 21 this.additionalContentID = null; 22 this.page = null; 23 this.event = null; 24 this.wasError = false; 25 this.popupImageStack = null; 26 27 this.showContent = null; 28 this.isRTL = false; 29 30 var self = this; 31 32 this.getFirst = function() { /* To be implemented */ 33 if (!this.popupImageStack) { 34 return false; 35 } 36 return this.popupImageStack[0].id == this.page; 37 }; 38 39 this.getLast = function() { /* To be implemented */ 40 if (!this.popupImageStack) { 41 return false; 42 } 43 return this.popupImageStack[this.popupImageStack.length - 1].id == this.page; 44 }; 45 46 this.skipToImage = function(itemNr) { 47 48 var previous = null; 49 var elem = null; 50 for ( var item in this.popupImageStack) { 51 52 if ( !this.popupImageStack.hasOwnProperty(item) ) 53 { 54 continue; 55 } 56 57 var check = this.popupImageStack[item]; 58 59 // previous was inpoint 60 if (previous && previous.id == this.page) { 61 elem = check; 62 break; 63 } 64 65 // Found + must go 66 if (check.id == this.page && itemNr < 0) { 67 elem = previous; 68 break; 69 } 70 71 previous = check; 72 elem = check; 73 } 74 75 if (elem) { 76 this.dispatchClick(elem); 77 } 78 }; 79 80 this.dispatchClick = function(elem) { 81 if (elem == null) { 82 return; 83 } 84 85 $(elem).trigger('click'); 86 }; 87 88 this.setContentSize = function(width, height, offsetHeight, offsetElement) { 89 90 if (!this.contentDiv || !this.controlDiv) { 91 return; 92 } 93 94 if (!width || width === 0) { 95 width = this.screenWidth * this.maxWidthFactor; 96 } 97 98 if (!height || height === 0) { 99 height = this.screenHeight * this.maxHeightFactor; 100 } 101 102 // If given, we want the optimal size 103 if ( offsetElement ) 104 { 105 try { 106 // IE8 has isues 107 offsetElement.style.display = 'fixed'; 108 } catch(e) {} 109 110 offsetElement.style.visibility = 'hidden'; 111 offsetElement.style.width = ''; 112 offsetElement.style.height = ''; 113 114 height = offsetElement.offsetHeight; 115 width = offsetElement.offsetWidth; 116 117 try { 118 // IE8 has isues 119 offsetElement.style.display = ''; 120 } catch(e) {} 121 offsetElement.style.visibility = ''; 122 } 123 124 width = parseFloat(width); 125 height = parseFloat(height); 126 offsetHeight = typeof offsetHeight == "undefined" || isNaN(parseFloat(offsetHeight)) ? 0 : parseFloat(offsetHeight); // may be undefined 127 var ratio = width / height; 128 129 height += offsetHeight; 130 131 if (height > (this.screenHeight * 0.99) - 60) { 132 height = (this.screenHeight * 0.99) - 60; 133 134 if (this.isImage) { // If this is an image we will have to fix the size 135 width = (height - offsetHeight) * ratio; 136 } else { 137 width += 20; // For the scroller Bar that will apear; 138 } 139 } 140 141 if (width > (this.screenWidth * 0.99) - 40) { 142 width = (this.screenWidth * 0.99) - 40; 143 144 if (this.isImage) { // If Image is defined then we will have to fix it 145 height = (width / ratio) + offsetHeight; 146 } 147 } 148 149 this.endWidth = width + (this.isImage ? 0 : 24); // 24 Px for padding + Border if is Image 150 this.endHeight = height; 151 152 var xOffset = document.body.scrollLeft || document.documentElement.scrollLeft || window.pageXOffset || 0; 153 var yOffset = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset || 0; 154 155 this.endMarginTop = (this.screenHeight - height) * 0.5 + yOffset; 156 if (this.endMarginTop < 5) { 157 this.endMarginTop = 5; 158 } 159 160 this.endMarginLeft = (this.screenWidth - width) * 0.5 + xOffset; 161 this.setSize(); 162 if ( !$('#popupviewer_loader_div').size() > 0 ) this.addNextAndPrevious(); 163 }; 164 165 this.setSize = function() { 166 167 var style = "width:" + this.endWidth + 'px;'; 168 if (!this.isImage) { 169 style += "height:" + this.endHeight + 'px;'; 170 } 171 172 this.contentDiv.style.cssText = style; // Really nasty IE6 hacking! 173 this.contentDiv.setAttribute('style', style); 174 175 style = "top:" + this.endMarginTop + 'px;'; 176 177 if (!this.isRTL) { 178 style += "left:" + this.endMarginLeft + 'px;'; 179 } else { 180 style += "right:" + this.endMarginLeft + 'px;'; 181 } 182 183 this.controlDiv.style.cssText = style; // Really nasty IE6 hacking! 184 this.controlDiv.setAttribute('style', style); 185 }; 186 187 this.addNextAndPrevious = function() { 188 189 // If not already defined, do so now 190 if (!this.popupImageStack) { 191 this.popupImageStack = $(document).find('img.popupimage'); 192 } 193 194 if (this.popupImageStack && this.popupImageStack.length > 1) { 195 196 var previousImage = document.createElement('a'); 197 previousImage.id = 'popupviewer_control_prevoiusImage'; 198 199 var nextImage = document.createElement('a'); 200 nextImage.id = 'popupviewer_control_nextImage'; 201 202 var self = this; 203 var skipEvent = function(event) { /* To be implemented */ 204 205 if (!event) { 206 var event = window.event; 207 } 208 209 var target = ((event.target) ? event.target : event.srcElement).id.indexOf("next") > 0 ? 1 : -1; 210 self.skipToImage(target); 211 }; 212 213 // If this is not the last image - set inactive 214 if (!this.getLast()) { 215 $(nextImage).click(skipEvent); 216 } else { 217 nextImage.className = "inactive"; 218 } 219 220 // If this is not the first image - set inactive 221 if (!this.getFirst()) { 222 $(previousImage).click(skipEvent); 223 } else { 224 previousImage.className = "inactive"; 225 } 226 227 if ( $('#'+nextImage.id).size() > 0 ) { $('#'+nextImage.id).remove(); } 228 if ( $('#'+previousImage.id).size() > 0 ) { $('#'+previousImage.id).remove(); } 229 230 this.controlDiv.appendChild(nextImage); 231 this.controlDiv.appendChild(previousImage); 232 } 233 }; 234 235 this.getIntValue = function(value) { 236 return parseInt(value.substr(0, value.indexOf('px')), 10); 237 }; 238 239 this.buildViewerWithLoader = function() { 240 241 this.removeOldViewer(); 242 this.contentDiv = document.createElement('div'); 243 this.contentDiv.id = 'popupviewer_content'; 244 this.contentDiv.className = 'isImage'; 245 246 this.controlDiv = document.createElement('div'); 247 this.controlDiv.id = 'popupviewer_control'; 248 249 this.controlDiv.appendChild(this.contentDiv); 250 251 var loaderDiv = document.createElement('div'); 252 loaderDiv.id = 'popupviewer_loader_div'; 253 254 this.contentDiv.appendChild(loaderDiv); 255 256 var closeImage = document.createElement('a'); 257 closeImage.id = 'popupviewer_control_closeImage'; 258 259 this.controlDiv.appendChild(closeImage); 260 261 var sampleDiv = document.createElement('div'); 262 sampleDiv.id = 'popupviewer'; 263 264 var overlayDiv = document.createElement('div'); 265 overlayDiv.id = 'popupviewer_overlay'; 266 267 var arVersion = navigator.appVersion.split("MSIE"); 268 var version = parseFloat(arVersion[1]); 269 if (!(version >= 5.0 && version < 7.0)) { 270 overlayDiv.style.position = 'fixed'; 271 } else { 272 overlayDiv.style.height = (document.body.offsetHeight -1 ) + 'px'; 273 overlayDiv.style.width = (document.body.offsetWidth -1 ) + 'px'; 274 } 275 276 sampleDiv.appendChild(overlayDiv); 277 278 /* IE 6 Crasher */ 279 sampleDiv.appendChild(this.controlDiv); 280 281 $(overlayDiv).click(self.removeOldViewer); 282 $(closeImage).click(self.removeOldViewer); 283 $(document).bind('keydown', self.globalEvent); 284 285 // window.scrollTo(0, 0); 286 document.getElementsByTagName('body')[0].style.overflow = 'hidden'; 287 document.getElementsByTagName('body')[0].appendChild(sampleDiv); 288 289 this.setContentSize(210, 20); 290 }; 291 292 this.removeOldViewer = function() 293 { 294 if ($('#popupviewer').size() > 0) { 295 $('#popupviewer').remove() 296 $(document).unbind('keydown', self.globalEvent); 297 } 298 document.getElementsByTagName('body')[0].style.overflow = 'auto'; 299 }; 300 301 this.displayContent = function(showContent, isImage, width, height) { 302 303 this.isImage = isImage; 304 305 if (!$('#popupviewer').size() > 0) { 306 this.buildViewerWithLoader(); 307 } 308 if (!showContent || showContent === null) { 309 if (typeof (showContent) != 'undefined') { 310 this.setContentSize(width, height); 311 } 312 return this; 313 } 314 315 if (isImage) { 316 317 var img = new Image(); 318 img.src = showContent; 319 img.className = "imageContent"; 320 321 if (this.event) { 322 var elem = (this.event.target) ? this.event.target : this.event.srcElement; 323 this.page = elem.id; 324 } 325 326 var check = new checkImageRoutine(img); 327 var self = this; 328 var callback = { 329 330 image : img, 331 error : function() { 332 self.removeOldViewer(); 333 }, 334 finalize : function() { 335 336 // var height = this.image.height; 337 var selfCallback = this; 338 339 // self.setContentSize(this.image.width, height, true); 340 var callback = function(response) { 341 342 var container = document.createElement('div'); 343 container.className = 'additionalContent dokuwiki'; 344 container.innerHTML = response; 345 346 $('#popupviewer_loader_div').remove(); 347 $('#popupviewer_content').append(selfCallback.image); 348 self.contentDiv.className = 'dokuwiki'; 349 self.contentDiv.className = 'isImage'; 350 $('#popupviewer_content').append(container); 351 352 self.setContentSize(selfCallback.image.offsetWidth,selfCallback.image.offsetHeight,container.offsetHeight); 353 var style = 'width:' + self.endWidth + 'px; height:' + self.endHeight + 'px;'; 354 selfCallback.image.style.cssText = style; // Really nasty IE6 hacking! 355 selfCallback.image.setAttribute('style', style); 356 }; 357 358 var errorCallback = function() { 359 $('#popupviewer_content').append(selfCallback.image); 360 $('#popupviewer_loader_div').remove(); 361 self.contentDiv.className = 'dokuwiki'; 362 self.contentDiv.className = 'isImage'; 363 364 self.setContentSize(selfCallback.image.offsetWidth, selfCallback.image.offsetHeight); 365 var style = 'width:' + self.endWidth + 'px; height:' + self.endHeight + 'px;'; 366 selfCallback.image.style.cssText = style; // Really 367 // nasty IE6 368 // hacking! 369 selfCallback.image.setAttribute('style', style); 370 371 }; 372 373 if (self.additionalContent) { 374 callback(self.additionalContent); 375 } else { 376 self.runAJAX(callback, { 377 'call' : '_popup_load_image_meta', 378 'id' : self.additionalContentID 379 }, errorCallback); 380 } 381 382 } 383 }; 384 385 check.checkLoadImage(50, callback); 386 } else { 387 this.contentDiv.className = 'dokuwiki'; 388 this.contentDiv.innerHTML = showContent; 389 this.setContentSize(width, height, null, this.contentDiv); 390 } 391 }; 392 393 this.linkReplacer = function(matches, depth) { 394 395 var schema = matches[1]; 396 var urlpart = matches[2]; 397 398 if (urlpart.match(/^#(.*?)$/)) { 399 // ScrollToDiv 400 urlpart += "\" onclick=\"if(!event){var event=window.event;}if(event){event.cancelBubble=true;event.returnValue=false;}if(event&&event.stopPropagation){event.stopPropagation();}if(event&&event.preventDefault){event.preventDefault();}jQuery('#popupviewer_content').scrollTop=jQuery('#" 401 + ((urlpart == "#") ? "popupviewer_content" : urlpart 402 .substr(1)) + "').offsetTop;return false;"; 403 } else if (!urlpart.match(new RegExp("^(https?:\/\/|mailto:|" 404 + escape(DOKU_BASE) + ")"))) { 405 urlpart = depth + urlpart; 406 } 407 408 return schema + '="' + urlpart + '"'; 409 }; 410 411 this.callback = function(data) { 412 413 /* Reset Init Events */ 414 window.oninit = function() { 415 }; 416 417 /* check for script to be executed */ 418 var script = ""; 419 if (typeof data == "string" && data !== '') { 420 data = data.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, 421 function() { 422 if (data !== null) { 423 script += arguments[1].replace(new RegExp("(<!--\/\/--><!\\[CDATA\\[\/\/><!--|\/\/--><!\\]\\]>)", "gi"), "") + '\n'; 424 } 425 return ''; 426 }); 427 428 } 429 430 try { 431 data = self.preg_replace_callback( '/(href|src|action)="([^"]*)"/ig', self.linkReplacer, data); 432 self.displayContent(data, false, self.endWidth, self.endHeight); 433 } catch (e) { 434 alert(e); 435 return self.removeOldViewer(); 436 } 437 try { 438 eval(script + "window.oninit();"); 439 } catch (scriptE) { 440 alert("A script error occurred in PopUpViewer. This problem may not be as problematic and the site will run fine. But please get in contact with the sites owner and tell them what you did.\n\n" + scriptE); 441 } 442 }; 443 444 this.errorCallback = function(ajax) { 445 446 var id = "errorCallbackForm"; 447 $('#'+id).remove(); 448 449 var form = document.createElement("form"); 450 form.setAttribute("action", self.page); 451 form.setAttribute("method", "POST"); 452 form.id = id; 453 ajax.requestFile = self.page; 454 self.wasError = true; 455 456 document.getElementsByTagName("body")[0].appendChild(form); 457 458 // Create Completion function 459 ajax.onCompletion = function() { 460 461 if (ajax.responseXML) { 462 var dwEle = $(ajax.responseXML).find('div.dokuwiki'); 463 if (dwEle.length > 0) { 464 ajax.response = '<div class="dokuwiki">' 465 + dwEle[0].innerHTML + "</div>"; 466 } 467 } 468 469 if ( typeof self.callback == "function" ) { 470 self.callback(ajax.response); 471 } 472 if (typeof ajax.execute == "object" && ajax.execute.srcForm) { 473 $(ajax.execute.srcForm).remove(); 474 } 475 }; 476 477 // call via proxy 478 var proxy = new iframeProxy(ajax, form); 479 }; 480 481 this.loadAndDisplayPage = function(page, width, height, id, params) { 482 483 if (this.event) { 484 var elem = (this.event.target) ? this.event.target : this.event.srcElement; 485 this.page = elem.href == page ? elem.getAttribute('href') : ""; 486 } 487 488 this.endWidth = width; 489 this.endHeight = height; 490 491 var self = this; 492 493 // Set custom params 494 if ( (typeof params).toLowerCase() != "object" ) { params = {}; } 495 if ( !params.call ) { params.call = '_popup_load_file'; } 496 if ( !params.id ) { params.id = id; } 497 this.runAJAX(self.callback, params, self.errorCallback); 498 }; 499 500 this.globalEvent = function(e) { 501 502 e = e||window.event; 503 504 if ( e.keyCode ) { 505 switch( e.keyCode ) { 506 case 39: // Right 507 if ( $('#popupviewer_control_nextImage').size() > 0 && !this.getLast() ) { 508 this.dispatchClick($('popupviewer_control_nextImage')); 509 } 510 break; 511 case 37: // Left 512 if ( $('#popupviewer_control_prevoiusImage').size() > 0 && !this.getFirst() ) { 513 this.dispatchClick($('#popupviewer_control_prevoiusImage')); 514 } 515 break; 516 case 27: // Escape 517 this.removeOldViewer(); 518 break; 519 } 520 } 521 522 return; 523 }; 524 525 this.runAJAX = function(callback, options, errorCallback, url) { 526 527 var trackLink = url; 528 if (typeof url == "undefined") { 529 url = DOKU_BASE + 'lib/exe/ajax.php'; 530 } 531 532 var ajax = new sack(url); 533 ajax.AjaxFailedAlert = function() {}; 534 ajax.encodeURIString = true; 535 ajax.onCompletion = function() { 536 537 if ((ajax.response === "" || (typeof ajax.xmlhttp.status != "undefined" && ajax.xmlhttp.status != 200)) 538 && typeof errorCallback == "function") { 539 errorCallback(ajax); 540 return true; 541 } 542 543 // Google Ping 544 if ( typeof googleanalytics_trackLink != "undefined" ) { 545 googleanalytics_trackLink(trackLink); 546 } 547 if ( typeof callback == "function" ) { 548 callback(ajax.response); 549 } 550 }; 551 552 for ( var option in options) { 553 if (option === null || options[option] === null ) { 554 continue; 555 } 556 ajax.setVar(option, options[option]); 557 if ( option == 'id' ) { trackLink = "/" + options[option].replace(new RegExp(":", "g"), "/"); } 558 } 559 560 try { 561 ajax.runAJAX(); 562 } catch (e) { 563 if (typeof errorCallback != "undefined") { 564 errorCallback(ajax); 565 } 566 } 567 }; 568 569 this.preg_replace_callback = function(pattern, callback, subject, limit) { 570 // Perform a regular expression search and replace using a callback 571 // 572 // discuss at: http://geekfg.net/ 573 // + original by: Francois-Guillaume Ribreau (http://fgribreau) 574 // * example 1: 575 // preg_replace_callback("/(\\@[^\\s,\\.]*)/ig",function(matches){return 576 // matches[0].toLowerCase();},'#FollowFriday @FGRibreau @GeekFG',1); 577 // * returns 1: "#FollowFriday @fgribreau @GeekFG" 578 // * example 2: 579 // preg_replace_callback("/(\\@[^\\s,\\.]*)/ig",function(matches){return 580 // matches[0].toLowerCase();},'#FollowFriday @FGRibreau @GeekFG'); 581 // * returns 2: "#FollowFriday @fgribreau @geekfg" 582 583 limit = !limit ? -1 : limit; 584 585 var _check = pattern.substr(0, 1), _flag = pattern.substr(pattern 586 .lastIndexOf(_check) + 1), _pattern = pattern.substr(1, pattern 587 .lastIndexOf(_check) - 1), reg = new RegExp(_pattern, _flag), rs = null, res = [], x = 0, list = [], depth = "", ret = subject; 588 589 String.prototype.repeat = function(num) { 590 return new Array(num + 1).join(this); 591 }; 592 593 // This may generate urls like "../test/../test" 594 if ( !this.page ) { this.page = ""; } 595 depth = this.page.substr(0, this.page.lastIndexOf("/") + 1); 596 597 if (limit === -1) { 598 var tmp = []; 599 600 do { 601 tmp = reg.exec(subject); 602 if (tmp !== null) { 603 res.push(tmp); 604 } 605 } while (tmp !== null && _flag.indexOf('g') !== -1); 606 } else { 607 res.push(reg.exec(subject)); 608 } 609 610 for (x = res.length - 1; x > -1; x--) {// explore match 611 if (!list[res[x][0]]) { 612 ret = ret.replace(new RegExp(res[x][0], "g"), callback(res[x], 613 depth)); 614 list[res[x][0]] = true; 615 } 616 } 617 return ret; 618 }; 619 620 this.init = function(event) { 621 if (!event) { 622 var event = window.event; 623 } 624 if (event) { 625 event.cancelBubble = true; 626 event.returnValue = false; 627 if (event.stopPropagation) { 628 event.stopPropagation(); 629 } 630 if (event.preventDefault) { 631 event.preventDefault(); 632 } 633 } 634 this.event = event; 635 }; 636 637 this.removeOldViewer(); 638 this.displayContent(showContent, isImage, width, height); 639}; 640 641var checkImageRoutine = function(inputImage) { 642 643 this.image = null; 644 this.counter = 500; 645 this.isFinished = false; 646 647 this.checkImages = function() { 648 649 var isOK = this.isImageOk(); 650 if (!isOK && this.counter > 0) { 651 this.counter--; 652 return false; 653 } 654 655 if (isOK) { 656 this.isFinished = true; 657 } 658 return true; 659 }; 660 661 this.isImageOk = function(img) { 662 663 if (this.isFinished) { 664 return true; 665 } 666 667 if (!img) { 668 img = this.image; 669 } 670 // During the onload event, IE correctly identifies any images 671 // that weren't downloaded as not complete. Others should too. 672 // Gecko-based browsers act like NS4 in that they imageflow this 673 // incorrectly: they always return true. 674 if (!img.complete) { 675 return false; 676 } 677 678 // However, they do have two very useful properties: naturalWidth 679 // and naturalHeight. These give the true size of the image. If 680 // it failed to load, either of these should be zero. 681 if (typeof img.naturalWidth != "undefined" && img.naturalWidth === 0) { 682 return false; 683 } 684 685 // No other way of checking: assume it's ok. 686 return true; 687 }; 688 689 this.checkLoadImage = function(count, callback) { 690 691 if (!count || count === 0) { 692 if (callback && callback.error) { 693 callback.error(); 694 } 695 return false; 696 } 697 if (!this.isImageOk()) { 698 var self = this; 699 setTimeout(function() { 700 self.checkLoadImage(count - 1, callback); 701 }, 100); 702 return; 703 } 704 705 if (callback && callback.finalize) { 706 callback.finalize(); 707 } 708 return true; 709 }; 710 711 this.finish = function() { 712 this.counter = 0; 713 }; 714 715 this.image = inputImage; 716 this.image.onload = this.finish; 717 this.image.onabord = this.finish; 718}; 719 720var iframeProxy = function(ajax, srcForm) { 721 722 // Setup 723 var self = this; 724 725 if ( jQuery ) { 726 var $ = jQuery; 727 } 728 729 this.iframe = null; 730 this.ajax = ajax; 731 this.error = false; 732 this.srcForm = srcForm; 733 this.src = typeof this.ajax.requestFile != 'undefined' && this.ajax.requestFile !== null ? this.ajax.requestFile : this.srcForm.getAttribute('action'); 734 735 this.onCompletion = function(self) { 736 737 try { 738 self.ajax.responseXML = window.frames[self.iframe.id].document; 739 } catch (e) { 740 try { 741 self.ajax.response = window.frames[self.iframe.id].document.body.innerHTML; 742 } catch (ee) { /* DEAD END */ 743 } 744 } 745 746 self.ajax.execute = self; 747 748 try { 749 self.ajax.onCompletion(); 750 } catch (ee) { 751 self.error = ee; 752 alert(ee); 753 return false; 754 } 755 756 // Clean Up 757 var self2 = self; 758 window.setTimeout(function() { 759 if (self2.iframe) { 760 $(self2.iframe).remove(); 761 } 762 }, 500); 763 764 return true; 765 }; 766 767 if ( typeof this.src == 'undefined' ) { 768 self.onCompletion(self); 769 return; 770 } 771 772 this.name = "iframeProxy" 773 + escape(this.src.replace(new RegExp("[\\W]", "g"), "")) + "_" 774 + Math.round(Math.random() * 1000000); 775 776 777 // Return on duplicate 778 if ($('#'+this.name).size() > 0) { 779 this.error = "iframe exists"; 780 return; 781 } 782 783 // Build Frame 784 this.iframe = document.createElement("iframe"); 785 786 this.iframe.src = this.src; 787 this.iframe.name = this.name; 788 this.iframe.id = this.name; 789 this.iframe.width = "0px"; 790 this.iframe.height = "0px"; 791 this.iframe.style.display = "none"; 792 this.iframe.frameBorder = false; 793 794 var wrapEvent = function() { 795 self.onCompletion(self); 796 }; 797 798 $(this.iframe).load(wrapEvent); 799 800 try { 801 document.getElementsByTagName("body")[0].appendChild(this.iframe); 802 this.srcForm.target = this.name; 803 this.srcForm.onsubmit = function() { 804 }; 805 806 $(this.iframe).load(wrapEvent); 807 // Stupid Event Creation in Iframes 808 if (this.iframe.addEventListener) { 809 this.iframe.addEventListener('load', wrapEvent, false); 810 } else if (this.iframe.attachEvent) { 811 this.iframe.attachEvent('onload', wrapEvent); 812 } else { 813 this.srcForm.submit(); 814 } 815 816 } catch (e) { /* DEAD END */ 817 this.error = e; 818 alert("Dead End: " + e); 819 } 820};