1/* 2Taken From:: 3 Created By: Chris Campbell 4 Website: http://particletree.com 5 Date: 2/1/2006 6 7 Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ 8 9Modified By:: 10 Brian Smith - DNZoom 11*/ 12 13/*-------------------------------GLOBAL VARIABLES------------------------------------*/ 14 15var detect = navigator.userAgent.toLowerCase(); 16var OS,browser,version,total,thestring; 17 18/*-----------------------------------------------------------------------------------------------*/ 19 20//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/ 21 22function getBrowserInfo() { 23 if (checkIt('konqueror')) { 24 browser = "Konqueror"; 25 OS = "Linux"; 26 } 27 else if (checkIt('safari')) browser = "Safari"; 28 else if (checkIt('omniweb')) browser = "OmniWeb"; 29 else if (checkIt('opera')) browser = "Opera"; 30 else if (checkIt('webtv')) browser = "WebTV"; 31 else if (checkIt('icab')) browser = "iCab"; 32 else if (checkIt('msie')) browser = "Internet Explorer"; 33 else if (!checkIt('compatible')) { 34 browser = "Netscape Navigator" 35 version = detect.charAt(8); 36 } 37 else browser = "An unknown browser"; 38 39 if (!version) version = detect.charAt(place + thestring.length); 40 41 if (!OS) { 42 if (checkIt('linux')) OS = "Linux"; 43 else if (checkIt('x11')) OS = "Unix"; 44 else if (checkIt('mac')) OS = "Mac" 45 else if (checkIt('win')) OS = "Windows" 46 else OS = "an unknown operating system"; 47 } 48} 49 50function checkIt(string) { 51 place = detect.indexOf(string) + 1; 52 thestring = string; 53 return place; 54} 55 56/*-----------------------------------------------------------------------------------------------*/ 57 58$(window).one('load', getBrowserInfo); 59$(window).one('load', addLightboxMarkup); 60//Event.observe(window, 'unload', Event.unloadCache, false); 61 62var Lightbox = { 63 content : '', 64 65 yPos : 0, 66 xPos : 0, 67 68 hOrig : 0, 69 wOrig : 0, 70 71 // specific for confirm 72 callback : '', 73 callbackArgs : '', 74 75 76 // Turn everything on - mainly the IE fixes 77 activate: function(){ 78 Lightbox.prepare(); 79 return Lightbox.displayLightbox("block"); 80 }, 81 82 prepare: function() { 83 if (browser == 'Internet Explorer'){ 84 Lightbox.getScroll(); 85 Lightbox.prepareIE('100%', 'hidden'); 86 Lightbox.setScroll(0,0); 87// Lightbox.hideSelects('hidden'); 88 } 89 return true; 90 }, 91 92 // Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox 93 prepareIE: function(height, overflow) { 94 bod = $(document.getElementsByTagName('body')[0]); 95 bod.height(height); 96 bod.css('overflow', overflow); 97 98 htm = $(document.getElementsByTagName('html')[0]); 99 htm.height(height); 100 htm.css('overflow', overflow); 101 return true; 102 }, 103 104 // In IE, select elements hover on top of the lightbox 105 hideSelects: function(visibility){ 106 selects = document.getElementsByTagName('select'); 107 for(i = 0; i < selects.length; i++) { 108 $(selects[i]).css('visibility', visibility); 109 } 110 return true; 111 }, 112 113 // Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ 114 getScroll: function(){ 115 if (self.pageYOffset) { 116 Lightbox.yPos = self.pageYOffset; 117 } else if (document.documentElement && document.documentElement.scrollTop){ 118 Lightbox.yPos = document.documentElement.scrollTop; 119 } else if (document.body) { 120 Lightbox.yPos = document.body.scrollTop; 121 } 122 return true; 123 }, 124 125 setScroll: function(x, y){ 126 window.scrollTo(x, y); 127 return true; 128 }, 129 130 setDimensions: function(h,w) { 131 $('#lightbox').height(parseInt(h)); 132 $('#lightbox').width( parseInt(w)); 133 return true; 134 }, 135 136 displayLightbox: function(display){ 137 $('#overlay').css('display', display); 138 $('#lightbox').css('display', display); 139 140 if (display == 'block') { 141 var theDiv = '<div id="lbContent"></div>'; 142 $('#lbLoadMessage').before(theDiv); 143 return Lightbox.content = $('#lbContent'); 144 } 145 }, 146 147 // Example of creating your own functionality once lightbox is initiated 148 deactivate: function() { 149 $('#lbContent').remove(); 150 151 if (browser == "Internet Explorer"){ 152 Lightbox.setScroll(0,Lightbox.yPos); 153 Lightbox.prepareIE("auto", "auto"); 154// Lightbox.hideSelects("visible"); 155 } 156 157 Lightbox.displayLightbox("none"); 158 159 $('#lightbox').height(Lightbox.hOrig); 160 $('#lightbox').width( Lightbox.wOrig); 161 162 Lightbox.callback = ''; 163 Lightbox.callbackArgs = ''; 164 return false;
165 }, 166 167/*------------------------------ NOTICE BOXES ---------------------------------------------------*/ 168 alert: function(msg) { 169 Lightbox.setDimensions(380,610); 170 171 Lightbox.activate(); 172 Lightbox.content.append('<div style="padding:12px 15px;"><center><div style="width:100px;height:20px;text-align:center"><span class="left" style="margin-right:5px"><img src="/images/alert.png"></span><span class="left"><h2>Alert</h2></span></div></center>' 173 + '<br /><p>'+msg.toString()+'</p><br />' 174 + '<a href="javascript:void();" onClick="javascript:return Lightbox.deactivate();" class="actionbutton"><span>Continue</span></a></div>'); 175 return true; 176 }, 177 178 display: function(page, title, disable_actions, close_window_callback) { 179 Lightbox.setDimensions(380,610); 180 if (! title) 181 title = 'Help notice'; 182 if (! close_window_callback) 183 close_window_callback = 'Lightbox.deactivate()'; 184 185 Lightbox.activate(); 186 Lightbox.content.append('<div class="closelightbox"><a href="javascript:void();" onClick="javascript:return '+close_window_callback+';"><img src="/images/closelightbox.png" border="0" /></a></div><div style="padding:12px 15px;"><center><h2>'+title+'</h2></center>' 187 + '<br /><center><p id="displayDiv" style="overflow-y:auto;text-align:left;width:580px;max-height:19em"></p></center><br />' 188 + ((! disable_actions) ? '<p><a class="actionbutton" href="javascript:void();" onClick="javascript:return Lightbox.deactivate();"><span>Continue</span></a>' : '' ) +'</p></div>'); 189 190 $('#displayDiv').load(page); 191 return true; 192 }, 193 194 confirm : function(msg, callback, args) { 195 Lightbox.callback = callback; 196 Lightbox.callbackArgs = args; 197 198 Lightbox.setDimensions(380,610); 199 Lightbox.activate(); 200 201 Lightbox.content.append('<div style="padding:12px 15px;"><center><div style="width:180px;height:20px;text-align:center"><span class="left" style="margin-right:5px"><img src="/images/confirmicon.png"></span><span class="left"><h2>Please confirm</h2></span></div></center>' 202 + '<br /><p>'+msg.toString()+'</p><br />' 203 + '<a href="#" onClick="javascript:return Lightbox.confirmResponse();" class="actionbutton"><span>Yes</span></a>' 204 + '<a href="#" onClick="javascript:return Lightbox.deactivate();" class="actionbutton"><span>No</span></a></div>'); 205 return true; 206 }, 207 208 confirmResponse : function() { 209 Lightbox.callback( Lightbox.callbackArgs ); 210 Lightbox.deactivate(); 211 return true; 212 } 213}; 214 215/*-----------------------------------------------------------------------------------------------*/ 216 217// Add in markup necessary to make this work. Basically two divs: 218// Overlay holds the shadow 219// Lightbox is the centered square that the content is put into. 220function addLightboxMarkup() { 221 $('body').append('<div id="overlay"><div id="lightbox" class="loading"><div id="lbLoadMessage"><p>Loading</p></div></div></div>'); 222 Lightbox.hOrig = $('#lightbox').height(); 223 Lightbox.wOrig = $('#lightbox').width(); 224 return true; 225}
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.