Skip to content

Commit

Permalink
[fix] コピー機能の調整
Browse files Browse the repository at this point in the history
  • Loading branch information
yudukiak committed Jun 1, 2018
1 parent a30741a commit 2ed469d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
19 changes: 10 additions & 9 deletions assets/script.js
Expand Up @@ -520,15 +520,16 @@ function urlQuery(data){
}
// クリップボードへコピー
function copyTextToClipboard(textVal){
var copyFrom = document.createElement('textarea');
copyFrom.className = 'clipboard';
copyFrom.textContent = textVal;
var bodyElm = document.getElementsByTagName('body')[0];
bodyElm.appendChild(copyFrom);
copyFrom.select();
var retVal = document.execCommand('copy');
bodyElm.removeChild(copyFrom);
return retVal;
var temp = document.createElement('div');
temp.appendChild(document.createElement('pre')).textContent = textVal;
var s = temp.style;
s.position = 'fixed';
s.left = '-100%';
document.body.appendChild(temp);
document.getSelection().selectAllChildren(temp);
var result = document.execCommand('copy');
document.body.removeChild(temp);
return result;
}
// --------------------
// 読み込み時
Expand Down
2 changes: 1 addition & 1 deletion assets/script.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/style.css
Expand Up @@ -486,13 +486,13 @@ main > div {
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
.clipboard {
/*.clipboard {
height: 1px;
width: 1px;
padding: 0;
margin: 0;
font-size: 0px;
}
}*/
.display_none {
display: none !important;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ed469d

Please sign in to comment.