Permalink
Browse files

Fixed #2 - Can't export block list to clipboard

  • Loading branch information...
Kadauchi committed Jan 4, 2018
1 parent cc4b001 commit a1faf9b3b20c2a249fe9e7bd6ac485501ba112e6
Showing with 21 additions and 5 deletions.
  1. +16 −0 change_log/change_log.html
  2. +5 −5 hit_finder/hit_finder.js
View
@@ -23,6 +23,22 @@
HIT Tracker is fully functional. Tweaks for ease of use and will happen based on feedback.
</div>
<div class="card mt-1">
<div class="card-header bg-primary text-white">
Version <small>Release Date</small>
</div>
<div class="card-block">
<div class="list-group">
<div class="list-group-item flex-column align-items-start">
<h5 class="d-flex w-100 justify-content-between">HIT Finder</h5>
<ul>
<li>Fixed block list export not copying to clipboard</li>
</ul>
</div>
</div>
</div>
</div>
<div class="card mt-1">
<div class="card-header bg-primary text-white">
v2.1.1 <small>Thursday, January 4, 2018</small>
View
@@ -809,7 +809,7 @@ function blockListImport(json) {
function blockListExport() {
try {
const string = JSON.stringify(storage.blockList);
const copy = toClipBoard(string);
const copy = toClipBoard(string, document.getElementById(`block-list-modal`));
alert(copy ? `Block list export has been copied to your clipboard.` : string);
}
@@ -1020,7 +1020,7 @@ function includeListImport() {
function includeListExport() {
try {
const string = JSON.stringify(storage.includeList);
const copy = toClipBoard(string);
const copy = toClipBoard(string , document.getElementById(`include-list-modal`));
alert(copy ? `Include list export has been copied to your clipboard.` : string);
}
@@ -1556,16 +1556,16 @@ async function updateRequesterReviews(reviews) {
});
})();
function toClipBoard(string) {
function toClipBoard(string, element) {
const textarea = document.createElement(`textarea`);
textarea.opacity = 0;
textarea.textContent = string;
document.getElementById(`include-list-modal`).appendChild(textarea);
element.appendChild(textarea);
textarea.select();
const copy = document.execCommand(`copy`);
document.getElementById(`include-list-modal`).removeChild(textarea);
element.removeChild(textarea);
return copy ? true : false;
}

0 comments on commit a1faf9b

Please sign in to comment.