1/* 2 * vil - vioma information layer 3 * 4 */ 5if (window.console && window.console.info) { 6 console.info('vioma information layer'); 7 console.info('Version 0.6'); 8} 9 10if (typeof vil_indexes == 'undefined') { 11 var vil_indexes = 1005, 12 vil_timer = {}, 13 vil_settings = {}, 14 vil_counter = 0, 15 vil_defaults = { 16 effect : 'fade', 17 delay : 750, 18 clickable : false, 19 width : 350, 20 posX : false, 21 posY : false, 22 table : false 23 }; 24 25 jQuery.fn.extend({ 26 vil: function(settings) { 27 var link = jQuery(this), 28 identifier = vil_counter++, 29 options = {}, 30 settings = settings || link.attr('rev'); 31 32 if (!link[0]) return; 33 34 if (link.attr('rev')) { 35 var parts = settings.split(';'), 36 length = parts.length; 37 38 for ( var j = 0; j < length; j++) { 39 var cur = parts[j].split(':'); 40 41 cur[0] = cur[0].replace(/^\s+/, '').replace(/\s+$/, ''); 42 cur[1] = cur[1].replace(/^\s+/, '').replace(/\s+$/, ''); 43 44 options[cur[0]] = cur[1]; 45 } 46 } 47 48 vil_settings[identifier] = jQuery.extend(false, vil_defaults, options); 49 50 if (!vil_settings[identifier].table) { 51 var table = jQuery( 'table:first.vil_content:not(.vil_table)' ); 52 53 if ( table.size() == 0 ) { 54 table = jQuery(this).siblings( 'table:first:not(.vil_table)') 55 } 56 57 table.attr('id', 'vil_element' + identifier + '_table'); 58 vil_settings[identifier].table = '#vil_element' + identifier + '_table'; 59 } else { 60 var table = jQuery(vil_settings[identifier].table); 61 } 62 63 table 64 .hide() 65 .appendTo('body') 66 .css({ 67 position : 'absolute', 68 opacity : 0 69 }) 70 .addClass('vil_table') 71 .bind('mouseenter', function() { 72 if (vil_timer[vil_settings[identifier].table .substring(1)]) { 73 window.clearTimeout(vil_timer[jQuery(this).attr('id')]); 74 } 75 }) 76 .bind( 'mouseleave', function() { 77 vil_timer[vil_settings[identifier].table.substring(1)] = window.setTimeout( 78 function() { 79 delete vil_timer[vil_settings[identifier].table.substring(1)]; 80 81 if (vil_settings[identifier].effekt == 'none') { 82 table.css('display','none'); 83 } else { 84 table.animate({ opacity : 0 }, { duration: 650, queue: false }, 'linear' ); 85 86 window.setTimeout(function(){ 87 table.css('z-index',-1); 88 }, 650 ); 89 } 90 }, 91 vil_settings[identifier].delay); 92 }); 93 94 link 95 .attr('vil_element', identifier) 96 .unbind('click') 97 .bind('click', function() { 98 return vil_settings[identifier].clickable; 99 }) 100 .bind( 'mouseenter', function(j) { 101 var table = jQuery(vil_settings[identifier].table); 102 103 jQuery(this).addClass('vil_link_hover'); 104 105 if (table.length == -1) return; 106 107 if (vil_timer[table.attr('id')]) { 108 window.clearTimeout(vil_timer[table.attr('id')]); 109 } 110 111 if (vil_settings[identifier].height) { 112 table.height(vil_settings[identifier].height); 113 } 114 115 if (vil_settings[identifier].width) { 116 table.width(vil_settings[identifier].width); 117 } 118 119 var offset = jQuery(this).offset(), 120 left = offset.left + jQuery(this, j).width() + 10; 121 122 if (!vil_settings[identifier].posY) { 123 if (vil_settings[identifier].vert) { 124 if (vil_settings[identifier].vert == 'top') { 125 offset.top -= table.outerHeight(); 126 } else if (vil_settings[identifier].vert == 'bottom') { 127 offset.top += parseInt( jQuery(this, j) .height(), 10); 128 } 129 } else if ((offset.top + table.outerHeight()) > parseInt( window.pageYOffset + window.innerHeight, 10)) { 130 offset.top -= table.outerHeight(); 131 } else if (vil_settings[identifier].top) { 132 offset.top += parseInt( vil_settings[identifier].top, 10); 133 } 134 } else { 135 offset.top = vil_settings[identifier].posY; 136 } 137 138 if (!vil_settings[identifier].posX) { 139 if (left + table.outerWidth(true) > jQuery( 'body').width()) { 140 left = offset.left - table.outerWidth(true) - 10; 141 142 if (vil_settings[identifier].horz && vil_settings[identifier].horz == 'left') { 143 left += link.outerWidth(); 144 } 145 } else { 146 if (vil_settings[identifier].horz && vil_settings[identifier].horz == 'left') { 147 left -= link.outerWidth(); 148 } 149 if (vil_settings[identifier].left) {
150 left += parseInt( vil_settings[identifier].left, 10); 151 } 152 } 153 } else { 154 left = vil_settings[identifier].posX; 155 } 156 157 offset_y = 20; 158 offset_x = 20; 159 160 // wenn die box über den unteren rand 161 // gehen würde 162 if (j.screenY + table.height() > $( 163 window).height()) { 164 offset_y = -table.height(); 165 } 166 167 var top_value = j.pageY + offset_y; 168 169 if (j.pageY + offset_y < $(window).scrollTop()) { 170 top_value = $(window).scrollTop() + 10; 171 } 172 173 var left_value = j.pageX + offset_x; 174 175 if (left_value + table.width() > $(window).width()) { 176 left_value = j.pageX - offset_x - table.width() 177 } 178 if (left_value < 0) { 179 left_value = 0 180 } 181 182 table.css({ 183 'top' : top_value + 'px', 184 'left' : left_value + 'px', 185 'z-index' : vil_indexes++ 186 }) 187 188 if (vil_settings[identifier].effect == 'none') { 189 table.css({ 190 opacity : 1, 191 display : 'block' 192 }); 193 } else { 194 table.css({ 195 opacity : 0, 196 display : 'block' 197 }); 198 table.animate({ opacity : 1 }, { duration: 150, queue: false }); 199 } 200 }) 201 .bind('mouseleave',function(j) { 202 var table = jQuery(vil_settings[identifier].table); 203 jQuery(this).removeClass('vil_link_hover'); 204 205 vil_timer[table.attr('id')] = window.setTimeout(function() { 206 delete vil_timer[table.attr('id')]; 207 208 if (vil_settings[identifier].effect == 'none') { 209 table.css( 'display', 'none' ); 210 } else { 211 table.animate({ opacity : 0 }, { duration: 650, queue: false }, 'linear' ); 212 213 window.setTimeout(function(){ 214 table.css('z-index',-1); 215 }, 650 ); 216 } 217 }, 218 vil_settings[identifier].delay); 219 }); 220 } 221 }); 222} 223 224jQuery(function() { 225 jQuery('.vil_link').each(function() { 226 jQuery(this).vil(); 227 }); 228});
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.