Skip to content

Commit 25102fc

Browse files
authored
Add extra support for text encryption.
1 parent cc10ca9 commit 25102fc

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

index.htm

+28-2
Original file line numberDiff line numberDiff line change
@@ -6078,8 +6078,8 @@ <h3>Decoding:</h3>
60786078
<p>Upload a B3K file here:</p>
60796079
<input type="file" id="fileToRead">
60806080
<br>
6081-
<textarea id="textbox" cols="25" >Type BWTC32Key-encoded text here to decode</textarea><button id="create">Click to decode file</button><br />
6082-
<p>Output's Filename & MIMEtype</p>
6081+
<!--<form name="b3k">--><textarea id="textbox" name="decinput" cols="25" >Type BWTC32Key-encoded text here to decode</textarea><button id="create">Click to decode file</button><br />
6082+
<p>Output's Filename & MIMEtype <button id="textextract" onclick="copyOutputToClipboard2();" type="button">Copy above box</button></p><!--</form>-->
60836083
<textarea id="filename">output.bin</textarea>
60846084
<textarea id="filetype">application/octet-stream</textarea><br />
60856085
<a download="output.bin" id="downloadlink" style="display: none">Download decoded file</a>
@@ -9706,6 +9706,7 @@ <h3>Decoding:</h3>
97069706

97079707
});
97089708

9709+
97099710
function copyOutputToClipboard() {
97109711
var targetBox = document.BWTC32Key.base32768textarea;
97119712
// https://stackoverflow.com/questions/51158061/copy-data-to-clipboard-without-selecting-any-text
@@ -9731,6 +9732,31 @@ <h3>Decoding:</h3>
97319732
targetBox.setSelectionRange(origSelectionStart, origSelectionEnd);
97329733
};
97339734

9735+
function copyOutputToClipboard2() {
9736+
var targetBox2 = document.getElementById('textbox');
9737+
// https://stackoverflow.com/questions/51158061/copy-data-to-clipboard-without-selecting-any-text
9738+
// - restoring original selection doesn't seem to work
9739+
var origSelectionStart, origSelectionEnd;
9740+
origSelectionStart = targetBox2.selectionStart;
9741+
origSelectionEnd = targetBox2.selectionEnd;
9742+
// select the content
9743+
var currentFocus = document.activeElement;
9744+
targetBox2.focus();
9745+
targetBox2.setSelectionRange(0, targetBox2.value.length);
9746+
var succeed;
9747+
try {
9748+
succeed = document.execCommand("copy");
9749+
} catch(e) {
9750+
succeed = false;
9751+
}
9752+
// restore original focus
9753+
if (currentFocus && typeof currentFocus.focus === "function") {
9754+
currentFocus.focus();
9755+
}
9756+
// restore prior selection
9757+
targetBox2.setSelectionRange(origSelectionStart, origSelectionEnd);
9758+
};
9759+
97349760

97359761
//]]>
97369762

0 commit comments

Comments
 (0)