PageSourceSearch

https://www.authorlearningcenter.com/cfs-filesystemfile/__key/them…/theme.js?_=639199448468685328

js authorlearningcenter.com collected 2026-09-25 23:54:17 UTC 36,895 bytes, 1,141 lines download raw bytes

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