File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 45
45
< div class ="tool " onclick ="copyOutputData() ">
46
46
< img src ="../img/copy.png " alt ="copy " />
47
47
</ div >
48
+ < div id ="share " class ="tool " onclick ="share() ">
49
+ < img src ="../img/share.png " alt ="share " />
50
+ </ div >
48
51
< div id ="asn1Tool " class ="hide labeledTool " onclick ="decodeAsAsn1() ">
49
52
< img src ="../img/linking1.png " alt ="asn1 " />
50
53
< span > asn1</ span >
Original file line number Diff line number Diff line change @@ -118,3 +118,14 @@ const toggleAsn1Button = () => {
118
118
document . getElementById ( 'asn1Tool' ) . classList . add ( 'hide' ) ;
119
119
}
120
120
} ;
121
+
122
+ const share = ( ) => {
123
+ const inType = document . getElementById ( 'inType' ) . selectedOptions [ 0 ] . value ;
124
+ const outType = document . getElementById ( 'outType' ) . selectedOptions [ 0 ] . value ;
125
+ const data = document . getElementById ( 'inData' ) . value ;
126
+
127
+ const url = `?in=${ inType } &out=${ outType } &data=${ encodeURIComponent ( data ) } ` ;
128
+
129
+ window . history . pushState ( url , url , url ) ;
130
+ navigator . clipboard . writeText ( window . location . href ) ;
131
+ } ;
You can’t perform that action at this time.
0 commit comments