1(function ($) { 2 3 function throttle(handler) { 4 if (!window.requestAnimationFrame) 5 return handler; 6 var timeout; 7 return function () { 8 if (timeout) 9 window.cancelAnimationFrame(timeout); 10 timeout = window.requestAnimationFrame(handler); 11 }; 12 } 13 14 var defaults = { 15 adaptiveHeaders: true, 16 adaptiveHeadersMinWidth: null, 17 dockedSidebars: true 18 }; 19 20 $.telligent.evolution.theme.social = { 21 register: function (options) { 22 var settings = $.extend({}, defaults, options || {}); 23 24 if (settings.adaptiveHeaders) { 25 var initAdaptiveHeaders = function() { 26 // adapt the header when scrolled 27 $('.header-fragments .layout-content').evolutionAdapativeHeader({ 28 fix: '.layout-region.header', 29 activeClass: 'scrolled', 30 minWidth: settings.adaptiveHeadersMinWidth 31 }); 32 } 33 // if using a dynamic cover, wait for it to load 34 if ($('body').hasClass('dynamic-cover') && !$('body').hasClass('no-cover')) { 35 $(window).one('dynamic-cover-loaded', function() { 36 initAdaptiveHeaders(); 37 }); 38 } else { 39 initAdaptiveHeaders(); 40 } 41 } 42 43 if (settings.dockedSidebars) { 44 // dock the sidebar when possible 45 $('.content-fragment-page') 46 .find('.layout-content.content-left-sidebar-right, .layout-content.sidebar-left-content-center-sidebar-right, .layout-content.sidebar-left-content-right, .layout-content.header-top-content-left-sidebar-right, .layout-content.header-top-sidebar-left-content-center-sidebar-right, .layout-content.header-top-sidebar-left-content-right, .layout-content.header-top-content-left-sidebar-right-footer, .layout-content.header-top-sidebar-left-content-center-sidebar-right-footer, .layout-content.header-top-sidebar-left-content-right-footer') 47 .find('.layout-region-inner.right-sidebar, .layout-region-inner.left-sidebar') 48 .evolutionDock({}); 49 } 50 51 // edit 52 $(document).on('customizepage', function () { 53 $('body').addClass('edit'); 54 }); 55 56 // raise available height messages 57 var availableHeight = 0, 58 win = $(window), 59 headerElements = $('.header-fragments .layout-content, .header-fragments .layout-region.header'); 60 61 62 function getHeaderOffset() { 63 var headerOffset = 0; 64 headerElements.each(function () { 65 var header = $(this); 66 if (header.is(':visible') && header.css('position') == 'fixed') { 67 var offset = parseInt(header.css('top'), 10); 68 if (isNaN(offset)) { 69 offset = 0; 70 } 71 offset += header.outerHeight(); 72 if (offset > headerOffset) { 73 headerOffset = offset; 74 } 75 } 76 }); 77 return headerOffset; 78 } 79 80 win.on('scroll resize', throttle(function () { 81 var scrollHeight = win.height(); 82 var headerOffsetTop = getHeaderOffset(); 83 var measuredHeight = scrollHeight - headerOffsetTop; 84 85 if (availableHeight != measuredHeight) { 86 $.telligent.evolution.messaging.publish('window.scrollableheight', { 87 height: measuredHeight 88 }); 89 availableHeight = measuredHeight; 90 } 91 })); 92 } 93 } 94 95})(jQuery); 96 97// Overrides 98 99// override modals 100$.extend($.glowModal.defaults, { 101 isDraggable: true, 102 isResizable: false, 103 loadingHtmlUrl: 'about:blank', 104 windowCssClasses: ['modal'], 105 windowTitleCssClasses: ['modal-title'], 106 windowCloseCssClasses: ['modal-close-wrapper', 'modal-close'],
107 windowContentCssClasses: ['modal-content'], 108 windowMaskCssClasses: ['modal-mask'], 109 windowFooterCssClasses: ['modal-footer'], 110 windowWrapperCssClasses: [], 111 loadingHtml: '<span class="ui-loading" style="color: #ddd;"></span>', 112 height: 100 113}); 114 115$.extend($.fn.glowPopUpPanel.defaults, { 116 animate: function (data) { 117 return $.Deferred(function (d) { 118 if (data.action == 'initialize') { 119 data.panel.css({ 120 overflow: 'hidden', 121 transform: 'translate3d(0px 0px, 0px)' 122 }); 123 d.resolve(); 124 } else if (data.action == 'open') { 125 var initialX = 0, 126 initialY = 0; 127 128 if (data.position.indexOf('left') === 0) { 129 initialX = data.openerWidth; 130 } else if (data.position.indexOf('right') === 0) { 131 initialX = -data.openerWidth; 132 } 133 134 if (data.position.indexOf('down') === 0) { 135 initialY = -data.openerHeight; 136 } else if (data.position.indexOf('up') === 0) { 137 initialY = data.openerHeight; 138 } 139 140 data.panel 141 .evolutionTransform({ 142 x: initialX, 143 y: initialY, 144 opacity: 0 145 }, { 146 duration: 0 147 }) 148 .evolutionTransform({ 149 x: 0, 150 y: 0, 151 opacity: 1 152 }, { 153 complete: function () { 154 d.resolve(); 155 }, 156 duration: 150, 157 easing: 'ease-out' 158 }); 159 160 } else if (data.action == 'resize') { 161 data.panel.css({ 162 width: data.orginalWidth + 'px', 163 height: data.originalHeight + 'px' 164 }).evolutionTransform({ 165 width: data.width, 166 height: data.height 167 }, { 168 complete: function () { 169 d.resolve(); 170 }, 171 duration: 150 172 }); 173 } else if (data.action == 'close') { 174 var targetX = 0, 175 targetY = 0; 176 177 if (data.position.indexOf('left') === 0) { 178 targetX = data.openerWidth; 179 } else if (data.position.indexOf('right') === 0) { 180 targetX = -data.openerWidth; 181 } 182 183 if (data.position.indexOf('down') === 0) { 184 targetY = -data.openerHeight; 185 } else if (data.position.indexOf('up') === 0) { 186 targetY = data.openerHeight; 187 } 188 189 data.panel.evolutionTransform({ 190 x: targetX, 191 y: targetY, 192 opacity: 0 193 }, { 194 complete: function () { 195 data.panel.evolutionTransform({ 196 visibility: 'hidden', 197 opacity: 1, 198 x: 0, 199 y: 0 200 }, { 201 duration: 0 202 }); 203 d.resolve(); 204 }, 205 duration: 150, 206 easing: 'ease-in' 207 }); 208 } else { 209 d.resolve(); 210 } 211 }).promise(); 212 } 213}); 214 215 216(function ($, global, undef) { 217 218 function throttle(handler) { 219 if (!window.requestAnimationFrame) 220 return handler; 221 var timeout; 222 return function () { 223 if (timeout) 224 window.cancelAnimationFrame(timeout); 225 timeout = window.requestAnimationFrame(handler); 226 }; 227 } 228 229 function process(context) { 230 var width = context.selection.width(), 231 scrollTop = $(global).scrollTop(); 232 233 // if too narrow, don't process, just possibly disable 234 if (width <= context.minWidth) { 235 // disable if was enabled and screen now too narrow to support this behavior 236 if (context.enabled) { 237 context.enabled = false; 238 unfix(context); 239 240 if (context.adapted) { 241 unadapt(context); 242 } 243 } 244 // and do no more... 245 return; 246 } 247 248 var documentHeight = $(document).height(); 249 var windowHeight = $(window).height(); 250 var difference = context.staticHeight - context.minimizedHeight; 251 252 var documentIsLongEnoughToAdapt = documentHeight - difference - context.fixedElementsHeight * 2 > windowHeight; 253 254 if (!context.adapted && scrollTop > difference && documentIsLongEnoughToAdapt) { 255 adapt(context); 256 } else if (context.adapted && scrollTop <= difference) { 257 unadapt(context); 258 } 259 260 // enable if not enabled at all 261 if (!context.enabled) { 262 context.enabled = true; 263 if (scrollTop == 0) { 264 fix(context); 265 } 266 } 267 } 268 269 function unfix(context) { 270 if(!context.fixed) 271 return; 272 context.fixed = false; 273 var bodyPadding = parseInt(context.body.css("paddingTop"), 10) - context.fixedElementsHeight; 274 bodyPadding = bodyPadding >= 0 ? bodyPadding : 0; 275 context.body.css({ 276 paddingTop: bodyPadding 277 }); 278 context.fixedElements.css({ 279 position: 'static' 280 }); 281 } 282 283 function fix(context) { 284 if(context.fixed) 285 return; 286 context.fixed = true; 287 var bodyPadding = parseInt(context.body.css("paddingTop"), 10); 288 context.body.css({ 289 paddingTop: ('+=' + context.fixedElementsHeight) 290 }); 291 bodyPadding = parseInt(context.body.css("paddingTop"), 10); 292 context.fixedElements.css({ 293 position: 'fixed', 294 top: 0, 295 'z-index': 10 296 }); 297 } 298 299 function adapt(context) { 300 context.adapted = true; 301 302 unfix(context); 303 304 context.body.css({ 305 paddingTop: ('+=' + context.staticHeight) 306 }); 307 context.selection.css({ 308 position: 'fixed', 309 top: 0, 310 'z-index': 10 311 }).addClass(context.activeClass); 312 $.telligent.evolution.messaging.publish(context.scrolledMessage); 313 } 314 315 function unadapt(context) { 316 context.adapted = false; 317 318 fix(context); 319 320 context.selection.css({ 321 position: 'static' 322 }).removeClass(context.activeClass); 323 context.body.css({ 324 paddingTop: ('-=' + context.staticHeight) 325 }); 326 $.telligent.evolution.messaging.publish(context.unscrolledMessage); 327 } 328 329 function handleEvents(context) { 330 // re-init only when width changes 331 var resizedTimeout; 332 var lastWidth = $(global).width(); 333 334 var reset = function() { 335 unadapt(context); 336 unfix(context);
337 context.body.css({ 'padding-top': 0 }); 338 context.fixedElementsHeight = context.fixedElements.height(); 339 context.staticHeight = context.selection.height(); 340 process(context); 341 }; 342 343 $(global).on('resized.adaptiveHeader', throttle(function () { 344 global.clearTimeout(resizedTimeout); 345 resizedTimeout = global.setTimeout(function(){ 346 var currentWidth = $(global).width(); 347 if (currentWidth == lastWidth) 348 return; 349 lastWidth = currentWidth; 350 reset(); 351 }, 250); 352 })); 353 354 context.selection.on('resized.adaptiveHeader', throttle(function() { 355 reset(); 356 })); 357 358 $(global).on('scroll.adaptiveHeader', throttle(function () { 359 process(context); 360 })); 361 362 // when entering page edit mode, turn everything back off 363 $(document).on('customizepage', function () { 364 unadapt(context); 365 unfix(context); 366 context.body.css({ 367 'padding-top': 0 368 }); 369 $(global).off('.adaptiveHeader'); 370 }); 371 } 372 373 // determines minimized/scrolled height breakpoint by testing 374 // the height when the scrolled class is applied 375 function measureMinimizedHeight(context) { 376 context.selection 377 .css({ 378 visibility: 'hidden' 379 }) 380 .addClass(context.activeClass); 381 382 var height = context.selection.height(); 383 384 context.selection 385 .removeClass(context.activeClass) 386 .css({ 387 visibility: 'visible' 388 }); 389 390 return height; 391 } 392 393 $.fn.evolutionAdapativeHeader = function (options) { 394 var context = $.extend({}, $.fn.evolutionAdapativeHeader.defaults, options || {}); 395 context.selection = this; 396 context.body = $('body'); 397 398 // capture elements 399 context.fixedElements = $(context.fix, this); 400 context.fixedElementsHeight = context.fixedElements.height(); 401 context.staticHeight = context.selection.height(); 402 403 if (!context.minimizedHeight) { 404 context.minimizedHeight = measureMinimizedHeight(context); 405 } 406 407 handleEvents(context); 408 process(context); 409 410 return context.selection; 411 } 412 413 $.fn.evolutionAdapativeHeader.defaults = { 414 fix: '.layout-region.header', 415 // pre-defined breakpoint (when not provided, determines one by measuring height when activeClass is applied) 416 minimizedHeight: null, 417 //don't activate or remove behavior when screen less than 418 minWidth: $.telligent.evolution.theme.getReflowBreakpoint(), 419 activeClass: 'scrolled', 420 scrolledMessage: 'theme.social.scrolled', 421 unscrolledMessage: 'theme.social.unscrolled' 422 }; 423 424})(jQuery, window); 425 426 427(function ($, global, undef) { 428 429 function throttle(handler) { 430 if (!window.requestAnimationFrame) 431 return handler; 432 var timeout; 433 return function () { 434 if (timeout) 435 window.cancelAnimationFrame(timeout); 436 timeout = window.requestAnimationFrame(handler); 437 }; 438 } 439 440 $.fn.evolutionDock = function (options) { 441 var settings = $.extend({}, $.fn.evolutionDock.defaults, options || {}), 442 fixedSupported = true, 443 availableHeight = $(window).height(); 444 445 (function () { 446 var test = $('<div></div>').css({ 447 'position': 'fixed', 448 'top': '100px' 449 }); 450 $('body').append(test); 451 fixedSupported = test.offset().top == 100 + $(global).scrollTop(); 452 453 global.setTimeout(function () { 454 fixedSupported = test.offset().top == 100 + $(global).scrollTop(); 455 test.remove(); 456 }, 199); 457 })(); 458 459 return this.each(function () { 460 var dockWrapper = $(this), 461 jGlobal = $(global), 462 top = dockWrapper.offset().top, 463 defaults = { 464 top: dockWrapper.css('top'), 465 position: dockWrapper.css('position'), 466 width: dockWrapper.css('width') 467 }, 468 docked = false, 469 scrollOffset = undefined, 470 lastScroll = undefined, 471 absTop = undefined,
472 lastWindowHeight = jGlobal.height(), 473 placeholder = $('<div></div>').attr({ 474 'class': dockWrapper.attr('class'), 475 'visibility': 'hidden' 476 }).hide(), 477 footers = $(settings.footers); 478 479 dockWrapper.parent().css('position', 'relative').append(placeholder); 480 481 var reposition = function () { 482 var scrollTop = jGlobal.scrollTop(); 483 if (scrollTop == lastScroll) { 484 return; 485 } 486 var parentOffset = dockWrapper.parent().offset(); 487 var headerOffsetTop = $(window).height() - availableHeight; 488 489 var shouldBeFixed = fixedSupported && scrollTop > parentOffset.top - headerOffsetTop; 490 491 if (shouldBeFixed) { 492 if (!docked) { 493 placeholder.show().css('height', dockWrapper.innerHeight() + 'px'); 494 scrollOffset = 0; 495 lastScroll = scrollTop; 496 } 497 498 var footerOffsetTop = getFooterTop(); 499 var top = null, 500 position, dockOuterHeight = dockWrapper.outerHeight(); 501 if (footerOffsetTop == -1 || (scrollTop + headerOffsetTop + dockOuterHeight - scrollOffset) < footerOffsetTop) { 502 if (dockOuterHeight > availableHeight) { 503 if (lastScroll < scrollTop) { 504 // moving down 505 scrollOffset += (scrollTop - lastScroll); 506 if (scrollOffset >= dockOuterHeight - availableHeight) { 507 scrollOffset = dockOuterHeight - availableHeight; 508 position = 'fixed'; 509 top = headerOffsetTop - scrollOffset; 510 absTop = scrollTop - (parentOffset.top - headerOffsetTop) - (dockOuterHeight - availableHeight); 511 } else { 512 position = 'absolute'; 513 top = absTop; 514 } 515 } else { 516 // moving up 517 scrollOffset -= (lastScroll - scrollTop); 518 if (scrollOffset <= 0 || !docked) { 519 scrollOffset = 0; 520 position = 'fixed'; 521 top = headerOffsetTop; 522 absTop = scrollTop - (parentOffset.top - headerOffsetTop); 523 } else { 524 position = 'absolute'; 525 top = absTop; 526 } 527 } 528 } else { 529 top = headerOffsetTop; 530 absTop = scrollTop - (parentOffset.top - headerOffsetTop); 531 position = 'fixed'; 532 } 533 } else { 534 absTop = top = footerOffsetTop - parentOffset.top - dockOuterHeight; 535 position = 'absolute'; 536 } 537 docked = true; 538 dockWrapper.css({ 539 position: position, 540 top: top + 'px', 541 width: placeholder.width() + 'px' 542 }); 543 lastScroll = scrollTop; 544 } else if (!shouldBeFixed && docked) { 545 placeholder.hide().css('height', '0px'); 546 docked = false; 547 dockWrapper.css({ 548 position: defaults.position, 549 top: defaults.top, 550 width: defaults.width 551 }); 552 } 553 }, 554 getFooterTop = function () { 555 var footerTop = -1; 556 footers.each(function () { 557 var footer = $(this); 558 if (footer.is(':visible')) { 559 var offset = footer.offset(); 560 if (footerTop == -1 || offset.top < footerTop) { 561 footerTop = offset.top; 562 } 563 } 564 }); 565 return footerTop; 566 } 567 568 function reflow() { 569 var newHeight = $(window).height(); 570 if (lastWindowHeight != newHeight) { 571 lastWindowHeight = newHeight; 572 if (docked) { 573 var parentOffset = dockWrapper.parent().offset(); 574 var headerOffsetTop = $(window).height() - availableHeight; 575 576 lastScroll = jGlobal.scrollTop(); 577 absTop = lastScroll - (parentOffset.top - headerOffsetTop); 578 scrollOffset = 0; 579 } 580 reposition(); 581 } 582 } 583 584 jGlobal 585 .on('scroll', throttle(function () { 586 reposition(); 587 })) 588 .on('resized', reflow); 589 590 $.telligent.evolution.messaging.subscribe('reflow.reflowend', reflow); 591 592 $.telligent.evolution.messaging.subscribe('window.scrollableheight', function (data) { 593 if (availableHeight != data.height) { 594 availableHeight = data.height; 595 if (docked) { 596 var parentOffset = dockWrapper.parent().offset(); 597 var headerOffsetTop = $(window).height() - availableHeight; 598 599 lastScroll = jGlobal.scrollTop(); 600 absTop = lastScroll - (parentOffset.top - headerOffsetTop); 601 scrollOffset = 0; 602 } 603 reposition(); 604 } 605 }); 606 607 reposition(); 608 }); 609 }; 610 $.extend($.fn.evolutionDock, { 611 defaults: { 612 footers: ('.footer-fragments-header, ' + 613 '.footer-fragments, ' + 614 '.footer-fragments-footer, ' + 615 '.content-fragment-page ' + 616 '.layout-region.footer') 617 } 618 }); 619 620})(jQuery, window); 621 622// override pager UI component 623$.fn.evolutionPager.defaults = $.extend({}, $.fn.evolutionPager.defaults, { 624 showFirst: true, 625 showLast: true, 626 showNext: true, 627 showPrevious: true, 628 showIndividualPages: true, 629 numberOfPagesToDisplay: 5, 630 template: '' + 631 ' <% if(links && links.length > 0) { %> ' + 632 ' <% if($.grep(links, function(l){ return l.type === "previous"; }).length > 0) { %> ' + 633 ' <a class="previous" data-type="previous" data-page="<%= $.grep(links, function(l){ return l.type === "previous"; })[0].page %>" href="<%: $.grep(links, function(l){ return l.type === "previous"; })[0].url %>" title="<%: $.grep(links, function(l){ return l.type === "previous"; })[0].label %>"><</a> ' + 634 ' <% } else { %> ' + 635 ' <a class="previous disabled" href="#" aria-role="presentation"><</a> ' + 636 ' <% } %> ' + 637 ' <div class="ends"> ' + 638 ' <div> ' + 639 ' <% foreach(links, function(link, i) { %> ' + 640 ' <% if(link.type === "first") { %> ' + 641 ' <a href="<%: link.url %>" class="first" data-type="first" data-page="<%= link.page %>" data-selected="false" title="<%= link.label %>"><span>«</span></a> ' + 642 ' <% } else if(link.type === "page") { %> ' + 643 ' <a href="<%: link.url %>" class="page<%= link.selected ? " selected" : "" %>" data-type="page" data-page="<%= link.page %>" data-selected="<%= link.selected ? "true" : "false" %>" title="<%= link.label %>"><span><%= link.page %></span></a> ' + 644 ' <% } else if(link.type === "last") { %> ' + 645 ' <a href="<%: link.url %>" class="last" data-type="last" data-page="<%= link.page %>" data-selected="false" title="<%= link.label %>"><span>»</span></a> ' + 646 ' <% } %> ' + 647 ' <% }); %> ' + 648 ' </div> ' + 649 ' </div> ' + 650 ' <% if($.grep(links, function(l){ return l.type === "next"; }).length > 0) { %> ' + 651 ' <a class="next" data-type="next" data-page="<%= $.grep(links, function(l){ return l.type === "next"; })[0].page %>" href="<%: $.grep(links, function(l){ return l.type === "next"; })[0].url %>" title="<%= $.grep(links, function(l){ return l.type === "next"; })[0].label %>">></a> ' + 652 ' <% } else { %> ' + 653 ' <a class="next disabled" href="#" aria-role="presentation"><</a> ' + 654 ' <% } %> ' + 655 ' <% } %> ' 656}); 657 658(function ($, global, undef) { 659 660 function showLoadingIndicator(container, mask) { 661 var containerOffset = container.offset(); 662 mask.hide().appendTo('body').css({ 663 width: container.width(), 664 height: container.height(), 665 top: containerOffset.top, 666 left: containerOffset.left 667 }).show(); 668 } 669 670 var recentlyLoaded = true; 671 setTimeout(function () { 672 recentlyLoaded = false; 673 }, 2000); 674 675 function hideLoadingIndicator(container, mask) { 676 mask.hide(); 677 } 678 679 function buildMask() { 680 return $('<div></div>').css({ 681 backgroundColor: '#fff', 682 position: 'absolute', 683 opacity: .75, 684 zIndex: 1 685 }); 686 } 687 688 var ajaxPagerContexts = {}; 689 $.telligent.evolution.ui.components.page = { 690 setup: function () { 691 692 }, 693 add: function (elm, options) { 694 // general settings 695 var settings = { 696 currentPage: parseInt(options.currentpage, 10), 697 pageSize: parseInt(options.pagesize, 10), 698 totalItems: parseInt(options.totalitems, 10), 699 showPrevious: typeof options.configuration.ShowPrevious === 'undefined' ? true : options.configuration.ShowPrevious === 'true', 700 showNext: typeof options.configuration.ShowNext === 'undefined' ? true : options.configuration.ShowNext === 'true', 701 showIndividualPages: typeof options.configuration.ShowIndividualPages === 'undefined' ? true : options.configuration.ShowIndividualPages === 'true', 702 pageKey: options.pagekey, 703 hash: options.configuration.Target, 704 baseUrl: options.configuration.BaseUrl || window.location.href, 705 template: typeof options.configuration.Template !== 'undefined' ? options.configuration.Template : $.fn.evolutionPager.defaults.template 706 }; 707 // ajax-specific options 708 if (options.pagedcontenturl) { 709 ajaxPagerContexts[options.pagedcontentpagingevent] = { 710 onPage: function (pageIndex, complete, hash) { 711 var contentContainer = $('#' + options.pagedcontentwrapperid), 712 body = $('html,body'); 713 714 var data = hash || {}; 715 data[options.pagekey] = pageIndex; 716 // modify the url instead of passing as data, as the url might have this in the querystring already 717 var url = $.telligent.evolution.url.modify({ 718 url: options.pagedcontenturl, 719 query: data 720 });
721 $.telligent.evolution.get({ 722 url: url, 723 cache: false, 724 success: function (response) { 725 complete(response); 726 // if host page just loaded, don't bother scrolling pageable area 727 if (recentlyLoaded) 728 return; 729 // scroll to top of paging area after page if out of view 730 var top = contentContainer.offset().top - 160; 731 var scrollTop = 0; 732 body.each(function (i, e) { 733 if (e.scrollTop && e.scrollTop > scrollTop) { 734 scrollTop = e.scrollTop; 735 } 736 }); 737 if (scrollTop > top) { 738 body.animate({ 739 scrollTop: top 740 }, 250); 741 } 742 } 743 }); 744 } 745 }; 746 $.extend(settings, { 747 onPage: function (pageIndex, complete, hash) { 748 ajaxPagerContexts[options.pagedcontentpagingevent].onPage(pageIndex, complete, hash); 749 }, 750 refreshOnAnyHashChange: (options.loadonanyhashchange === 'true'), 751 pagedContentContainer: '#' + options.pagedcontentwrapperid, 752 pagedContentPagingEvent: options.pagedcontentpagingevent, 753 pagedContentPagedEvent: options.pagedcontentpagedevent, 754 transition: options.configuration.Transition, 755 transitionDuration: typeof options.configuration.TransitionDuration === 'undefined' ? 200 : parseInt(options.configuration.TransitionDuration, 10) 756 }); 757 } 758 $(elm).evolutionPager(settings); 759 760 if (options.loadingindicator === 'true') { 761 var container = $('#' + options.pagedcontentwrapperid), 762 mask = buildMask(); 763 $.telligent.evolution.messaging.subscribe(options.pagedcontentpagingevent, function () { 764 showLoadingIndicator(container, mask); 765 }); 766 $.telligent.evolution.messaging.subscribe(options.pagedcontentpagedevent, function () { 767 hideLoadingIndicator(container, mask); 768 }); 769 } 770 } 771 }; 772 773})(jQuery, window); 774 775// moderation UI component override 776(function ($, global, undef) { 777 778 function addAbuseReport(contentId, contentTypeId) { 779 return $.telligent.evolution.post({ 780 url: $.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/abusereports.json', 781 data: { 782 ContentId: contentId, 783 ContentTypeId: contentTypeId 784 }, 785 cache: false, 786 dataType: 'json' 787 }); 788 } 789 790 function show(elm) { 791 return elm.css({ 792 display: 'block' 793 }); 794 } 795 796 function hide(elm) { 797 return elm.css({ 798 display: 'none' 799 }); 800 } 801 802 $.telligent.evolution.ui.components.moderate = { 803 setup: function () {}, 804 add: function (elm, options) { 805 if (options.supportsabuse === 'false') { 806 elm.remove(); 807 return; 808 } 809 elm.removeClass('ui-moderate').empty(); 810 var flagLink = hide($('<a href="#">' + $.telligent.evolution.ui.components.moderate.defaults.flagText + '</a>').appendTo(elm)); 811 var changing = hide($('<a href="#">â¦</a>').appendTo(elm)); 812 var flaggedState = hide($('<a href="#">' + $.telligent.evolution.ui.components.moderate.defaults.flaggedText + '</a>').appendTo(elm)); 813 814 // if already flagged, show that instead of the link 815 if (options.initialstate == 'true') { 816 show(flaggedState).on('click', function (e) { 817 return false; 818 }); 819 } else { 820 show(flagLink).on('click', function (e) { 821 e.preventDefault(); 822 e.stopPropagation(); 823 $.fn.uilinks.hide(); 824 // when tapped, show the 'changing' state 825 show(changing); 826 hide(flagLink); 827 // and submit the abuse report 828 addAbuseReport(options.contentid, options.contenttypeid).then(function () { 829 // switch to the 'flagged' link state 830 show(flaggedState); 831 hide(changing); 832 // raise ui.reportabuse message 833 $.telligent.evolution.messaging.publish('ui.reportabuse', { 834 contentId: options.contentid, 835 contentTypeId: options.contenttypeid 836 }); 837 // show a message 838 $.telligent.evolution.notifications.show($.telligent.evolution.ui.components.moderate.defaults.reportedText, { 839 duration: $.telligent.evolution.ui.components.moderate.defaults.duration 840 }); 841 }); 842 }); 843 } 844 } 845 }; 846 $.telligent.evolution.ui.components.moderate.defaults = { 847 reportedText: 'Thank you for your report', 848 flagText: 'Flag as spam/abuse', 849 flaggedText: 'Flagged as spam/abuse', 850 duration: 5 * 1000 851 }; 852 853})(jQuery, window); 854 855 856// resize overload 857(function ($, global, undef) { 858 859 var resize = function (context) { 860 context.area.css({ 861 height: 'auto' 862 }); 863 864 var newHeight = context.area.prop('scrollHeight'); 865 if (newHeight < context.minHeight) 866 newHeight = context.minHeight; 867 868 context.area.css({ 869 height: newHeight 870 }); 871 872 newHeight = (context.area.outerHeight(true)); 873 874 if (newHeight !== context.oldHeight) { 875 context.area.css({ 876 overflow: 'hidden' 877 }); 878 context.area.trigger('evolutionResize', { 879 newHeight: newHeight, 880 oldHeight: context.oldHeight 881 }); 882 context.oldHeight = newHeight; 883 } 884 }; 885 886 $.fn.evolutionResize = function (options) { 887 var settings = $.extend({}, $.fn.evolutionResize.defaults, options || {}); 888 return this.filter('textarea').each(function () { 889 var area = $(this) 890 .css({ 891 width: '100%', 892 resize: 'none', 893 overflow: 'hidden' 894 }); 895 var context = { 896 area: area, 897 oldHeight: area.height(), 898 minHeight: area.outerHeight() 899 }; 900 area.on('input', function () { 901 resize(context); 902 }); 903 resize(context); 904 }); 905 }; 906 $.fn.evolutionResize.defaults = { 907 maxLength: 250 908 }; 909 910})(jQuery, window); 911 912// evolutionHighlight 913(function ($, global, undef) { 914 915 var highlighterKey = '_HIGHLIGHTER_CONTEXT', 916 getContext = function (selection, options) { 917 var context = selection.data(highlighterKey); 918 if (typeof context === 'undefined' || context === null) { 919 context = buildContext(selection, options); 920 selection.data(highlighterKey, context); 921 } 922 return context; 923 }, 924 buildContext = function (selection, options) { 925 var area = selection.filter('textarea'); 926 var context = { 927 selection: area, 928 settings: $.extend({}, $.fn.evolutionHighlight.defaults, options || {}), 929 verticalPadding: parseInt(area.css('padding-top') || '0', 10) + parseInt(area.css('padding-bottom') || '0', 10), 930 horizontalPadding: parseInt(area.css('padding-left') || '0', 10) + parseInt(area.css('padding-right') || '0', 10) + parseInt(area.css('border-left') || '0', 10) + parseInt(area.css('border-right') || '0', 10) 931 }; 932 buildHighlightingContainer(context); 933 return context; 934 }, 935 buildHighlightingContainer = function (context) {
936 context.wrapper = $('<div></div>'); 937 context.mirror = $('<div></div>'); 938 939 // remove margins from textarea and apply to wrapper 940 var wrapperStyle = { 941 position: 'relative', 942 width: context.selection.outerWidth(true), 943 height: context.selection.outerHeight(true) + 2 944 }; 945 $.each(['margin-left', 'margin-right', 'margin-top', 'margin-bottom'], function (i, styleName) { 946 wrapperStyle[styleName] = context.selection.css(styleName); 947 context.selection.css(styleName, 0); 948 }); 949 950 // capture textarea styles to apply to mirror 951 var mirrorStyle = { 952 position: 'absolute', 953 top: '0px', 954 left: '0px', 955 zIndex: '0', 956 borderTopColor: 'transparent', 957 borderBottomColor: 'transparent', 958 borderLeftColor: 'transparent', 959 borderRightColor: 'transparent', 960 backgroundColor: context.selection.css('backgroundColor'), 961 color: 'transparent', 962 width: context.selection.outerWidth(), 963 height: context.selection.outerHeight(), 964 overflow: 'hidden', 965 whiteSpace: 'normal' 966 }; 967 $.each(context.settings.styles, function (i, styleName) { 968 mirrorStyle[styleName] = context.selection.css(styleName); 969 }); 970 971 // new styles to apply to text area 972 var textAreaStyle = { 973 position: 'absolute', 974 top: '0px', 975 left: '0px', 976 zIndex: '1', 977 backgroundColor: 'transparent', 978 width: context.selection.outerWidth(), 979 height: context.selection.outerHeight() 980 }; 981 982 // apply styles 983 context.wrapper.css(wrapperStyle).addClass('highlighter'); 984 context.mirror.css(mirrorStyle); 985 context.selection.css(textAreaStyle); 986 987 // set background-color 988 context.mirror.css('color', context.mirror.css('background-color')); 989 990 // rearrange DOM 991 context.selection.before(context.wrapper); 992 context.wrapper.append(context.selection); 993 context.wrapper.append(context.mirror); 994 995 context.mirror.css({ 996 width: context.selection.outerWidth(true) + context.horizontalPadding, 997 height: context.selection.outerHeight(true) + context.verticalPadding 998 }) 999 }, 1000 rDoubleSpace = /\s\s/gi, 1001 rBreak = /\n/gi, 1002 encodeSymbols = { 1003 '&': '&', 1004 '>': '>', 1005 '<': '<', 1006 '"': '"', 1007 "'": ''' 1008 }, 1009 highlight = function (context) { 1010 // prepare highlights 1011 var ranges = {}; 1012 $.each(context.settings.ranges, function (i, range) { 1013 ranges[range.start] = ranges[range.start] || []; 1014 ranges[range.start].push(range); 1015 ranges[range.stop] = ranges[range.stop] || []; 1016 ranges[range.stop].push(range); 1017 }); 1018 1019 var rawValue = $.telligent.evolution.html.encode(context.selection.val()); 1020 newValue = [], 1021 spanDepth = 0; 1022 for (var i = 0; i < rawValue.length; i++) { 1023 if (typeof ranges[i] !== 'undefined') { 1024 $.each(ranges[i], function (h, range) { 1025 if (range.start === i) { 1026 newValue[newValue.length] = '<span class="' + range.className + '" style="white-space:normal;">'; 1027 spanDepth++; 1028 } else { 1029 newValue[newValue.length] = '</span>'; 1030 spanDepth--; 1031 } 1032 }); 1033 } 1034 newValue[newValue.length] = encodeSymbols[rawValue.charAt(i)] ? encodeSymbols[rawValue.charAt(i)] : rawValue.charAt(i); 1035 } 1036 if (spanDepth > 0) { 1037 newValue[newValue.length] = '</span>'; 1038 } 1039 var newRawValue = newValue.join('').replace(rBreak, '<br />').replace(rDoubleSpace, ' '); 1040 // not using .html() as it executes js. Not using .innerHTML directly on mirror as it errors in IE 1041 var mirroredValueWrapper = document.createElement('span'); 1042 mirroredValueWrapper.innerHTML = newRawValue; 1043 context.mirror.empty().get(0).appendChild(mirroredValueWrapper); 1044 }; 1045 var methods = { 1046 init: function (options) { 1047 var context = getContext(this, options); 1048 context.settings = $.extend({}, $.fn.evolutionHighlight.defaults, options || {}); 1049 highlight(context); 1050 return this; 1051 }, 1052 clear: function () { 1053 var context = getContext(this, null); 1054 if (context === null) 1055 return; 1056 context.mirror.html(''); 1057 return this; 1058 }, 1059 resize: function (width, height) { 1060 var context = getContext(this, null); 1061 if (context === null) 1062 return; 1063 var newStyle = { 1064 width: width + context.horizontalPadding, 1065 height: height + context.verticalPadding 1066 };
1067 context.mirror.css(newStyle); 1068 context.selection.css(newStyle); 1069 context.wrapper.css({ 1070 width: context.selection.width() + context.horizontalPadding, 1071 height: context.selection.height() + context.verticalPadding + 4 1072 }); 1073 return this; 1074 }, 1075 css: function (css) { 1076 var context = getContext(this, null); 1077 if (context === null) 1078 return; 1079 context.wrapper.css(css); 1080 return this; 1081 } 1082 }; 1083 $.fn.evolutionHighlight = function (method) { 1084 if (methods[method]) { 1085 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 1086 } else if (typeof method === 'object' || !method) { 1087 return methods.init.apply(this, arguments); 1088 } else { 1089 $.error('Method ' + method + ' does not exist on jQuery.evolutionHighlight'); 1090 } 1091 }; 1092 $.fn.evolutionHighlight.defaults = { 1093 ranges: [], 1094 styles: ['border-top-width', 'border-top-style', 'border-bottom-width', 1095 'border-bottom-style', 'border-right-width', 'border-right-width-value', 1096 'border-right-style', 'border-right-style-value', 'border-left-width', 1097 'border-left-width-value', 'border-left-style', 'border-left-style-value', 1098 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 1099 'font-style', 'font-variant', 'font-weight', 1100 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 1101 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'word-spacing' 1102 ] 1103 }; 1104 1105})(jQuery, window); 1106 1107// override search result UI component 1108(function ($) { 1109 $.telligent.evolution.ui.components.searchresult = { 1110 setup: function () {}, 1111 add: function (elm) {} 1112 }; 1113})(jQuery); 1114 1115 1116// override for liker template 1117(function ($) { 1118 1119 $.fn.evolutionLike.defaults.likersTemplate = '' + 1120 ' <% foreach(likers, function(liker) { %> ' + 1121 ' <li class="content-item"> ' + 1122 ' <div class="full-post-header"></div> ' + 1123 ' <div class="full-post"> ' + 1124 ' <span class="avatar"> ' + 1125 ' <a href="<%: liker.profileUrl %>" class="internal-link view-user-profile"> ' + 1126 ' <% if(liker.avatarHtml) { %> ' + 1127 ' <%= liker.avatarHtml %> ' + 1128 ' <% } else { %> ' + 1129 ' <img src="<%: liker.avatarUrl %>" alt="" border="0" width="32" height="32" style="width:32px;height:32px" /> ' + 1130 ' <% } %> ' + 1131 ' </a> ' + 1132 ' </span> ' + 1133 ' <span class="user-name"> ' + 1134 ' <a href="<%: liker.profileUrl %>" class="internal-link view-user-profile"><%= liker.displayName %></a> ' + 1135 ' </span> ' + 1136 ' </div> ' + 1137 ' <div class="full-post-footer"></div> ' + 1138 ' </li> ' + 1139 ' <% }); %> '; 1140 1141})(jQuery); 1142 1143// override defaults 1144(function ($) { 1145 $.fn.glowUpload.defaults.width = '80%'; 1146 $.fn.evolutionStarRating.defaults.starElement = 'span' 1147})(jQuery); 1148 1149 1150// adjust tables to be scrollable if they are larger than the content width and available height 1151(function ($) { 1152 var maxHeight = 400, 1153 checkResize = function () { 1154 $('.content-fragment-content .content .content .content-scrollable-wrapper, .user-defined-markup .content-scrollable-wrapper').each(function () { 1155 var w = $(this); 1156 var sw = w.prop('scrollWidth') || w.width(); 1157 if (sw > w.outerWidth()) { 1158 w.addClass('content-scrollable-wrapper-scrolled').css('max-height', (maxHeight * .8) + 'px'); 1159 } else { 1160 w.removeClass('content-scrollable-wrapper-scrolled').css('max-height', 'none'); 1161 } 1162 }); 1163 }, 1164 detectElements = function () { 1165 $('.content-fragment-content .content .content table, .content-fragment-content .content .content pre, .user-defined-markup table, .user-defined-markup pre').each(function () { 1166 var t = $(this); 1167 if (!t.is('.scrollable-ignore') && t.parents('.content-scrollable-wrapper').length == 0) { 1168 t.wrap('<div class="content-scrollable-wrapper" style="max-width: 100%; overflow: auto;"></div>'); 1169 } 1170 }); 1171 }; 1172 1173 $.telligent.evolution.messaging.subscribe('window.scrollableheight', function (data) { 1174 maxHeight = data.height; 1175 checkResize(); 1176 }); 1177 1178 $(function () { 1179 var mutationTimeout; 1180 $('body').on('mutate', function () { 1181 clearTimeout(mutationTimeout); 1182 mutationTimeout = setTimeout(function () { 1183 detectElements(); 1184 checkResize(); 1185 }, 500); 1186 }); 1187 1188 detectElements(); 1189 checkResize(); 1190 }); 1191})(jQuery); 1192 1193// adjust iframe based embeddable scripts to be scrollable if they are larger than the content width and available height 1194(function ($) { 1195 1196 function throttle(handler) { 1197 if (!window.requestAnimationFrame) 1198 return handler; 1199 var timeout; 1200 return function () { 1201 if (timeout) 1202 window.cancelAnimationFrame(timeout); 1203 timeout = window.requestAnimationFrame(handler); 1204 }; 1205 } 1206 1207 $(function () { 1208 var $allVideos = $('.resizable-embeddablescript iframe') 1209 $allVideos.each(function () { 1210 $(this).data('aspectRatio', this.height / this.width) 1211 .removeAttr('height') 1212 .removeAttr('width'); 1213 }); 1214 1215 var maxHeight = 0; 1216 var resizeEnd; 1217 1218 var resizeEmbeddableIframes = function () { 1219 clearTimeout(resizeEnd); 1220 resizeEnd = setTimeout(function () { 1221 $allVideos.each(function () { 1222 var $el = $(this); 1223 var parent = $el.closest('.content-fragment-content'); 1224 1225 var newWidth = parent.width() - 5; 1226 var newHeight = parent.width() * $el.data('aspectRatio'); 1227 1228 if (maxHeight > 0 && newHeight > maxHeight) { 1229 newHeight = maxHeight; 1230 newWidth = maxHeight / $el.data('aspectRatio') 1231 } 1232 1233 $el.width(newWidth).height(newHeight); 1234 }); 1235 }, 100); 1236 }; 1237 1238 $.telligent.evolution.messaging.subscribe('window.scrollableheight', function (data) { 1239 maxHeight = data.height; 1240 1241 resizeEmbeddableIframes(); 1242 }); 1243 1244 $(window).on('resized', throttle(function () { 1245 resizeEmbeddableIframes(); 1246 })).trigger('resize'); 1247 }); 1248 1249})(jQuery); 1250 1251// position notifications in top right, with long error durations 1252(function ($) { 1253 $.extend($.telligent.evolution.notifications.defaults, { 1254 errorDuration: 60 * 1000, 1255 verticalOffset: 45, 1256 horizontalOffset: 5, 1257 placement: 'topright' 1258 }); 1259})(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.