1$(function(){ 2 3 console.log('/home/home.js init'); 4 5 if (App.isMobile || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Android/i)) { 6 $('.product-boxes-list li').click(function(){ 7 $(this).mouseout(); 8 }); 9 10// window.onpageshow = function(event) { 11// if (event.persisted) { 12// $('.product-boxes-list li:hover').trigger('hover'); 13// } 14// }; 15 } 16 17 18// setInterval(function(){ 19// 20// if($( window ).width() < 975){ 21// 22// $('#carousel-home-mobile-slide .item.active .home-carousel-caption').css('min-width',($('#carousel-home-mobile-slide .item.active .home-carousel-caption .carousel-title').width()+15)); 23// $('#carousel-home-mobile-slide .item.active .home-carousel-caption.no-banner-caption').css('min-width',($('#carousel-home-mobile-slide .item.active .home-carousel-caption.no-banner-caption .carousel-title').width()+15)); 24// }else{ 25// 26// $('#carousel-home-slide .item.active .home-carousel-caption').css('min-width',($('#carousel-home-slide .item.active .home-carou
26sel-caption .carousel-title').width()+55)); 27// $('#carousel-home-slide .item.active .home-carousel-caption.no-banner-caption').css('min-width',($('#carousel-home-slide .item.active .home-carousel-caption.no-banner-caption .carousel-title').width() + 15)); 28// } 29// 30// }, 300); 31 32 33 var maxHeight = Math.max.apply(null, $('.featured-book-image').map(function (){return $(this).height();}).get()); 34 if (maxHeight > 0) { 35 $('.featured-book-holder').css('height',maxHeight); 36 } 37 38 $( window ).resize(function() { 39 var maxHeight = Math.max.apply(null, $('.featured-book-image').map(function (){return $(this).height();}).get()); 40 if (maxHeight > 0) { 41 $('.featured-book-holder').css('height',maxHeight); 42 } 43 $(".heightlightDesc span").each(function() { 44 if($(this).height() > 80){ 45 $(this).addClass("text-hidden"); 46 } 47 else{ 48 $(this).removeClass("text-hidden"); 49 } 50 }); 51 52 }); 53 54 $(".heightlightDesc span").each(function() { 55 if($(this).height() > 80){ 56 $(this).addClass("text-hidden"); 57 } 58 }); 59 60 61 62 containerWidth = $(".container").width(); 63 lSize = $('.product-boxes-list li.large').width(); 64 sSize = $('.product-boxes-list li.Small').width() 65 66// console.log('set listWidth' + listWidth); 67 68 switchSlideBanner(); 69 resizeHomeBoxes(); 70 71 72 $('.product-boxes-list').isotope({ 73 itemSelector : 'li', 74 containerStyle : { position: 'relative', overflow: 'visible' }, 75 layoutMode : 'perfectMasonry', 76 perfectMasonry: { columnWidth: 244 }, 77 onLayout: this.onLayout 78 }); 79 80 81// $(".product-boxes-list .active-img").load(function(){ 82// $('.product-boxes-list').isotope( 'reloadItems' ).isotope(); 83// 84// }); 85// 86// $(".product-boxes-list .active-img").each(function(i, e){ 87// if (this.complete) { 88// $(this).load(); 89// } 90// }); 91 92 $('.site-canvas').css('overflow','hidden'); 93 94 95 96 97 98 $( window ).resize(function() { 99// $(window).on("debouncedresize", function( event ) { 100 var dfd = $.Deferred(); 101// console.log('b4set containerWidth' + containerWidth + "/" + $(".container").width()); 102 if (App.isMobile || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Android/i)) { 103 $('.product-boxes-list li').css('pointer-events','none'); 104 resizeHomeBoxes(); 105 var selector = $('#boxTypeSelect').children(":selected"); 106 filterHomeBoxes(selector); 107 containerWidth = $('.container').width(); 108 $('.product-boxes-list li').css('pointer-events','initial'); 109 }else{ 110 if ($(".container").width() != containerWidth){ 111 var checkResize; 112 $('.product-boxes-list li').css('pointer-events','none'); 113 setTimeout(function(){ 114 containerWidth = $(".container").width(); 115 resizeHomeBoxes(); 116 checkResize = setInterval(function(){ 117 if ($(".container").width() < 978) { 118 liSize = sSize; 119 } else { 120 liSize = lSize; 121 } 122 // console.log($('.product-boxes-list li.large').width() + "&" + liSize); 123 if ($('.product-boxes-list li.large').width() == liSize) { 124 // console.log('set listWidth' + listWidth); 125 // console.log('check width'); 126 dfd.resolve(); 127 } 128 }, 150); 129 130 },150); 131 132 $.when( dfd ).done(function () { 133// console.log('pc resize done'); 134 clearInterval(checkResize); 135 $('.product-boxes-list').isotope( 'reloadItems' ).isotope(); 136 $('.product-boxes-list li').css('pointer-events','initial'); 137 138 }); 139 140 } 141 } 142 switchSlideBanner(); 143 144 145 }); 146 147 148 149 150 151 152 $('.box').hover(zoomProject, zoomOutProject); 153 154 155 $('.typeTag').click(function(){ 156 var type = $(this).attr('data-filter'); 157 /*if(type == 't-all'){ 158 filterHomeBoxes($(this)); 159 }else{ 160 $('#boxTypeSelect').children().each(function(){ 161 if($(this).attr('data-filter') == type){ 162 $(this).attr('selected','selected'); 163 //$('#boxTypeSelect').trigger('change'); 164 filterHomeBoxes($(this)); 165 } 166 }); 167 }*/ 168 169 filterHomeBoxes($(this)); 170 171 return false;
172 }); 173 174 175 $('#boxTypeSelect').change(function(){ 176 var selector = $(this).children(":selected"); 177 filterHomeBoxes(selector); 178 }); 179 180 181 function switchSlideBanner(){ 182 if($( window ).width() < 975){ 183 $('#carousel-home-slide').hide(); 184 $('#carousel-home-mobile-slide').show() 185 }else{ 186 $('#carousel-home-mobile-slide').hide(); 187 $('#carousel-home-slide').show(); 188 } 189 } 190 191 192 193 function zoomProject(e) 194 { 195 var $img = $(e.currentTarget).find('.active-img'); 196 var $desc = $(e.currentTarget).find('.desc'); 197 198 if (App.isMobile) { 199 $img.css('top', -222); 200 $desc.css('bottom', 0); 201 $desc.css('display', 'block'); 202 } else { 203 $desc.addClass('show'); 204 TweenLite.to($img, 0.7, { top: -222 }); 205 TweenLite.to($desc, 0.3, { bottom: 0 }); 206 } 207 } 208 209 function zoomOutProject(e) 210 { 211 var $img = $(e.currentTarget).find('.active-img'); 212 var $desc = $(e.currentTarget).find('.desc'); 213 214 215 if (App.isMobile) { 216 $img.css('top', 0); 217 $desc.css('bottom', 222); 218 $desc.css('display', 'none'); 219 } else { 220 $desc.removeClass('show'); 221 TweenLite.to($img, 0.7, { top: 0 }); 222 TweenLite.to($desc, 0.3, { bottom: 222 }); 223 } 224 } 225 226 227 function onFilterClick(e) { 228 var selector = $(e).attr('data-filter'); 229 if (selector) { 230 filterProject(selector); 231 } 232 } 233 234 function filterProject (selector) 235 { 236 var filter = ''; 237 238 if (!selector || selector == 'all') { 239 filter = '*:not(.tag-only)'; 240 } else { 241 filter = '.' + selector; 242 } 243 $('.product-boxes-list').isotope({
244 filter : filter 245 }); 246 247 // change active menu 248 $('.audience-group-visual li').removeClass('active'); 249 $('.typeTag').removeClass('active'); 250 $('.typeTag').each(function(){ 251 if($(this).attr('data-filter') == selector){ 252 $(this).parent().addClass('active'); 253 $(this).addClass('active'); 254 if($(this).parent().next().hasClass('last')){ 255 $('.last').addClass('active'); 256 } 257 if($(this).parent().prev().hasClass('typeAll')){ 258 $('.first').addClass('active'); 259 } 260 } 261 }); 262 } 263 264 265 function filterHomeBoxes(selector){ 266 var type = selector.attr('data-filter'); 267 if(type == 't-all'){ 268 var divLen = $('.box').length; 269 for(var i=0; i < divLen; i++){ 270 $('.product-boxes-list').append($('#homebox-'+i)); 271 } 272 }else{ 273 274 $('.box').each(function(){ 275 var random = Math.floor(Math.random() * $('.box').length); 276 $(this).after($('#homebox-'+random)); 277 }); 278 var m = true; 279 $('.large').each(function(){ 280 if($(this).hasClass(type)){ 281 if(m){ 282 $(this).prependTo($(".product-boxes-list")); 283 m = false; 284 } 285 } 286 }); 287 } 288 $('.product-boxes-list').isotope( 'reloadItems' ).isotope(); 289 onFilterClick(selector); 290 291 } 292 293 function resizeHomeBoxes(){ 294// console.log('resizeHomeBoxes init'); 295// console.log('check listWidth' + listWidth); 296// console.log('check containerWidth' + containerWidth + "/" + $(".container").width()); 297 if($( ".container" ).width() < 978){ 298// console.log('resizeHomeBoxes < 978 init'); 299 $('.product-boxes-list li').each(function(){ 300 var mIamge = $(this).attr('data-mobile'); 301 $(this).removeClass('size-2-1').addClass('size-1-1'); 302 //$(this).find('img').attr('src', mIamge); 303 $(this).find('.image-desktop').hide().removeClass('active-img'); 304 $(this).find('.image-mobile').show().addClass('active-img'); 305 }); 306 }else{ 307 $('.product-boxes-list li').each(function(){ 308 var mIamge = $(this).attr('data-img'); 309 var mSize = $(this).attr('data-size'); 310 $(this).addClass(mSize); 311 //$(this).find('img').attr('src', mIamge); 312 $(this).find('.image-mobile').hide().removeClass('active-img'); 313 $(this).find('.image-desktop').show().addClass('active-img'); 314 }); 315 } 316 317 } 318 319 $('#topcontrol').click(function(){ 320 $("html, body").animate({ scrollTop: 0 }, 600); 321 return false; 322 }); 323 324 325 if($( window ).width() > 767){ 326 $( window ).scroll(function() { 327 if($(window).scrollTop() > ($('header').height())) { 328 $('#topcontrol').css('bottom','15px'); 329 }else{ 330 331 $('#topcontrol').css('bottom','-100px'); 332 } 333 }); 334 } 335 336 337}); 338 339$( document ).ready(function() { 340 $('.typeAll').find('a').trigger('click'); 341 342 $('#Featured,#Highlights').carousel({interval: false}); 343}); 344 345
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.