PageSourceSearch

https://mainpp.gov.my/components/com_jmap/js/jquery.treeview.js?1f7a36

js mainpp.gov.my collected 2026-10-02 14:08:11 UTC 28,265 bytes, 690 lines download raw bytes

1(function(e) {
2	e.extend(e.fn, {
3		swapClass : function(e, t) {
4			var n = this.filter("." + e);
5			this.filter("." + t).removeClass(t).addClass(e);
6			n.removeClass(e).addClass(t);
7			return this
8		},
9		replaceClass : function(e, t) {
10			return this.filter("." + e).removeClass(e).addClass(t).end()
11		},
12		hoverClass : function(t) {
13			t = t || "hover";
14			return this.hover(function() {
15				e(this).addClass(t)
16			}, function() {
17				e(this).removeClass(t)
18			})
19		},
20		heightToggle : function(e, speed, t) {
21			e ? this.animate({
22				height : "toggle"
23			}, speed, t) : this.each(function() {
24				jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"]();
25				if (t)
26					t.apply(this, arguments)
27			})
28		},
29		heightHide : function(e, t) {
30			if (e) {
31				this.animate({
32					height : "hide"
33				}, e, t)
34			} else {
35				this.hide();
36				if (t)
37					this.each(t)
38			}
39		},
40		prepareBranches : function(e, parentWrappedSet) {
41			if (!e.prerendered) {
42				this.filter(":last-child:not(ul)").addClass(t.last);
43
44				if(e.collapsed) {
45					var branchSelector = '';
46					var negativeBranchSelector = new Array();
47					jQuery.each(e.contentCollapsed, function(sourceHash, sourceCollapsed){
48						if(sourceCollapsed == 2) {
49							if(sourceHash.indexOf('com_content') != -1) {
50								branchSelector += ":not(ul[data-hash*='" + sourceHash + "'])";
51							} else {
52								branchSelector += ":not(ul[data-hash='" + sourceHash + "'])";
53								negativeBranchSelector.push("ul[data-hash='" + sourceHash + "']");
54							}
55						}
56					});
57					if(branchSelector) {
58						var filteredUL = parentWrappedSet.filter(branchSelector);
59						if(negativeBranchSelector.length) {
60							filteredUL.each(function(index, filteredULElement){
61								if(!jQuery(filteredULElement).parents(negativeBranchSelector.join()).length) {
62									jQuery(filteredULElement).find(">li>ul").hide();			
63								}
64							});
65						} else {
66							filteredUL.find(">li>ul,li[data-hash] ul").hide();
67						}
68					} else {
69						this.filter(":not(." + t.open + ")").find(">ul").hide();
70					}
71				}
72				
73				if(!e.collapsed) {
74					var branchSelector = new Array();
75					jQuery.each(e.contentCollapsed, function(sourceHash, sourceCollapsed){
76						if(sourceCollapsed == 1) {
77							if(sourceHash.indexOf('com_content') != -1) {
78								branchSelector.push("ul[data-hash*='" + sourceHash + "']");
79							} else {
80								branchSelector.push("ul[data-hash='" + sourceHash + "']");
81							}
82						}
83					});
84					if(branchSelector.length) {
85						var filteredUL = parentWrappedSet.filter(branchSelector.join());
86						filteredUL.find("li ul").hide();
87					}
88				}
89			}
90			return this.filter(":has(>ul)")
91		},
92		applyClasses : function(n, r) {
93			this.filter(":not(.noexpandable):has(>ul):not(:has(>a))").find(">span").off("click.treeview").on("click.treeview", function(t) {
94				if (this == t.target)
95					r.apply(e(this).next())
96			}).add(e("a", this)).hoverClass();
97			if (!n.prerendered) {
98				this.filter(":not(.noexpandable):has(>ul:hidden)").addClass(t.expandable).replaceClass(t.last, t.lastExpandable);
99				this.filter(":not(.noexpandable)").not(":has(>ul:hidden)").addClass(t.collapsable).replaceClass(t.last, t.lastCollapsable);
100				var i = this.not(".noexpandable").find("div." + t.hitarea);
101				if (!i.length)
102					i = this.not(".noexpandable").prepend('<div class="' + t.hitarea + '"/>').find("div." + t.hitarea);
103				i.removeClass().addClass(t.hitarea).each(function() {
104					var t = "";
105					e.each(e(this).parent().attr("class").split(" "), function() {
106						t += this + "-hitarea "
107					});
108					e(this).addClass(t)
109				})
110			}
111			this.find("div." + t.hitarea).off("click.treeview").on("click.treeview", r);
112		},
113		treeview : function(n) {
114			var parentWrappedSet = this;
115			function r(n, r) {
116				function s(r) {
117					return function() {
118						i.apply(e("div." + t.hitarea, n).filter(function() {
119							return r ? e(this).parent("." + r).length : true
120						}));
121						return false
122					}
123				}
124				e("a:eq(0)", r).click(s(t.collapsable));
125				e("a:eq(1)", r).click(s(t.expandable));
126				e("a:eq(2)", r).click(s())
127			}
128			function i() {
129				e(this).parent().find(">.hitarea").swapClass(t.collapsableHitarea, t.expandableHitarea).swapClass(t.lastCollapsableHitarea, t.lastExpandableHitarea).end()
130						.swapClass(t.collapsable, t.expandable).swapClass(t.lastCollapsable, t.lastExpandable).find(">ul").heightToggle(n.animated, n.animateSpeed, n.toggle);
131				if (n.unique) {
132					e(this).parent().siblings().find(">.hitarea").replaceClass(t.collapsableHitarea, t.expandableHitarea).replaceClass(t.lastCollapsableHitarea, t.lastExpandableHitarea).end()
133							.replaceClass(t.collapsable, t.expandable).replaceClass(t.lastCollapsable, t.lastExpandable).find(">ul").heightHide(n.animated, n.toggle)
134				}
135			}
136			function s() {
137				function t(e) {
138					return e ? 1 : 0
139				}
140				var r = [];
141				a.each(function(t, n) {
142					r[t] = e(n).is(":has(>ul:visible)") ? 1 : 0
143				});
144				e.cookie(n.cookieId, r.join(""), n.cookieOptions)
145			}
146			function o() {
147				var t = e.cookie(n.cookieId);
148				if (t) {
149					var r = t.split("");
150					a.each(function(t, n) {
151						e(n).find(">ul")[parseInt(r[t]) ? "show" : "hide"]()
152					})
153				}
154			}
155			n = e.extend({
156				cookieId : "treeview"
157			}, n);
158			if (n.toggle) {
159				var u = n.toggle;
160				n.toggle = function() {
161					return u.apply(e(this).parent()[0], arguments)
162				}
163			}
164			this.data("toggler", i);
165			this.addClass("treeview");
166			var a = this.find("li").prepareBranches(n, parentWrappedSet);
167			
168			if(e('#jmap_toggler #jmap_toggler_all').length) {
169				e('#jmap_toggler #jmap_toggler_all').on('click.treeview', function(){
170					e('div.jmapcolumn ul > li.expandable > div.hitarea').trigger('click');
171				});
172			}
173			if(e('#jmap_toggler #jmap_toggler_none').length) {
174				e('#jmap_toggler #jmap_toggler_none').on('click.treeview', function(){
175					e('div.jmapcolumn ul >
175 li.collapsable > div.hitarea').trigger('click');
176				});
177			}
178			
179			switch (n.persist) {
180			case "cookie":
181				var f = n.toggle;
182				n.toggle = function() {
183					s();
184					if (f) {
185						f.apply(this, arguments)
186					}
187				};
188				o();
189				break;
190			case "location":
191				var l = this.find("a").filter(function() {
192					return this.href.toLowerCase() == location.href.toLowerCase()
193				});
194				if (l.length) {
195					var c = l.addClass("selected").parents("ul, li").add(l.next()).show();
196					if (n.prerendered) {
197						c.filter("li").swapClass(t.collapsable, t.expandable).swapClass(t.lastCollapsable, t.lastExpandable).find(">.hitarea").swapClass(t.collapsableHitarea, t.expandableHitarea)
198									  .swapClass(t.lastCollapsableHitarea, t.lastExpandableHitarea)
199					}
200				}
201				break;
202			case "none":
203				break
204			}
205			a.applyClasses(n, i);
206			if (n.control) {
207				r(this, n.control);
208				e(n.control).show()
209			}
210			var h = e("li>span.folder");
211			e.each(h, function(t, n) {
212				var r = e(n).text();
213				var i = r.replace(/^\s+|\s+$/g, "");
214				if (i.length == 0) {
215					e(n).parent("li").css("list-style-type", "none");
216					if (e(n).css("background-image") === "none") {
217						e(n).hide()
218					}
219				}
220			});
221			return this
222		}
223	});
224	e.treeview = {};
225	var t = e.treeview.classes = {
226		open : "open",
227		closed : "closed",
228		expandable : "expandable",
229		expandableHitarea : "expandable-hitarea",
230		lastExpandableHitarea : "lastExpandable-hitarea",
231		collapsable : "collapsable",
232		collapsableHitarea : "collapsable-hitarea",
233		lastCollapsableHitarea : "lastCollapsable-hitarea",
234		lastCollapsable : "lastCollapsable",
235		lastExpandable : "lastExpandable",
236		last : "last",
237		hitarea : "hitarea"
238	}
239})(jQuery);
240
241jQuery(function($) {
242	if(typeof(jmapExpandContentTree) === 'undefined') { jmapExpandContentTree = '{}'; }
243	var defaultOptions = {
244			persist : jmapExpandLocation,
245			collapsed : !jmapExpandAllTree,
246			contentCollapsed : JSON.parse(jmapExpandContentTree),
247			unique : false,
248			animated: jmapAnimated,
249			animateSpeed: jmapAnimateSpeed
250		};
251	$("ul.jmap_filetree").treeview(defaultOptions);
252	
253	$(function(){
254		var recursiveBackground = function(parentElement) {
255			var parentBgColor = $(parentElement).css('background-color');
256			if((parentBgColor == 'rgba(0, 0, 0, 0)' || parentBgColor == 'transparent') && parentElement.length) {
257				recursiveBackground(parentElement.parent());
258			} else {
259				$('#jmap_sitemap div.jmapcolumn>ul>li>div.lastCollapsable-hitarea').css('background-color', parentBgColor);
260				$('#jmap_sitemap div.jmapcolumn>ul>li>div.lastExpandable-hitarea').css('background-color', parentBgColor);
261				$('#jmap_sitemap div.jmapcolumn>ul.treeview>li>ul:last-child>li:last-child li.last').addClass('jmap_last_before');
262				$('#jmap_sitemap div.jmapcolumn>ul.treeview>li>ul:last-child>li:last-child.last').addClass('jmap_last_before');
263				$('#jmap_sitemap div.jmapcolumn>ul.treeview>li>ul:last-child>li.expandable:last-child').addClass('jmap_last_before');
264				$('#jmap_sitemap div.jmapcolumn>ul.treeview>li>ul>li.expandable:last-child li.expandable').addClass('jmap_last_before');
265
266				$("<style type='text/css'>li.jmap_last_before.expandable:before,li.jmap_last_before.last:before{ background-color:" + parentBgColor +";</style>").appendTo("head");
267			}
268		}
269		if($('#jmap_sitemap').data('template') == 'mindmap') {
270			recursiveBackground($('#jmap_sitemap').parent());
271			
272			if(jmapDraggableSitemap) {
273				var tmp_handler = function(){};
274				$('div.jmapcolumn>ul').draggable({
275					opacity: .8,
276					addClasses: false,
277					zIndex: 100,
278					distance: 10,
279					start : function(event,ui){
280						try{
281							tmp_handler = $._data( $('span', event.target)[0], "events" ).click[0].handler;
282						} catch(e){}
283						$('span', this).off('.treeview');
284					},
285					stop : function(event,ui){
286						setTimeout(function(){
287							$('span', event.target).on("click.treeview", tmp_handler)
288						}, 300);
289						
290						try {
291							if(document.elementFromPoint) {
292								var elementOnCoordinates = document.elementFromPoint(ui.offset.left - 1, ui.offset.top - 1);
293								var parentBgColor = 'rgba(0, 0, 0, 0)';
294								var recursiveElementOnCoordinatesBackground = function(parentElement) {
295									parentBgColor = parentElement.css('background-color');
296									if((parentBgColor == 'rgba(0, 0, 0, 0)' || parentBgColor == 'transparent') && parentElement.length) {
297										recursiveElementOnCoordinatesBackground(parentElement.parent());
298									}
299									return parentBgColor;
300								}
301								
302								var elementOnCoordinatesBgColor = recursiveElementOnCoordinatesBackground($(elementOnCoordinates));
303								var uniqueID = 'repositioned' + Math.floor((Math.random() * 100) + 1);
304								$(event.target).attr('id', uniqueID);
305								$('#' + uniqueID + '>li:first-child>div.lastCollapsable-hitarea').css('background-color', elementOnCoordinatesBgColor);
306								$('#' + uniqueID + '>li:first-child>div.lastExpandable-hitarea').css('background-color', elementOnCoordinatesBgColor);
307								$("<style type='text/css'>#" + uniqueID + " li.jmap_last_before.expandable:before,#" + uniqueID + " li.jmap_last_before.last:before{ background-color:" + elementOnCoordinatesBgColor +";</style>").appendTo("head");
308							}
309						} catch(e){}
310					}
311				});
312			}
313		}
314	});
315	
316	if(jmapExpandFirstLevel) {
317		$('div.jmapcolumn>ul>li.expandable.lastExpandable>div.hitarea').trigger('click');
318	}
319	
320	if(!$.isEmptyObject(jmapLinkableCatsSources)) {
321		$.each(jmapLinkableCatsSources, function(linkableList, linkableMode){
322			var dataSourcePromise = $.Deferred(function(defer) {
323				setTimeout(function(){
324					var ulCategoryList = $('ul[data-hash=' + linkableList + ']').get(0);
325					if(!ulCategoryList) return;
326					var ulCategoryListLinks = $('a', $(ulCategoryList));
327					if(!ulCategoryListLinks.length) return;
328					defer.resolve(ulCategoryList, ulCategoryListLinks, linkableList, linkableMode);
329				}, 0);
330			}).promise();
331			
332			dataSourcePromise.then(function(ulCategoryList, ulCategoryListLinks, linkableList, linkableMode) {
333				if(linkableMode == 'yeshide') {
334					$('ul[data-hash=' + linkableList + ']').hide();
335				}
336				var struct = {};
337				$.each(ulCategoryListLinks, function(index, link){
338					var href = $(link).attr('href');
339					var pkey = $(link).text();
340					struct[pkey] = href;
341				});
342				var target = $(ulCategoryListLinks.get(0)).attr('target');
343				var targetString = target ? 'target="' + target + '"' : 'target="_self"';
344				var ulLinkableLists = $('ul[data-hash="' + linkableList + '\.items"]');
345				$.each(ulLinkableLists, function(index, singleLinkableList){
346					var spansToReplace = $('ul.jmap_filetree span.folder', singleLinkableList);
347					$.each(spansToReplace, function(k, spanElem){
348						var spanElemPKey = $(spanElem).text();
349						if(struct[spanElemPKey]) {
350							$(spanElem).text('');
351							$(spanElem).append('<a ' + targetString + ' href="' + struct[spanElemPKey] + '">' + spanElemPKey + '</a>');
352						}
353					});
354				});
355			});
356		});
357	}
358	
359	if(jmapMergeAliasMenu) {
360		var dataSourceMenuAliasPromise = $.Deferred(function(defer) {
361			setTimeout(function(){
362				var ulMenuMergeAliasList = $('ul.jmap_filetree_menu li[data-merge]');
363				if(!ulMenuMergeAliasList.length) return;
364				defer.resolve(ulMenuMergeAliasList);
365			}, 0);
366		}).promise();
367		
368		dataSourceMenuAliasPromise.then(function(ulMenuMergeAliasList) {
369			var allMenuLinksToEvaluate = $('ul.jmap_filetree_menu li:not([data-merge]) a').filter(function(){
370				return $(this).parents('li[data-merge]').length ? false : true;
371			});
372			$.each(allMenuLinksToEvaluate, function(index, menuLinkToEvaluate) {
373				var hrefLink = $(menuLinkToEvaluate).attr('href');
374				$.each(ulMenuMergeAliasList, function(k, originalMergeSource){
375					var $originalMergeSource = $(originalMergeSource);
376					var currentDataMerge = $(originalMergeSource).data('merge');
377					var currentElementMerge = $('ul', $originalMergeSource).get(0);
378					if(currentElementMerge && currentDataMerge == hrefLink) {
379						var clonedDomElement = $(currentElementMerge).clone(true, true).css('display', 'block');
380						var parentsUL = $originalMergeSource.parents('ul:not(.jmap_filetree_menu )');
381						var directLIParent = $($originalMergeSource.parents('li.collapsable').get(0));
382						$originalMergeSource.remove()
383						if(!$('li', parentsUL).length) {
384							parentsUL.parents('ul.jmap_filetree_menu').remove();
385						}
386						if(!$('li', directLIParent).length) {
387							directLIParent.removeClass('collapsable lastCollapsable');
388						}
389						$(menuLinkToEvaluate).after(clonedDomElement);
390						$(menuLinkToEvaluate).before('<div class="hitarea collapsable-hitarea"></div>');
391						$($(menuLinkToEvaluate).parents('ul').get(0)).treeview(defaultOptions);
392					}
393				});
394			});
395		});
396	}
397	
398	if(!$.isEmptyObject(jmapMergeMenuTree)) {
399		$.each(jmapMergeMenuTree, function(mergebleListIdentifier, linkableMode) {
400			var dataSourcePromise = $.Deferred(function(defer) {
401				if(mergebleListIdentifier == 'com_content') {return;}
402				setTimeout(function(){
403					var ulCategoryList = $('ul[data-hash="' + mergebleListIdentifier + '"]');
404					if(!ulCategoryList.length) return;
405					if(linkableMode == 'yeshide') {
406						$('ul[data-hash="' + mergebleListIdentifier + '"]').hide();
407					}
408					
409					var ulCategoryListUl = $('ul[data-hash^="' + mergebleListIdentifier + '"]', $(ulCategoryList));
410					if(!ulCategoryListUl.length) return;
411					
412					defer.resolve(ulCategoryListUl, mergebleListIdentifier, linkableMode);
413				}, 0);
414			}).promise();
415			
416			dataSourcePromise.then(function(ulCategoryListUl, mergebleListIdentifier, linkableMode) {
417				var struct = {};
418				$.each(ulCategoryListUl, function(index, listUl){
419					var dataHash = $(listUl).data('hash');
420					var pkey = $('a', listUl).text();
421					struct[pkey] = dataHash;
422				});
423				
424				var ulItemsAnchors = $('ul[data-hash="' + mergebleListIdentifier + '\.items"] span.folder');
425				$.each(ulItemsAnchors, function(index, ulItemsAnchor){
426					var anchorElemPKey = $(ulItemsAnchor).text();
427					if(struct[anchorElemPKey]) {
428						var $genericListItem = $('ul.jmap_filetree li[data-hash="' + struct[anchorElemPKey] + '"]');
429						var genericListItemExpandable = $genericListItem.hasClass('expandable')
430						var displayClass = genericListItemExpandable ? 'none' : 'block';
431						var targetUlToAppend = $(ulItemsAnchor).parents('ul.jmap_filetree').get(0);
432						var clonedDomElement = $(targetUlToAppend).clone(true, true).css('display', displayClass);
433						$genericListItem.append(clonedDomElement);
434					}
435				});
436				
437				if(!ulItemsAnchors.length && mergebleListIdentifier == 'com_igallery') {
438					var ulItemsAnchors = $('ul[data-hash*="' + mergebleListIdentifier + '\.category"]');
439					$.each(ulItemsAnchors, function(index, ulItemsAnchor){
440						var anchorElemPKey = $(ulItemsAnchor).text();
441						if(struct[anchorElemPKey]) {
442							var $genericListItem = $('ul.jmap_filetree li[data-hash="' + struct[anchorElemPKey] + '"]');
443							var genericListItemExpandable = $genericListItem.hasClass('expandable')
444							var displayClass = genericListItemExpandable ? 'none' : 'block';
445							var clonedDomElement = $(ulItemsAnchor).clone(true, true).css('display', displayClass);
446							$genericListItem.append(clonedDomElement);
447						}
448					});
449				}
450				
451				if(linkableMode == 'yeshide') {
452					$('ul[data-hash="' + mergebleListIdentifier + '\.items"]').hide();
453				}
454			});
455			
456			var dataSourceContentPromise = $.Deferred(function(defer) {
457				if(mergebleListIdentifier != 'com_content') {return;}
458				setTimeout(function(){
459					var ulCategoryContentList = $('ul.jmap_filetree[data-hash^="' + mergebleListIdentifier + '"]');
460					if(!ulCategoryContentList.length) return;
461					if(linkableMode == 'yeshide') {
462						$('ul.jmap_filetree[data-hash^="' + mergebleListIdentifier + '"]').hide();
463					}
464					
465					defer.resolve(ulCategoryContentList, mergebleListIdentifier, linkableMode);
466				}, 0);
467			}).promise();
468			
469			dataSourceContentPromise.then(function(ulCategoryContentList, mergebleListIdentifier, linkableMode) {
470				$.each(ulCategoryContentList, function(index, ulCategoryContent) {
471					var sourceHash = $(ulCategoryContent).data('hash');
472					var alternativeSourceHash = sourceHash.replace('category', 'categories');
473					var $genericListItems = $('ul.jmap_filetree li[data-hash="' + sourceHash + '"],ul.jmap_filetree li[data-hash="' + alternativeSourceHash + '"]');
474					if(!$genericListItems.length) {return true;}
475					$.each($genericListItems, function(index, genericListItem) {
476						var $genericListItem = $(genericListItem);
477						var genericListItemExpandable = $genericListItem.hasClass('expandable')
478						var displayClass = genericListItemExpandable ? 'none' : 'block';
479						var clonedDomElement = $(ulCategoryContent).clone(true, true).css({'display':'block', 'height':'auto'});
480						$genericListItem.append(clonedDomElement).addClass('fulltreepopulated');
481					});
482				});
483			});
484			
485			if(typeof(jmapMergeMenuTreeLevels) !== 'undefined' && jmapMergeMenuTreeLevels == 'topchildlevels') {
486				var dataSourceContentChildPromise = $.Deferred(function(defer) {
487					if(mergebleListIdentifier != 'com_content') {return;}
488					setTimeout(function(){
489						var ulCategoryContentList = $('*[data-hash="com_content.container"] ul.jmap_filetree[data-hash-catid^="' + mergebleListIdentifier + '"]');
490						if(!ulCategoryContentList.length) return;
491						
492						defer.resolve(ulCategoryContentList, mergebleListIdentifier, linkableMode);
493					}, 0);
494				}).promise();
495				
496				dataSourceContentChildPromise.then(function(ulCategoryContentList, mergebleListIdentifier, linkableMode) {
497					$.each(ulCategoryContentList, function(index, ulCategoryContent) {
498						var $ulCategoryContent = $(ulCategoryContent);
499						var sourceHash = $ulCategoryContent.data('hash');
500						var sourceCatidHash = $ulCategoryContent.data('hash-catid');
501						var alternativeSourceCatidHash = sourceCatidHash.replace('category', 'categories');
502						var $genericListItems = $('ul.jmap_filetree li[data-hash="' + sourceCatidHash + '"],ul.jmap_filetree li[data-hash="' + alternativeSourceCatidHash + '"]').not('.fulltreepopulated');
503						if(!$genericListItems.length) {return true;}
504						$.each($genericListItems, function(index, genericListItem) {
505							var $genericListItem = $(genericListItem);
506							var genericListItemExpandable = $genericListItem.hasClass('expandable')
507							var displayClass = genericListItemExpandable ? 'none' : 'block';
508							var clonedDomElement = $ulCategoryContent.clone(true, true).css({'display':displayClass, 'height':'auto'});
509							$genericListItem.append(clonedDomElement);
510							var ulCategoryContentLevel = $ulCategoryContent.data('level');
511							var allChildItems = $ulCategoryContent.nextAll('ul.jmap_filetree[data-hash="' + sourceHash + '"]')
512																.filter(function(index){
513																	var itemLevel = $(this).data('level');
514																	return itemLevel >= ulCategoryContentLevel;
515																})
516																.clone(true, true)
517																.css({'display':displayClass, 'height':'auto'});
518							$.each(allChildItems, function(index, element){
519								if($(element).data('level') == ulCategoryContentLevel) {
520									return false;
521								}
522								genericListItem.append(element);
523							});
524						});
525					});
526				});
527			}
528		});
529	}
530	
531	if(jmapMergeGenericMenuByClass) {
532		var dataSourceAllMenusPromise = $.Deferred(function(defer) {
533			setTimeout(function(){
534				var ulMenuGenericList = $('ul.jmap_filetree[data-hash]').filter(function(){
535					var dataHash = $(this).data('hash');
536					var isContent = dataHash.search('com_content') == -1 ? true : false;
537					return isContent;
538				});
539				if(!ulMenuGenericList.length) return;
540				defer.resolve(ulMenuGenericList);
541			}, 0);
542		}).promise();
543		
544		dataSourceAllMenusPromise.then(function(ulMenuGenericList) {
545			$.each(ulMenuGenericList, function(index, genericListItem) {
546				var $genericListItem = $(genericListItem);
547				var genericListItemHash = $genericListItem.attr('data-hash').replace('.', '\\.');
548				var matchingGenericMenuItem = $('ul.jmap_filetree_menu li.' + genericListItemHash + ' > a').get(0);
549				var $matchingGenericMenuItemLi = $('ul.jmap_filetree_menu li.' + genericListItemHash);
550				var genericListItemExpandable = $matchingGenericMenuItemLi.hasClass('expandable')
551				var displayClass = genericListItemExpandable ? 'none' : 'block';
552				if(matchingGenericMenuItem) {
553					var clonedDomElement = $genericListItem.clone(true, true).css('display', displayClass);
554					$(matchingGenericMenuItem).after(clonedDomElement);
555					$genericListItem.remove();
556				}
557			});
558		});
559	}
560	
561	if(jmapGojsSitemap) {
562		(function initGoJsJMapTreeLayout() {
563			$('#jmap_sitemap').addClass('gojs_sitemap');
564			var gojsPromise = $.Deferred(function(defer) {
565				setTimeout(function(){
566					defer.resolve();
567				}, 0);
568			}).promise();
569			
570			gojsPromise.then(function() {
571				var getTextWidth = function(text, font) {
572				    var canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
573				    var context = canvas.getContext("2d");
574				    context.font = font;
575				    var metrics = context.measureText(text);
576				    return metrics.width;
577				}
578				if(typeof(go) === 'undefined') {
579					$('#jmap_sitemap').removeClass('gojs_sitemap');
580					return;
581				}
582				var gojs = go.GraphObject.make;
583				var horizontalOrientation = jmapisRTLLanguage ? 180 : 0;
584				var jMapTreeDiagram = gojs(go.Diagram, "gojsjmaptreelayout", {
585					initialAutoScale : (jmapGojsAutoScaleCanvas ? go.Diagram.UniformToFill : go.Diagram.None),
586					layout : gojs(go.TreeLayout, {
587						angle : (jmapGojsTreeOrientation == 'horizontal' ? horizontalOrientation : 90),
588						comparer : go.LayoutVertex.smartComparer
589					})
590				});
591				jMapTreeDiagram.addDiagramListener("InitialLayoutCompleted", function(e) {
592					if(jmapGojsAutoHeightCanvas) {
593						var dia = e.diagram;
594						dia.div.style.height = (dia.documentBounds.height + 26) + "px";
595					}
596					if(!jmapDraggableSitemap) {
597						e.diagram.nodes.each(function(n) { n.movable = false; });
598					}
599				});
600				jMapTreeDiagram.nodeTemplate = gojs(go.Node, "Spot", {
601					locationSpot : go.Spot.Center
602				},  
603				gojs(go.Shape, "Ellipse", {
604					fill : "lightgray",
605					stroke : null
606				}, new go.Binding("fill", "fill")), 
607				gojs("HyperlinkText",
608			          function(node) { 
609						return node.data.link; 
610					},
611			          function(node) { 
612						var denominator = node.data.text.length > 1 ? node.data.text.length : 2;
613						var ratio = 100 / denominator;
614						var textWidth = getTextWidth(node.data.text, "normal 16px arial") + ratio;
615						node.width = textWidth >= 50 ? textWidth : 50;
616						node.height = 50;
617						return node.data.text; 
618					},
619			          { margin: 10, stroke: jmapGojsNodeColorText }
620			        )
621				);
622				jMapTreeDiagram.linkTemplate = gojs(go.Link, {
623					routing : go.Link.Orthogonal,
624					selectable : true
625				}, gojs(go.Shape, {
626					strokeWidth : 3,
627					stroke : "#333"
628				}));
629				var nodeDataArray = [];
630				var key = 0;
631				var rootsColor = jmapGojsRootColor;
632				var childrenColor = jmapGojsChildColor;
633				var recursiveDataModelBuilder = function(element, level, parent) {
634					var nodeColor = level == 0 ? rootsColor : childrenColor;
635					var immediateLiChildren = $(element).children('li');
636					$.each(immediateLiChildren, function(index, liElement){
637						var $liElement = $(liElement);
638						if(jmapHideEmptyCats && $liElement.hasClass('noexpandable last')) {
639							return true;
640						}
641						var nodeText =  $liElement.children('span.folder, a').text();
642						if(!nodeText) {
643							return true;
644						}
645						
646						var directAnchorChildren = $liElement.children('a');
647						var nodeLink = directAnchorChildren.attr('href') || $liElement.children('span.folder').children('a').attr('href') || '';
648						if(!nodeLink || (nodeLink && !directAnchorChildren.length)) {
649							nodeColor = rootsColor;
650						}
651						key++;
652						nodeDataArray.push({
653							"key" : key,
654							"text" : nodeText,
655							"fill" : nodeColor,
656							"link": nodeLink,
657							"parent" : parent,
658							"__gohashid" : key
659						});
660						var childUlElement = $liElement.children('ul');
661						if(childUlElement.length) {
662							level++;
663							recursiveDataModelBuilder(childUlElement, level, key);
664						}
665					});
666				}
667
668				if($('div.jmapcolumn > ul[data-hash*=com_content][style*="margin-left"],div.jmapcolumn > ul.jmap_filetree li.collapsable ul[style*="margin-left"],div.jmapcolumn > ul.jmap_filetree li.expandable ul[style*="margin-left"]').length) {
669					for(var i=150; i>0; i-=15) {
670						$('div.jmapcolumn > ul[data-hash*=com_content][style="margin-left:' + i + 'px"],' +
671						  'div.jmapcolumn > ul.jmap_filetree li.collapsable ul[style*="margin-left:' + i + 'px"],' +
672						  'div.jmapcolumn > ul.jmap_filetree li.expandable ul[style*="margin-left:' + i + 'px"],'+
673						  'div.jmapcolumn > ul.jmap_filetree li.collapsable ul[style*="margin-left: ' + i + 'px"],' +
674						  'div.jmapcolumn > ul.jmap_filetree li.expandable ul[style*="margin-left: ' + i + 'px"]').each(function(index, childUlElement){
675							var $childUlElement = $(childUlElement);
676							var previousParent = $(childUlElement).prev('ul.jmap_filetree,ul[data-hash]');
677							$(previousParent).children('li.lastExpandable,li.lastCollapsable,li.last').append(childUlElement);
678						});
679					}
680				}
681				
682				$('div.jmapcolumn > ul:visible').each(function(index, rootUlElement){
683					$(this).hide();
684					recursiveDataModelBuilder(rootUlElement, 0, undefined);
685				});
686				jMapTreeDiagram.model = new go.TreeModel(nodeDataArray);
687			});
688		})();
689	}
690});

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.