1/*! 2 * Kopa custom js (http://kopatheme.com) 3 * Copyright 2014 Kopasoft. 4 * Licensed under GNU General Public License v3 5 */ 6 7/* ========================================================= 8Comment Form 9============================================================ */ 10jQuery(document).ready(function(){ 11 if(jQuery("#comments-form").length > 0){ 12 // get front validate localization 13 var validateLocalization = kopa_custom_front_localization.validate; 14 15 // Validate the comments form 16 jQuery('#comments-form').validate({ 17 18 // Add requirements to each of the fields 19 rules: { 20 author: { 21 required: true, 22 minlength: 2 23 }, 24 email: { 25 required: true, 26 email: true 27 }, 28 comment: { 29 required: true, 30 minlength: 10 31 } 32 }, 33 34 // Specify what error messages to display 35 // when the user does something horrid 36 messages: { 37 author: { 38 required: validateLocalization.name.required, 39 minlength: jQuery.format(validateLocalization.name.minlength) 40 }, 41 email: { 42 required: validateLocalization.email.required, 43 email: validateLocalization.email.email 44 }, 45 url: { 46 required: validateLocalization.url.required, 47 url: validateLocalization.url.url 48 }, 49 comment: { 50 required: validateLocalization.message.required, 51 minlength: jQuery.format(validateLocalization.message.minlength) 52 } 53 } 54 }); 55 } 56 57 if(jQuery("#contact-form").length > 0){ 58 // get front validate localization 59 var validateLocalization = kopa_custom_front_localization.validate; 60 61 // Validate the contact form 62 jQuery('#contact-form').validate({ 63 64 // Add requirements to each of the fields 65 rules: { 66 name: { 67 required: true, 68 minlength: 2 69 }, 70 email: { 71 required: true, 72 email: true 73 }, 74 message: { 75 required: true, 76 minlength: 10 77 } 78 }, 79 80 // Specify what error messages to display 81 // when the user does something horrid 82 messages: { 83 name: { 84 required: validateLocalization.name.required, 85 minlength: jQuery.format(validateLocalization.name.minlength) 86 }, 87 email: { 88 required: validateLocalization.email.required, 89 email: validateLocalization.email.email 90 }, 91 url: { 92 required: validateLocalization.url.required, 93 url: validateLocalization.url.url 94 }, 95 message: { 96 required: validateLocalization.message.required, 97 minlength: jQuery.format(validateLocalization.message.minlength) 98 } 99 }, 100 101 // Use Ajax to send everything to processForm.php 102 submitHandler: function(form) { 103 jQuery("#submit-contact").attr("value", validateLocalization.form.sending); 104 jQuery(form).ajaxSubmit({ 105 success: function(responseText, statusText, xhr, $form) { 106 jQuery("#response").html(responseText).hide().slideDown("fast"); 107 jQuery("#submit-contact").attr("value", validateLocalization.form.submit); 108 } 109 });
110 return false; 111 } 112 }); 113 } 114}); 115 116/* ========================================================= 117HeadLine Scroller 118============================================================ */ 119 120jQuery(function() { 121 var _scroll = { 122 delay: 1000, 123 easing: 'linear', 124 items: 1, 125 duration: 0.07, 126 timeoutDuration: 0, 127 pauseOnHover: 'immediate' 128 }; 129 jQuery('.ticker-1').carouFredSel({ 130 width: 1000, 131 align: false, 132 items: { 133 width: 'variable', 134 height: 40, 135 visible: 1 136 }, 137 scroll: _scroll 138 }); 139 140 // set carousels to be 100% wide 141 jQuery('.caroufredsel_wrapper').css('width', '100%'); 142}); 143 144/* ========================================================= 145Sub menu 146==========================================================*/ 147(function($){ //create closure so we can safely use $ as alias for jQuery 148 149 jQuery(document).ready(function(){ 150 151 // initialise plugin 152 var example = jQuery('#main-menu').superfish({ 153 //add options here if required 154 disableHI: true // Fix: Superfish conflicts with WP admin bar for WordPress < 3.6 155 }); 156 }); 157 158})(jQuery); 159 160/* ========================================================= 161Mobile menu 162============================================================ */ 163jQuery(document).ready(function () { 164 165 jQuery('#mobile-menu > span').on('click', function () { 166 167 var mobile_menu = jQuery('#toggle-view-menu'); 168 169 if (mobile_menu.is(':hidden')) { 170 mobile_menu.slideDown('300'); 171 jQuery(this).children('span').html('-'); 172 } else { 173 mobile_menu.slideUp('300'); 174 jQuery(this).children('span').html('+'); 175 } 176 }); 177 178 jQuery('#toggle-view-menu li').on('click', function () { 179 180 var text = jQuery(this).children('div.menu-panel'); 181 182 if (text.is(':hidden')) { 183 text.slideDown('300'); 184 jQuery(this).children('span').html('-'); 185 } else { 186 text.slideUp('300'); 187 jQuery(this).children('span').html('+'); 188 } 189 190 jQuery(this).toggleClass('active'); 191 192 }); 193 194}); 195 196/* ========================================================= 197Flex Slider 198============================================================ */ 199jQuery(window).load(function(){ 200 201 // flexslider widget 1 202 jQuery('.home-slider').each(function () { 203 var $this = jQuery(this), 204 dataAnimation = $this.data('animation'), 205 dataDirection = $this.data('direction'), 206 dataSlideshowSpeed = $this.data('slideshow_speed'), 207 dataAnimationSpeed = $this.data('animation_speed'), 208 dataIsAutoPlay = $this.data('autoplay'); 209 210 $this.flexslider({ 211 animation: dataAnimation, // animation effect 212 direction: dataDirection, // direction 213 slideshow: dataIsAutoPlay, // autoplay 214 slideshowSpeed: dataSlideshowSpeed, // slideshow 215 animationSpeed: dataAnimationSpeed, // animation speed 216 smoothHeight:true, 217 pauseOnHover: true, 218 start: function(slider){ 219 jQuery('body').removeClass('loading'); 220 } 221 }); 222 }); 223 224 // article list gallery slider 225 jQuery('.entry-thumb-slider').flexslider({ 226 animation: "slide", 227 slideshow: false, 228 smoothHeight:true, 229 pauseOnHover: true, 230 start: function(slider){ 231 jQuery('body').removeClass('loading'); 232 } 233 }); 234 235 // flexslide widget 2 236 jQuery('.gallery-slider').each(function () { 237 var $this = jQuery(this), 238 dataAnimation = $this.data('animation'), 239 dataDirection = $this.data('direction'), 240 dataSlideshowSpeed = $this.data('slideshow_speed'), 241 dataAnimationSpeed = $this.data('animation_speed'), 242 dataIsAutoPlay = $this.data('autoplay'); 243 244 $this.flexslider({ 245 animation: dataAnimation, // animation effect 246 direction: dataDirection, // direction 247 slideshow: dataIsAutoPlay, // autoplay 248 slideshowSpeed: dataSlideshowSpeed, // slideshow 249 animationSpeed: dataAnimationSpeed, // animation speed 250 smoothHeight:true, 251 pauseOnHover: true, 252 start: function(slider){ 253 jQuery('body').removeClass('loading'); 254 } 255 }); 256 });
257 258 // gallery post format slider 259 jQuery('.kopa-single-slider').flexslider({ 260 animation: "slide", 261 smoothHeight:true, 262 pauseOnHover: true, 263 start: function(slider){ 264 jQuery('body').removeClass('loading'); 265 } 266 }); 267 268 // blog slider 2 269 jQuery('.kopa-blog-slider').each(function () { 270 var $this = jQuery(this), 271 dataAnimation = $this.data('animation'), 272 dataSlideshowSpeed = $this.data('slideshow_speed'), 273 dataAnimationSpeed = $this.data('animation_speed'), 274 dataIsAutoPlay = $this.data('autoplay'); 275 276 $this.flexslider({ 277 animation: dataAnimation, // animation effect 278 slideshow: dataIsAutoPlay, // autoplay 279 slideshowSpeed: dataSlideshowSpeed, // slideshow 280 animationSpeed: dataAnimationSpeed, // animation speed 281 smoothHeight:true, 282 pauseOnHover: true, 283 start: function(slider){ 284 jQuery('body').removeClass('loading'); 285 } 286 }); 287 }); 288}); 289 290/* ========================================================= 291Tabs 292============================================================ */ 293jQuery(document).ready(function() { 294 295 jQuery( '.tabs-1' ).each(function () { 296 var $this = jQuery(this), 297 firstTabContentID = $this.find('li a').first().attr('href'); 298 299 // add active class to first list item 300 $this.children('li').first().addClass('active'); 301 302 // hide all tabs 303 $this.find('li a').each(function () { 304 var tabContentID = jQuery(this).attr('href'); 305 jQuery(tabContentID).hide(); 306 }); 307 // show only first tab 308 jQuery(firstTabContentID).show(); 309 310 $this.children('li').on('click', function(e) { 311 e.preventDefault(); 312 var $this = jQuery(this), 313 $currentClickLink = $this.children('a'); 314 315 if ( $this.hasClass('active') ) { 316 return; 317 } else { 318 $this.addClass('active') 319 .siblings().removeClass('active'); 320 } 321 322 $this.siblings('li').find('a').each(function () { 323 var tabContentID = jQuery(this).attr('href'); 324 jQuery(tabContentID).hide(); 325 }); 326 327 jQuery( $currentClickLink.attr('href') ).fadeIn(); 328 329 }); 330 }); 331 332 jQuery( '.tabs-2' ).each(function () { 333 var $this = jQuery(this), 334 firstTabContentID = $this.find('li a').first().attr('href'); 335 336 // add active class to first list item 337 $this.children('li').first().addClass('active'); 338 339 // hide all tabs 340 $this.find('li a').each(function () { 341 var tabContentID = jQuery(this).attr('href'); 342 jQuery(tabContentID).hide(); 343 }); 344 // show only first tab 345 jQuery(firstTabContentID).show(); 346 347 $this.children('li').on('click', function(e) { 348 e.preventDefault(); 349 var $this = jQuery(this), 350 $currentClickLink = $this.children('a'); 351 352 if ( $this.hasClass('active') ) { 353 return; 354 } else { 355 $this.addClass('active') 356 .siblings().removeClass('active'); 357 } 358 359 $this.siblings('li').find('a').each(function () { 360 var tabContentID = jQuery(this).attr('href'); 361 jQuery(tabContentID).hide(); 362 }); 363 364 jQuery( $currentClickLink.attr('href') ).fadeIn(); 365 366 }); 367 }); 368 369 jQuery( '.tabs-3' ).each(function () { 370 var $this = jQuery(this), 371 firstTabContentID = $this.find('li a').first().attr('href'); 372 373 // add active class to first list item 374 $this.children('li').first().addClass('active'); 375 376 // hide all tabs 377 $this.find('li a').each(function () { 378 var tabContentID = jQuery(this).attr('href'); 379 jQuery(tabContentID).hide(); 380 }); 381 // show only first tab 382 jQuery(firstTabContentID).show(); 383 384 $this.children('li').on('click', function(e) { 385 e.preventDefault(); 386 var $this = jQuery(this), 387 $currentClickLink = $this.children('a'); 388 389 if ( $this.hasClass('active') ) { 390 return; 391 } else { 392 $this.addClass('active') 393 .siblings().removeClass('active'); 394 } 395 396 $this.siblings('li').find('a').each(function () { 397 var tabContentID = jQuery(this).attr('href'); 398 jQuery(tabContentID).hide(); 399 }); 400 401 jQuery( $currentClickLink.attr('href') ).fadeIn(); 402 403 }); 404 });
405 406}); 407 408/* ========================================================= 409Carousel 410============================================================ */ 411jQuery(window).load(function() { 412 413 if( jQuery(".kopa-featured-news-carousel").length > 0){ 414 jQuery('.kopa-featured-news-carousel').each(function() { 415 var $this = jQuery(this), 416 prevID = $this.data('prev-id'), 417 nextID = $this.data('next-id'), 418 paginationID = $this.data('pagination-id'), 419 scrollItems = $this.data('scroll-items'); 420 421 $this.carouFredSel({ 422 responsive: true, 423 prev: prevID, 424 next: nextID, 425 width: '100%', 426 height:'variable', 427 scroll: scrollItems, 428 pagination: paginationID, 429 auto: false, 430 pauseOnHover: true, 431 items: { 432 width: 234, 433 height: 'auto', 434 visible: { 435 min: 1, 436 max: 4 437 } 438 } 439 }) 440 }); 441 } 442}); 443 444/* ========================================================= 445prettyPhoto 446============================================================ */ 447jQuery(document).ready(function(){ 448 init_image_effect(); 449}); 450 451jQuery(window).resize(function(){ 452 init_image_effect(); 453}); 454 455function init_image_effect(){ 456 457 var view_p_w = jQuery(window).width(); 458 var pp_w = 500; 459 var pp_h = 344; 460 461 if(view_p_w <= 479){ 462 pp_w = '120%'; 463 pp_h = '100%'; 464 } 465 else if(view_p_w >= 480 && view_p_w <= 599){ 466 pp_w = '100%'; 467 pp_h = '170%'; 468 } 469 470 jQuery("a[rel^='prettyPhoto']").prettyPhoto({ 471 show_title: false, 472 deeplinking:false, 473 social_tools:false, 474 default_width: pp_w, 475 default_height: pp_h 476 }); 477} 478 479/* ========================================================= 480Twitter 481============================================================ */ 482jQuery(function(){ 483 jQuery('.kp-tweets-container').each(function() { 484 var $this = jQuery(this), 485 twitterUsername = $this.data('twitter-username'), 486 tweetsNumber = $this.data('tweets-number'); 487 488 $this.tweetable({ 489 username: twitterUsername, 490 time: true, 491 rotate: false, 492 speed: 4000, 493 limit: tweetsNumber, 494 replies: false, 495 position: 'append', 496 failed: "Sorry, twitter is currently unavailable for this user.", 497 html5: true, 498 onComplete:function($ul){ 499 jQuery('time').timeago(); 500 } 501 }); 502 }); 503}); 504 505/* ========================================================= 506Accordion 507========================================================= */ 508jQuery(document).ready(function() { 509 var acc_wrapper=jQuery('.acc-wrapper'); 510 if (acc_wrapper.length >0) 511 { 512 513 jQuery('.acc-wrapper .accordion-container').hide(); 514 jQuery.each(acc_wrapper, function(index, item){ 515 jQuery(this).find(jQuery('.accordion-title')).first().addClass('active').next().show(); 516 517 }); 518 519 jQuery('.accordion-title').on('click', function(e) { 520 kopa_accordion_click(jQuery(this)); 521 e.preventDefault(); 522 }); 523 524 var titles = jQuery('.accordion-title'); 525 526 jQuery.each(titles,function(){ 527 kopa_accordion_click(jQuery(this)); 528 }); 529 } 530 531}); 532 533function kopa_accordion_click (obj) { 534 if( obj.next().is(':hidden') ) { 535 obj.parent().find(jQuery('.active')).removeClass('active').next().slideUp(300); 536 obj.toggleClass('active').next().slideDown(300); 537 538 } 539jQuery('.accordion-title span').html('+'); 540 if (obj.hasClass('active')) { 541 obj.find('span').first().html('-'); 542 } 543} 544 545/* =========================================================
546Full Screen Background 547============================================================ */ 548// jQuery(document).ready(function(){ 549// var view_port_w; 550// if(self.innerWidth!=undefined) view_port_w= self.innerWidth; 551// else{ 552// var D= document.documentElement; 553// if(D) view_port_w= D.clientWidth; 554// } 555// if(view_port_w > 1000){ 556// jQuery.backstretch([ 557// // "http://localhost/news-mix/wp-content/uploads/2013/08/01.jpg" 558// ], { 559// fade: 750, 560// duration: 4000 561// }); 562// } 563// }) 564 565/* ========================================================= 566Toggle Boxes 567============================================================ */ 568jQuery(document).ready(function () { 569 570 jQuery('#toggle-view li').on('click', function (event) { 571 572 var text = jQuery(this).children('div.panel'); 573 574 if (text.is(':hidden')) { 575 jQuery(this).addClass('active'); 576 text.slideDown('300'); 577 jQuery(this).children('span').html('-'); 578 } else { 579 jQuery(this).removeClass('active'); 580 text.slideUp('300'); 581 jQuery(this).children('span').html('+'); 582 } 583 584 }); 585 586}); 587 588/* ========================================================= 589Gallery slider 590============================================================ */ 591jQuery(window).load(function(){ 592 593 jQuery('.kp-gallery-carousel').flexslider({ 594 animation: "slide", 595 controlNav: false, 596 slideshow: false, 597 itemWidth: 149, 598 itemMargin: 6, 599 asNavFor: '.kp-gallery-slider' 600 }); 601 602 jQuery('.kp-gallery-slider').flexslider({ 603 animation: "slide", 604 controlNav: false, 605 slideshow: false, 606 sync: ".kp-gallery-carousel", 607 start: function(slider){ 608 jQuery('body').removeClass('loading'); 609 } 610 }); 611}); 612 613/* ========================================================= 614Scroll to top 615============================================================ */ 616jQuery(document).ready(function(){ 617 618 // hide #back-top first 619 jQuery("#back-top").hide(); 620 621 // fade in #back-top 622 jQuery(function () { 623 jQuery(window).scroll(function () { 624 if (jQuery(this).scrollTop() > 200) { 625 jQuery('#back-top').fadeIn(); 626 } else { 627 jQuery('#back-top').fadeOut(); 628 } 629 }); 630 631 // scroll body to 0px on click 632 jQuery('#back-top a').on('click', function () { 633 jQuery('body,html').animate({ 634 scrollTop: 0 635 }, 800); 636 return false; 637 }); 638 }); 639 640}); 641 642/* ========================================================= 643UISearch 644============================================================ */ 645new UISearch( document.getElementById( 'sb-search' ) ); 646 647/*========================================================== 648focus on comment form when click reply button 649============================================================*/ 650jQuery(document).ready(function(){ 651 jQuery('.comment-reply-link').on('click',function(){ 652 jQuery('#comment_message').focus(); 653 }); 654});
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.