Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy button to the translator #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ button:active, button.pressed, .button:active, .button.pressed {
line-height: 1em;
}

#tools{
max-width: 40em;
}

#editor, #in-editor, #out-editor {
position: relative;
Expand All @@ -177,9 +180,14 @@ button:active, button.pressed, .button:active, .button.pressed {
#out-editor {
width: 100%;
padding: 4px;
margin-top: 4px;
overflow: auto;
}

#copy-btn{
float:right;
margin: 0px;
}

.CodeMirror, #out-editor {
letter-spacing: +0.5px;
Expand Down Expand Up @@ -500,4 +508,3 @@ img .hidden {
position: absolute;
opacity: 0;
}

10 changes: 8 additions & 2 deletions translator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ <h1>
</div>

<div id="side" class=right>
<div>
<div id="tools">
<select id="choose-lang">
<option value="">Select language…
</select>

<small id=lang-status></small>

<button id="copy-btn">Copy</button>
</div>

<textarea id="out-editor" placeholder="Select a language" readonly></textarea>
Expand All @@ -51,6 +52,7 @@ <h1>

var editor = document.getElementById('in-editor');
var swapBtn = document.getElementById('swap-btn');
var copyBtn = document.getElementById('copy-btn');

var obj = {};
extractHash();
Expand Down Expand Up @@ -285,6 +287,11 @@ <h1>

updatedFromHash();

copyBtn.onclick = function(){
outEditor.select();
document.execCommand('copy');
};

</script>
<script>
!function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
Expand All @@ -294,4 +301,3 @@ <h1>

_gs('GSN-349113-Y');
</script>