1/* 2 * jQuery.BiggerLink v2.0.1 3 * http://www.ollicle.com/eg/jquery/biggerlink/ 4 * 5 * Copyright (c) 2009 Oliver Boermans 6 * http://creativecommons.org/licenses/MIT/ 7 * 8 * 2009-11-22 (22 Nov 2009) 9*/ 10(function($){ 11 $.fn.extend({ 12 biggerlink:function(options) { 13 14 // Default settings 15 var settings = { 16 biggerclass:'bl-bigger', // class added to the first contained link and others that trigger it 17 hoverclass:'bl-hover', // class added to parent element on hover/focus 18 hoverclass2:'bl-hover2', // class added to parent element on hover/focus of other links 19 clickableclass:'bl-hot', // class added to parent element with behaviour 20 otherstriggermaster: true, // will all links in containing biggerlink element trigger the first link 21 follow: 'auto' // follow master link on click? : 'auto',true,false 22 }; 23 if(options) { 24 $.extend(settings, options); 25 } 26 $(this).filter(function(){ 27 return $('a',this).length > 0; 28 29 }).addClass(settings.clickableclass).css('cursor', 'pointer').each(function(i){ 30 31 // store element references 32 var big = $(this).data('biggerlink',{hovered:false,focused:false,hovered2:false,focused2:false}); 33 var links = { 34 all: $('a',this), 35 big: $(this), 36 master: $('a:first',this).data('biggerlink',{status:'master'}).addClass(settings.biggerclass), 37 other: $('a',this).not($('a:first',this)).data('biggerlink',{status:'other'}) 38 }; 39 40 41 $('a',this).andSelf().each(function(){ 42 var newdata = $.extend($(this).data('biggerlink'),links); 43 $(this).data('biggerlink',newdata); 44 }); 45 46 47 48 // Add title of first link with title to parent if not already set 49 var thistitle = big.attr('title'); 50 var newtitle = big.data('biggerlink').master.attr('title'); 51 if(newtitle && !thistitle) 52 { 53 big.attr('title', newtitle); 54 } 55 56 57 58 // events on biggerlink element 59 60 big 61 .mouseover(function(event){ 62 window.status = $(this).data('biggerlink').master.get(0).href; 63 $(this).addClass(settings.hoverclass); 64 $(this).data('biggerlink').hovered = true; 65 }) 66 .mouseout(function(event){ 67 window.status = ''; 68 if(!$(this).data('biggerlink').focused) 69 { 70 $(this).removeClass(settings.hoverclass); 71 } 72 $(this).data('biggerlink').hovered = false; 73 }) 74 .bind('click',function(event){ 75 76 // if clicked direct or non-link 77 if(!$(event.target).closest('a').length) 78 { 79 $(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'}); 80 event.stopPropagation(); 81 } 82 }); 83 84 85 86 // focus/blur 87 88 links.all 89 .bind('focus',function(){ 90 $(this).data('biggerlink').big.addClass(settings.hoverclass); 91 $(this).data('biggerlink').big.data('biggerlink').focused = true; 92 }).bind('blur',function(){ 93 if(!$(this).data('biggerlink').big.data('biggerlink').hovered) 94 { 95 $(this).data('biggerlink').big.removeClass(settings.hoverclass); 96 } 97 $(this).data('biggerlink').big.data('biggerlink').focused = false;
98 }); 99 100 101 102 // click/focus/blur event on master (first) link within biggerlink 103 104 links.master 105 .bind('click',function(event){ 106 if(event.source == 'biggerlink') 107 { 108 if(settings.follow === true || settings.follow == 'auto' && event.result !== false) 109 { 110 if($(this).attr("target") == "_blank"){ 111 window.open($(this).attr('href')); 112 }else{ 113 window.location = $(this).attr('href'); 114 } 115 } 116 else 117 { 118 event.stopPropagation(); 119 } 120 } 121 }); 122 123 124 // links other than the first (master) link also within biggerlink 125 126 // other links are independent 127 if(settings.otherstriggermaster) 128 { 129 links.other.addClass(settings.biggerclass) 130 .bind('click',function(event){ 131 // trigger click events on master link instead 132 $(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'}); 133 134 // stop this link being followed 135 event.preventDefault(); 136 137 // prevent events on parent elements being triggered 138 event.stopPropagation(); 139 }); 140 } 141 142 // other links are slaves of master link 143 else 144 { 145 links.other 146 .bind('focus',function(){ 147 $(this).data('biggerlink').big.addClass(settings.hoverclass2); 148 $(this).data('biggerlink').big.data('biggerlink').focused2 = true; 149 }) 150 .bind('blur',function(){ 151 if(!$(this).data('biggerlink').big.data('biggerlink').hovered2) 152 { 153 $(this).data('biggerlink').big.removeClass(settings.hoverclass2); 154 } 155 $(this).data('biggerlink').big.data('biggerlink').focused2 = false; 156 157 }) 158 .bind('mouseover',function(event){ 159 $(this).data('biggerlink').big.addClass(settings.hoverclass2); 160 $(this).data('biggerlink').big.data('biggerlink').hovered2 = true; 161 event.stopPropagation(); 162 }) 163 .bind('mouseout',function(event){ 164 if(!$(this).data('biggerlink').big.data('biggerlink').focused2) 165 { 166 $(this).data('biggerlink').big.removeClass(settings.hoverclass2); 167 } 168 $(this).data('biggerlink').big.data('biggerlink').hovered2 = false; 169 event.stopPropagation(); 170 }); 171 172 if(!links.other.attr('title')) 173 { 174 links.other.attr('title',''); 175 } 176 } 177 }); 178 return this; 179 } 180 }); 181})(jQuery);
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.