mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 23:06:14 -04:00
feat(tool): added URL encoder/decoder
This commit is contained in:
parent
5550248a8b
commit
03a7e8c42d
2 changed files with 77 additions and 0 deletions
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- URL path changed
|
- URL path changed
|
||||||
- `/hash` -> [`/hash-text`](https://it-tools.tech/hash-text)
|
- `/hash` -> [`/hash-text`](https://it-tools.tech/hash-text)
|
||||||
- `/cypher` -> [`/cypher-uncyfer-text`](https://it-tools.tech/cypher-uncyfer-text)
|
- `/cypher` -> [`/cypher-uncyfer-text`](https://it-tools.tech/cypher-uncyfer-text)
|
||||||
|
- `/url-encoder` -> [`/url-encoder-decoder`](https://it-tools.tech/url-encoder-decoder)
|
||||||
- [Crontab generator](https://it-tools.tech/crontab-generator) now handle 6 digits format (second support)
|
- [Crontab generator](https://it-tools.tech/crontab-generator) now handle 6 digits format (second support)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
76
tools/web/url-encoder-decoder.vue
Normal file
76
tools/web/url-encoder-decoder.vue
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<template>
|
||||||
|
<ToolWrapper :config="$toolConfig">
|
||||||
|
<v-textarea
|
||||||
|
v-model="decoded"
|
||||||
|
outlined
|
||||||
|
label="URL decoded string"
|
||||||
|
:rules="rules.decoded"
|
||||||
|
/>
|
||||||
|
<v-textarea
|
||||||
|
v-model="encoded"
|
||||||
|
outlined
|
||||||
|
label="URL encoded string"
|
||||||
|
:rules="rules.encoder"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<v-btn @click="copy(decoded)">Copy decoded</v-btn>
|
||||||
|
<v-btn @click="copy(encoded)">Copy encoded</v-btn>
|
||||||
|
</div>
|
||||||
|
</ToolWrapper>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<tool>
|
||||||
|
title: 'URL encode / decode'
|
||||||
|
description: 'Lorem Ipsum dolor sit amet'
|
||||||
|
icon: 'mdi-link-variant'
|
||||||
|
keywords: [ 'system', 'port', 'lan' ]
|
||||||
|
path: '/url-encoder-decoder'
|
||||||
|
</tool>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
import {Component} from 'nuxt-property-decorator'
|
||||||
|
import {CopyableMixin} from '@/mixins/copyable.mixin'
|
||||||
|
import Tool from '~/components/Tool.vue'
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
mixins: [CopyableMixin]
|
||||||
|
})
|
||||||
|
export default class RandomPortGenerator extends Tool {
|
||||||
|
decoded = 'Hello world :)'
|
||||||
|
rules = {
|
||||||
|
decoder: [
|
||||||
|
(v: string) => {
|
||||||
|
try {
|
||||||
|
decodeURIComponent(v)
|
||||||
|
return true
|
||||||
|
} catch (_) {
|
||||||
|
return 'Impossible to parse this string'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
encoder: [
|
||||||
|
(v: string) => {
|
||||||
|
try {
|
||||||
|
encodeURIComponent(v)
|
||||||
|
return true
|
||||||
|
} catch (_) {
|
||||||
|
return 'Impossible to parse this string'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
get encoded() {
|
||||||
|
return encodeURIComponent(this.decoded)
|
||||||
|
}
|
||||||
|
|
||||||
|
set encoded(value: string) {
|
||||||
|
try {
|
||||||
|
this.decoded = decodeURIComponent(value)
|
||||||
|
} catch (_) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue