1(function ($) { 2 "use strict"; 3 function customAttribute(){ 4 // Custom } 5 $( '.nano-custom-attribute > li' ).live( 'click', function(e) { 6 e.preventDefault(); 7 8 var variation_value = $(this).data( 'value' ), 9 selectId = $(this).parent().data( 'attribute' ), 10 select = $( 'select#'+selectId ); 11 12 $(this).addClass( 'selected' ).siblings().removeClass( 'selected' ); 13 14 select.val( variation_value ).trigger( 'change' ); 15 } ); 16 17 $( '.variations_form' ).live( 'change', 'select[data-attribute_name]', function() { 18 // Auto select option thas has only 1 choice availible 19 setTimeout( function() { 20 $( '.variations_form select[data-attribute_name]' ).each( function( i, e ) { 21 if ( $( e ).val() == '' && $( e ).children( '[value!=""]' ).length == 1 ) { 22 $( e ).val( $( e ).children( '[value!=""]' ).attr( 'value' ) ).trigger( 'change' ); 23 } 24 } ); 25 }, 50 ); 26 27 $( '.nano-custom-attribute[data-attribute]' ).each( function( i, e ) { 28 ( function( e ) { 29 setTimeout( function() { 30 var option = $( e ).attr( 'data-attribute' ), 31 select = $( '#' + option ); 32 33 $( e ).children().each( function( i2, e2 ) { 34 if ( select.children( '[value="' + $( e2 ).attr( 'data-value' ) + '"]' ).length == 1 ) { 35 $( e2 ).show(); 36 } else { 37 $( e2 ).hide(); 38 } 39 } ); 40 }, 50 ); 41 } )( e ); 42 } ); 43 } ); 44 45 $( 'a.reset_variations' ).live( 'click', function() { 46 $( '.nano-custom-attribute' ).each( function( i, e ) { 47 $( e ).find( 'li.selected' ).removeClass( 'selected' ); 48 } ) 49 } ); 50 } 51 52 $(document).ready(function() { 53 customAttribute(); 54 55 56 var paged = 1; 57 //loadMore ===================================================================================================== 58 jQuery('.type-loadMore').each(function(){ 59 var wrapper = jQuery(this); 60 var loadMore_button = jQuery(this).find('#loadMore'); 61 loadMore_button.live('click', function(){ 62 paged++; 63 var number = parseInt(wrapper.data( 'number' )), 64 cat = wrapper.data( 'cat'), 65 col = wrapper.data( 'col'), 66 pages = wrapper.data( 'paged'), 67 layout = wrapper.data( 'layout'); 68 $.ajax({ 69 url: NaScript.ajax_url, 70 dataType: 'html', 71 type: 'POST', 72 data: { 73 action : 'load_post', 74 number : number, 75 cat : cat, 76 paged : paged, 77 col : col, 78 layout : layout 79 }, 80 beforeSend: function() { 81 loadMore_button.addClass( 'loading' ); 82 }, 83 success:function(data) { 84 var val = $(data); 85 var $container = wrapper.find('.affect-isotope').isotope(); 86 $container.append(val).isotope( 'appended', val ); 87 $("img.lazy").lazy(); 88 setTimeout(function() { 89 $container.imagesLoaded().progress( function() { 90 $container.isotope('layout'); 91 }); 92 }, 100) 93 94 loadMore_button.removeClass( 'loading' ); 95 if ( paged == pages ) {
96 loadMore_button.addClass( 'hidden' ); 97 } 98 }, 99 100 error: function(data){ 101 console.log(data); 102 }, 103 }); 104 return false; 105 }); 106 }); 107 //infinitescroll =============================================================================================== 108 $('.type-infiniteScroll').each(function(){ 109 var win = $(window); 110 var nextPage = $('.wrapper-posts').find('#nextPage'); 111 function bindScroll(){ 112 if($(window).scrollTop() + $(window).innerHeight() > $(document).height() - 250) { 113 $(window).unbind('scroll'); 114 loadMore(); 115 } 116 } 117 function loadMore() 118 { 119 paged++; 120 var wrapper = $('.wrapper-posts'), 121 number = parseInt(wrapper.data( 'number' )), 122 cat = wrapper.data( 'cat'), 123 col = wrapper.data( 'col'), 124 pages = wrapper.data( 'paged'), 125 layout = wrapper.data( 'layout'); 126 127 $.ajax({ 128 url: NaScript.ajax_url, 129 dataType: 'html', 130 type: 'POST', 131 data: { 132 action : 'load_more_post', 133 number : number, 134 cat : cat, 135 paged : paged, 136 col : col, 137 layout : layout 138 }, 139 beforeSend: function() { 140 nextPage.addClass( 'loading' ); 141 }, 142 success:function(data) { 143 var val = $(data); 144 // Set Container 145 var $container = $( '.wrapper-posts').find('.affect-isotope').isotope(); 146 $container.append(val).isotope( 'appended', val ); 147 $("img.lazy").lazy(); 148 setTimeout(function() { 149 $container.imagesLoaded().progress( function() { 150 $container.isotope('layout'); 151 }); 152 }, 100) 153 154 nextPage.removeClass( 'loading' ); 155 $(window).bind('scroll', bindScroll); 156 if ( paged == pages ) { 157 nextPage.addClass( 'hidden' ); 158 } 159 }, 160 error: function(data){ 161 console.log(data); 162 }, 163 }); 164 165 166 167 } 168 $(window).scroll(bindScroll); 169 }); 170 171 //Load Category ================================================================================================ 172 jQuery('.box-recent').each(function(){ 173 var loadMoreCat_button = $('.wrapper-posts').find('#loadMoreCat'); 174 var loadMore_button = $('.wrapper-posts').find('#loadMore'); 175 var $wrapper = jQuery(this).find('.tab-content'); 176 var $catItem = jQuery(this).find('.wrapper-filter .cat-item'); 177 var $catAll = jQuery(this).find('.wrapper-filter .cat-items'); 178 $catItem.live('click', function(){ 179 var agr = $wrapper.parent().find('.agr-loading'), 180 archive = $wrapper.find('.archive-blog'), 181 cat = jQuery(this).data( 'catfilter' ), 182 number = $wrapper.parent().data( 'number' ), 183 col = $wrapper.parent().data( 'col'), 184 layout = $wrapper.parent().data( 'layout'); 185 $catItem.parent().removeClass('active'); 186 jQuery(this).parent().addClass( 'active' ); 187 188 // RequestData ============================ 189 var requestData = { 190 action : 'load_more_category', 191 number : number, 192 cat : cat, 193 col : col, 194 layout : layout 195 }; 196 197 if(!jQuery(this).hasClass('loaded')){ 198 $.ajax({ 199 url: NaScript.ajax_url, 200 dataType: 'html', 201 type: 'POST', 202 data: requestData, 203 beforeSend: function() { 204 agr.addClass( 'post-loading' ); 205 archive.addClass( 'archive-affect' ); 206 return true; 207 }, 208 success:function(data) { 209 agr.removeClass( 'post-loading' ); 210 archive.removeClass( 'archive-affect'); 211 ajaxResponse(data); 212 }, 213 error: function(data){ 214 console.log(data); 215 } 216 }); 217 } 218 219 jQuery(this).not('.loaded').addClass('loaded'); 220 var $activeContent='allCat'; 221 if(jQuery(this).parent().hasClass('active')){ 222 $activeContent = jQuery(this).data( 'catfilter' ); 223 } 224 $wrapper.find('.archive-blog').removeClass('active'); 225 $wrapper.find('.archive-blog').removeClass('affect-isotope'); 226 $wrapper.find('#'+$activeContent).addClass('active').addClass('affect-isotope');; 227 jQuery( '.wrapper-posts').find('.affect-isotope').isotope({ 228 transitionDuration: '0.4s', 229 masonry: { 230 columnWidth:'.col-item' 231 }, 232 fitWidth: true, 233 }); 234 }); 235 236 function ajaxResponse(data) { 237 var val = $(data); 238 var $container = $( '.wrapper-posts').find('.affect-isotope').isotope({ 239 transitionDuration: '0.4s', 240 masonry: { 241 columnWidth:'.col-item' 242 }, 243 fitWidth: true, 244 }); 245
246 loadMore_button.addClass( 'hidden' ); 247 loadMoreCat_button.removeClass( 'hidden' ); 248 $wrapper.append(val).find('.affect-isotope').isotope({ 249 transitionDuration: '0.4s', 250 masonry: { 251 columnWidth:'.col-item' 252 }, 253 fitWidth: true, 254 }); 255 $wrapper.find("img.lazy").lazy(); 256 setTimeout(function() { 257 $container.imagesLoaded().progress( function() { 258 $container.isotope('layout'); 259 }); 260 $("img.lazy").lazy(); 261 }, 100) 262 } 263 264 $catAll.live('click', function(){ 265 $catItem.parent().removeClass('active'); 266 jQuery(this).parent().addClass( 'active' ); 267 jQuery(this).not('.loaded').addClass('loaded'); 268 var $activeContent='allCat'; 269 if(jQuery(this).parent().hasClass('active')){ 270 $activeContent = jQuery(this).data( 'catfilter' ); 271 } 272 $wrapper.find('.archive-blog').removeClass('active'); 273 $wrapper.find('.archive-blog').removeClass('affect-isotope'); 274 $wrapper.find('#'+$activeContent).addClass('active').addClass('affect-isotope');; 275 jQuery( '.wrapper-posts').find('.affect-isotope').isotope({ 276 transitionDuration: '0.4s', 277 masonry: { 278 columnWidth:'.col-item' 279 }, 280 fitWidth: true, 281 }); 282 loadMore_button.removeClass( 'hidden' ); 283 loadMoreCat_button.addClass( 'hidden' ); 284 }); 285 }); 286 287 // then loadmore 288 jQuery('.box-recent .box-filter').each(function(){ 289 var wrapper = jQuery(this).parent().parent(); 290 var loadMoreCat_button = wrapper.find('#loadMoreCat'); 291 var paged = 1; 292 loadMoreCat_button.on('click', function(){ 293 jQuery('.wrapper-filter .cat-item').on('click', function(){ 294 return paged = 1; 295 }); 296 paged++; 297 var pages= 1, 298 cat='', 299 number='9', 300 col='', 301 layout='', 302 wrapperActive=wrapper.find('.archive-blog.active'); 303 304 if(jQuery('.wrapper-posts').find('.archive-blog').hasClass('active')){ 305 pages = parseInt(wrapperActive.find('#filterPages').data('filter-pages')), 306 cat = wrapperActive.find('#filterPages').data('filter-cat'), 307 number = wrapperActive.find('#filterPages').data('filter-number'), 308 col = jQuery('.wrapper-posts').data( 'col'), 309 layout = jQuery('.wrapper-posts').data( 'layout'); 310 } 311 312 if(paged <= pages) { 313 $.ajax({ 314 url: NaScript.ajax_url, 315 dataType: 'html', 316 type: 'POST', 317 data: { 318 action: 'load_more_post', 319 number: number, 320 cat: cat, 321 paged: paged, 322 col: col, 323 layout: layout 324 }, 325 beforeSend: function () { 326 loadMoreCat_button.addClass('loading'); 327 }, 328 success: function (response) { 329 var val2 = $(response); 330 var $container = $( '.wrapper-posts').find('.affect-isotope').isotope({ 331 transitionDuration: '0.4s', 332 masonry: { 333 columnWidth:'.col-item' 334 }, 335 fitWidth: true, 336 }); 337 $container.append(val2).isotope( 'appended', val2 ); 338 $("img.lazy").lazy(); 339 setTimeout(function() { 340 $container.imagesLoaded().progress( function() { 341 $container.isotope('layout'); 342 }); 343 $("img.lazy").lazy(); 344 }, 100) 345
346 loadMoreCat_button.removeClass('loading'); 347 348 if (paged == pages) { 349 loadMoreCat_button.addClass('hidden'); 350 } 351 }, 352 error: function (data) { 353 console.log(data); 354 }, 355 }); 356 return false; 357 } 358 if (pages == '1') { 359 loadMoreCat_button.addClass('hidden'); 360 } 361 }); 362 }); 363 364 //loadCategory BOX============================================================================================= 365 jQuery('.box-cats').each(function(){ 366 var $wrapper = jQuery(this).find('.tab-content'); 367 var $catItem = jQuery(this).find('.wrapper-filter .cat-item'); 368 $catItem.live('click', function(){ 369 var agr = $wrapper.parent().find('.agr-loading'), 370 archive = $wrapper.find('.archive-blog'), 371 cat = jQuery(this).data( 'catfilter' ), 372 number = $wrapper.parent().data( 'number' ), 373 col = $wrapper.parent().data( 'col'), 374 layout = $wrapper.parent().data( 'layout'); 375 $catItem.parent().removeClass('active'); 376 jQuery(this).parent().addClass( 'active' ); 377 378 // RequestData ============================ 379 var requestData = { 380 action : 'load_more_category', 381 number : number, 382 cat : cat, 383 col : col, 384 layout : layout 385 }; 386 387 if(!jQuery(this).hasClass('loaded')){ 388 $.ajax({ 389 url: NaScript.ajax_url, 390 dataType: 'html', 391 type: 'POST', 392 data: requestData, 393 beforeSend: function() { 394 agr.addClass( 'post-loading' ); 395 archive.addClass( 'archive-affect' ); 396 return true; 397 }, 398 success:function(data) { 399 agr.removeClass( 'post-loading' ); 400 archive.removeClass( 'archive-affect'); 401 ajaxResponse(data); 402 }, 403 error: function(data){ 404 console.log(data); 405 } 406 }); 407 } 408 409 jQuery(this).not('.loaded').addClass('loaded'); 410 var $activeContent='allCat'; 411 if(jQuery(this).parent().hasClass('active')){ 412 $activeContent = jQuery(this).data( 'catfilter' ); 413 } 414 $wrapper.find('.archive-blog').removeClass('active'); 415 $wrapper.find('#'+$activeContent).addClass('active'); 416 }); 417 418 function ajaxResponse(data) { 419 var val = $(data); 420 $wrapper.append(val); 421 $wrapper.find("img.lazy").lazy(); 422 } 423 424 }); 425 426 //Videos BOX============================================================================================= 427 jQuery('.box-videos').each(function(){ 428 var $wrapper = jQuery(this).find('.slider-video .post-item'); 429 430 var $btn = jQuery(this).find('.btn-play'); 431 432 433 var $postItem = jQuery('.box-video .slider-video .post-item'); 434 435 $btn.live('click', function(){ 436 437 //check active nav 438 if( jQuery('.slider-nav .post-image').hasClass('active')){ 439 jQuery('.slider-nav .post-image').removeClass('active'); 440 }; 441 jQuery(this).addClass('active'); 442 443 var id = jQuery(this).data( 'id'); 444 var videoItem = jQuery('.slider-video .post-item.video-'+id); 445 var iframeVideo = $postItem.find('.video-item'); 446 var iframeCurrent = videoItem.find('.video-item'); 447 448 449 //reset active slider 450 if($wrapper.hasClass('active')){ 451 $wrapper.removeClass('active'); 452 } 453 454 //active 455 videoItem.addClass('active'); 456 457 458 // RequestData ============================ 459 var requestData = { 460 action : 'load_videos', 461 id : id, 462 };
463 if(!videoItem.hasClass('loaded')){ 464 $.ajax({ 465 url: NaScript.ajax_url, 466 dataType: 'html', 467 type: 'POST', 468 data: requestData, 469 beforeSend: function() { 470 //archive.addClass( 'archive-affect' ); 471 jQuery('.slider-video .post-item.video-'+id).addClass('video-loading'); 472 return true; 473 }, 474 success:function(data) { 475 jQuery('.slider-video .post-item.video-'+id).removeClass('video-loading'); 476 var val = $(data); 477 jQuery('.slider-video .post-item.video-'+id+' .article-video').append(val); 478 jQuery('.slider-video .post-item.video-'+id).addClass('loaded'); 479 jQuery('.playing').videoController('play'); 480 jQuery('.paused').videoController('pause'); 481 }, 482 error: function(data){ 483 console.log(data); 484 } 485 }); 486 } 487 //add paused 488 if(iframeVideo.not('paused')){ 489 iframeVideo.addClass('paused'); 490 }; 491 //reset playing 492 if(iframeVideo.hasClass('playing')){ 493 iframeVideo.removeClass('playing'); 494 }; 495 496 //add playing 497 iframeCurrent.removeClass('paused'); 498 iframeCurrent.addClass('playing'); 499 500 if(iframeVideo.hasClass('playing')){ 501 playVideo(); 502 } 503 if(iframeVideo.hasClass('paused')){ 504 pauseVideo(); 505 } 506 }); 507 508 function ajaxResponse(data) { 509 var val = $(data); 510 $append.append(val); 511 } 512 513 }); 514 jQuery('.video-item').videoController({ 515 videoReady: function() { displayEvent('ready'); }, 516 videoStart: function() { displayEvent('start'); }, 517 videoPlay: function() { displayEvent('play'); }, 518 videoPause: function() { displayEvent('pause'); }, 519 videoEnded: function() { displayEvent('ended'); } 520 }); 521 522 }); 523 function playVideo() { 524 jQuery('.playing').videoController('play'); 525 } 526 527 function pauseVideo() { 528 jQuery('.paused').videoController('pause'); 529 } 530 function displayEvent(eventType) { 531 var textarea = $('.events'); 532 textarea.val(textarea.val() + '\n' + eventType); 533 } 534 535})(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.