1$ = jQuery; 2 3/** 4 * Stuff to run on document ready 5 */ 6jQuery(document).ready(function($) { 7 8 /** 9 * Open all external links in a new tab/window 10 **/ 11 $('a[rel~=external]').click(function(){ 12 window.open(this.href,'',''); 13 return false; 14 }); 15 16 17 /** 18 * Home slideshow 19 */ 20 if ($('#home-slideshow ul').length) { 21 $('#home-slideshow ul').eq(0).cycle({ 22 fx: 'fade', 23 //easeOut: 'easeout', 24 //fx: 'uncover', 25 //fx: 'scrollLeft', 26 next:'#s-next', 27 prev:'#s-prev', 28 //height:250,//291, 29 speed: 1000, 30 timeout: 5000, 31 pause: 0, 32 /*pager: '#latest-photos-nav',*/ 33 sync: 1 34 }); 35 $('#s-stop').click(function(){ 36 if (!$(this).hasClass('stopped')) { 37 $('#home-slideshow ul').eq(0).cycle('pause'); 38 $(this).addClass('stopped'); 39 } else { 40 $('#home-slideshow ul').eq(0).cycle('resume'); 41 $(this).removeClass('stopped'); 42 } 43 return false; 44 }); 45 } 46 47 /** 48 * Latest videos scroller 49 */ 50 if ($('#latest-videos').length) { 51 setVidScrollerHeight(); 52 $('div.scrollable').scrollable({ 53 size: 3 54 }); 55 $('#latest-videos .scrollable dt a').each(function(){ 56 $(this).append('<span><strong>play</strong> ►</span>'); 57 }); 58 } 59 60 /** 61 * IE fixes 62 */ 63 //if (!$.browser.msie) { 64 /*$('#submenu a span, #submenu strong span').before('<em></em>'); 65 if (!$.browser.msie) { 66 $("#submenu a em, #submenu strong em").css("opacity","0"); 67 } else { 68 $("#submenu a em, #submenu strong em").hide(); 69 } 70 // on mouse over 71 $("#submenu a, #submenu strong").hover(function () { 72 // animate opacity to full 73 var originalBG = $(this).css("background-image"); 74 $(this).find('em').css('background-image',originalBG); 75 if (!$.browser.msie) { 76 $(this).find('em').stop().animate({ opacity: 1}, 'slow'); 77 } else { 78 $(this).find('em').stop().show(); 79 } 80 }, 81 // on mouse out 82 function () { 83 // animate opacity to nill 84 if (!$.browser.msie) { 85 $(this).find('em').stop().animate({ opacity: 0}, 'fast'); 86 } else { 87 $(this).find('em').stop().hide(); 88 } 89 });*/ 90 //} 91 92 93 /** 94 * Adds class "last", where needed 95 */ 96 $('#col-1 .post:last, #col-2 .post:last, body.category #content .post:last, body.archive #content .post:last, body.search #content .post:last').addClass('last'); 97 98 /** 99 * Adds 'last' class to the posts before date tag in Events section 100 */ 101 if ($('h4.date').length) { 102 $('h4.date').each(function(){ 103 var prevp = $(this).prev(); 104 if (prevp.hasClass('post')) prevp.addClass('last') 105 }); 106 } 107 108 /** 109 * Adds/removes "hover" class to "Stay Tuned" links in the footer 110 */ 111 $('.stay-tuned ul li a') 112 .mouseover(function(){ 113 $(this).parent().addClass('hover'); 114 }) 115 .mouseout(function(){ 116 $(this).parent().removeClass('hover'); 117 }); 118 119 /** 120 * Stuff needed by Ramona overlay 121 */ 122 if ($(".chat").length > 0){ 123 $(".chat a").overlay({ 124 onBeforeLoad: function() { 125 $('.wrap').append('<iframe width="945" height="830" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" id="frame" name="frame" allowtransparency="true" />'); 126 $('#frame').attr('src', this.getTrigger().attr("href")); 127 //$('#chat-box').attr('overlay', 'none'); 128 }, 129 close: '.wrap .close', 130 onClose: function() { 131 $('#frame').remove(); 132 }, 133 finish: { 134 top: 'center', 135 left: 'center', 136 absolute: false 137 }, 138 expose: { 139 color: '#000000', 140 opacity: 0.8, 141 closeSpeed: 600 142 }, 143 speed:'fast' 144 }); 145 $.frameReady(function(){ 146 // $("<div>I am a div element</div>").prependTo("body"); 147 }, "top.frame", 148 { load: [ 149 {type:"stylesheet", src:"../stylesheets/chat.css"} 150 ] } 151 ); 152 } 153 154 /** 155 * Prepends a span needed in .photos section 156 */ 157 $("#content .page-id-77886 .post-body ul li a").prepend("<span class='zoom'></span>"); 158 159 /** 160 * Adds 'wider' class to descriptions of wide videos (in Video section) 161 */ 162 if ($('#content .video object').length) { 163 $('#content .video object').each(function(){ 164 if ($(this).width() > 450) $(this).closest('.video').next().addClass('wider'); 165 }); 166 } 167 168 /** 169 * Adds onclick='window.open()' to related links in the sidebar 170 **/ 171 $('#sidebar div.related-content a').click(function(){ 172 window.open(this.href,'',''); 173 return false; 174 }); 175 176 /** 177 * BLOG comment form submit handler 178 **/ 179 if ($('#commentform').length) { 180 /** 181 * jQuery Validation plugin setup 182 **/ 183 $.validator.addMethod( 184 "notequal", 185 function(value, element, param) { 186 return this.optional(element) || value != param; 187 }, 188 "This field value is incorrect." 189 ); 190 $('#commentform').validate({ 191 rules: { 192 email: { 193 required: true, 194 email: true, 195 'notequal': 'email address' 196 }, 197 author: { 198 required: true, 199 'notequal': 'your name' 200 }, 201 comment: { 202 required: true, 203 'notequal': 'Type your comment here...' 204 } 205 } 206 }); 207 } 208 209 210 211 212}); 213 214/** 215 * Stuff to run on window load 216 */ 217 218$(window).load(function(){ 219 thumbnailize(); //Process images wherever necessary 220 if ($('#latest-videos').length) setVidScrollerHeight(); //Set home page scroller 221 $('a[rel^="prettyPhoto"]').attr('title',''); 222 $('a[rel^="prettyPhoto"]').prettyPhoto({ 223 animation_speed: 'normal', 224 padding: 40, 225 opacity: 0.8, 226 show_title: false, 227 deeplinking: false, 228 allowresize: true, 229 counter_separator_label: '/', 230 theme: 'light_rounded', 231 overlay_gallery: false, 232 keyboard_shortcuts: false, 233 ie6_fallback: false 234 }); 235}); 236 237 238/************************************************************************** 239 Helper functions 240**************************************************************************/ 241 242/** 243* Invokes print page dialog 244*/ 245function printPage() { 246 window.print(); 247} 248 249/** 250 * Sets height of the Home page videos scroller 251 **/ 252function setVidScrollerHeight() { 253 var latest_videos_maxheight = 0; 254 $('#latest-videos li').each(function(){ 255 th = $(this).height(); 256 if (th > latest_videos_maxheight) latest_videos_maxheight = th; 257 }); 258 $('#home-slideshow .videos-scroller .scrollable').height(latest_videos_maxheight + 'px'); 259} 260 261/** 262 * Adds lightboxes to images 263 * @return - 264 */ 265function thumbnailize(){ 266 var imgs = $('img.expando, body.single #content .post-content img, body.page #content .post-content img'); 267 if (imgs.length > 0){ 268 for (i=0;i<imgs.length;i++) { 269 var img = imgs.get(i); 270 var imghtmlw = $(img).width(); 271 if (img.src.indexOf('icon_arrow_4.png') == -1) { 272 var jpg,gif,png,bmp = false; 273 // set displayed image width 274 //if ($(img).parent().hasClass('wp-caption')) $(img).parent().width(width); 275 // add a link to display the image in lightbox -- IF NEEDED 276 var imgalign = ''; 277 if ($(img).hasClass('alignleft')) { 278 imgalign = 'alignleft'; 279 } else if ($(img).hasClass('alignright')) { 280 imgalign = 'alignright'; 281 } else if ($(img).hasClass('aligncenter')) { 282 imgalign = 'aligncenter'; 283 } 284 if ($(img).parent().get(0).tagName == "A"){ 285 jpg = ( $(img).parent().attr('href').toLowerCase().indexOf('.jpg') == $(img).parent().attr('href').length - 4 || $(img).parent().attr('href').indexOf('.jpeg') == $(img).parent().attr('href').length - 5 ) ? true : false; 286 gif = ($(img).parent().attr('href').toLowerCase().indexOf('.gif') == $(img).parent().attr('href').length - 4) ? true : false; 287 png = ($(img).parent().attr('href').toLowerCase().indexOf('.png') == $(img).parent().attr('href').length - 4) ? true : false; 288 bmp = ($(img).parent().attr('href').toLowerCase().indexOf('.bmp') == $(img).parent().attr('href').length - 4) ? true : false; 289 if (jpg || gif || png || bmp) { 290 $(img).parent("a:not([rel^=prettyPhoto])").attr('rel','prettyPhoto'); 291 $(img).parent("a").addClass('expando-wrapper'); 292 $(img).parent("a").addClass(imgalign); 293 $(img).removeClass(imgalign); 294 } 295 } else if (!$('body.single').length && !$('body.page').length) { // Don't add any <a> on single pages 296 $(img).wrap("<a href='#' rel='prettyPhoto' class='expando-wrapper " + imgalign + "'></a>"); 297 $(img).parent("a[rel^='prettyPhoto']").attr('href',img.src); 298 } 299 if (!$(img).hasClass('expando')) 300 $(img).parent('a[rel^="prettyPhoto"],a[rel^="prettyPhoto"]').prepend('<span class="enlarge" style="width:' + ( imghtmlw + 2 ) + 'px"><strong>enlarge | +</strong></span>'); //+2px because of img borders 301 } 302 } 303 304 }; 305}
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.