-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (68 loc) · 4.62 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html>
<head>
<style>
* {font-family: sans-serif; font-size:10pt; color: #666}
h3 {color: #ccc; padding: .5em 0 .5em; font-size: 16pt}
a, a:link, a:visited {
text-decoration: none !important;
color: gray;
-webkit-transition: color 1s ease, background-color 1s ease;
-moz-transition: color 1s ease, background-color 1s ease;
-o-transition: color 1s ease, background-color 1s ease;
transition: color 1s ease, background-color 1s ease;
}
a:hover {
color: #30D135;
background-color: #DAFFCF;
}
.center {
display: flex;
width: 95vw;
height: 95vh;
justify-content: center;
align-items: center;
}
hr {
border: 1px dotted #ccc;
}
</style>
</head>
<body>
<div class="center">
<div>
<h3>Components Search</h3>
<p>Drag the link below to your Bookmarks bar (show/hide bookmarks with Cmd+Shift+B in Chrome):</p>
<ul>
<li>
<b>
<a href="javascript:(function(){var PREFIX='/apps';if(!window.Coral){alert('Not Site Admin or AEM page in Edit Mode!');throw new Error('not a coral page!');}var ui=$(window).adaptTo('foundation-ui'),ID_DLG='compsDlg',old=document.getElementById(ID_DLG);ui.wait();if(old){old.show();ui.clearWait();throw new Error('dialog exists! show');}Coral.Autocomplete.prototype._setInputValues=Coral.Autocomplete.prototype._handleInput=Coral.Autocomplete.prototype._handleItemSelectedChange=function(){return false;};Coral.Autocomplete.prototype._handleItemValueChange=function(e){e.preventDefault();e.stopImmediatePropagation();return false;};Coral.Autocomplete.prototype._handleSelect=function(evt){evt.preventDefault();evt.stopImmediatePropagation();Coral.commons.nextFrame(function(){window.open(`/mnt/overlay/wcm/core/content/sites/components/details.html${evt.matchedTarget.value}`,'_compDetails').focus();});};fetch(`${window.location.origin}/bin/querybuilder.json?group.1_type=cq:Template&group.2_type=cq:Component&group.p.or=true&orderby=path&orderby.sort=asc&p.limit=-1&path=${PREFIX}`).then((resp)=>resp.json()).then((data)=>{showData(data.hits);}).catch((err)=>{ui.notify('',err,'warning');console.log(err);}).finally(function(){ui.clearWait();});function showData(items){var compList=new Coral.Autocomplete().set({placeholder:'Type component name',icon:'search',});compList.style.width='37em';var len=items.length;for(var i=0;i<len;i++){var item,resType,group;item=items[i];resType=item.path.replace('/apps/','');group='';if(!item.path.startsWith(PREFIX)){continue;}var entry=new Coral.Autocomplete.Item().set({value:item.path,content:{innerHTML:`<li class='coral-List--minimal'title='${resType}'>${group}<b>${Granite.I18n.get(item.title)}</b> (${resType})</li>`,},});compList.items.add(entry);}var dialogContent=new Coral.Dialog.Content();dialogContent.appendChild(compList);dialogContent.style.width='40em';window._dlg=new Coral.Dialog().set({id:ID_DLG,header:{innerHTML:`Components Lookup<span style='font-size:8pt;color:#ccc'>(ESC to close)</span> <a class='coral-Link'tabindex='-1'target='_aemComps'href='/libs/wcm/core/content/sites/components.html'><coral-icon icon='alias'size='XS'></coral-icon></a>`,},content:dialogContent,footer:{innerHTML:`<button is='coral-button'variant='primary'coral-close=''>Close</button>`,},}).show();compList.showSuggestions();compList._triggerChangeEvent=false;ui.clearWait();$(window._dlg).on('coral-overlay:open',function(e){$(window._dlg).find('coral-autocomplete input.coral-Autocomplete-input').focus();});}})();">🔎 Search</a>
</b>
👈
<i>(drag to bookmarks)</i>
</li>
</ul>
<p>
<i>USAGE</i>
: Click the bookmark in the browser bookmark toolbar while browsing the
<u>
<b>
<a href="http://localhost:4502/sites.html">AEM site admin</a>
</b>
</u>
or any AEM page in Author Mode.
</p>
<p>
<i>NOTE</i>
: You can also use the AEM OOTB
<u>
<b>
<a href="http://localhost:4502/libs/wcm/core/content/sites/components.html">Tools › General › Components</a>
</b>
</u>
.
</p>
</div>
</div>
</body>
</html>