first the decoders, then the encoders
This commit is contained in:
		
							parent
							
								
									7d2cdac227
								
							
						
					
					
						commit
						d62498023a
					
				
					 1 changed files with 46 additions and 46 deletions
				
			
		
							
								
								
									
										92
									
								
								dencode.js
									
										
									
									
									
								
							
							
						
						
									
										92
									
								
								dencode.js
									
										
									
									
									
								
							|  | @ -10,52 +10,6 @@ | ||||||
| 				}; | 				}; | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		{ |  | ||||||
| 			"id": "base64encode", |  | ||||||
| 			"name": "Encode Base64", |  | ||||||
| 			"convert": function (input) { |  | ||||||
| 				return { |  | ||||||
| 					"status": "OK", |  | ||||||
| 					"content": btoa(input) |  | ||||||
| 				}; |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			"id": "encodeuri", |  | ||||||
| 			"name": "Encode URI", |  | ||||||
| 			"convert": function (input) { |  | ||||||
| 				return { |  | ||||||
| 					"status": "OK", |  | ||||||
| 					"content": encodeURI(input).replace(/%5B/g, '[').replace(/%5D/g, ']') |  | ||||||
| 				}; |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			"id": "encodeuricomponent", |  | ||||||
| 			"name": "Encode URI component", |  | ||||||
| 			"convert": function (input) { |  | ||||||
| 				return { |  | ||||||
| 					"status": "OK", |  | ||||||
| 					"content": encodeURIComponent(input).replace(/[!'()*]/g, function(c) { |  | ||||||
| 							return '%' + c.charCodeAt(0).toString(16); |  | ||||||
| 						}) |  | ||||||
| 				}; |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			"id": "encodehtmlentities", |  | ||||||
| 			"name": "Encode HTML entities", |  | ||||||
| 			"convert": function (input) { |  | ||||||
| 				return { |  | ||||||
| 					"status": "OK", |  | ||||||
| 					"content": input |  | ||||||
| 						.replace(/\&/g, "&") |  | ||||||
| 						.replace(/\</g, "<") |  | ||||||
| 						.replace(/\>/g, ">") |  | ||||||
| 						.replace(/\"/g, """) |  | ||||||
| 				}; |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		{ | 		{ | ||||||
| 			"id": "base64decode", | 			"id": "base64decode", | ||||||
| 			"name": "Decode Base64", | 			"name": "Decode Base64", | ||||||
|  | @ -127,6 +81,52 @@ | ||||||
| 					}; | 					}; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"id": "base64encode", | ||||||
|  | 			"name": "Encode Base64", | ||||||
|  | 			"convert": function (input) { | ||||||
|  | 				return { | ||||||
|  | 					"status": "OK", | ||||||
|  | 					"content": btoa(input) | ||||||
|  | 				}; | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"id": "encodeuri", | ||||||
|  | 			"name": "Encode URI", | ||||||
|  | 			"convert": function (input) { | ||||||
|  | 				return { | ||||||
|  | 					"status": "OK", | ||||||
|  | 					"content": encodeURI(input).replace(/%5B/g, '[').replace(/%5D/g, ']') | ||||||
|  | 				}; | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"id": "encodeuricomponent", | ||||||
|  | 			"name": "Encode URI component", | ||||||
|  | 			"convert": function (input) { | ||||||
|  | 				return { | ||||||
|  | 					"status": "OK", | ||||||
|  | 					"content": encodeURIComponent(input).replace(/[!'()*]/g, function(c) { | ||||||
|  | 							return '%' + c.charCodeAt(0).toString(16); | ||||||
|  | 						}) | ||||||
|  | 				}; | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
|  | 		{ | ||||||
|  | 			"id": "encodehtmlentities", | ||||||
|  | 			"name": "Encode HTML entities", | ||||||
|  | 			"convert": function (input) { | ||||||
|  | 				return { | ||||||
|  | 					"status": "OK", | ||||||
|  | 					"content": input | ||||||
|  | 						.replace(/\&/g, "&") | ||||||
|  | 						.replace(/\</g, "<") | ||||||
|  | 						.replace(/\>/g, ">") | ||||||
|  | 						.replace(/\"/g, """) | ||||||
|  | 				}; | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	]; | 	]; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue