2 //\ overLIB Hide Form Plugin
4 //\ Uses an iframe shim to mask system controls for IE v5.5 or higher as suggested in
5 //\ http://dotnetjunkies.com/weblog/jking/posts/488.aspx
6 //\ This file requires overLIB 4.10 or later.
8 //\ overLIB 4.05 - You may not remove or change this notice.
9 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
10 //\ Contributors are listed on the homepage.
11 //\ See http://www.bosrup.com/web/overlib/ for details.
15 if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the HideForm Plugin.');
18 // Function which generates the popup with an IFRAME shim
19 function generatePopUp(content) {
20 if(!olIe4||olOp||!olIe55||(typeof o3_shadow != 'undefined' && o3_shadow)||(typeof o3_bubble != 'undefined' && o3_bubble)) return;
22 var wd,ht,txt, zIdx = 0;
24 wd = parseInt(o3_width);
25 ht = over.offsetHeight;
26 txt = backDropSource(wd,ht,zIdx++);
27 txt += '<div style="position: absolute; top: 0; left: 0; width: '+ wd+'px; z-index: ' + zIdx + ';">' + content + '</div>';
31 // Code for the IFRAME which is used in other places
32 function backDropSource(width, height, Z) {
33 return '<iframe frameborder="0" scrolling="no" src="javascript:false;" width="' + width + '" height="' + height + '" style="z-index: ' + Z + '; filter: Beta(Style=0,Opacity=0);"></iframe>';
36 // Hides SELECT boxes that will be under the popup
37 // Checking Gecko version number to try to include other browsers based on the Gecko engine
38 function hideSelectBox() {
39 if(olNs4 || olOp || olIe55) return;
40 var px, py, pw, ph, sx, sw, sy, sh, selEl, v;
44 v = navigator.userAgent.match(/Gecko\/(\d{8})/i);
45 if(!v) return; // return if no string match
49 if (v < 20030624) { // versions less than June 24, 2003 were earlier Netscape browsers
50 px = parseInt(over.style.left);
51 py = parseInt(over.style.top);
53 ph = (o3_aboveheight ? parseInt(o3_aboveheight) : over.offsetHeight);
54 selEl = (olIe4) ? o3_frame.document.all.tags("SELECT") : o3_frame.document.getElementsByTagName("SELECT");
55 for (var i=0; i<selEl.length; i++) {
56 if(!olIe4 && selEl[i].size < 2) continue; // Not IE and SELECT size is 1 or not specified
57 sx = pageLocation(selEl[i],'Left');
58 sy = pageLocation(selEl[i],'Top');
59 sw = selEl[i].offsetWidth;
60 sh = selEl[i].offsetHeight;
61 if((px+pw) < sx || px > (sx+sw) || (py+ph) < sy || py > (sy+sh)) continue;
62 selEl[i].isHidden = 1;
63 selEl[i].style.visibility = 'hidden';
68 // Shows previously hidden SELECT Boxes
69 function showSelectBox() {
70 if(olNs4 || olOp || olIe55) return;
75 v = navigator.userAgent.match(/Gecko\/(\d{8})/i);
81 selEl = (olIe4) ? o3_frame.document.all.tags("SELECT") : o3_frame.document.getElementsByTagName("SELECT");
82 for (var i=0; i<selEl.length; i++) {
83 if(typeof selEl[i].isHidden != 'undefined' && selEl[i].isHidden) {
84 selEl[i].isHidden = 0;
85 selEl[i].style.visibility = 'visible';
91 // function gets the total offset properties of an element
92 // this same function occurs in overlib_mark.js.
93 function pageLocation(o,t){
96 while(o.offsetParent){
106 // reset mouse move routine for NS7 but not NS7.1,Opera, or IE5.5+
107 // It also bypasses Netscape 6 since the modifications mess up the display of popups
108 // and don't work anyways.
109 // Modify mouse move routine while loading so that hideSelectBox()
110 // can be called from the correct location
111 if (!(olNs4 || olOp || olIe55 || navigator.userAgent.indexOf('Netscape6') != -1)) {
112 var MMStr = olMouseMove.toString();
113 var strRe = /(if\s*\(o3_allowmove\s*==\s*1.*\)\s*)/;
114 var f = MMStr.match(strRe);
117 var ls = MMStr.search(strRe);
119 var le = MMStr.substring(ls).search(/[;|}]\n/);
120 MMStr = MMStr.substring(0,ls) + ' { runHook("placeLayer",FREPLACE); if(olHideForm) hideSelectBox(); ' + MMStr.substring(ls + (le != -1 ? le+3 : 0));
121 document.writeln('<script type="text/javascript">\n<!--\n' + MMStr + '\n//-->\n</' + 'script>');
124 f = capExtent.onmousemove.toString().match(/function[ ]+(\w*)\(/);
125 if (f&&f[1] != 'anonymous') capExtent.onmousemove = olMouseMove;
130 // PLUGIN REGISTRATIONS
132 registerHook("createPopup",generatePopUp,FAFTER);
133 registerHook("hideObject",showSelectBox,FAFTER);