Skip to content

Commit a84f8a2

Browse files
committed
fixed the export double click (moved the target to the outer div)
1 parent 8d11c34 commit a84f8a2

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

index.html

+42-39
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@
189189
overflow-y: auto;
190190
}
191191

192-
193192
</style>
194193
<style id="Org_Chart_Layout_Magic">
195194
/* OrgChart CSS Base: Reference https://www.cssscript.com/responsive-hierarchical-organization-chart-pure-css/ */
@@ -2209,9 +2208,10 @@
22092208
let sNotes = getCookie( 'notes' ) || '/config/notes.html';
22102209
let sMeetingLink = getCookie( 'meetingLink' ) || 'Add YOUR Zoom URL to your OrgChart settings so it will appear here!';
22112210
let aAllSearchTypes;
2211+
22122212
function getAncestors( oPerson )
22132213
{
2214-
let aAncestors = [oPerson.id]; // include self in ancestry
2214+
let aAncestors = [ oPerson.id ]; // include self in ancestry
22152215
let oAncestor = oPerson;
22162216
while( oAncestor.manager )
22172217
{
@@ -2228,6 +2228,7 @@
22282228
}
22292229
return aAncestors;
22302230
}
2231+
22312232
function mapData( data )
22322233
{
22332234
for( const chump in data )
@@ -2298,11 +2299,13 @@
22982299
document.getElementById( 'searchText' ).focus();
22992300

23002301

2301-
document.body.addEventListener('keydown', function(e) {
2302-
if (e.key === "Escape") {
2302+
document.body.addEventListener( 'keydown', function( e )
2303+
{
2304+
if( e.key === 'Escape' )
2305+
{
23032306
cancelSearch();
23042307
}
2305-
});
2308+
} );
23062309
}
23072310

23082311
function cancelSearch()
@@ -2311,7 +2314,7 @@
23112314
document.getElementById( 'searchResults' ).innerHTML = '';
23122315
document.getElementById( 'searchResults' ).style.display = 'none';
23132316
document.getElementById( 'searchText' ).focus();
2314-
loadPerson( sCurrentPersonId);
2317+
loadPerson( sCurrentPersonId );
23152318
}
23162319

23172320
function getAllSearchTypes()
@@ -2320,7 +2323,7 @@
23202323
let aSearchTypes = [ ...oSearchTypesSelect.options ].map( o => o.value );
23212324
const aSortedSearchTypes = aSearchTypes.sort();
23222325
aSortedSearchTypes.unshift( 'name' ); //
2323-
return aSortedSearchTypes
2326+
return aSortedSearchTypes;
23242327
}
23252328

23262329
function setCookie( sCookieName, sValue )
@@ -2616,32 +2619,31 @@
26162619
}
26172620
</script>
26182621
<style>
2619-
.searchDistanceUp
2620-
{
2621-
color:blue;
2622+
.searchDistanceUp {
2623+
color: blue;
26222624
}
2623-
.searchDistanceDown
2624-
{
2625-
color:green;
2625+
2626+
.searchDistanceDown {
2627+
color: green;
26262628
}
2627-
.searchCommonAncestor
2628-
{
2629+
2630+
.searchCommonAncestor {
26292631
color: black;
26302632
font-weight: normal;
26312633
font-style: italic;
26322634
}
2633-
.searchDistance
2634-
{
2635+
2636+
.searchDistance {
26352637
font-size: 80%;
26362638
}
2639+
26372640
.searchDistanceUpIcon,
2638-
.searchDistanceDownIcon
2639-
{
2641+
.searchDistanceDownIcon {
26402642
font-size: 120%;
26412643
font-weight: bold;
26422644
}
2643-
.defaultTopAncestor
2644-
{
2645+
2646+
.defaultTopAncestor {
26452647
color: gray;
26462648
}
26472649
</style>
@@ -2661,10 +2663,10 @@
26612663
<strong>${ getFullName( person.id ) }</strong>
26622664
26632665
<span class="searchDistance">
2664-
<span class="searchDistanceUp">${ person.lastMatchUp }</span><span class="searchDistanceUpIcon">&uarr;</span>
2665-
<span class="searchCommonAncestor">${ person.lastMatchCommonAncestor ? person.lastMatchCommonAncestor : '' }</span>
2666-
<span class="searchCommonAncestor">${ !person.lastMatchCommonAncestor ? '<span class="defaultTopAncestor">' + sDefaultPersonId + '</span>' : '' }</span>
2667-
<span class="searchDistanceDown">${ person.lastMatchDown }</span><span class="searchDistanceDownIcon">&darr;</span>
2666+
<span class="searchDistanceUp">${ person.lastMatchUp }</span><span class="searchDistanceUpIcon">&uarr;</span>
2667+
<span class="searchCommonAncestor">${ person.lastMatchCommonAncestor ? person.lastMatchCommonAncestor : '' }</span>
2668+
<span class="searchCommonAncestor">${ !person.lastMatchCommonAncestor ? '<span class="defaultTopAncestor">' + sDefaultPersonId + '</span>' : '' }</span>
2669+
<span class="searchDistanceDown">${ person.lastMatchDown }</span><span class="searchDistanceDownIcon">&darr;</span>
26682670
</span>
26692671
26702672
<br/>
@@ -3538,32 +3540,32 @@
35383540
break;
35393541
}
35403542
}
3541-
document.getElementById( 'searchResults' ).innerHTML += sSearchResultsHtml
3543+
document.getElementById( 'searchResults' ).innerHTML += sSearchResultsHtml;
35423544

35433545
function sortSearchResultsByDistance( oMatches )
35443546
{
35453547

35463548
let oReferencePerson = data[ sCurrentPersonId ];
35473549
if( sCurrentPersonId === sDefaultPersonId )
35483550
{
3549-
oReferencePerson = data[ sMe ] || data[sDefaultPersonId];
3551+
oReferencePerson = data[ sMe ] || data[ sDefaultPersonId ];
35503552
}
35513553

35523554
for( let sPersonId in oMatches )
35533555
{
35543556
const oSearchResultPerson = oMatches[ sPersonId ];
35553557
findCommonAncestor( oReferencePerson, oSearchResultPerson );
35563558
}
3557-
let aMatches = sortObjectByProperty( oMatches, "lastMatchDown" ); // the secondary sort goes first
3558-
aMatches = sortArrayOfObjectsByProperty( aMatches, "lastMatchUp" ); // primary property goes second - stable sort to preserve previous order
3559+
let aMatches = sortObjectByProperty( oMatches, 'lastMatchDown' ); // the secondary sort goes first
3560+
aMatches = sortArrayOfObjectsByProperty( aMatches, 'lastMatchUp' ); // primary property goes second - stable sort to preserve previous order
35593561
return aMatches;
35603562

35613563
function sortObjectByProperty( oObject, sProperty )
35623564
{
3563-
const aSortedArray = Object.keys( oObject ).map( key => ({
3565+
const aSortedArray = Object.keys( oObject ).map( key => ( {
35643566
personId: key,
35653567
...oObject[ key ]
3566-
}));
3568+
} ) );
35673569
aSortedArray.sort( ( a, b ) => a[ sProperty ] - b[ sProperty ] );
35683570
return aSortedArray;
35693571
}
@@ -3581,7 +3583,7 @@
35813583
let aSearchResultPersonAncestors = oSearchResultPerson.ancestors;// || getAncestors( oSearchResultPerson );
35823584
oSearchResultPerson.lastMatchUp = 99;
35833585
oSearchResultPerson.lastMatchDown = 99;
3584-
oSearchResultPerson.lastMatchDistance = 99 ;
3586+
oSearchResultPerson.lastMatchDistance = 99;
35853587
oSearchResultPerson.lastMatchCommonAncestor = oReferencePerson.id;
35863588
for( let iStepsUp = 0; iStepsUp < aReferencePersonAncestors.length; iStepsUp++ )
35873589
{
@@ -3590,9 +3592,9 @@
35903592
if( aReferencePersonAncestors[ iStepsUp ] === aSearchResultPersonAncestors[ iStepsDown ] )
35913593
{
35923594
sCommonAncestorId = aReferencePersonAncestors[ iStepsUp ];
3593-
oSearchResultPerson.lastMatchUp = iStepsUp +"";
3594-
oSearchResultPerson.lastMatchDown = iStepsDown+"";
3595-
oSearchResultPerson.lastMatchDistance = iStepsDown + iStepsUp +"" ;
3595+
oSearchResultPerson.lastMatchUp = iStepsUp + '';
3596+
oSearchResultPerson.lastMatchDown = iStepsDown + '';
3597+
oSearchResultPerson.lastMatchDistance = iStepsDown + iStepsUp + '';
35963598
oSearchResultPerson.lastMatchCommonAncestor = sCommonAncestorId;
35973599
break;
35983600
}
@@ -3711,8 +3713,8 @@
37113713
function exportSearchResults()
37123714
{
37133715
// const aDataFields = [ 'email', 'phone', 'mobile', 'slack', 'skype', 'twitter', 'linkedin', 'github', 'website' ];
3714-
const aDataFields = [ "name", 'email', "title" ];
3715-
const sEmailAddresses = getDataElements( oSearchResults, aDataFields, "," );
3716+
const aDataFields = [ 'name', 'email', 'title' ];
3717+
const sEmailAddresses = getDataElements( oSearchResults, aDataFields, ',' );
37163718
navigator.clipboard.writeText( sEmailAddresses );
37173719
}
37183720

@@ -3749,6 +3751,7 @@
37493751
}
37503752
}, 2000 );
37513753
}
3754+
37523755
return sData;
37533756
}
37543757
</script>
@@ -3866,7 +3869,7 @@
38663869
</button>
38673870
</div>
38683871
</div>
3869-
<div id="searchArea" onclick="showSearchResults()">
3872+
<div id="searchArea" onclick="showSearchResults()" ondblclick="exportSearchResults()">
38703873
<form name="SearchForm" class="touchTargets">
38713874
<label aria-label="State">
38723875
<select name="type" id="searchType"
@@ -3935,7 +3938,7 @@
39353938
</label>
39363939

39373940
<button id="AndSearchButton" onclick="andSearch(); return false;" style="visibility: hidden"></button>
3938-
<div id="searchResults" ondblclick="exportSearchResults()">
3941+
<div id="searchResults">
39393942
<div></div>
39403943
</div>
39413944
</form>

0 commit comments

Comments
 (0)