@@ -57,14 +57,26 @@ function calculateAndPopulate(input) {
5757 const uri_encoding = uriEncode ( input ) ;
5858 setElementContentById ( "uri_encoded_out" , uri_encoding ) ;
5959
60+ // Only show component encoding if it's different from regular encoding
6061 const uri_component_encoding = uriEncodeComponent ( input ) ;
61- setElementContentById ( "uri_component_encoded_out" , uri_component_encoding ) ;
62+ if ( uri_component_encoding !== uri_encoding ) {
63+ showElement ( "uri_component_encoding_row" ) ;
64+ setElementContentById ( "uri_component_encoded_out" , uri_component_encoding ) ;
65+ } else {
66+ hideElement ( "uri_component_encoding_row" ) ;
67+ }
6268
6369 const uri_decoding = uriDecode ( input ) ;
6470 setElementContentById ( "uri_decoded_out" , uri_decoding ) ;
6571
72+ // Only show component decoding if it's different from regular decoding
6673 const uri_component_decoding = uriDecodeComponent ( input ) ;
67- setElementContentById ( "uri_component_decoded_out" , uri_component_decoding ) ;
74+ if ( uri_component_decoding !== uri_decoding ) {
75+ showElement ( "uri_component_decoding_row" ) ;
76+ setElementContentById ( "uri_component_decoded_out" , uri_component_decoding ) ;
77+ } else {
78+ hideElement ( "uri_component_decoding_row" ) ;
79+ }
6880
6981 // Add character table to DOM
7082 character_table . innerHTML = characterTable ( input ) ;
@@ -79,6 +91,16 @@ async function setElementContentByIdAsync(id, promise) {
7991 setElementContentById ( id , result || "" ) ;
8092}
8193
94+ // Show/hide elements
95+ function showElement ( id ) {
96+ const element = document . getElementById ( id ) ;
97+ if ( element ) element . style . display = "" ;
98+ }
99+ function hideElement ( id ) {
100+ const element = document . getElementById ( id ) ;
101+ if ( element ) element . style . display = "none" ;
102+ }
103+
82104// Hashing
83105async function hashMessage ( message , algorithm ) {
84106 if ( algorithm === "MD5" ) {
0 commit comments