1/* 2* Template Name: Kerge - Resume / CV / vCard Template 3* Author: lmpixels 4* Author URL: http://themeforest.net/user/lmpixels 5* Version: 2.3 6*/ 7 8var PageTransitions = (function ($, options) { 9"use strict"; 10 var sectionsContainer = $(".subpages"), 11 isAnimating = false, 12 endCurrentPage = true, 13 endNextPage = false, 14 animEndEventNames = { 15 'WebkitAnimation' : 'webkitAnimationEnd', 16 'OAnimation' : 'oAnimationEnd', 17 'msAnimation' : 'MSAnimationEnd', 18 'animation' : 'animationend' 19 }, 20 21 // animation end event name 22 animEndEventName = animEndEventNames[Modernizr.prefixed('animation')], 23 24 // support css animations 25 support = Modernizr.cssanimations; 26 27 function init(options) { 28 29 // Get all the .pt-page sections. 30 $('.pt-page').each( function() { 31 var $page = $(this); 32 $page.data('originalClassList', $page.attr('class')); 33 }); 34 35 // Get all the .pt-wrapper div which is the parent for all pt-div 36 sectionsContainer.each( function() { 37 if (location.hash === "") { 38 $('section[data-id='+ pageStart +']').addClass('pt-page-current'); 39 } 40 }); 41 42 // Adding click event to main menu link 43 $('.pt-trigger').on("click", function (e) { 44 e.preventDefault(); 45 if (isAnimating) { 46 return false; 47 } 48 var pageTrigger = $(this); 49 50 activeMenuItem( pageTrigger ); 51 52 Animate( pageTrigger ); 53 54 location.hash = $(this).attr('href'); 55 56 }); 57 58 window.onhashchange = function(event) { 59 if(location.hash) { 60 if (isAnimating) { 61 return false; 62 } 63 var menuLink = $(menu+' a[href*="'+location.hash.split('/')[0]+'"]'); 64 activeMenuItem( menuLink ); 65 Animate(menuLink); 66 67 ajaxLoader(); 68 } 69 }; 70 71 var menu = options.menu, 72 pageStart = getActiveSection(); 73 74 location.hash = pageStart; 75 var menuLink = $(menu+' a[href*="'+location.hash.split('/')[0]+'"]'); 76 77 activeMenuItem(menuLink); 78 79 Animate(menuLink); 80 81 $('body').append('<div id="page-ajax-loaded" class="page-ajax-loaded animated rotateInDownRight"></div>'); 82 ajaxLoader(); 83 84 $(".lmpixels-arrow-right").click(function() { 85 var activeItem = $('.site-main-menu li.active'); 86 activeItem.next("li").children("a").click(); 87 if ( activeItem.is(':last-child') ) { 88 $('.site-main-menu li:first-child').children("a").click(); 89 } 90 }); 91 92 $(".lmpixels-arrow-left").click(function() { 93 var activeItem = $('.site-main-menu li.active'); 94 activeItem.prev("li").children("a").click(); 95 if ( activeItem.is(':first-child') ) { 96 $('.site-main-menu li:last-child').children("a").click(); 97 } 98 }); 99 } 100 101 function getActiveSection() { 102 if(location.hash === "") { 103 return location.hash = $('section.pt-page').first().attr('data-id'); 104 } 105 else { 106 return location.hash; 107 } 108 } 109 110 function activeMenuItem(item) { 111 if ( !item ) { 112 return false; 113 } 114 115 var navLink = $(item); 116 navLink = navLink['0']; 117 navLink = $(navLink.parentNode); 118 119 if(navLink) { 120 $('ul.site-main-menu li').removeClass('active'); 121 navLink.addClass('active'); 122 } 123 } 124 125 function ajaxLoader() { 126 // Check for hash value in URL 127 var ajaxLoadedContent = $('#page-ajax-loaded'); 128 129 function showContent() { 130 ajaxLoadedContent.removeClass('rotateOutDownRight closed'); 131 ajaxLoadedContent.show(); 132 $('body').addClass('ajax-page-visible'); 133 } 134 135 function hideContent() { 136 $('#page-ajax-loaded').addClass('rotateOutDownRight closed'); 137 $('body').removeClass('ajax-page-visible'); 138 setTimeout(function(){ 139 $('#page-ajax-loaded.closed').html(''); 140 ajaxLoadedContent.hide(); 141 }, 500); 142 } 143 144 var href = $('.ajax-page-load').each(function(){ 145 href = $(this).attr('href'); 146 if(location.hash == location.hash.split('/')[0] + '/' + href.substr(0,href.length-5)){ 147 var toLoad = $(this).attr('href'); 148 showContent(); 149 ajaxLoadedContent.load(toLoad); 150 return false;
151 } 152 }); 153 154 $(document) 155 .on("click",".site-main-menu, #ajax-page-close-button", function (e) { // Hide Ajax Loaded Page on Navigation cleck and Close button 156 e.preventDefault(); 157 hideContent(); 158 location.hash = location.hash.split('/')[0]; 159 }) 160 .on("click",".ajax-page-load", function () { // Show Ajax Loaded Page 161 var hash = location.hash.split('/')[0] + '/' + $(this).attr('href').substr(0,$(this).attr('href').length-5); 162 location.hash = hash; 163 showContent(); 164 165 return false; 166 }); 167 } 168 169 function Animate($pageTrigger, gotoPage) { 170 171 // Checking for 'data-animation' attribute. 172 if (!($pageTrigger.attr('data-animation'))) { 173 var animNumber = parseInt(Math.floor(Math.random() * 67) + 1); 174 $pageTrigger.data('animation',animNumber); 175 } 176 177 var animation = $pageTrigger.data('animation').toString(), 178 gotoPage, inClass, outClass, selectedAnimNumber; 179 180 // Check if the delimiter '-' is present then create an animation array list. 181 if(animation.indexOf('-') != -1) { 182 var randomAnimList = animation.split('-'); 183 selectedAnimNumber = parseInt(randomAnimList[(Math.floor(Math.random() * randomAnimList.length))]); 184 } 185 else { 186 selectedAnimNumber = parseInt(animation); 187 } 188 189 // Checking if the animation number is out of bound, max allowed value is 1 to 67. 190 if (selectedAnimNumber > 67) { 191 alert("Transition.js : Invalid 'data-animation' attribute configuration. Animation number should not be greater than 67"); 192 return false; 193 } 194 195 switch(selectedAnimNumber) { 196 case 1: 197 inClass = 'pt-page-moveFromRight'; 198 outClass = 'pt-page-moveToLeft'; 199 break; 200 case 2: 201 inClass = 'pt-page-moveFromLeft'; 202 outClass = 'pt-page-moveToRight'; 203 break; 204 case 3: 205 inClass = 'pt-page-moveFromBottom'; 206 outClass = 'pt-page-moveToTop'; 207 break; 208 case 4: 209 inClass = 'pt-page-moveFromTop'; 210 outClass = 'pt-page-moveToBottom'; 211 break; 212 case 5: 213 inClass = 'pt-page-moveFromRight pt-page-ontop'; 214 outClass = 'pt-page-fade'; 215 break; 216 case 6: 217 inClass = 'pt-page-moveFromLeft pt-page-ontop'; 218 outClass = 'pt-page-fade'; 219 break; 220 case 7: 221 inClass = 'pt-page-moveFromBottom pt-page-ontop'; 222 outClass = 'pt-page-fade'; 223 break; 224 case 8: 225 inClass = 'pt-page-moveFromTop pt-page-ontop'; 226 outClass = 'pt-page-fade'; 227 break; 228 case 9: 229 inClass = 'pt-page-moveFromRightFade'; 230 outClass = 'pt-page-moveToLeftFade'; 231 break; 232 case 10: 233 inClass = 'pt-page-moveFromLeftFade'; 234 outClass = 'pt-page-moveToRightFade'; 235 break; 236 case 11: 237 inClass = 'pt-page-moveFromBottomFade'; 238 outClass = 'pt-page-moveToTopFade'; 239 break; 240 case 12: 241 inClass = 'pt-page-moveFromTopFade'; 242 outClass = 'pt-page-moveToBottomFade'; 243 break; 244 case 13: 245 inClass = 'pt-page-moveFromRight'; 246 outClass = 'pt-page-moveToLeftEasing pt-page-ontop'; 247 break; 248 case 14: 249 inClass = 'pt-page-moveFromLeft'; 250 outClass = 'pt-page-moveToRightEasing pt-page-ontop'; 251 break; 252 case 15: 253 inClass = 'pt-page-moveFromBottom'; 254 outClass = 'pt-page-moveToTopEasing pt-page-ontop'; 255 break; 256 case 16: 257 inClass = 'pt-page-moveFromTop'; 258 outClass = 'pt-page-moveToBottomEasing pt-page-ontop'; 259 break; 260 case 17: 261 inClass = 'pt-page-moveFromRight pt-page-ontop'; 262 outClass = 'pt-page-scaleDown'; 263 break; 264 case 18:
265 inClass = 'pt-page-moveFromLeft pt-page-ontop'; 266 outClass = 'pt-page-scaleDown'; 267 break; 268 case 19: 269 inClass = 'pt-page-moveFromBottom pt-page-ontop'; 270 outClass = 'pt-page-scaleDown'; 271 break; 272 case 20: 273 inClass = 'pt-page-moveFromTop pt-page-ontop'; 274 outClass = 'pt-page-scaleDown'; 275 break; 276 case 21: 277 inClass = 'pt-page-scaleUpDown pt-page-delay300'; 278 outClass = 'pt-page-scaleDown'; 279 break; 280 case 22: 281 inClass = 'pt-page-scaleUp pt-page-delay300'; 282 outClass = 'pt-page-scaleDownUp'; 283 break; 284 case 23: 285 inClass = 'pt-page-scaleUp'; 286 outClass = 'pt-page-moveToLeft pt-page-ontop'; 287 break; 288 case 24: 289 inClass = 'pt-page-scaleUp'; 290 outClass = 'pt-page-moveToRight pt-page-ontop'; 291 break; 292 case 25: 293 inClass = 'pt-page-scaleUp'; 294 outClass = 'pt-page-moveToTop pt-page-ontop'; 295 break; 296 case 26: 297 inClass = 'pt-page-scaleUp'; 298 outClass = 'pt-page-moveToBottom pt-page-ontop'; 299 break; 300 case 27: 301 inClass = 'pt-page-scaleUpCenter pt-page-delay400'; 302 outClass = 'pt-page-scaleDownCenter'; 303 break; 304 case 28: 305 inClass = 'pt-page-moveFromRight pt-page-delay200 pt-page-ontop'; 306 outClass = 'pt-page-rotateRightSideFirst'; 307 break; 308 case 29: 309 inClass = 'pt-page-moveFromLeft pt-page-delay200 pt-page-ontop'; 310 outClass = 'pt-page-rotateLeftSideFirst'; 311 break; 312 case 30: 313 inClass = 'pt-page-moveFromTop pt-page-delay200 pt-page-ontop'; 314 outClass = 'pt-page-rotateTopSideFirst'; 315 break; 316 case 31: 317 inClass = 'pt-page-moveFromBottom pt-page-delay200 pt-page-ontop'; 318 outClass = 'pt-page-rotateBottomSideFirst'; 319 break; 320 case 32: 321 inClass = 'pt-page-flipInLeft pt-page-delay500'; 322 outClass = 'pt-page-flipOutRight'; 323 break; 324 case 33: 325 inClass = 'pt-page-flipInRight pt-page-delay500'; 326 outClass = 'pt-page-flipOutLeft'; 327 break; 328 case 34: 329 inClass = 'pt-page-flipInBottom pt-page-delay500'; 330 outClass = 'pt-page-flipOutTop'; 331 break; 332 case 35: 333 inClass = 'pt-page-flipInTop pt-page-delay500'; 334 outClass = 'pt-page-flipOutBottom'; 335 break; 336 case 36: 337 inClass = 'pt-page-scaleUp'; 338 outClass = 'pt-page-rotateFall pt-page-ontop'; 339 break; 340 case 37: 341 inClass = 'pt-page-rotateInNewspaper pt-page-delay500'; 342 outClass = 'pt-page-rotateOutNewspaper'; 343 break; 344 case 38: 345 inClass = 'pt-page-moveFromRight'; 346 outClass = 'pt-page-rotatePushLeft'; 347 break; 348 case 39: 349 inClass = 'pt-page-moveFromLeft'; 350 outClass = 'pt-page-rotatePushRight'; 351 break; 352 case 40: 353 inClass = 'pt-page-moveFromBottom'; 354 outClass = 'pt-page-rotatePushTop'; 355 break; 356 case 41: 357 inClass = 'pt-page-moveFromTop'; 358 outClass = 'pt-page-rotatePushBottom'; 359 break; 360 case 42: 361 inClass = 'pt-page-rotatePullRight pt-page-delay180'; 362 outClass = 'pt-page-rotatePushLeft'; 363 break; 364 case 43: 365 inClass = 'pt-page-rotatePullLeft pt-page-delay180'; 366 outClass = 'pt-page-rotatePushRight'; 367 break; 368 case 44: 369 inClass = 'pt-page-rotatePullBottom pt-page-delay180'; 370 outClass = 'pt-page-rotatePushTop'; 371 break; 372 case 45: 373 inClass = 'pt-page-rotatePullTop pt-page-delay180'; 374 outClass = 'pt-page-rotatePushBottom'; 375 break; 376 case 46: 377 inClass = 'pt-page-moveFromRightFade'; 378 outClass = 'pt-page-rotateFoldLeft'; 379 break; 380 case 47:
381 inClass = 'pt-page-moveFromLeftFade'; 382 outClass = 'pt-page-rotateFoldRight'; 383 break; 384 case 48: 385 inClass = 'pt-page-moveFromBottomFade'; 386 outClass = 'pt-page-rotateFoldTop'; 387 break; 388 case 49: 389 inClass = 'pt-page-moveFromTopFade'; 390 outClass = 'pt-page-rotateFoldBottom'; 391 break; 392 case 50: 393 inClass = 'pt-page-rotateUnfoldLeft'; 394 outClass = 'pt-page-moveToRightFade'; 395 break; 396 case 51: 397 inClass = 'pt-page-rotateUnfoldRight'; 398 outClass = 'pt-page-moveToLeftFade'; 399 break; 400 case 52: 401 inClass = 'pt-page-rotateUnfoldTop'; 402 outClass = 'pt-page-moveToBottomFade'; 403 break; 404 case 53: 405 inClass = 'pt-page-rotateUnfoldBottom'; 406 outClass = 'pt-page-moveToTopFade'; 407 break; 408 case 54: 409 inClass = 'pt-page-rotateRoomLeftIn'; 410 outClass = 'pt-page-rotateRoomLeftOut pt-page-ontop'; 411 break; 412 case 55: 413 inClass = 'pt-page-rotateRoomRightIn'; 414 outClass = 'pt-page-rotateRoomRightOut pt-page-ontop'; 415 break; 416 case 56: 417 inClass = 'pt-page-rotateRoomTopIn'; 418 outClass = 'pt-page-rotateRoomTopOut pt-page-ontop'; 419 break; 420 case 57: 421 inClass = 'pt-page-rotateRoomBottomIn'; 422 outClass = 'pt-page-rotateRoomBottomOut pt-page-ontop'; 423 break; 424 case 58: 425 inClass = 'pt-page-rotateCubeLeftIn'; 426 outClass = 'pt-page-rotateCubeLeftOut pt-page-ontop'; 427 break; 428 case 59: 429 inClass = 'pt-page-rotateCubeRightIn'; 430 outClass = 'pt-page-rotateCubeRightOut pt-page-ontop'; 431 break; 432 case 60: 433 inClass = 'pt-page-rotateCubeTopIn'; 434 outClass = 'pt-page-rotateCubeTopOut pt-page-ontop'; 435 break; 436 case 61: 437 inClass = 'pt-page-rotateCubeBottomIn'; 438 outClass = 'pt-page-rotateCubeBottomOut pt-page-ontop'; 439 break; 440 case 62: 441 inClass = 'pt-page-rotateCarouselLeftIn'; 442 outClass = 'pt-page-rotateCarouselLeftOut pt-page-ontop'; 443 break; 444 case 63: 445 inClass = 'pt-page-rotateCarouselRightIn'; 446 outClass = 'pt-page-rotateCarouselRightOut pt-page-ontop'; 447 break; 448 case 64: 449 inClass = 'pt-page-rotateCarouselTopIn'; 450 outClass = 'pt-page-rotateCarouselTopOut pt-page-ontop'; 451 break; 452 case 65: 453 inClass = 'pt-page-rotateCarouselBottomIn'; 454 outClass = 'pt-page-rotateCarouselBottomOut pt-page-ontop'; 455 break; 456 case 66: 457 inClass = 'pt-page-rotateSidesIn pt-page-delay200'; 458 outClass = 'pt-page-rotateSidesOut'; 459 break; 460 case 67: 461 inClass = 'pt-page-rotateSlideIn'; 462 outClass = 'pt-page-rotateSlideOut'; 463 break; 464 } 465 466 // This will get the pt-trigger elements parent wrapper div 467 var $pageWrapper = sectionsContainer, 468 currentPageId = $pageWrapper.data('current'), tempPageIndex, 469 linkhref = $pageTrigger.attr('href').split("#"), 470 gotoPage = linkhref[1]; 471 472 tempPageIndex = currentPageId; 473 474 // Current page to be removed. 475 var $currentPage = $('section[data-id="' + currentPageId + '"]'); 476 477 // NEXT PAGE 478 currentPageId = gotoPage; 479 480 // Check if the current page is same as the next page then do not do the animation 481 // else reset the 'isAnimatiing' flag 482 if (tempPageIndex != currentPageId) { 483 isAnimating = true; 484 485 $pageWrapper.data('current', currentPageId); 486 487 // Next page to be animated. 488 489 var $nextPage = $('section[data-id='+currentPageId+']').addClass('pt-page-current'); 490 491 $nextPage.scrollTop(0); 492 493 $currentPage.addClass(outClass).on(animEndEventName, function() { 494 $currentPage.off(animEndEventName); 495 endCurrentPage = true; 496 if(endNextPage) { 497 onEndAnimation($pageWrapper, $nextPage, $currentPage); 498 endCurrentPage = false;
499 } 500 }); 501 502 $nextPage.addClass(inClass).on(animEndEventName, function() { 503 $nextPage.off(animEndEventName); 504 endNextPage = true; 505 if(endCurrentPage) { 506 onEndAnimation($pageWrapper, $nextPage, $currentPage); 507 endNextPage = false; 508 isAnimating = false; 509 } 510 }); 511 512 } 513 else { 514 isAnimating = false; 515 } 516 517 518 // Check if the animation is supported by browser and reset the pages. 519 if(!support) { 520 onEndAnimation($currentPage, $nextPage); 521 } 522 523 } 524 525 function onEndAnimation($pageWrapper, $nextPage, $currentPage) { 526 resetPage($nextPage, $currentPage); 527 } 528 529 function resetPage($nextPage, $currentPage) { 530 $currentPage.attr('class', $currentPage.data('originalClassList')); 531 $nextPage.attr('class', $nextPage.data('originalClassList') + ' pt-page-current'); 532 } 533 534 return { 535 init : init, 536 }; 537 538})(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.