PageSourceSearch

https://gazetazn.com.br/imagens/iBox/ibox.js

js gazetazn.com.br collected 2026-10-03 00:03:36 UTC 28,460 bytes, 849 lines download raw bytes

1/**
2 * iBox 2.2 (Build 1612)
3 * For more info & download: http://www.ibegin.com/labs/ibox/
4 * Created as a part of the iBegin Labs Project - http://www.ibegin.com/labs/
5 * For licensing please see readme.html (MIT Open Source License)
6 *** ATENÇÃO  *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO
7 *** ATENÇÃO 
8 *** ATENÇÃO: variáveis trocadas por ibox_ para não conflitar com outro script
9 *** ATENÇÃO: inserida rotina para retirar o www. quando o visitante não insere isso na chamada do site
10 *** ATENÇÃO 
11 *** ATENÇÃO 
12 *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO *** ATENÇÃO 
13*/
14var iBox = function() {
15	var _pub = {
16		// label for the close link
17		close_label: 'X',
18
19		// show iframed content in the parent window
20		// this *does not* work with #containers
21		inherit_frames: false,
22
23		// how fast to fade in the overlay/ibox (this is each step in ms)
24		fade_in_speed: 0,
25		fade_out_speed: 0,
26
27		// our attribute identifier for our iBox elements
28		attribute_name: 'rel',
29		
30		// tags to hide when we show our box
31		tags_to_hide: ['select', 'embed', 'object'],
32
33		// default width of the box (when displaying html only)
34		// height is calculated automatically
35		default_width: 900,
36
37		// public version number
38		version_number: '2.2',
39		// internal build number
40		build_number: '1612',
41
42		// browser checks		
43		is_opera: navigator.userAgent.indexOf('Opera/9') != -1,
44		is_ie: navigator.userAgent.indexOf("MSIE ") != -1,
45		is_ie6: false /*@cc_on || @_jscript_version < 5.7 @*/,
46		is_firefox: navigator.appName == "Netscape" && navigator.userAgent.indexOf("Gecko") != -1 && navigator.userAgent.indexOf("Netscape") == -1,
47		is_mac: navigator.userAgent.indexOf('Macintosh') != -1,
48
49		// url for including images/external files
50		base_url: '',
51		
52		/**
53		 * Updates the base_url variable.
54		 * @param {String} path Relative or absolute path to this file.
55		 */
56		setPath: function(path) {
57			_pub.base_url = path;
58		},
59		
60		/**
61		 * Checks a container for specified tags containing rel="ibox"
62		 * @param {Object} container
63		 * @param {String} tag_name
64		 */
65		checkTags: function(ibox_container, ibox_tag_name) {
66			if (!ibox_container) var ibox_container = document.body;
67			if (!ibox_tag_name) var ibox_tag_name = 'a';
68			var ibox_els = ibox_container.getElementsByTagName(ibox_tag_name);
69			for (var i=0; i<ibox_els.length; i++) {
70				if (ibox_els[i].getAttribute(_pub.attribute_name)) {
71					var t = ibox_els[i].getAttribute(_pub.attribute_name);
72					if ((t.indexOf("ibox") != -1) || t.toLowerCase() == "ibox") { // check if this element is an iBox element
73						ibox_els[i].onclick = _pub.handleTag;
74					}
75				}
76			}
77		},
78		
79		/**
80		 * Binds arguments to a callback function
81		 */
82		bind: function(fn) {
83				var args = [];
84				for (var n=1; n<arguments.length; n++) args.push(arguments[n]);
85				return function(e) { return fn.apply(this, [e].concat(args)); };
86		},
87
88		/**
89		 * Sets the content of the ibox
90		 * @param {String} content HTML content
91		 * @param {Object} ibox_params
92		 */
93		html: function(content, ibox_params) {
94			if (content === undefined) return ibox_els.content;
95			if (ibox_params === undefined) var ibox_params = {};
96			if (!active.is_loaded) return;
97			_pub.clear();
98
99			_pub.updateObject(ibox_els.wrapper.style, {display: 'block', visibility: 'hidden', left: 0, top: 0, height: '', width: ''});
100			
101			if (typeof(content) == 'string') ibox_els.content.innerHTML = content;
102			else ibox_els.content.appendChild(content);
103
104			var pagesize = _pub.getPageSize();
105
106			if (ibox_params.can_resize === undefined) ibox_params.can_resize = true;
107			if (ibox_params.fade_in === undefined) ibox_params.use_fade = true;
108
109			if (ibox_params.fullscreen) {
110				ibox_params.width = '100%';
111				ibox_params.height = '100%';
112			}
113			
114			// reset offsets
115			offset.ibox_container = [ibox_els.wrapper.offsetLeft*2, ibox_els.wrapper.offsetTop*2];
116			offset.wrapper = [ibox_els.wrapper.offsetWidth-ibox_els.content.offsetWidth, ibox_els.wrapper.offsetHeight-ibox_els.content.offsetHeight];
117
118			// TODO: remove the +4 when issue is solved with calculations
119			offset.wrapper[1] += 4;
120
121			if (ibox_params.width) var width = ibox_params.width;
122			else var width = _pub.default_width;
123
124			if (ibox_params.height) var height = ibox_params.height;
125			else {
126				ibox_els.content.style.height = '100%';
127				var height = ibox_els.content.offsetHeight + 12;
128				ibox_els.content.style.height = '';
129			}
130			active.dimensions = [width, height];
131			active.ibox_params = ibox_params;
132			_pub.reposition();
133
134			// XXX: Fix for inline containers which had elements that were hidden
135			for (var i=0; i<_pub.tags_to_hide.length; i++) {
136				showTags(_pub.tags_to_hide[i], ibox_els.content);
137			}
138
139			ibox_els.wrapper.style.visibility = 'visible';
140		},
141		
142		/**
143		 * Empties the content of the iBox (also hides the loading indicator)
144		 */
145		clear: function() {
146			ibox_els.loading.style.display = "none";
147			while (ibox_els.content.firstChild) ibox_els.content.removeChild(ibox_els.content.firstChild);
148		},
149		
150		/**
151		 * Loads text into the ibox
152		 * @param {String} text
153		 * @param {String} title
154		 * @param {Object} ibox_params
155		 */
156		show: function(text, title, ibox_params) {
157			showInit(title, ibox_params, function() {
158				_pub.html(text, active.ibox_params);
159			});
160		},
161		/**
162		 * Loads a url into the ibox
163		 * @param {String} url
164		 * @param {String} title
165		 * @param {Object} ibox_params
166		 */
167		showURL: function(url, title, ibox_params) {
168			showInit(title, ibox_params, function() {
169				for (var i=0; i<_pub.plugins.list.length; i++) {
170					var plugin = _pub.plugins.list[i];
171					if (plugin.match(url)) {
172						active.plugin = plugin;
173						plugin.render(url, active.ibox_params);
174						break;
175					}
176				}
177			});
178		},
179
180		/**
181		 * Hides the iBox
182		 */
183		hide: function() {
184			if (active.plugin) {
185				// call the plugins unload method
186				if (active.plugin.unload) active.plugin.unload();
187			}
188			active = {}
189			_pub.clear();
190			// restore elements that were hidden
191			for (var i=0; i<_pub.tags_to_hide.length; i++) showTags(_pub.tags_to_hide[i]);
192
193			ibox_els.loading.style.display = 'none';
194			ibox_els.wrapper.style.display = 'none';
195			_pub.fade(ibox_els.overlay, _pub.getOpacity(null, ibox_els.overlay), 0, _pub.fade_out_speed, function() { ibox_els.overlay.style.display = 'none';});
196			_pub.fireEvent('hide');
197		},
198
199		/**
200		 * Repositions the iBox wrapper based on the ibox_params set originally.
201		 */
202		reposition: function() {
203			if (!active.is_loaded) return;
204
205			// center loading box
206			if (ibox_els.loading.style.display != 'none') _pub.center(ibox_els.loading);
207			
208			// update ibox width/height/position
209			if (active.dimensions) {
210				var pagesize = _pub.getPageSize();
211
212				var width = active.dimensions[0];
213				var height = active.dimensions[1];
214				
215				if (height.toString().indexOf('%') != -1) {
216					ibox_els.wrapper.style.height = (Math.max(document.documentElement.clientHeight, document.body.clientHeight, pagesize.height) - offset.ibox_container[0])*(parseInt(height)/100) + 'px';
217				}
218				else if (height) {
219					ibox_els.content.style.height = height + 'px';
220					// TODO: if we dont set wrapper height, it doesnt restrict the height and the box is fine
221					// so offset.wrapper[1] must not be correct
222					ibox_els.wrapper.style.height = ibox_els.content.offsetHeight + offset.wrapper[1] + 'px';
223				}
224				else {
225					ibox_els.wrapper.style.height = ibox_els.content.offsetHeight + offset.wrapper[1] + 'px';
226				}
227				var container_offset = (ibox_els.content.offsetHeight - ibox_els.content.firstChild.offsetHeight);
228				if (width.toString().indexOf('%') != -1) {
229					ibox_els.wrapper.style.width = (Math.max(document.documentElement.clientWidth, document.body.clientWidth, pagesize.width) - offset.ibox_container[1])*(parseInt(width)/100) + 'px';
230					var ibox_container_offset = 0;
231				}
232				else {
233					ibox_els.content.style.width = width + 'px';
234					ibox_els.wrapper.style.width = ibox_els.content.offsetWidth + offset.wrapper[0] + 'px';
235				}
236
237				_pub.updateObject(ibox_els.content.style, {width: '', height: ''});
238
239				var width = parseInt(ibox_els.wrapper.style.width);
240				var height = parseInt(ibox_els.wrapper.style.height);
241
242				// if we can resize this, make sure it fits in our page bounds
243				if (active.ibox_params.can_resize) {
244					var x = pagesize.width;
245					var y = pagesize.height;
246					
247					x -= offset.ibox_container[0];
248					y -= offset.ibox_container[1];
249					if (width > x) {
250						if (active.ibox_params.constrain) height = height * (x/width);
251						width = x;
252					}
253					if (height > y) {
254						if (active.ibox_params.constrain) width = width * (y/height);
255						height = y;
256					}
257					_pub.updateObject(ibox_els.wrapper.style, {width: width + 'px', height: height + 'px'});
258				}
259
260				//ibox_els.content.style.width = width - offset.wrapper[0] + 'px';
261				// TODO: this isn't adjusting to the right height for containers that are smaller than the page height
262				// resize the wrappers height based on the content boxes height
263				// this needs to be height - ibox_content[margin+padding+border]
264				ibox_els.content.style.height = height - offset.wrapper[1] + 'px';
265				if (active.dimensions != ['100%', '100%']) _pub.center(ibox_els.wrapper);
266			}
267			
268			// fix overlay width/height (cant use css fixed on ie6 or fx or any
269			// browser really due to issues)
270			ibox_els.overlay.style.height = Math.max(document.body.clientHeight, document.documentElement.clientHeight) + 'px';
271		},
272
273		updateObject: function(obj, ibox_params) {
274			for (var i in ibox_params) obj[i] = ibox_params[i];
275		},
276
277		/**
278		 * Centers an object
279		 * @param {Object} obj
280		 */
281		center: function(obj) {
282			var pageSize = _pub.getPageSize();
283			var scrollPos = _pub.getScrollPos();
284			var emSize = _pub.getElementSize(obj);
285			var x = Math.round((pageSize.width - emSize.width) / 2 + scrollPos.scrollX);
286			var y = Math.round((pageSize.height - emSize.height) / 2 + scrollPos.scrollY);
287			if (obj.offsetLeft) x -= obj.offsetLeft;
288			if (obj.offsetTop) y -= obj.offsetTop;
289			if (obj.style.left) x += parseInt(obj.style.left);
290			if (obj.style.top) y += parseInt(obj.style.top);
291			// this nearly centers it due to scrollbars
292			x -= 10;
293			_pub.updateObject(obj.style, {top: y + 'px', left: x + 'px'});
294		},
295		
296		getStyle: function(obj, styleProp) {
297			if (obj.currentStyle)
298				return obj.currentStyle[styleProp];
299			else if (window.getComputedStyle)
300				return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
301		},
302
303		/**
304		 * Gets the scroll positions
305		 */
306		getScrollPos: function() {
307			var docElem = document.documentElement;
308			return {
309				scrollX: document.body.scrollLeft || window.pageXOffset || (docElem && docElem.scrollLeft),
310				scrollY: document.body.scrollTop || window.pageYOffset || (docElem && docElem.scrollTop)
311			};
312		},
313
314		/**
315		 * Gets the page constraints
316		 */
317		getPageSize: function() {
318			return {
319				width: window.innerWidth || (document.documentElement && document.documentElement.clientWidth) || document.body.clientWidth,
320				height: window.innerHeight || (document.documentElement && document.documentElement.clientHeight) || document.body.clientHeight
321			};
322		},
323
324		/**
325		 * Gets an objects offsets
326		 * @param {Object} obj
327		 */
328		getElementSize: function(obj) {
329			return {
330				width: obj.offsetWidth || obj.style.pixelWidth,
331				height: obj.offsetHeight || obj.style.pixelHeight
332			};
333		},
334		
335		fade: function(obj, start, end, speed, callback) {
336//inseri comando em 04/04/2011
337var start = 0;
338var end = 1;
339var speed = 0;		
340			if (start === undefined || !(start >= 0) || !(start <= 100)) var start = 0;
341			if (end === undefined || !(end >= 0) || !(end <= 100)) var end = 100;
342			if (speed === undefined) var speed = 0;
343
344			if (obj.fader) clearInterval(obj.fader);
345
346			if (!speed) {
347				_pub.setOpacity(null, obj, end);
348				if (callback) callback();
349			}
350			
351			var opacity_difference = end - start; 
352			var time_total = speed; // time is speed (jQuery compat)
353			var step_size = 25; // step size in ms
354			var steps = time_total / step_size; // total number of steps
355			var increment = Math.ceil(opacity_difference / steps); // how much to incr per step
356			
357			obj.fader = setInterval(_pub.bind(function(e, obj, increment, end, callback) {
358				var opacity = _pub.getOpacity(e, obj) + increment;
359				_pub.setOpacity(e, obj, opacity);
360				if ((increment < 0 && opacity <= end) || (increment > 0 && opacity >= end)) {
361					_pub.setOpacity(e, obj, end);
362					clearInterval(obj.fader);
363					if (callback) callback();
364				}
365			}, obj, increment, end, callback), step_size);
366		},
367
368		/**
369		 * Sets the opacity of an element
370		 * @param {Object} obj
371		 * @param {Integer} value
372		 */
373		setOpacity: function(e, obj, value) {
374			value = Math.round(value);
375			obj.style.opacity = value/100;
376			obj.style.filter = 'alpha(opacity=' + value + ')';
377		},
378		
379		/**
380		 * Gets the opacity of an element
381		 * @param {Object} obj
382		 * @return {Integer} value
383		 */
384		getOpacity: function(e, obj) {
385			return _pub.getStyle(obj, 'opacity')*100;
386		},
387		
388		/**
389		 * Creates a new XMLHttpRequest object based on browser
390		 */
391		createXMLHttpRequest: function() {
392			var ibox_http;
393			if (window.XMLHttpRequest) { // Mozilla, Safari,...
394				ibox_http = new XMLHttpRequest();
395				if (ibox_http.overrideMimeType) {
396					// set type accordingly to anticipated content type
397					ibox_http.overrideMimeType('text/html');
398				}
399			}
400			else if (window.ActiveXObject) { // IE
401				try {
402					ibox_http = new ActiveXObject("Msxml2.XMLHTTP");
403				} catch (e) {
404					try {
405						ibox_http = new ActiveXObject("Microsoft.XMLHTTP");
406					} catch (e) {}
407				}
408			}
409			if (!ibox_http) {
410				alert('Cannot create XMLHTTP instance');
411				return false;
412			}
413			return ibox_http;
414		},
415		
416		addEvent: function(obj, evType, fn) {
417			if (obj.addEventListener) {
418				obj.addEventListener(evType, fn, false);
419				return true;
420			}
421			else if (obj.attachEvent) {
422				var r = obj.attachEvent("on"+evType, fn);
423				return r;
424			}
425			else {
426				return false;
427			}
428		},
429		
430		addEventListener: function(name, callback) {
431			if (!events[name]) events[name] = new Array();
432			events[name].push(callback);
433		},
434		
435		/**
436		 * Causes all event listeners attached to `name` event to
437		 * execute.
438		 * @param {String} name Event name
439		 */
440		fireEvent: function(name) {
441				if (events[name] && events[name].length) {
442					for (var i=0; i<events[name].length; i++) {
443						var args = [];
444						for (var n=1; n<arguments.length; n++) args.push(arguments[n]);
445						// Events returning false stop propagation
446						if (events[name][i](args) === false) break;
447					}
448				}
449		},
450		
451		/**
452		 * Parses the arguments in the rel attribute
453		 * @param {String} query
454		 */
455		parseQuery: function(query) {
456			 var ibox_params = new Object();
457			 if (!query) return ibox_params; 
458			 var pairs = query.split(/[;&]/);
459			 var end_token;
460			 for (var i=0; i<pairs.length; i++) {
461					var keyval = pairs[i].split('=');
462					if (!keyval || keyval.length != 2) continue;
463					var key = unescape(keyval[0]);
464					var val = unescape(keyval[1]);
465					val = val.replace(/\+/g, ' ');
466					if (val[0] == '"') var token = '"';
467					else if (val[0] == "'") var token = "'";
468					else var token = null;
469					if (token) {
470						if (val[val.length-1] != token) {
471							do {
472								i += 1;
473								val += '&'+pairs[i];
474							}
475							while ((end_token = pairs[i][pairs[i].length-1]) != token)
476						}
477						val = val.substr(1, val.length-2);
478					}
479					if (val == 'true') val = true;
480					else if (val == 'false') val = false;
481					else if (val == 'null') val = null;
482					ibox_params[key] = val;
483			 }
484			 return ibox_params;
485		},
486		/**
487		 * Handles the onclick event for iBox anchors.
488		 * @param {Event} e
489		 */
490		handleTag: function(e) {
491			var t = this.getAttribute('rel');
492			var ibox_params = _pub.parseQuery(t.substr(5,999));
493			if (ibox_params.target) var url = ibox_params.target;
494			else if (this.target && !ibox_params.ignore_target) var url = this.target;
495			else var url = this.href;
496			var title = this.title;
497			if (_pub.inherit_frames && window.parent) window.parent.iBox.showURL(url, title, ibox_params);
498			else _pub.showURL(url, title, ibox_params);
499			return false;
500		},
501		
502		plugins: {
503			list: new Array(),
504			register: function(func, ibox_last) {
505				if (ibox_last === undefined) var ibox_last = false;
506				if (!ibox_last) {
507					_pub.plugins.list = [func].concat(_pub.plugins.list);
508				}
509				else {
510					_pub.plugins.list.push(func);
511				}
512			}
513		}
514	};
515	
516	// private methods and variables
517	var active = {};
518	
519	// events
520	var events = {};
521
522	// some containers
523	// we store these in memory instead of finding them each time
524	var ibox_els = {};
525	
526	var offset = {};
527	
528	/**
529	 * Creates the iBox container and appends it to an element
530	 * @param {HTMLObject} elem Container to attach to
531	 * @return {HTMLObject} iBox element
532	 */
533	var create = function(elem) {
534		pagesize = _pub.getPageSize();
535		
536		// TODO: why isnt this using DOM tools
537		// a trick on just creating an ibox wrapper then doing an innerHTML on our root ibox element
538		ibox_els.ibox_container = document.createElement('div');
539		ibox_els.ibox_container.id = 'ibox';
540
541		ibox_els.overlay = document.createElement('div');
542		ibox_els.overlay.style.display = 'none';
543		_pub.setOpacity(null, ibox_els.overlay, 0);
544		// firefox mac has issues with opacity and flash
545		if (!_pub.is_firefox) ibox_els.overlay.style.background = '#ffffff';
546		else ibox_els.overlay.style.backgroundImage = "url('" + _pub.base_url + "images/bg.png')";
547		ibox_els.overlay.id = 'ibox_overlay';
548		ibox_params = {position: 'absolute', top: 0, left: 0, width: '100%'};
549		_pub.updateObject(ibox_els.overlay.style, ibox_params);
550		ibox_els.overlay.onclick = _pub.hide;
551		ibox_els.ibox_container.appendChild(ibox_els.overlay);
552
553		ibox_els.loading = document.createElement('div');
554		ibox_els.loading.id = 'ibox_loading';
555		ibox_els.loading.innerHTML = 'Loading...';
556		ibox_els.loading.style.display = 'none';
557		ibox_els.loading.onclick = _pub.hide
558		ibox_els.ibox_container.appendChild(ibox_els.loading);
559
560		ibox_els.wrapper = document.createElement('div')
561		ibox_els.wrapper.id = 'ibox_wrapper';
562		_pub.updateObject(ibox_els.wrapper.style, {position: 'absolute', top: 0, left: 0, display: 'none'});
563
564		ibox_els.content = document.createElement('div');
565		ibox_els.content.id = 'ibox_content';
566		_pub.updateObject(ibox_els.content.style, {overflow: 'auto'})
567		ibox_els.wrapper.appendChild(ibox_els.content);
568	
569		var child = document.createElement('div');
570		child.id = 'ibox_footer_wrapper';
571	
572		var child2 = document.createElement('a');
573		child2.innerHTML = _pub.close_label;
574		child2.href = 'javascript:void(0)';
575		child2.onclick = _pub.hide;
576		child.appendChild(child2);
577	
578		ibox_els.footer = document.createElement('div');
579		ibox_els.footer.id = 'ibox_footer';
580		ibox_els.footer.innerHTML = '&nbsp;';
581		child.appendChild(ibox_els.footer);
582		ibox_els.wrapper.appendChild(child);
583
584		ibox_els.ibox_container.appendChild(ibox_els.wrapper);
585
586		elem.appendChild(ibox_els.ibox_container);
587				
588		_pub.updateObject(ibox_els.wrapper.style, {right: '', bottom: ''});
589		
590		return ibox_els.ibox_container;
591	};
592	
593	/**
594	 * Hides tags within the container
595	 * @param {String} tag The name of the tag (e.g. 'a')
596	 * @param {HTMLObject} container The container to restore tags within (defaults to document)
597	 */
598	var hideTags = function(tag, ibox_container) {
599		if (ibox_container === undefined) var ibox_container = document.body;
600		var list = ibox_container.getElementsByTagName(tag);
601		for (var i=0; i<list.length; i++) {
602			if (_pub.getStyle(list[i], 'visibility') != 'hidden' && list[i].style.display != 'none') {
603				list[i].style.visibility = 'hidden';
604				list[i].wasHidden = true;
605			}
606		}
607	};
608	
609	/**
610	 * Shows all previously hidden tags in a container.
611	 * @param {String} tag The name of the tag (e.g. 'a')
612	 * @param {HTMLObject} container The container to restore tags within (defaults to document)
613	 */
614	var showTags = function(tag, ibox_container) {
615		if (ibox_container === undefined) var ibox_container = document.body;
616		var list = ibox_container.getElementsByTagName(tag);
617		for (var i=0; i<list.length; i++) {
618			if (list[i].wasHidden) {
619				list[i].style.visibility = 'visible';
620				list[i].wasHidden = null;
621			}
622		}
623	};
624	
625	var showInit = function(title, ibox_params, callback) {
626		if (!_initialized) initialize();
627		if (ibox_params === undefined) var ibox_params = {};
628		if (active.plugin) _pub.hide();
629
630		active.is_loaded = true;
631		active.ibox_params = ibox_params;
632		
633		ibox_els.loading.style.display = "block";
634		
635		_pub.center(ibox_els.loading);
636		_pub.reposition();
637
638		// hide tags
639		for (var i=0; i<_pub.tags_to_hide.length; i++) {
640			hideTags(_pub.tags_to_hide[i]);
641		}
642
643		// set title here
644		ibox_els.footer.innerHTML = title || "&nbsp;";
645
646		// setup background
647		ibox_els.overlay.style.display = "block";
648		
649		if (!_pub.is_firefox) var amount = 70;
650		else var amount = 100;
651		_pub.fade(ibox_els.overlay, _pub.getOpacity(null, ibox_els.overlay), amount, _pub.fade_in_speed, callback);
652		
653		_pub.fireEvent('show');
654	};
655	
656	var drawCSS = function() {
657		// Core CSS (positioning/etc)
658		var core_styles = "#ibox {z-index:1000000;text-align:left;} #ibox_overlay {z-index:1000000;} #ibox_loading {position:absolute;z-index:1000001;} #ibox_wrapper {margin:30px;position:absolute;top:0;left:0;z-index:1000001;} #ibox_content {z-index:1000002;margin:27px 5px 5px 5px;padding:2px;} #ibox_content object {display:block;} #ibox_content .ibox_image {width:100%;height:100%;margin:0;padding:0;border:0;display:block;} #ibox_footer_wrapper a {float:right;display:block;outline:0;margin:0;padding:0;} #ibox_footer_wrapper {text-align:left;position:absolute;top:5px;right:5px;left:5px;white-space:nowrap;overflow:hidden;}";
659		
660		// Default style/theme/skin/whatever
661		var default_skin = "#ibox_footer_wrapper {font-weight:bold;height:20px;line-height:20px;} #ibox_footer_wrapper a {text-decoration:none;background:#888;border:1px solid #666;line-height:16px;padding:0 5px;color:#333;font-weight:bold;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;} #ibox_footer_wrapper a:hover {background-color:#999;color:#111;} #ibox_footer_wrapper {font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;color:#111;} #ibox_wrapper {border:1px solid #ccc;} #ibox_wrapper {background-color:#999;}#ibox_content {background-color:#fff;border:1px solid #666;} #ibox_loading {padding:50px; background:#000;color:#fff;font-size:16px;font-weight:bold;}";
662
663		var head = document.getElementsByTagName("head")[0];
664
665		// tricky hack for IE
666		// because IE doesn't like when you insert stuff the proper way
667		// and we cant use relative paths to include this as an external
668		// stylesheet
669		var htmDiv = document.createElement('div');
670
671		htmDiv.innerHTML = '<p>
671x</p><style type="text/css">'+default_skin+'</style>';
672		head.insertBefore(htmDiv.childNodes[1], head.firstChild);
673
674		htmDiv.innerHTML = '<p>x</p><style type="text/css">'+core_styles+'</style>';
675		head.insertBefore(htmDiv.childNodes[1], head.firstChild);
676	};
677
678	var _initialized = false;
679	var initialize = function() {
680		// make sure we haven't already done this
681		if (_initialized) return;
682		_initialized = true;
683		// elements here start the look up from the start non <a> tags
684		drawCSS();
685		var ibox_els = document.getElementsByTagName('script');
686		var src;
687		for (var i=0, el=null; (el = ibox_els[i]); i++) {
688			if (!(src = el.getAttribute('src'))) continue;
689			src = src.split('?')[0];
690			if (src.substr(src.length-8) == '/ibox.js') {
691				_pub.setPath(src.substr(0, src.length-7));
692				break;
693			}
694		}
695		create(document.body);
696		_pub.checkTags(document.body, 'a');
697		_pub.ibox_http = _pub.createXMLHttpRequest();
698		_pub.fireEvent('load');
699	};
700	
701	_pub.addEvent(window, 'keypress', function(e){ if (e.keyCode == (window.event ? 27 : e.DOM_VK_ESCAPE)) { iBox.hide(); }});
702	_pub.addEvent(window, 'resize', _pub.reposition);
703	_pub.addEvent(window, 'load', initialize);
704	_pub.addEvent(window, 'scroll', _pub.reposition);
705
706	// DEFAULT PLUGINS
707
708	/**
709	 * Handles embedded containers in the page based on url of #container.
710	 * This _ONLY_ works with hidden containers.
711	 */
712	var iBoxPlugin_Container = function() {
713		var was_error = false;
714		var original_wrapper = null;
715		return {
716			/**
717			 * Matches the url and returns true if it fits this plugin.
718			 */
719			match: function(url) {
720				return url.indexOf('#') != -1;
721			},
722			/**
723			 * Called when this plugin is unloaded.
724			 */
725			unload: function() {
726				if (was_error) return;
727				var elemSrc = _pub.html().firstChild;
728				if (elemSrc) {
729					elemSrc.style.display = 'none';
730					original_wrapper.appendChild(elemSrc);
731				}
732			},
733			/**
734			 * Handles the output
735			 * @param {iBox} ibox
736			 * @param {String} url
737			 * @return {iBoxContent} an instance or subclass of iBoxContent
738			 */
739			render: function(url, ibox_params) {
740				was_error = false;
741				var elemSrcId = url.substr(url.indexOf("#") + 1);
742				var elemSrc = document.getElementById(elemSrcId);
743				// If the element doesnt exist, break the switch
744				if (!elemSrc) {
745					was_error = true;
746					_pub.html(document.createTextNode('There was an error loading the document.'), ibox_params);
747				}
748				else {
749					original_wrapper = elemSrc.parentNode;
750					elemSrc.style.display = 'block';
751					_pub.html(elemSrc, ibox_params);
752				}
753			}
754		}
755	}();
756	_pub.plugins.register(iBoxPlugin_Container, true);
757
758	/**
759	 * Handles images
760	 */
761	var iBoxPlugin_Image = function() {
762		// Image types (for auto detection of image display)
763		var image_types = /\.jpg|\.jpeg|\.png|\.gif/gi;
764
765		return {
766			match: function(url) {
767				return url.match(image_types);
768			},
769
770			render: function(url, ibox_params) {	
771				var img = document.createElement('img');
772				img.onclick = _pub.hide;
773				img.className = 'ibox_image'
774				img.style.cursor = 'pointer';
775				img.onload = function() {
776					_pub.html(img, {width: this.width, height: this.height, constrain: true})
777				}
778				img.onerror = function() {
779					_pub.html(document.createTextNode('There was an error loading the document.'), ibox_params);
780				}
781				img.src = url;
782			}
783		}
784	}();
785	_pub.plugins.register(iBoxPlugin_Image);
786
787	var iBoxPlugin_YouTube = function() {
788		var youtube_url = /(?:http:\/\/)?(?:www\d*\.)?(youtube\.(?:[a-z]+))\/(?:v\/|(?:watch(?:\.php)?)?\?(?:.+&)?v=)([^&]+).*/;
789		return {
790			match: function(url) {
791				return url.match(youtube_url);
792			},
793
794			render: function(url, ibox_params) {
795				var _match = url.match(youtube_url);
796				var domain = _match[1];
797				var id = _match[2];
798				ibox_params.width = 425;
799				ibox_params.height = 355;
800				ibox_params.constrain = true;
801				var html = '<span><object width="100%" height="100%" style="overflow: hidden; display: block;"><param name="movie" value="http://www.' + domain + '/v/' + id + '"/><param name="wmode" value="transparent"/><embed src="http://www.' + domain + '/v/' + id + '" type="application/x-shockwave-flash" wmode="transparent" width="100%" height="100%"></embed></object></span>';
802				_pub.html(html, ibox_params);
803			}
804		}
805	}();
806	_pub.plugins.register(iBoxPlugin_YouTube);
807
808	var iBoxPlugin_Document = function() {
809		return {
810			match: function(url) {
811				return true;
812			},
813
814			render: function(url, ibox_params) {
815				// para ajustar para quem digita sem o www no endereço
816				// criado em 11/04/2011
817				// retira o www se o visitante não colocou no endereço
818				var ibox_url_site = document.location.href;
819				var ibox_apoio = (ibox_url_site.substr(7,4));
820				if (ibox_apoio != "www.") {
821					url = url.replace("www.","");
822				};
823				_pub.ibox_http.open('get', url, true);
824
825				_pub.ibox_http.onreadystatechange = function() {
826					if (_pub.ibox_http.readyState == 4) {
827						// XXX: why does status return 0?
828						if (_pub.ibox_http.status == 200 || _pub.ibox_http.status == 0) {
829							_pub.html(_pub.ibox_http.responseText, ibox_params);
830						}
831						else {
832							_pub.html(document.createTextNode('There was an error loading the document.'), ibox_params);
833						}
834					}
835				}
836				_pub.ibox_http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
837				try {
838					_pub.ibox_http.send(null);
839				}
840				catch (ex) {
841					_pub.html(document.createTextNode('There was an error loading the document.'), ibox_params);
842				}
843			}
844		};
845	}();
846	_pub.plugins.register(iBoxPlugin_Document, true);
847
848	return _pub;
849}();

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.