1/* Author: 2 Luke Smith - Netnak 3 Graham Baines - Netnak 4*/ 5 6$(document).ready(function(){ 7 checkNth() 8 externallinks() 9 scroller() 10 portfolio() 11 teamimages() 12 checkRequired() 13 guidedownload() 14 checkPlaceholder() 15}); 16 17 18function guidedownload() { 19 $('.download a').click(function(e) { 20 file = $(this).attr('href'); 21 $('#downloadlink').attr('href',file); 22 23 if($.cookie('registered')) { 24 return; 25 } else { 26 $('#register').lightbox_me({ 27 centered: true, 28 onLoad: function() { 29 //$('#register').find('input:first').focus() 30 $('#downloadfile').attr('href',file); 31 $('#downloadpath').val(file); 32 } 33 }); 34 e.preventDefault(); 35 }; 36 37 $('#downloadlink').click(function() { 38 var postform 39 40 if (Modernizr.input.required) { 41 42 var items = $('#register').find('input[required]'), 43 count = items.length, 44 allvalid = true; 45 46 for (var i = 0; i < count; i += 1) { 47 var obj = items[i]; 48 if (obj.validity.valid === false) { 49 allvalid = false; 50 } 51 }; 52 if (allvalid === false) { 53 // Not all the inputs were valid, stop the download 54 return false; 55 56 } else { 57 // All inputs are valid so go ahead. 58 postform = true; 59 } 60 61 } else { 62 if ($("#register").valid() === true ) { 63 postform = true 64 }; 65 }; 66 67 if (postform === true) { 68 email = $("#downloademail").val(); 69 //file = $("#downloadpath").val(); 70 71 $.post('/emaildownload/', $('#register').serialize(), function(data) { 72 $.cookie('registered', email); 73 //$('#register label, #register input, #register button').remove(); 74 //$('#register p').html(data); 75 //$('#register p a').live('click', function(){ 76 // $('#register').trigger('close'); 77 //}); 78 //return; 79 $('#register').trigger('close'); 80 }); 81 } else { 82 return false; 83 } 84 }); 85 86 }); 87} 88 89function teamimages(){ 90 $('.linkedin').each(function() { 91 $(this).children('a').children('img').css('display','none').first().css('display','block'); 92 $(this).children('a').children('img').last().addClass('last'); 93 //alert($(this).children('a').attr('title')); 94 //.first().css('display','block').last().addClass('last') 95 }); 96 97 $(".linkedin").hover( //cancel the timer when a user hovers 98 function () { 99 $(this).addClass('cycling'); 100 scrollerintervalid = setInterval('cycleimages()', 800); 101 }, 102 function () { //start it again when they move off 103 clearInterval(scrollerintervalid); 104 $(this).removeClass('cycling').children('a').children('img').css('display','none').first().css('display','block'); 105 } 106 ); 107} 108 109function cycleimages() { 110 111 //$('.cycling img').filter(':visible').css('display','none').next().css('display','block'); 112 113 if ($('.cycling img').filter(':visible').hasClass('last')) { //if it is the last dot 114 $('.cycling img').css('display','none').first().css('display','block'); 115 } else { 116 $('.cycling img').filter(':visible').css('display','none').next().css('display','block'); 117 } 118} 119 120 121function portfolio(){ 122 if ($('#portfoliodrops').length){ 123 $('#portfoliodrops select').change(function() { 124 125 var keyword = $(this).val().toLowerCase(); 126 var type = $(this).attr('id').toLowerCase(); 127 128 if (type =='pagename') { 129 window.location.replace('/clients/client/'+keyword+'/'); 130 } else { 131 window.location.replace('/clients/'+type+'/'+keyword+'/'); 132 } 133 }); 134 } 135 136 137} 138 139function emailform() { 140 141} 142 143 144// add target="blank" for external links 145function externallinks() { 146 $("a[rel='external']").attr("target", "_blank"); 147} 148 149//full size centered image and scoller for home page 150function scroller() { 151 $('#home #wrap article').css('display', 'none'); 152 $('#home #wrap article .text').css('display', 'none'); 153 $('#home #wrap article').fadeIn('slow'); 154 $('#home article:first').addClass('first'); 155 $('#home #wrap article:first .text').fadeIn('slow'); 156 157 $(window).resize(function () { 158 159 var winwidth = $(window).width(); 160 var winheight = $(window).height() 161 var winheight = $("#home").height(); 162 var viewheight = winheight - 130 //give 130 pixel padding at the bottom 163 164 165 $('#home article img').each(function () { 166 167 var self = this; 168 var img = new Image(); 169 img.onload = function () { 170 171 var imagewidth = this.width; 172 var imageheight = this.height; 173 174 $(self).parent().css({ //.imagewrap 175 'width': winwidth, 176 'height': viewheight 177 }); 178 179 $(self).parent().parent().css({ //article 180 'width': winwidth, 181 'height': winheight 182 }); 183 184 $(self).parent().parent().parent().css({ //#wrap 185 'width': winwidth * 5, 186 'height': winheight 187 }); 188 189 $(self).parent().parent().parent().parent().css({ //#home 190 'width': winwidth, 191 'height': winheight 192 }); 193 194 195 if (winwidth / viewheight > imagewidth / imageheight) { 196 $(self).css({ 197 'width': winwidth, 198 'height': (winwidth * imageheight / imagewidth), 199 'left': 0, 200 'top': 0.5 * (viewheight - (winwidth * imageheight / imagewidth)), 201 'position': 'relative' 202 }); 203 204 } else { 205 $(self).css({ 206 'width': viewheight * imagewidth / imageheight, 207 'height': viewheight, 208 'top': 0, 209 'left': 0.5 * (winwidth - (viewheight * imagewidth / imageheight)), 210 'position': 'relative' 211 }); 212 } 213 } 214 img.src = $(self).attr('src'); 215 216 }); 217 218 $('.home .nav .next').live('click', function() { 219 var winwidth = $(window).width(); 220 var winheight = $(window).height(); 221 var winheight = $("#home").height() 222 if(!$('body').hasClass('animating')) { 223 $('body').addClass('animating'); 224 $('#home #wrap article:first .text').fadeOut('slow', function() { 225 $('#home #wrap article:first').animate({'margin-left': -winwidth}, 'slow', function() { 226 var atriclehtml = $(this).html(); 227 $('#home #wrap').append('<article style="width: ' + winwidth + 'px; height: ' + winheight + 'px;">' + atriclehtml + '</article>'); 228 $(this).remove(); 229 $('body').removeClass('animating'); 230 $('#home #wrap article:first').addClass('first').siblings().removeClass('first'); 231 $('#home #wrap article:first .text').fadeIn('slow'); 232 }); 233 }); 234 235 } 236 return false;
237 }); 238 239 $('.home .nav .prev').live('click', function() { 240 var winwidth = $(window).width(); 241 var winheight = $(window).height() 242 var winheight = $("#home").height() 243 if(!$('body').hasClass('animating')) { 244 $('body').addClass('animating'); 245 var atriclehtml = $('#home #wrap article:last').html(); 246 $('#home #wrap article:first .text').fadeOut('slow', function() { 247 $('#home #wrap').prepend('<article style="width: ' + winwidth + 'px; height: ' + winheight + 'px;">' + atriclehtml + '</article>'); 248 $('#home #wrap article:last').remove(); 249 $('#home #wrap article:first').css({'margin-left': -winwidth}); 250 $('#home #wrap article:first').animate({'margin-left': '0'}, 'slow', function() { 251 $('body').removeClass('animating'); 252 $('#home #wrap article:first').addClass('first').siblings().removeClass('first'); 253 $('#home #wrap article:first .text').fadeIn('slow'); 254 }); 255 }); 256 } 257 return false; 258 }); 259 260 }).trigger('resize'); 261} 262 263 264function checkPlaceholder() { 265 if (!Modernizr.input.placeholder){ 266 $('input[type=text],input[type=email]').each( function(){ 267 $(this).attr('value', $(this).attr('placeholder')).focus(function(){ 268 var ph = $(this).attr('value'); 269 $(this).attr('value','').blur(function(){ 270 if($(this).attr('value').length < 1 ){ 271 $(this).attr('value', ph); 272 } 273 }) 274 }); 275 }); 276 } 277} 278 279function checkNth() { 280 if (!(Modernizr.nthchildn)) { 281 $(".item:nth-child(3n)").css('margin-right', '0'); 282 } 283} 284 285Modernizr.testStyles(" #modernizr div:nth-child(3n){width:10px;} ", function(elem, rule){ 286 // Extend modernizr with a test for nthchild(n) 287 // Create a teststyle check for the style (using getComputedStyle if available, not get attribute!!) being applied to 1/3/6 elem and return bool.. 288 var bool = false, divs = elem.getElementsByTagName("div"); 289 if (divs.length == 7){ 290 var test = window.getComputedStyle ? function(i){ 291 return getComputedStyle(divs[i], null)["width"] == "10px"; 292 } : function(i){ 293 return divs[i].currentStyle["width"] == "10px"; 294 }; 295 // return bool based on all of the following 296 bool = !test(0) && !test(1) && test(2) && !test(3) && !test(4) && test(5) && !test(6); 297 } 298 Modernizr.addTest("nthchildn", bool); 299}, 7); 300 301 302 303function checkRequired() { 304// set and cache some variables, change var forms to whatever forms you want to validate 305 var forms = $('form'), 306 formsCount = forms.length, 307 items = forms.find('input[required]'), 308 count = items.length; 309 310 // check for "required" input support with modernizr 311 if (Modernizr.input.required) { 312 313 // do something else, maybe customize the output messages? 314 315 } else { 316 317 // loop though each required input and set the required and type class jQuery validate needs 318 for (var i = 0; i < count; i += 1) { 319 var obj = items[i]; 320 $(obj).attr('class', 'required ' + obj.getAttribute('type')).removeAttr('required'); 321 }; 322 323 // after the classes are set, load in the plugin with yepnope , you can do this with Modernizr.load as well 324 yepnope([{ 325 load: 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', 326 complete: function () { 327 328 // after the plugin is loaded, call the method on each form listed at the top 329 for (var i = 0; i < formsCount; i += 1) { 330 $(forms[i]).validate(); 331 } 332 } 333 }]); 334 335 } // if required supported 336 337 $('input').focusin(function(){ 338 $(this).keyup(function() { 339 if ($(this).attr('value').length > 3) { 340 $(this).addClass('touched'); 341 } 342 }); 343 }); 344 $('input').focusout(function(){ 345 if ($(this).attr('value').length == 0) { 346 $(this).removeClass('touched'); 347 } 348 }); 349}
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.