1/* 2 * Document : app.js 3 * Author : pixelcave 4 * Description: Custom scripts and plugin initializations 5 */ 6 7var App = function() { 8 9 /* Initialization UI Code */ 10 var uiInit = function() { 11 12 page = $('#page-container'); 13 pageContent = $('#page-content'); 14 header = $('header'); 15 footer = $('footer'); 16 17 sidebar = $('#sidebar'); 18 sScroll = $('#sidebar-scroll'); 19 sidebarAlt = $('#sidebar-alt'); 20 sScrollAlt = $('#sidebar-alt-scroll'); 21 22 // Initialize sidebars functionality 23 handleSidebar('init'); 24 25 // Sidebar navigation functionality 26 handleNav(); 27 handleSidebar('sidebar-scroll'); 28 // Handle UI 29 scrollToTop(); 30 scrollToYear(); 31 32 resizePageContent(); 33 main_content_minheight(); 34 iframe_proportion(); 35 toTopPosition(); 36 37 // Initialize tabs 38 $('[data-toggle="tabs"] a, .enable-tabs a').click(function(e){ e.preventDefault(); $(this).tab('show'); }); 39 40 // Initialize Tooltips 41 $('[data-toggle="tooltip"], .enable-tooltip').tooltip({container: 'body', animation: false}); 42 43 // Initialize Popovers 44 $('[data-toggle="popover"], .enable-popover').popover({container: 'body', animation: true}); 45 46 // Initialize Placeholder 47 // $('input, textarea').placeholder(); 48 49 // Initialize Select2 50 setTimeout(function(){ 51 $('.select-select2').select2({ 52 minimumResultsForSearch: -1 53 }); 54 $('.select-select2-search').select2(); 55 56 $('.select-select2').on('change', function (e) { 57 $(this).valid(); 58 $(this).select2('destroy'); 59 $(this).prev(".tooltip").remove(); 60 $(this).select2({ 61 minimumResultsForSearch: -1 62 }); 63 }); 64 65 $('.select-select2-search').on('change', function(e){ 66 $(this).valid(); 67 }); 68 69 },300); 70 71 72 73 // Toggle animation class when an element appears with Jquery Appear plugin 74 $('[data-toggle="animation-appear"]').each(function(){ 75 var $this = $(this); 76 var $animClass = $this.attr('data-animation-class'); 77 78 // var $elemOff = $this.attr('data-element-offset'); 79 if($(window).width()<1024){ 80 $this.removeClass('invisible'); 81 return; 82 } 83 $this.appear(function() { 84 $this.addClass($animClass); 85 setTimeout(function(){ 86 $this.removeClass('invisible'); 87 },300) 88 }); 89 90 }); 91 92 $('[data-toggle="animation-appear-delay"]').each(function(){ 93 var $this = $(this); 94 var $animClass = $this.attr('data-animation-class'); 95 var animate_delay = parseInt($this.data('animation-delay')); 96 // var $elemOff = $this.attr('data-element-offset'); 97 98 $this.appear(function() { 99 if(isNaN(animate_delay)){ 100 $this.addClass($animClass); 101 setTimeout(function(){ 102 $this.removeClass('invisible'); 103 },300); 104 }else{ 105 setTimeout(function(){ 106 $this.addClass($animClass); 107 setTimeout(function(){ 108 $this.removeClass('invisible'); 109 },300); 110 },animate_delay); 111 } 112 }); 113 114 }); 115 116 $('[data-toggle="animation-show"]').each(function(){ 117 var $this = $(this); 118 var animate_delay = parseInt($this.data('animation-delay')); 119 var $animClass = $this.attr('data-animation-class'); 120 if(isNaN(animate_delay)){ 121 $this.addClass($animClass); 122 setTimeout(function(){ 123 $this.removeClass('invisible'); 124 },300); 125 }else{ 126 setTimeout(function(){ 127 $this.addClass($animClass); 128 setTimeout(function(){ 129 $this.removeClass('invisible'); 130 },300); 131 },animate_delay); 132 } 133 134 }); 135 136 $('.global_refresh_img,#global_check_vcode,#pop_check_vcode').on('click', function(event) { 137 vTarget = '#'+$(this).data('targetfield'); 138 globalGenCode(vTarget); 139 }); 140 141 $('div#show-sidebar').on('click',function(event){ 142 event.preventDefault(); 143 $(this).toggleClass('active'); 144 if ($('div#mb-sidebar').hasClass('show-sidebar')) { //éé 145 $('body').css('overflow','auto'); 146 $('div#mb-sidebar').removeClass('show-sidebar'); 147 $('div#mb-sidebar').addClass('hidden-sidebar'); 148 $('.mb-title').removeClass('open'); 149 150 //sidebaråè½åè§£é¤åºå® 151 $('.sidebar-content .function-area').removeClass('fixed'); 152 $('.sidebar-nav.layer-1').removeClass('function-fixed'); 153 } 154 else { //éå 155 $('body').css('overflow','hidden'); 156 $('div#mb-sidebar').removeClass('hidden-sidebar'); 157 $('div#mb-sidebar').addClass('show-sidebar'); 158 $('.mb-title').addClass('open'); 159 if($('.sidebar-nav.layer-1 > li > a.active').length>0){ 160 App.handlePageScroll($('.sidebar-nav.layer-1 > li > a.active'),0,300); 161 } 162 163 //sidebaråè½ååºå® 164 setTimeout(function(){ 165 $('.sidebar-content .function-area').addClass('fixed'); 166 $('.sidebar-nav.layer-1').addClass('function-fixed'); 167 },500); 168 } 169 }); 170 171 $('.download-file-link, .download-file').on('click',function(e){ 172 e.preventDefault(); 173 target_link = $(this).attr('href'); 174 filename = $(this).data('file-name'); 175 if(filename == undefined){ 176 filename = target_link.substring(target_link.lastIndexOf('/')+1); 177 } 178 bootbox.confirm({ 179 message: "æªæ¡å稱 "+filename+"ï¼æ¯å¦è¦ä¸è¼?", 180 buttons: { 181 confirm: { 182 label: '確å®', 183 className: 'btn-info' 184 }, 185 cancel: { 186 label: 'åæ¶', 187 className: 'btn-default' 188 } 189 }, 190 callback: function(result) { 191 if (result) { 192 var a = document.createElement('a'); 193 if(target_link){ 194 a.href = encodeURI(target_link); 195 // a.download = filename; 196 a.click(); 197 } 198 } 199 } 200 }); 201 }); 202 203 204 205 206 $('.date-picker').datepicker({ 207 format: 'yyyy-mm-dd', 208 language: 'zh-TW', 209 startView : 'decade', 210 autoclose: true 211 }).attr('autocomplete','off'); 212 213 214 if(window.location.href.indexOf('#')>=0){ 215 link_hash = getUrlHashByString(window.location.href); 216 to_obj = $('#'+link_hash); 217 if($('[name="'+link_hash+'"]').length > 0){ 218 to_obj = $('[name="'+link_hash+'"]'); 219 } 220 if(to_obj.length <= 0){ 221 return; 222 } 223 setTimeout(function(){ 224 $(window).scrollTop(to_obj.offset().top - $('header').outerHeight() -10); 225 },10); 226 } 227 $('a[href*="#"]').click(function(e){ 228 link_url = $(this).attr('href'); 229 link_hash = getUrlHashByString(link_url); 230 link_pathname = link_url.split('#')[0]; 231 if(window.location.href.indexOf(link_pathname)>=0){ 232 to_obj = $('#'+link_hash); 233 if($('[name="'+link_hash+'"]').length > 0){ 234 to_obj = $('[name="'+link_hash+'"]'); 235 } 236 if(to_obj.length <= 0){ 237 return; 238 } 239 e.preventDefault(); 240 if($('div#mb-sidebar').hasClass('show-sidebar')){ 241 $('div#show-mb-sidebar').click(); 242 } 243 $(window).scrollTop(to_obj.offset().top - $('header').outerHeight() -10); 244 } 245 }); 246 247 ellipsis_line_ary = [1,2,3,4]; 248
249 ellipsis_line_ary.forEach(function(value){ 250 Ellipsis({ 251 ellipsis: '...', 252 ellipsis_class:'', 253 ellipsis_tag:'span', 254 class: '.ellipsis-area.line-'+value, 255 responsive: true, 256 lines: value, 257 break_word:true 258 }); 259 }); 260 $(window).on("resize scroll", function() { 261 main_content_minheight(); 262 iframe_proportion(); 263 toTopPosition(); 264 }); 265 };//uiInit end 266 267 /* Page Loading functionality */ 268 var pageLoading = function(){ 269 var pageWrapper = $('#page-wrapper'); 270 271 if (pageWrapper.hasClass('page-loading')) { 272 pageWrapper.removeClass('page-loading'); 273 } 274 }; 275 276 277 var isMobile = function() { 278 //console.log("Navigator: " + navigator.userAgent); 279 return /(iphone|ipod|ipad|android|blackberry|windows ce|palm|symbian)/i.test(navigator.userAgent); 280 }; 281 282 283 /* Gets window width cross browser */ 284 var getWindowWidth = function(){ 285 return window.innerWidth 286 || document.documentElement.clientWidth 287 || document.body.clientWidth; 288 }; 289 /* Sidebar Navigation functionality */ 290 var handleNav = function() { 291 292 // Animation Speed, change the values for different results 293 var upSpeed = 250; 294 var downSpeed = 250; 295 296 // Get all vital links 297 var menuLinks = $('.sidebar-nav-menu'); 298 var submenuLinks = $('.sidebar-nav-submenu'); 299 300 // Primary Accordion functionality 301 menuLinks.click(function(){ 302 var link = $(this); 303 304 if (page.hasClass('sidebar-mini') && page.hasClass('sidebar-visible-lg-mini') && (getWindowWidth() > 991)) { 305 if (link.hasClass('open')) { 306 link.removeClass('open'); 307 } 308 else { 309 $('.sidebar-nav-menu.open').removeClass('open'); 310 link.addClass('open'); 311 } 312 } 313 else if (!link.parent().hasClass('active')) { 314 if (link.hasClass('open')) { 315 link.removeClass('open').next().slideUp(upSpeed, function(){ 316 handlePageScroll(link, 0, 300); 317 }); 318 319 // Resize #page-content to fill empty space if exists 320 setTimeout(resizePageContent, upSpeed); 321 } 322 else { 323 $('.sidebar-nav-menu.open').removeClass('open').next().slideUp(upSpeed); 324 link.addClass('open').next().slideDown(downSpeed, function(){ 325 handlePageScroll(link, 0, 600); 326 }); 327 328 // Resize #page-content to fill empty space if exists 329 setTimeout(resizePageContent, ((upSpeed > downSpeed) ? upSpeed : downSpeed)); 330 } 331 } 332 333 return false; 334 }); 335 336 // Submenu Accordion functionality 337 submenuLinks.click(function(){ 338 var link = $(this); 339 console.log('submenuLinks'); 340 if (link.parent().hasClass('active') !== true) { 341 if (link.hasClass('open')) { 342 link.removeClass('open').next().slideUp(upSpeed, function(){ 343 handlePageScroll(link, 200, 300); 344 }); 345 346 // Resize #page-content to fill empty space if exists 347 setTimeout(resizePageContent, upSpeed); 348 } 349 else { 350 link.closest('ul').find('.sidebar-nav-submenu.open').removeClass('open').next().slideUp(upSpeed); 351 link.addClass('open').next().slideDown(downSpeed, function(){ 352 handlePageScroll(link, 150, 600); 353 }); 354 355 // Resize #page-content to fill empty space if exists 356 setTimeout(resizePageContent, ((upSpeed > downSpeed) ? upSpeed : downSpeed)); 357 } 358 } 359 360 return false;
361 }); 362 }; 363 364 var handleSidebar = function(mode, extra) { 365 // console.log(mode); 366 if (mode === 'init') { 367 // Init sidebars scrolling functionality 368 handleSidebar('sidebar-scroll'); 369 handleSidebar('sidebar-alt-scroll'); 370 371 372 373 374 // Close the other sidebar if we hover over a partial one 375 // In smaller screens (the same applies to resized browsers) two visible sidebars 376 // could mess up our main content (not enough space), so we hide the other one :-) 377 $('.sidebar-partial #sidebar') 378 .mouseenter(function(){ handleSidebar('close-sidebar-alt'); }); 379 $('.sidebar-alt-partial #sidebar-alt') 380 .mouseenter(function(){ handleSidebar('close-sidebar'); }); 381 } else { 382 var windowW = getWindowWidth(); 383 384 if (mode === 'toggle-sidebar') { 385 if ( windowW > 991) { // Toggle main sidebar in large screens (> 991px) 386 page.toggleClass('sidebar-visible-lg'); 387 388 if (page.hasClass('sidebar-mini')) { 389 page.toggleClass('sidebar-visible-lg-mini'); 390 } 391 392 if (page.hasClass('sidebar-visible-lg')) { 393 handleSidebar('close-sidebar-alt'); 394 } 395 396 // If 'toggle-other' is set, open the alternative sidebar when we close this one 397 if (extra === 'toggle-other') { 398 if (!page.hasClass('sidebar-visible-lg')) { 399 handleSidebar('open-sidebar-alt'); 400 } 401 } 402 } else { // Toggle main sidebar in small screens (< 992px) 403 page.toggleClass('sidebar-visible-xs'); 404 405 if (page.hasClass('sidebar-visible-xs')) { 406 handleSidebar('close-sidebar-alt'); 407 } 408 } 409 410 // Handle main sidebar scrolling functionality 411 handleSidebar('sidebar-scroll'); 412 } 413 else if (mode === 'toggle-sidebar-alt') { 414 if ( windowW > 991) { // Toggle alternative sidebar in large screens (> 991px) 415 page.toggleClass('sidebar-alt-visible-lg'); 416 417 if (page.hasClass('sidebar-alt-visible-lg')) { 418 handleSidebar('close-sidebar'); 419 } 420 421 // If 'toggle-other' is set open the main sidebar when we close the alternative 422 if (extra === 'toggle-other') { 423 if (!page.hasClass('sidebar-alt-visible-lg')) { 424 handleSidebar('open-sidebar'); 425 } 426 } 427 } else { // Toggle alternative sidebar in small screens (< 992px) 428 page.toggleClass('sidebar-alt-visible-xs'); 429 430 if (page.hasClass('sidebar-alt-visible-xs')) { 431 handleSidebar('close-sidebar'); 432 } 433 } 434 } 435 else if (mode === 'open-sidebar') { 436 if ( windowW > 991) { // Open main sidebar in large screens (> 991px) 437 if (page.hasClass('sidebar-mini')) { page.removeClass('sidebar-visible-lg-mini'); } 438 page.addClass('sidebar-visible-lg'); 439 } else { // Open main sidebar in small screens (< 992px) 440 page.addClass('sidebar-visible-xs'); 441 } 442 443 // Close the other sidebar 444 handleSidebar('close-sidebar-alt'); 445 } 446 else if (mode === 'open-sidebar-alt') { 447 if ( windowW > 991) { // Open alternative sidebar in large screens (> 991px) 448 page.addClass('sidebar-alt-visible-lg'); 449 } else { // Open alternative sidebar in small screens (< 992px) 450 page.addClass('sidebar-alt-visible-xs'); 451 } 452 453 // Close the other sidebar 454 handleSidebar('close-sidebar'); 455 } 456 else if (mode === 'close-sidebar') { 457 if ( windowW > 991) { // Close main sidebar in large screens (> 991px) 458 page.removeClass('sidebar-visible-lg'); 459 if (page.hasClass('sidebar-mini')) { page.addClass('sidebar-visible-lg-mini'); } 460 } else { // Close main sidebar in small screens (< 992px) 461 page.removeClass('sidebar-visible-xs'); 462 } 463 } 464 else if (mode === 'close-sidebar-alt') { 465 if ( windowW > 991) { // Close alternative sidebar in large screens (> 991px) 466 page.removeClass('sidebar-alt-visible-lg'); 467 } else { // Close alternative sidebar in small screens (< 992px) 468 page.removeClass('sidebar-alt-visible-xs'); 469 } 470 } 471 else if (mode == 'sidebar-scroll') { // Handle main sidebar scrolling 472 473 if (page.hasClass('sidebar-mini') && page.hasClass('sidebar-visible-lg-mini') && (windowW > 991)) { // Destroy main sidebar scrolling when in mini sidebar mode 474 if (sScroll.length && sScroll.parent('.slimScrollDiv').length) { 475 sScroll 476 .slimScroll({destroy: true}); 477 sScroll 478 .attr('style', ''); 479 } 480 } 481 else if ((page.hasClass('header-fixed-top') || page.hasClass('header-fixed-bottom'))) { 482 483 var sHeight = $(window).height(); 484 485 if (sScroll.length && (!sScroll.parent('.slimScrollDiv').length)) { // If scrolling does not exist init it.. 486 sScroll 487 .slimScroll({ 488 height: sHeight, 489 color: '#000', 490 size: '3px', 491 touchScrollStep: 100, 492 disableFadeOut: true, 493 }); 494 495 // Handle main sidebar's scrolling functionality on resize or orientation change 496 var sScrollTimeout; 497 498 $(window).on('resize orientationchange', function(){ 499 clearTimeout(sScrollTimeout); 500 501 sScrollTimeout = setTimeout(function(){ 502 handleSidebar('sidebar-scroll'); 503 }, 150); 504 }); 505 } 506 else { // ..else resize scrolling height 507 sScroll 508 .add(sScroll.parent()) 509 .css('height', sHeight); 510 } 511 } 512 } 513 else if (mode == 'sidebar-alt-scroll') { // Init alternative sidebar scrolling 514 if ((page.hasClass('header-fixed-top') || page.hasClass('header-fixed-bottom'))) { 515 var sHeightAlt = $(window).height(); 516 517 if (sScrollAlt.length && (!sScrollAlt.parent('.slimScrollDiv').length)) { // If scrolling does not exist init it.. 518 sScrollAlt 519 .slimScroll({ 520 height: sHeightAlt, 521 color: '#fff', 522 size: '3px', 523 touchScrollStep: 100 524 }); 525 526 // Resize alternative sidebar scrolling height on window resize or orientation change 527 var sScrollAltTimeout; 528 529 $(window).on('resize orientationchange', function(){ 530 clearTimeout(sScrollAltTimeout); 531 532 sScrollAltTimeout = setTimeout(function(){ 533 handleSidebar('sidebar-alt-scroll'); 534 }, 150); 535 }); 536 } 537 else { // ..else resize scrolling height 538 sScrollAlt 539 .add(sScrollAlt.parent()) 540 .css('height', sHeightAlt); 541 } 542 } 543 } 544 } 545 546 return false;
547 }; 548 /* Scrolls the page (static layout) or the sidebar scroll element (fixed header/sidebars layout) to a specific position - Used when a submenu opens */ 549 var handlePageScroll = function(sElem, sHeightDiff, sSpeed) { 550 if (!page.hasClass('disable-menu-autoscroll')) { 551 var elemScrollToHeight; 552 553 // If we have a static layout scroll the page 554 // if (!header.hasClass('navbar-fixed-top') && !header.hasClass('navbar-fixed-bottom')) { 555 // var elemOffsetTop = sElem.offset().top; 556 557 // elemScrollToHeight = (((elemOffsetTop - sHeightDiff) > 0) ? (elemOffsetTop - sHeightDiff) : 0); 558 559 // $('html, body').animate({scrollTop: elemScrollToHeight}, sSpeed); 560 // } else { // If we have a fixed header/sidebars layout scroll the sidebar scroll element 561 var sContainer = sElem.parents('#sidebar-scroll'); 562 var elemOffsetCon = sElem.offset().top - $(window).scrollTop() + Math.abs($('div:first', sContainer).offset().top - $(window).scrollTop()); 563 elemScrollToHeight = (((elemOffsetCon - sHeightDiff) > 0) ? (elemOffsetCon - sHeightDiff) : 0) ; 564 sContainer.animate({ scrollTop: elemScrollToHeight }, sSpeed); 565 // } 566 } 567 }; 568 569 570 571 /* Resize #page-content to fill empty space if exists */ 572 var resizePageContent = function() { 573 var windowH = $(window).height(); 574 var sidebarH = sidebar.outerHeight(); 575 var sidebarAltH = sidebarAlt.outerHeight(); 576 var headerH = header.outerHeight(); 577 var footerH = footer.outerHeight(); 578 579 // If we have a fixed sidebar/header layout or each sidebarsâ height < window height 580 if (header.hasClass('navbar-fixed-top') || header.hasClass('navbar-fixed-bottom') || ((sidebarH < windowH) && (sidebarAltH < windowH))) { 581 if (page.hasClass('footer-fixed')) { // if footer is fixed don't remove its height 582 pageContent.css('min-height', windowH - headerH + 'px'); 583 } else { // else if footer is static, remove its height 584 pageContent.css('min-height', windowH - (headerH + footerH) + 'px'); 585 } 586 } else { // In any other case set #page-content height the same as biggest sidebar's height 587 if (page.hasClass('footer-fixed')) { // if footer is fixed don't remove its height 588 pageContent.css('min-height', ((sidebarH > sidebarAltH) ? sidebarH : sidebarAltH) - headerH + 'px'); 589 } else { // else if footer is static, remove its height 590 pageContent.css('min-height', ((sidebarH > sidebarAltH) ? sidebarH : sidebarAltH) - (headerH + footerH) + 'px'); 591 } 592 } 593 594 if (page.hasClass('sidebar-alt-visible-xs') && $(window).width() > 990) { 595 handleSidebar('close-sidebar'); 596 page.toggleClass('sidebar-alt-visible-xs'); 597 } 598 599 }; 600 601 602 /* Scroll to top functionality */ 603 var scrollToTop = function() { 604 // Get link 605 var link = $('#to-top'); 606 var windowW = window.innerWidth 607 || document.documentElement.clientWidth 608 || document.body.clientWidth; 609 610 $(window).scroll(function() { 611 // If the user scrolled a bit (150 pixels) show the link in large resolutions 612 613 show_top_threshold = 650; 614 if($(window).width()>=650){ 615 show_top_threshold = 800; 616 } 617 if($(window).width()>=768){ 618 show_top_threshold = 700; 619 } 620 if($(window).width()>=1200){ 621 show_top_threshold = 800; 622 } 623 // if (($(this).scrollTop() > show_top_threshold)) { 624 // link.fadeIn(100); 625 // link.css('display', 'block'); 626 // } else { 627 // link.fadeOut(100); 628 // } 629 630 if($('.side-function-area').length){ 631 if (($('.side-function-area').offset().top > show_top_threshold + 44)) { 632 link.fadeIn(100); 633 link.css('display', 'block'); 634 } else { 635 link.fadeOut(100); 636 } 637 } 638 }); 639 // On click get to top 640 link.click(function() { 641 $('html, body').animate({scrollTop: 0}, 500); 642 return false;
643 }); 644 }; 645 646 var scrollToYear = function() { 647 // Get link 648 var link = $('.milestone-btn'); 649 var windowW = window.innerWidth 650 || document.documentElement.clientWidth 651 || document.body.clientWidth; 652 653 link.click(function() { 654 $('html, body').animate({scrollTop: 182}, 500); 655 return false; 656 }); 657 }; 658 659 var main_content_minheight = function() { 660 var header_height=parseInt($('header.website').outerHeight()); 661 var footer_height=parseInt($('footer.website').outerHeight()); 662 var window_height=parseInt($( window ).height()); 663 // var content_min_height=window_height-header_height-footer_height; 664 var content_min_height=window_height-footer_height; 665 666 if (window_height>$('header.website').height()) 667 { 668 $('div.main-area').css('min-height',content_min_height+'px'); 669 } 670 else 671 { 672 $('div.main-area').css('min-height','250px'); 673 } 674 } 675 var globalGenCode = function (vTarget){ 676 vNum = Math.random() 677 vNum = Math.round(vNum*10) 678 var vAjaxReqUrl = window.location.protocol+"//"+window.location.hostname; 679 $(vTarget).attr("src", vAjaxReqUrl+"/vcode/getCode/"+ vNum); 680 } 681 var toTopPosition = function() { 682 var footertotop = ($('footer.website').position().top); 683 var scrolltop = $(document).scrollTop() + window.innerHeight; 684 var difference = scrolltop - footertotop; 685 if (scrolltop > footertotop) { 686 $('#to-top').addClass('bot'); 687 } else { 688 $('#to-top').removeClass('bot'); 689 } 690 } 691 692 var iframe_proportion = function (){ 693 prefix = 'content-proportion-box-'; 694 $("iframe[class^="+prefix+"]").each(function( index, value ) { 695 class_name_str = $(this).attr('class'); 696 class_name_arr = class_name_str.split(' '); 697 ratio_class_name = ''; 698 $.each(class_name_arr, function( index, value ){ 699 if(value.indexOf(prefix) != -1){ 700 ratio_class_name = value; 701 return false; 702 } 703 }); 704 ratio = ratio_class_name.substr(prefix.length); 705 raitio_arr = ratio.split('-'); 706 iframe_width = $(this).width(); 707 iframe_height = iframe_width * parseInt(raitio_arr[1]) / parseInt(raitio_arr[0]); 708 $(this).height(iframe_height); 709 }); 710 } 711 var getUrlHashByString = function(url_str){ 712 if(url_str.indexOf('?')>=0){ 713 url_str = url_str.split('?')[0]; 714 } 715 hash = url_str.split('#')[1]; 716 return hash; 717 } 718 719 var initEllipsis = function(){ 720 ellipsis_line_ary = [1,2,3,4,5]; 721 722 ellipsis_line_ary.forEach(function(value){ 723 Ellipsis({ 724 ellipsis: '...', 725 ellipsis_class:'', 726 ellipsis_tag:'span', 727 class: '.ellipsis-area.line-'+value, 728 responsive: true, 729 lines: value, 730 break_word:true 731 }); 732 }); 733 } 734 return { 735 init: function() { 736 uiInit(); // Initialize UI Code 737 }, 738 sidebar: function(mode, extra) { 739 handleSidebar(mode, extra); // Handle sidebars - access functionality from everywhere 740 }, 741 742 handlePageScroll: function(sElem, sHeightDiff, sSpeed){ 743 handlePageScroll(sElem, sHeightDiff, sSpeed); 744 }, 745 initEllipsis: function(){ 746 initEllipsis(); 747 } 748 }; 749}(); 750 751/* Initialize app when page loads */ 752$(function(){ App.init(); }); 753$(document).ready(function() { 754});
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.