1(function ($, window, doc, undef) { 2 3var cloxItems = [] 4 , $doc = $(doc) 5 , $html = $(document.documentElement) 6 , isTesting = ($html.data('env') === 'testing'); 7 8function updateCloxItems () { 9 var dt = new Date() 10 , min = dt.getMinutes() 11 , hrs = dt.getHours() 12 , str; 13 str = (hrs < 10 ? '0' + hrs : hrs) + ':' + (min < 10 ? '0' + min : min); 14 _.each(cloxItems, function (item) { 15 try { 16 item.innerHTML = str; 17 } catch (error) {} 18 }); 19} 20 21$.fn.clox = function () { 22 cloxItems = cloxItems.concat(this.get()); 23 updateCloxItems(); 24 if (!$.fn.clox.interval) { 25 $.fn.clox.interval = setInterval(updateCloxItems, 11000); 26 } 27}; 28 29function supportsVml () { 30 if (typeof supportsVml.supported == "undefined") { 31 var a = doc.body.appendChild(doc.createElement('div')); 32 a.innerHTML = '<g_vml_:shape id="vml_flag1" adj="1" />'; 33 var b = a.firstChild; 34 b.style.behavior = "url(#default#VML)"; 35 supportsVml.supported = b ? typeof b.adj == "object": true; 36 a.parentNode.removeChild(a); 37 } 38 return supportsVml.supported; 39} 40 41function addNamespacesVML (doc) { 42 // create xmlns 43 if (!doc.namespaces['g_vml_']) { 44 doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml', 45 '#default#VML'); 46 } 47 if (!doc.namespaces['g_o_']) { 48 doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office', 49 '#default#VML'); 50 } 51} 52 53try { 54 if (doc.namespaces) { 55 addNamespacesVML(doc); 56 } 57} catch (error) {} 58 59$(function () { 60 // main menu 61 (function () { 62 var to 63 , postponeTimeout 64 , lastMouseleaveTime = 0 65 , effectShowDuration = 400 66 , effectHideDuration = 300 67 , postponeTolerance = 200 68 , hideDelay = isTesting ? 0 : 500 69 , animationSpeed = 150; 70 function getItems ($tab) { 71 return _.reduce($tab.siblings('li').andSelf().get(), function (memo, item) { 72 if ($(item).data('submenu-id')) { 73 memo.push({ li: item, href: '#' + $(item).data('submenu-id') }); 74 } else { 75 memo.push({ li: item, href: '' }); 76 } 77 78 return memo; 79 }, []); 80 } 81 function updateMenu (tabs, $tab, $panel, $selectedPanel) { 82 var $tabs = $(_(tabs).chain().pluck('href').without('').value().join(', ')); 83 $tabs 84 .filter('.is-expading') 85 .removeClass('is-expading') 86 .each(function () { 87 var $panel = $(this) 88 , panelOuterHeight = $panel.outerHeight() 89 , animatedHeight = $panel.is(':animated') ? parseInt($panel.css('top'), 10) : 0; 90 91 animatedHeight += panelOuterHeight; 92 // should not be used 93 animatedHeight = animatedHeight > panelOuterHeight ? panelOuterHeight : animatedHeight; 94 95 96 $panel.stop().effect('slide', { 97 distance: animatedHeight, mode: 'hide', direction: 'up' 98 }, parseInt(animatedHeight / animationSpeed * effectHideDuration)); 99 }); 100 $(_(tabs).pluck('li')).removeClass('ui-state-active'); 101 102 // add active state to tab 103 if ($tab) { 104 $tab.addClass('ui-state-active'); 105 } 106 107 // show panel 108 if ($panel || $selectedPanel) { 109 if ($panel.length) { 110 $panel.removeClass('ui-helper-hidden'); 111 } else { 112 $selectedPanel.removeClass('ui-helper-hidden'); 113 } 114 } 115 } 116 function mainMenuEventCoreHandler (event) { 117 var $this = $(this) 118 , isTab = $this.is('li') 119 , id 120 , $tab 121 , items 122 , hasId; 123 124 id = isTab 125 ? '#' + ($this.data('submenu-id') || '') 126 : '#' + ($this.attr('id') || ''); 127 $tab = isTab 128 ? $this 129 : $('#main .tab-bar ul > li[data-submenu-id="'+ id.substr(1) +'"]'); 130 hasId = (id !== '#' && /^#/.test(id)); 131 132 if (to) { 133 clearTimeout(to); 134 to = null; 135 } 136 137 if (event.type == 'mouseenter') { 138 items = _.reduce(getItems($tab), function (memo, item) { 139 if (item.href !== id) { 140 memo.push(item); 141 } 142 return memo; 143 }, []); 144 updateMenu(items, $tab, hasId ? $(id) : null); 145 } 146 147 if (event.type == 'mouseleave') { 148 to = setTimeout(function () { 149 updateMenu(getItems($tab)); 150 }, hideDelay); 151 } 152 } 153 function mainMenuEventUIHandler (event) { 154 var $this = $(this) 155 , id 156 , $panel 157 , $closest 158 , isAnimated 159 , isExpanding 160 , offsetLeft 161 , $offsetParent 162 , isRight 163 , css; 164 165 id = '#' + ($this.data('submenu-id') || ''); 166 167 if (id === '#' || !/^#/.test(id)) { return; } 168 169 $panel = $(id); 170 $closest = $panel.closest('.ui-effects-wrapper'); 171 172 if (!$closest.length && !$panel.parent().is('body')) { 173 $panel.hide() 174 .appendTo('body') 175 .show(); 176 } 177 178 isAnimated = $panel.is(':animated');
179 isExpanding = $panel.is('.is-expading'); 180 $offsetParent = $this.closest('.tab-bar'); 181 offsetLeft = $this.find('span').offset().left ; 182 isRight = (offsetLeft + $panel.outerWidth()) >= $(window).width(); 183 184 css = { 185 right: isRight ? ( $(window).width() - offsetLeft - $this.find('span').outerWidth() ) : '', 186 left: isRight ? '' : offsetLeft, 187 top: $offsetParent.offset().top + $offsetParent.outerHeight() - 1 188 }; 189 190 if ($.fn.bgiframe && !$panel.data('bgiframed')) { 191 $panel.data('bgiframed', true); 192 $panel.bgiframe(); 193 } 194 195 $panel 196 .removeClass('submenu-left submenu-right') 197 .addClass('is-expading') 198 .addClass(isRight ? 'submenu-right' : 'submenu-left'); 199 200 if ($panel.outerWidth() <= $this.find('span').outerWidth()) { 201 $panel.css('width', $this.find('span').outerWidth()); 202 } else { 203 $panel.css('width', $panel.width()); 204 } 205 206 if ($closest.length) { 207 $closest 208 .css(css) 209 .appendTo('body'); 210 } else { 211 if (!isAnimated) { 212 $panel.css(css); 213 } 214 $panel.appendTo('body'); 215 } 216 if (isAnimated && !isExpanding) { 217 $panel.stop(); 218 } 219 220 if (!isExpanding) { 221 (function (css) { 222 var panelOuterHeight = $panel.outerHeight() 223 , animatedHeight = isAnimated ? parseInt($panel.css('top'), 10) * -1 : panelOuterHeight; 224 // should not be used 225 animatedHeight = animatedHeight > panelOuterHeight ? panelOuterHeight : animatedHeight; 226 $panel.effect('slide', { 227 distance: animatedHeight, mode: 'show', direction: 'up', 228 complete: function () { 229 $(this).css(css).css('position', 'absolute'); 230 } 231 }, parseInt(animatedHeight / animationSpeed * effectShowDuration)); 232 })(css); 233 } 234 } 235 function mainMenuEventHandler () { 236 mainMenuEventCoreHandler.apply(this, arguments); 237 mainMenuEventUIHandler.apply(this, arguments); 238 } 239 240 241 var isTapDevice = ("ontouchstart" in document.documentElement); 242 243 if (isTapDevice) { 244 245 $(document).on('click', function(){ 246 $('.submenu:visible').removeClass('is-expading').hide(); 247 }); 248 $('body').delegate('.tab-bar ul > li', 'click mouseenter mouseleave', function (event) { 249 if (event.type == 'click') { 250 var id = '#' + ($(this).data('submenu-id') || ''); 251 if ($(id).length != 0) { 252 event.preventDefault(); 253 } 254 var me = this, 255 args = arguments; 256 setTimeout(function(){ 257 mainMenuEventHandler.apply(me, args); 258 },0); 259 } 260 261 if (event.type == 'mouseenter') { 262 $(this).addClass('ui-state-active'); 263 } 264 265 if (event.type == 'mouseleave') { 266 $(this).removeClass('ui-state-active'); 267 } 268 }); 269 270 } else { 271 // postpone sending mouseenter event to tabs if mouseleave from another happened before 272 $('body').delegate('.tab-bar ul > li', isTesting ? 'click' : 'mouseenter mouseleave touchstart', function (event) { 273 var $this = $(this); 274 275 if (isTesting) { 276 if ($this.find('.arrow').length > 0) { 277 event.preventDefault(); 278 } 279 } 280 281 event.stopPropagation(); 282 283 if (isTapDevice) { 284 $this.data('mouseenterhappened', true); 285 mainMenuEventHandler.apply(this, arguments); 286 } else { 287 288 var now = (new Date()).getTime(); 289 290 var condition; 291 292 if (isTesting) { 293 condition = !$this.data('mouseenterhappened'); 294 } else { 295 condition = (event.type == 'mouseenter'); 296 } 297 298 if (condition) { 299 if (isTesting) { 300 $this.data('mouseenterhappened', true); 301 mainMenuEventHandler.apply(this, arguments); 302 } else { 303 if ((now - lastMouseleaveTime) > postponeTolerance) { 304 $this.data('mouseenterhappened', true); 305 mainMenuEventHandler.apply(this, arguments); 306 } else { 307 postponeTimeout = _.delay((function (_this, event, args) { return function () { 308 $(_this).data('mouseenterhappened', true); 309 mainMenuEventHandler.apply(_this, [event].concat(args)); 310 }; })(this, _.extend({}, event), _.rest(arguments)), postponeTolerance); 311 } 312 } 313 } else { 314 if (isTesting) { 315 $this.data('mouseenterhappened', false);
316 mainMenuEventCoreHandler.call(this, { 317 type: 'mouseleave' 318 }); 319 } else { 320 lastMouseleaveTime = now; 321 if (postponeTimeout) { 322 clearTimeout(postponeTimeout); 323 } 324 postponeTimeout = 0; 325 if ($this.data('mouseenterhappened') === true) { 326 $this.data('mouseenterhappened', false); 327 mainMenuEventCoreHandler.apply(this, arguments); 328 } 329 } 330 } 331 } 332 333 }); 334 } 335 336 337 338 339 340 $('body').delegate('.submenu', 'mouseenter mouseleave', mainMenuEventCoreHandler); 341 342 343 $('#main .tab-bar ul > li.ui-tabs-selected:first') 344 .siblings('li.ui-tabs-selected') 345 .removeClass('ui-tabs-selected'); 346 })(); 347 348 // cloxzz 349 $('#main .tab-bar .clocks') 350 .remove(); 351 (function (formId) { 352 var $form = $('#' + formId) 353 , $loginLink = $('#header .login'); 354 355 $(document).bind('click', function (event) { 356 if (!$(event.target).closest('#' + formId).length && !$(event.target).closest('#header .login').length) { 357 $form.hide(); 358 } 359 }); 360 361 $loginLink.click(function (event) { 362 if (!$form.length) { 363 $form = $('<div><div class="form-content"/><div class="ajax-spinner-local"/></div>') 364 .attr('id', formId) 365 .addClass('login-inline-form') 366 .hide() 367 .appendTo('body') 368 } 369 $form.toggle(); 370 if ($form.is(':visible')) { 371 $(window).trigger('resize.login-inline-form'); 372 if (!$form.data('has-form')) { 373 $form.addClass('ui-state-loading') 374 .removeClass('ui-state-error') 375 .find('.form-content') 376 .html('') 377 $.ajax(elsHelpers.url('root') + 'infoblock/index/view/role/guest/mode/view/name/Authorization', { global: false, dataType: 'html' }) 378 .done(function (data) { 379 var $data = $('<div>').append(data) 380 , docLinks; 381 382 docLinks = _.reduce(_.toArray(doc.getElementsByTagName('link')), function (memo, link) { 383 var href = link.getAttribute('href'); 384 if (href) { memo[href] = true; } 385 return memo; 386 }, {}); 387 _.each($data.find('link').get(), function (link) { 388 var href = link.getAttribute('href'); 389 if (href && docLinks[href] === true) { 390 link.parentNode.removeChild(link); 391 } 392 }); 393 394 $form.find('.form-content').empty().append($data.children()); 395 $form.removeClass('ui-state-loading') 396 .data('has-form', true); 397 }).fail(function () { 398 $form.removeClass('ui-state-loading') 399 .addClass('ui-state-error'); 400 }); 401 } 402 } 403 event.preventDefault(); 404 }); 405 })(_.uniqueId('login-inline-form')); 406 407 // role select 408 $doc.delegate('.navigation-select, .language-select', 'change', function (event) { 409 doc.location.href = event.target.value; 410 }); 411 412 $('.language-select') 413 .appendTo($('.language-select').parent()); 414 $('.navigation-select') 415 .insertBefore($('.navigation-select').parent().children('.name')); 416 417 $('select.navigation-select') 418 .selectmenu({ 419 style: 'dropdown', 420 menuWidth: 170, 421 width: 170, 422 positionOptions: { 423 collision: 'none' 424 } 425 }); 426 $('select.language-select') 427 .selectmenu({ 428 style: 'dropdown', 429 format: function (text) { 430 return (text || '').replace(/^([a-z]{2,3})/, '<acronym>$1</acronym>'); 431 }, 432 maxHeight: 200, 433 width: 135, 434 menuWidth: 135 435 }); 436 437 // confirmable links 438 $(document).click(function (event, confirmed) { 439 var $target = $(event.target) 440 , $dialog 441 , confirmData = $target.data('confirm') 442 , dialogButtons = {}; 443 if ($target.is('a') && confirmData && !confirmed) { 444 event.preventDefault(); 445 $('.modal-confirm-dialog:ui-dialog').dialog('destroy'); 446 $('.modal-confirm-dialog').remove(); 447 $dialog = $('<div class="modal-confirm-dialog" title="' + confirmData['title'] + '">' + confirmData['text'] + '</div>'); 448 dialogButtons[confirmData['ok']] = function () { 449 $(this).dialog("close"); 450 document.location.href = $target.attr('href'); 451 } 452 dialogButtons[confirmData['cancel']] = function () { 453 $(this).dialog("close"); 454 } 455 $dialog.appendTo('body').dialog({ 456 resizable: false, 457 height: 140, 458 modal: true, 459 buttons: dialogButtons 460 }); 461 } 462 }); 463 464 // extended page play button overlay 465 (function () { 466 var $contentHere = $('.content-container > .content-here') 467 , $coursesList = $contentHere.find('.subject-course') 468 , $firstA; 469 470 if (!$coursesList.length) { 471 return; 472 } 473 if ($coursesList.length == 1) { 474 $firstA = $coursesList.find('a:first'); 475 $('<div><div class="course-play-overlay"></div><div class="course-play-overlay-wrapper"></div></div>') 476 .children('div.course-play-overlay-wrapper') 477 .append($firstA.clone(true).addClass('play-button')) 478 .end() 479 .appendTo($contentHere.find('.course-iframe-box').length ? $contentHere.find('.course-iframe-box') : $contentHere); 480 } 481 })(); 482 483 // extended page expand/collapse 484 (function () { 485 var scroll 486 , $contentContainers 487 , $extendedPagesWithAccordion; 488 489 $('.content-container.content-container-expandable').each(function () { 490 var $this = $(this) 491 , css 492 , $backupBox; 493 css = { 494 width: $this.width(), 495 height: $this.height() 496 }; 497 $backupBox = $($this.get(0).cloneNode(false)) 498 .attr('id', _.uniqueId('content-container-backup-')) 499 .css('height', css.height); 500 $this 501 .data('backup-id', $backupBox.attr('id')) 502 .css(_.extend(css, $this.offset(), { 503 position: 'absolute' 504 })) 505 .after($backupBox) 506 .appendTo('body') 507 .addClass('content-container-with-course-presentation'); 508 }); 509 $contentContainers = $('.content-container-with-course-presentation'); 510 511 $extendedPagesWithAccordion = $('div.hgll-col2').closest('div.extended-page'); 512 $extendedPagesWithAccordion.each(function (idx) { 513 $('#main').append( 514 $('<div class="accordion-expander container-ear">') 515 .css('top', $(this).offset().top - $('#main').offset().top) 516 .data('extended-page-idx', idx) 517 ); 518 }); 519 $(doc).delegate('.accordion-expander', 'click', function (event, immediate) { 520 var $target = $(event.target) 521 , idx = $target.data('extended-page-idx') 522 , $column1 = $extendedPagesWithAccordion.eq(idx).find('div.hgll-col1:first') 523 , $column2 = $extendedPagesWithAccordion.eq(idx).find('div.hgll-col2:first') 524 , $columnsWrapper = $extendedPagesWithAccordion.eq(idx).find('div.hgll-colwrap-inner:first') 525 , animateStyle 526 , duration = immediate ? 0 : 'fast'; 527 528 if ($column1.is(':animated') || $column2.is(':animated')) { 529 return; 530 } 531 532 if (!$target.data('animate-style')) { 533 $target.data('animate-style', { 534 'column1': { 535 'from': { 536 'margin-right': parseInt($column1.css('margin-left'), 10) 537 + parseInt($column1.css('margin-right'), 10), 538 'margin-left': 0 539 }, 540 'to': { 541 'margin-right': 0, 542 'margin-left': 0 543 } 544 }, 545 'column2': { 546 'from': { 547 'left': 0 548 }, 549 'to': { 550 'left': parseInt($column2.css('left'), 10) 551 } 552 } 553 }); 554 } 555 animateStyle = $target.data('animate-style'); 556 557 if ($target.data('hiding')) { 558 $target.data('hiding', false);
559 elsHelpers.store.init().then(function () { 560 this.set('accordion-column-state', 'expanded'); 561 }); 562 $columnsWrapper.css('margin-left', 0); 563 $extendedPagesWithAccordion.eq(idx) 564 .removeClass('extended-page-narrow hgll-pc-1-column'); 565 566 $column1 567 .css(animateStyle.column1.to) 568 .animate(animateStyle.column1.from, duration); 569 570 $column2 571 .css(animateStyle.column2.to) 572 .animate(animateStyle.column2.from, { 573 step: unthrottledResizeFunction, 574 duration: duration, 575 complete: function () { 576 _.invoke([$column1, $column2, $columnsWrapper], 'attr', 'style', ''); 577 $target.removeClass('accordion-expander-collapsed'); 578 unthrottledResizeFunction(); 579 $(window).trigger('resize'); 580 } 581 }); 582 } else { 583 $target.data('hiding', true); 584 elsHelpers.store.init().then(function () { 585 this.set('accordion-column-state', 'collapsed'); 586 }); 587 $columnsWrapper.css('margin-left', 0); 588 589 $column1 590 .css(animateStyle.column1.from) 591 .animate(animateStyle.column1.to, duration); 592 593 $column2 594 .css(animateStyle.column2.from) 595 .animate(animateStyle.column2.to, { 596 step: unthrottledResizeFunction, 597 duration: duration, 598 complete: function () { 599 _.invoke([$column1, $column2, $columnsWrapper], 'attr', 'style', ''); 600 $extendedPagesWithAccordion.eq(idx) 601 .addClass('extended-page-narrow hgll-pc-1-column'); 602 $target.addClass('accordion-expander-collapsed'); 603 unthrottledResizeFunction(); 604 $(window).trigger('resize'); 605 } 606 }); 607 } 608 }); 609 610 hm.module.base.ui.Accordion.initFirstState(); 611 612 function unthrottledResizeFunction () { 613 $contentContainers.each(function () { 614 var $this = $(this) 615 , $backupBox; 616 if ($this.is('.content-container-expanding') || $this.is('.content-container-expanded')) { 617 return; 618 } 619 $backupBox = $('#' + $this.data('backup-id')); 620 $('.course-iframe-box', this).css('height', ''); 621 $this.css(_.extend({ 622 width: $backupBox.width(), 623 height: $backupBox.height() 624 }, $backupBox.offset())); 625 }); 626 } 627 628 function fsResizeFunction () { 629 $contentContainers.each(function () { 630 var $this = $(this) 631 , $iframeBox 632 , height; 633 if (!$this.is('.content-container-expanded')) { return; } 634 $iframeBox = $('.course-iframe-box', this); 635 if (!$iframeBox.length) { return; } 636 height = $this.height(); 637 $iframeBox.css('height', height - ($iframeBox.offset().top - $this.offset().top)); 638 }); 639 } 640 641 if ($contentContainers.length) { 642 jQuery.resize.throttleWindow = false; 643 $([doc, window]) 644 .bind('resize.content-containers', _.throttle(unthrottledResizeFunction, 100)) 645 .bind('resize.content-containers-iframe-box', _.throttle(fsResizeFunction, 100)); 646 $(window).bind('scroll load', function () { 647 $contentContainers.each(function () { 648 var $this = $(this); 649 if (!$this.is('.content-container-expanded')) { return; } 650 $this.css('top', $(window).scrollTop()); 651 }); 652 }); 653 $(window).resize(); 654 } 655 656 function updateContentContainerState ($contentContainer, expand) { 657 /*var $contentSizeButton = $contentContainer.find('.content-size:first');*/ 658 659 if (!expand) { 660 $(doc.documentElement).removeClass('no-overflow'); 661 _.defer(function () { 662 $(doc.documentElement).scrollTop(scroll.top); 663 $(doc.documentElement).scrollLeft(scroll.left); 664 }); 665 $contentContainer 666 .removeClass('content-container-expanded'); 667 unthrottledResizeFunction(); 668 } else { 669 scroll = { 670 top: $(window).scrollTop(), 671 left: $(window).scrollLeft() 672 }; 673 $contentContainer 674 .animate(_.extend({ 675 width: $(window).width(), 676 height: $(window).height() 677 }, scroll), 1, function () { 678 $(doc.documentElement).addClass('no-overflow'); 679 $(this) 680 .css({ 681 width: '', 682 height: '', 683 top: $(window).scrollTop(), 684 left: $(window).scrollLeft() 685 }) 686 .removeClass('content-container-expanding') 687 .addClass('content-container-expanded'); 688 fsResizeFunction(); 689 }) 690 .addClass('content-container-expanding'); 691 } 692 } 693 694 scroll = { top: 0, left: 0 }; 695 $contentContainers.each(function (index) { 696 $(this).find('.content-size:first').attr('title', ''); 697 if (index == 0 && /fullscreen/.test(window.location.hash)) { 698 $(this).addClass('content-container-expanded'); 699 } 700 updateContentContainerState($(this), $(this).hasClass('content-container-expanded')); 701 }); 702 $('body').delegate('.content-container .content-size', 'click', function () { 703 var $contentContainer = $(this).closest('.content-container');
704 updateContentContainerState($contentContainer, !$contentContainer.hasClass('content-container-expanded')); 705 }); 706 })(); 707 708 // some fun 709 yepnope({ 710 load: ['/js/lib/jquery/jquery.hotkeys.min.js'], 711 complete: function () { _.defer(function () { if (jQuery.hotkeys) { 712 // helpfull staff 713 /*(function (reattach) { 714 $doc.bind('keydown', 'alt+ctrl+shift+w', reattach); 715 setInterval(reattach, 5000); 716 })(function () { 717 // reattach stylesheets 718 var links = $('link[rel="stylesheet"]'); 719 720 _.each(links.get(), function (link) { 721 var href = link.getAttribute('href') 722 , a = document.createElement('a'); 723 724 a.setAttribute('href', href); 725 a.search = _.map((a.search || '').split('&'), function (piece) { 726 if (/^_reload=/.test(piece)) { 727 return '_reload=' + (new Date()).getTime(); 728 } else { 729 return piece; 730 } 731 }).join('&'); 732 733 link.setAttribute('href', a.href); 734 }); 735 });*/ 736 737 738 (function () { 739 var i = [] 740 , direction = 1 741 , $contentContainers = $('.content-container-with-course-presentation'); 742 743 function animateCutie () { 744 $contentContainers.each(function (index) { 745 var $contentContainer = $(this) 746 , interval; 747 748 i[index] || (i[index] = 0); 749 750 interval = setInterval(function () { 751 i[index] = (i[index] + direction * 1) % 8; 752 $contentContainer.css('background-position', '' + i[index] + 'px ' + i[index] + 'px'); 753 }, 50); 754 setTimeout(function () { 755 clearInterval(interval); 756 }, 110 + parseInt(500 * Math.random())); 757 }); 758 setTimeout(function () { 759 direction = Math.random() > 0.5 ? 1 : -1; 760 animateCutie(); 761 }, 2000 + parseInt(5000 * Math.random())); 762 } 763 $doc.one('keydown', null, 'alt+ctrl+shift+q', function () { 764 animateCutie(); 765 }); 766 })(); 767 $doc.one('keydown', null, 'alt+ctrl+shift+p', function () { 768 yepnope({ 769 test: Modernizr.canvas && Modernizr.localstorage && Modernizr.audio && !!(Modernizr.audio.ogg || Modernizr.audio.mp3), 770 yep: ['theme!/css/fun/pacman.css', 'theme!/js/pacman.js'], 771 complete: function () { _.defer(function () { if (window.PACMAN) { 772 $('<div id="pacman">') 773 .css({ 774 width: 342, 775 height: 450, 776 position: 'absolute', 777 top: ($(window).height() / 2 - 450/2), 778 left: ($(window).width() / 2 - 342/2), 779 zIndex: 1000 780 }) 781 .appendTo('body'); 782 783 _.delay(function () { 784 PACMAN.init($('#pacman').get(0), elsHelpers.url('theme')); 785 $doc.one('keydown', 'esc', function () { 786 PACMAN.destroy($('#pacman').get(0)); 787 $('#pacman').remove(); 788 }); 789 }, 1); 790 } }); } 791 }); 792 }); 793 } }); } 794 }); 795 796 $('#container > #footer').prepend('<div class="bb-p"><div class="first"></div><div class="second"></div><div class="third"></div><div class="fourth"></div><div class="fifth"></div></div>'); 797 798 $('.ui-portlet').each(function () { 799 $(this).addClass('ui-portlet-color-' + Math.round(Math.random() * 3 )); 800 }); 801 802 $(document).on('mouseover focus', 'button, input[type="button"], input[type="submit"]', function () { 803 $(this).is(':ui-button') || $(this).button($(this).data('ui-options') || {}); 804 }).trigger('mouseover'); 805}); 806 807// accordion on extended page 808$doc.bind('accordioncreate', function (event) { 809 var $target = $(event.target); 810 if ($target.is('#page-context-accordion') && $target.find('> .ui-accordion-header > a > .gradient-me').length === 0) { 811 // this should update accordion 812 $target 813 .accordion('option', { 814 changestart: function (event, ui) { 815 _.defer(function () { 816 $(ui.newContent).css('width', '100%'); 817 }); 818 }, 819 change: function (event, ui) { 820 $(ui.newContent).css('overflow', 'auto'); 821 } 822 }) 823 .find('> .ui-accordion-header') 824 .children('a') 825 .prepend('<div class="gradient-me"><div class="gradient-me-again"><hr /></div></div>') 826 .end(); 827
828 if (!Modernizr.borderradius && supportsVml()) { 829 $target.children('.ui-accordion-header').children('.ui-icon') 830 .each(function () { 831 if (!Modernizr.borderradius && supportsVml()) { 832 this.insertAdjacentHTML('afterBegin', [ 833 '<g_vml_:oval', 834 ' style="width: '+ ($(this).width() - 1) +'px; height: '+ ($(this).height() - 1) +'px; position: absolute; top: 0; left: 0; z-index: -1;"', 835 ' filled="t"', 836 ' onclick="return false;"', 837 ' stroked="f">', 838 ' <g_vml_:stroke color="#ffffff" />', 839 ' <g_vml_:fill color="#ffffff" />', 840 '</g_vml_:oval>', 841 '<span class="ui-icon"></span>' 842 ].join('')); 843 } 844 }); 845 } 846 } 847}); 848 849$doc.bind('progressbarcreate', function (event) { 850 var $target = $(event.target); 851 if ($target.find('.gradient-me').length === 0) { 852 $target.find('.ui-progressbar-value').andSelf() 853 .prepend('<div class="gradient-me"><div class="gradient-me-again"></div></div>'); 854 } 855}); 856$doc.bind('dialogcreate', function (event) { 857 var $target = $(event.target) 858 , $outerDialog = $target.closest('.ui-dialog'); 859 if ($outerDialog.length && $outerDialog.find('.ui-dialog-gradient').length === 0) { 860 $outerDialog.find('.ui-dialog-titlebar').append('<div class="ui-dialog-gradient"><div></div></div>'); 861 } 862 if ($target.closest('.ui-dialog-content-wrapper').length === 0) { 863 $target.wrap('<div class="ui-dialog-content-wrapper"></div>'); 864 } 865}); 866$doc.bind('tabscreate', function (event) { 867 var $target = $(event.target) 868 , $li = $target.find('> .ui-tabs-nav > li'); 869 if ($li.find('.gradient-me').length === 0) { 870 if ($li.children('> span').length) { 871 $li.find('> a > span') 872 .wrap('<span></span>') 873 .parent() 874 .prepend('<div class="gradient-me"></div>'); 875 } else { 876 $li.find('> a') 877 .each(function () { 878 var $this = $(this); 879 $this.html('<span><div class="gradient-me"></div><span>'+ $this.html() +'</span></span>'); 880 }); 881 } 882 } 883}); 884 885$(function () { 886 if ($('#page-title').length && $('#page-title').text() === "Page header place here!") { 887 $('#page-title').html('<span>' + ($('#page-title').text() || '').split('').join('</span><span>') + '</span>'); 888 $('#page-title span').each(function () { 889 var a = ['baseline', 'bottom', 'middle', 'text-bottom', 'text-top', 'top']; 890 var rand = Math.floor(a.length * Math.random()); 891 $(this).css('vertical-align', a[rand]); 892 }); 893 894 } 895}); 896 897yepnope({ 898 test: !Modernizr.input.placeholder, 899 yep: '/js/lib/polyfills/placeholder.js', 900 callback: function () {$(function () { 901 _.defer(function() { $('input[placeholder], textarea[placeholder]').placeholder(); }); 902 }); } 903}); 904 905// control min-height of els-body
906$(function () { 907 var $elsBody = $('#main > .els-body:first') 908 , $footer = $('#footer') 909 , innerMargins; 910 911 $elsBody.length && $footer.length && $([window, document]).bind('load resize.min-height', function () { 912 var offsetTop = $elsBody.offset().top 913 , footerHeight = $footer.outerHeight(true); 914 915 if (innerMargins == null) { 916 var overflow = $elsBody.css('overflow'); 917 $elsBody.css('overflow', 'hidden'); 918 innerMargins = offsetTop - $elsBody.offset().top; 919 if (overflow) { 920 $elsBody.css('overflow', overflow); 921 } 922 } 923 924 $elsBody.css('min-height', $(window).height() - (offsetTop + footerHeight) - 1 - innerMargins); 925 }).trigger('resize.min-height'); 926}); 927 928})(jQuery, this, this.document); 929 930$(function () { 931 yepnope('theme!/css/gradients.css'); 932}); 933 934yepnope({ 935 test: /(:?^|\s)ie6(:?\s|$)/i.test(document.documentElement.className), 936 yep: 'theme!/js/ie6.js' 937});
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.