Skip to content

Commit

Permalink
feat/copy result to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
marmoure committed Aug 11, 2022
1 parent bdca006 commit 4d73383
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@
<input type="checkbox" id="auto-expand-matches" name="auto-expand-matches" checked="checked"/>
Highlight Index Matches
</label>
<label id="copy-all-clipboard" title="copy the resutls into the clipboard">
<i class="fa fa-clipboard" aria-hidden="true"></i>copy to clipboard
</label>
<img class="layout-switcher" src="resources/images/layouts_split.png" title="Switch results panel location between bottom and right"/>
<span class="current"/>
<a class="next" href="#">
Expand Down
9 changes: 9 additions & 0 deletions resources/css/eXide.css
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,15 @@ Sub level menu list items (undo style from Top level List Items)
margin-right: 8px;
}

#copy-all-clipboard {
margin: 0 0.5rem;
transition: all .2s ease-in-out;
}

#copy-all-clipboard * {
margin: 0 0.1rem;
}

.item {
min-height: 2.5em;
-ms-user-select: text;
Expand Down
10 changes: 10 additions & 0 deletions src/eXide.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,16 @@ eXide.app = (function(util) {
util.requestFullScreen(document.getElementById("fullscreen"));
});
$(".results-container .layout-switcher").click(app.switchResultsPanel);
$('.results-container #copy-all-clipboard').click(() => {
let res = '';
document.querySelectorAll("#results-body > div > div > div > div.item").forEach(item => res += item.innerText)
navigator.clipboard.writeText(res).then(function() {
console.log('Async: Copying to clipboard was successful!');
eXide.util.message("Copyed to clipboard");
}, function(err) {
console.error('Async: Could not copy text: ', err);
});
});
$('.results-container .next').click(app.browseNext);
$('.results-container .previous').click(app.browsePrevious);
$("#serialization-mode").change(function(ev) {
Expand Down

0 comments on commit 4d73383

Please sign in to comment.