mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-22 05:51:44 +03:00
1 parent
33cffc5d73
commit
bf7f986bfd
9 files changed
+369
-7
No files matched your search
Vendored
+12
-5
@@ -77,6 +77,7 @@ declare module '@vue/runtime-core' {
|
|||||||
CommandPaletteOption: typeof import('./src/modules/command-palette/components/command-palette-option.vue')['default']
|
CommandPaletteOption: typeof import('./src/modules/command-palette/components/command-palette-option.vue')['default']
|
||||||
CommonRegex: typeof import('./src/tools/common-regex-memo/common-regex.md')['default']
|
CommonRegex: typeof import('./src/tools/common-regex-memo/common-regex.md')['default']
|
||||||
CommonRegexMemo: typeof import('./src/tools/common-regex-memo/common-regex-memo.vue')['default']
|
CommonRegexMemo: typeof import('./src/tools/common-regex-memo/common-regex-memo.vue')['default']
|
||||||
|
Countdown: typeof import('./src/tools/countdown/countdown.vue')['default']
|
||||||
Counter: typeof import('./src/tools/pomodoro-timer/app/components/Counter.vue')['default']
|
Counter: typeof import('./src/tools/pomodoro-timer/app/components/Counter.vue')['default']
|
||||||
CrcCalculator: typeof import('./src/tools/crc-calculator/crc-calculator.vue')['default']
|
CrcCalculator: typeof import('./src/tools/crc-calculator/crc-calculator.vue')['default']
|
||||||
CrontabGenerator: typeof import('./src/tools/crontab-generator/crontab-generator.vue')['default']
|
CrontabGenerator: typeof import('./src/tools/crontab-generator/crontab-generator.vue')['default']
|
||||||
@@ -108,10 +109,12 @@ declare module '@vue/runtime-core' {
|
|||||||
DiffViewer: typeof import('./src/tools/json-diff/diff-viewer/diff-viewer.vue')['default']
|
DiffViewer: typeof import('./src/tools/json-diff/diff-viewer/diff-viewer.vue')['default']
|
||||||
DmarcReportAnalyzer: typeof import('./src/tools/dmarc-report-analyzer/dmarc-report-analyzer.vue')['default']
|
DmarcReportAnalyzer: typeof import('./src/tools/dmarc-report-analyzer/dmarc-report-analyzer.vue')['default']
|
||||||
DnsQueries: typeof import('./src/tools/dns-queries/dns-queries.vue')['default']
|
DnsQueries: typeof import('./src/tools/dns-queries/dns-queries.vue')['default']
|
||||||
|
Docker: typeof import('./src/tools/docker-memo/docker.md')['default']
|
||||||
DockerComposeConverter: typeof import('./src/tools/docker-compose-converter/docker-compose-converter.vue')['default']
|
DockerComposeConverter: typeof import('./src/tools/docker-compose-converter/docker-compose-converter.vue')['default']
|
||||||
DockerComposeToDockerRunConverter: typeof import('./src/tools/docker-compose-to-docker-run-converter/docker-compose-to-docker-run-converter.vue')['default']
|
DockerComposeToDockerRunConverter: typeof import('./src/tools/docker-compose-to-docker-run-converter/docker-compose-to-docker-run-converter.vue')['default']
|
||||||
DockerComposeToKubernetes: typeof import('./src/tools/docker-compose-to-kubernetes/docker-compose-to-kubernetes.vue')['default']
|
DockerComposeToKubernetes: typeof import('./src/tools/docker-compose-to-kubernetes/docker-compose-to-kubernetes.vue')['default']
|
||||||
DockerComposeValidator: typeof import('./src/tools/docker-compose-validator/docker-compose-validator.vue')['default']
|
DockerComposeValidator: typeof import('./src/tools/docker-compose-validator/docker-compose-validator.vue')['default']
|
||||||
|
DockerMemo: typeof import('./src/tools/docker-memo/docker-memo.vue')['default']
|
||||||
DockerRunToDockerComposeConverter: typeof import('./src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue')['default']
|
DockerRunToDockerComposeConverter: typeof import('./src/tools/docker-run-to-docker-compose-converter/docker-run-to-docker-compose-converter.vue')['default']
|
||||||
DockerRunToKubernetes: typeof import('./src/tools/docker-run-to-kubernetes/docker-run-to-kubernetes.vue')['default']
|
DockerRunToKubernetes: typeof import('./src/tools/docker-run-to-kubernetes/docker-run-to-kubernetes.vue')['default']
|
||||||
DurationCalculator: typeof import('./src/tools/duration-calculator/duration-calculator.vue')['default']
|
DurationCalculator: typeof import('./src/tools/duration-calculator/duration-calculator.vue')['default']
|
||||||
@@ -265,33 +268,36 @@ declare module '@vue/runtime-core' {
|
|||||||
MorseConverter: typeof import('./src/tools/morse-converter/morse-converter.vue')['default']
|
MorseConverter: typeof import('./src/tools/morse-converter/morse-converter.vue')['default']
|
||||||
MultiLinkDownloader: typeof import('./src/tools/multi-link-downloader/multi-link-downloader.vue')['default']
|
MultiLinkDownloader: typeof import('./src/tools/multi-link-downloader/multi-link-downloader.vue')['default']
|
||||||
MyIp: typeof import('./src/tools/my-ip/my-ip.vue')['default']
|
MyIp: typeof import('./src/tools/my-ip/my-ip.vue')['default']
|
||||||
|
NA: typeof import('naive-ui')['NA']
|
||||||
NanoidGenerator: typeof import('./src/tools/nanoid-generator/nanoid-generator.vue')['default']
|
NanoidGenerator: typeof import('./src/tools/nanoid-generator/nanoid-generator.vue')['default']
|
||||||
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
|
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
|
||||||
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
|
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
|
||||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||||
NCode: typeof import('naive-ui')['NCode']
|
NButton: typeof import('naive-ui')['NButton']
|
||||||
|
NCard: typeof import('naive-ui')['NCard']
|
||||||
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||||
NForm: typeof import('naive-ui')['NForm']
|
|
||||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||||
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
|
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
|
||||||
NH1: typeof import('naive-ui')['NH1']
|
NH1: typeof import('naive-ui')['NH1']
|
||||||
NH3: typeof import('naive-ui')['NH3']
|
NH3: typeof import('naive-ui')['NH3']
|
||||||
NIcon: typeof import('naive-ui')['NIcon']
|
NIcon: typeof import('naive-ui')['NIcon']
|
||||||
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
|
||||||
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
|
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
|
NModal: typeof import('naive-ui')['NModal']
|
||||||
NP: typeof import('naive-ui')['NP']
|
NP: typeof import('naive-ui')['NP']
|
||||||
NRate: typeof import('naive-ui')['NRate']
|
NRate: typeof import('naive-ui')['NRate']
|
||||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NTable: typeof import('naive-ui')['NTable']
|
NTable: typeof import('naive-ui')['NTable']
|
||||||
NTag: typeof import('naive-ui')['NTag']
|
NTag: typeof import('naive-ui')['NTag']
|
||||||
|
NTimePicker: typeof import('naive-ui')['NTimePicker']
|
||||||
NumberInput: typeof import('./src/tools/pomodoro-timer/app/components/NumberInput.vue')['default']
|
NumberInput: typeof import('./src/tools/pomodoro-timer/app/components/NumberInput.vue')['default']
|
||||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||||
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
|
OcrImage: typeof import('./src/tools/ocr-image/ocr-image.vue')['default']
|
||||||
@@ -369,6 +375,7 @@ declare module '@vue/runtime-core' {
|
|||||||
TextToNatoAlphabet: typeof import('./src/tools/text-to-nato-alphabet/text-to-nato-alphabet.vue')['default']
|
TextToNatoAlphabet: typeof import('./src/tools/text-to-nato-alphabet/text-to-nato-alphabet.vue')['default']
|
||||||
TextToUnicode: typeof import('./src/tools/text-to-unicode/text-to-unicode.vue')['default']
|
TextToUnicode: typeof import('./src/tools/text-to-unicode/text-to-unicode.vue')['default']
|
||||||
TextToUnicodeNames: typeof import('./src/tools/text-to-unicode-names/text-to-unicode-names.vue')['default']
|
TextToUnicodeNames: typeof import('./src/tools/text-to-unicode-names/text-to-unicode-names.vue')['default']
|
||||||
|
TimeAlarm: typeof import('./src/tools/time-alarm/time-alarm.vue')['default']
|
||||||
TimezoneConverter: typeof import('./src/tools/timezone-converter/timezone-converter.vue')['default']
|
TimezoneConverter: typeof import('./src/tools/timezone-converter/timezone-converter.vue')['default']
|
||||||
TokenDisplay: typeof import('./src/tools/otp-code-generator-and-validator/token-display.vue')['default']
|
TokenDisplay: typeof import('./src/tools/otp-code-generator-and-validator/token-display.vue')['default']
|
||||||
'TokenGenerator.tool': typeof import('./src/tools/token-generator/token-generator.tool.vue')['default']
|
'TokenGenerator.tool': typeof import('./src/tools/token-generator/token-generator.tool.vue')['default']
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
"@tiptap/starter-kit": "2.9.1",
|
"@tiptap/starter-kit": "2.9.1",
|
||||||
"@tiptap/vue-3": "2.9.1",
|
"@tiptap/vue-3": "2.9.1",
|
||||||
"@types/haversine": "^1.1.8",
|
"@types/haversine": "^1.1.8",
|
||||||
|
"@types/moment": "^2.13.0",
|
||||||
"@unicode/unicode-15.1.0": "^1.6.5",
|
"@unicode/unicode-15.1.0": "^1.6.5",
|
||||||
"@vicons/material": "^0.12.0",
|
"@vicons/material": "^0.12.0",
|
||||||
"@vicons/tabler": "^0.12.0",
|
"@vicons/tabler": "^0.12.0",
|
||||||
@@ -200,6 +201,7 @@
|
|||||||
"memorystream": "^0.3.1",
|
"memorystream": "^0.3.1",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"mitex-wasm": "^0.2.5",
|
"mitex-wasm": "^0.2.5",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"monaco-editor": "^0.43.0",
|
"monaco-editor": "^0.43.0",
|
||||||
"morsee": "^1.0.10",
|
"morsee": "^1.0.10",
|
||||||
"naive-ui": "^2.35.0",
|
"naive-ui": "^2.35.0",
|
||||||
@@ -266,6 +268,7 @@
|
|||||||
"vue-router": "^4.1.6",
|
"vue-router": "^4.1.6",
|
||||||
"vue-shadow-dom": "^4.2.0",
|
"vue-shadow-dom": "^4.2.0",
|
||||||
"vue-tsc": "^1.8.1",
|
"vue-tsc": "^1.8.1",
|
||||||
|
"vue3-flip-countdown": "^0.1.6",
|
||||||
"vue3-fortune-wheel": "^2.0.5",
|
"vue3-fortune-wheel": "^2.0.5",
|
||||||
"vuedraggable": "^4.1.0",
|
"vuedraggable": "^4.1.0",
|
||||||
"vuex": "^4.1.0",
|
"vuex": "^4.1.0",
|
||||||
|
|||||||
Generated
+25
-2
@@ -104,6 +104,9 @@ dependencies:
|
|||||||
'@types/haversine':
|
'@types/haversine':
|
||||||
specifier: ^1.1.8
|
specifier: ^1.1.8
|
||||||
version: 1.1.8
|
version: 1.1.8
|
||||||
|
'@types/moment':
|
||||||
|
specifier: ^2.13.0
|
||||||
|
version: 2.13.0
|
||||||
'@unicode/unicode-15.1.0':
|
'@unicode/unicode-15.1.0':
|
||||||
specifier: ^1.6.5
|
specifier: ^1.6.5
|
||||||
version: 1.6.5
|
version: 1.6.5
|
||||||
@@ -334,7 +337,7 @@ dependencies:
|
|||||||
version: 4.5.1
|
version: 4.5.1
|
||||||
ical-generator:
|
ical-generator:
|
||||||
specifier: ^8.1.1
|
specifier: ^8.1.1
|
||||||
version: 8.1.1(@types/luxon@3.4.2)(@types/node@18.19.75)(luxon@3.5.0)
|
version: 8.1.1(@types/luxon@3.4.2)(@types/node@18.19.75)(luxon@3.5.0)(moment@2.30.1)
|
||||||
ical.js:
|
ical.js:
|
||||||
specifier: ^2.1.0
|
specifier: ^2.1.0
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
@@ -497,6 +500,9 @@ dependencies:
|
|||||||
mitex-wasm:
|
mitex-wasm:
|
||||||
specifier: ^0.2.5
|
specifier: ^0.2.5
|
||||||
version: 0.2.5
|
version: 0.2.5
|
||||||
|
moment:
|
||||||
|
specifier: ^2.30.1
|
||||||
|
version: 2.30.1
|
||||||
monaco-editor:
|
monaco-editor:
|
||||||
specifier: ^0.43.0
|
specifier: ^0.43.0
|
||||||
version: 0.43.0
|
version: 0.43.0
|
||||||
@@ -695,6 +701,9 @@ dependencies:
|
|||||||
vue-tsc:
|
vue-tsc:
|
||||||
specifier: ^1.8.1
|
specifier: ^1.8.1
|
||||||
version: 1.8.1(typescript@5.2.2)
|
version: 1.8.1(typescript@5.2.2)
|
||||||
|
vue3-flip-countdown:
|
||||||
|
specifier: ^0.1.6
|
||||||
|
version: 0.1.6
|
||||||
vue3-fortune-wheel:
|
vue3-fortune-wheel:
|
||||||
specifier: ^2.0.5
|
specifier: ^2.0.5
|
||||||
version: 2.0.5(vue@3.3.4)
|
version: 2.0.5(vue@3.3.4)
|
||||||
@@ -6331,6 +6340,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@types/moment@2.13.0:
|
||||||
|
resolution: {integrity: sha512-DyuyYGpV6r+4Z1bUznLi/Y7HpGn4iQ4IVcGn8zrr1P4KotKLdH0sbK1TFR6RGyX6B+G8u83wCzL+bpawKU/hdQ==}
|
||||||
|
deprecated: This is a stub types definition for Moment (https://github.com/moment/moment). Moment provides its own type definitions, so you don't need @types/moment installed!
|
||||||
|
dependencies:
|
||||||
|
moment: 2.30.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/morsee@1.0.2:
|
/@types/morsee@1.0.2:
|
||||||
resolution: {integrity: sha512-WANv1kCyQtmGZTiov9FzFdt1X4wRtXYZA6B4YR3CghKgx4ychU7d1gkOx7oD+ddVGI+SWmWOPccco7pAc6wXeA==}
|
resolution: {integrity: sha512-WANv1kCyQtmGZTiov9FzFdt1X4wRtXYZA6B4YR3CghKgx4ychU7d1gkOx7oD+ddVGI+SWmWOPccco7pAc6wXeA==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -11791,7 +11807,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-DfKQpLlFq9yEUIEnFuCJzss3XavD7iHZTU5PyqXiAJ+rmaMp+NFP3hboumHKuK8nZjuOJg93WemTzcQ5b9jOZA==}
|
resolution: {integrity: sha512-DfKQpLlFq9yEUIEnFuCJzss3XavD7iHZTU5PyqXiAJ+rmaMp+NFP3hboumHKuK8nZjuOJg93WemTzcQ5b9jOZA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ical-generator@8.1.1(@types/luxon@3.4.2)(@types/node@18.19.75)(luxon@3.5.0):
|
/ical-generator@8.1.1(@types/luxon@3.4.2)(@types/node@18.19.75)(luxon@3.5.0)(moment@2.30.1):
|
||||||
resolution: {integrity: sha512-vorfUDZk4NaVLB7f1pm9AeRGy0jTYn7QUHZCFCMx3EGOz9+yykdAjA1i4ez+ZLAEK55lmutCXvVovEdTj9s1XA==}
|
resolution: {integrity: sha512-vorfUDZk4NaVLB7f1pm9AeRGy0jTYn7QUHZCFCMx3EGOz9+yykdAjA1i4ez+ZLAEK55lmutCXvVovEdTj9s1XA==}
|
||||||
engines: {node: 18 || 20 || >=22.0.0}
|
engines: {node: 18 || 20 || >=22.0.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -11827,6 +11843,7 @@ packages:
|
|||||||
'@types/luxon': 3.4.2
|
'@types/luxon': 3.4.2
|
||||||
'@types/node': 18.19.75
|
'@types/node': 18.19.75
|
||||||
luxon: 3.5.0
|
luxon: 3.5.0
|
||||||
|
moment: 2.30.1
|
||||||
uuid-random: 1.3.2
|
uuid-random: 1.3.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
@@ -18106,6 +18123,12 @@ packages:
|
|||||||
typescript: 5.2.2
|
typescript: 5.2.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/vue3-flip-countdown@0.1.6:
|
||||||
|
resolution: {integrity: sha512-RRz+iZ7Zvr1U9mrZRya7I5815jboDyRJz9vzgILq8ZCc2fQ6SxZPYwOr3pD5oWCDBprAEsPF9x4fsTtEitSmXw==}
|
||||||
|
dependencies:
|
||||||
|
vue: 3.3.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
/vue3-fortune-wheel@2.0.5(vue@3.3.4):
|
/vue3-fortune-wheel@2.0.5(vue@3.3.4):
|
||||||
resolution: {integrity: sha512-fMCmyT8sE79+O6fs2IWWrQMa1UjU+cuzu92C6EDCNaXaHaJKLReQxkAKLDiHyUC/GFpcsbpuBFbketWE3cKL0A==}
|
resolution: {integrity: sha512-fMCmyT8sE79+O6fs2IWWrQMa1UjU+cuzu92C6EDCNaXaHaJKLReQxkAKLDiHyUC/GFpcsbpuBFbketWE3cKL0A==}
|
||||||
engines: {node: '>=20.14.0', pnpm: '>=9.5.0'}
|
engines: {node: '>=20.14.0', pnpm: '>=9.5.0'}
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { Countdown } from 'vue3-flip-countdown';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { useQueryParam } from '@/composable/queryParams';
|
||||||
|
|
||||||
|
interface CountDown {
|
||||||
|
d: number
|
||||||
|
h: number
|
||||||
|
m: number
|
||||||
|
s: number
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCountDownHref(c: CountDown) {
|
||||||
|
const parsedUrl = new URL(window.location.href);
|
||||||
|
parsedUrl.searchParams.set('d', c.d.toString());
|
||||||
|
parsedUrl.searchParams.set('h', c.h.toString());
|
||||||
|
parsedUrl.searchParams.set('m', c.m.toString());
|
||||||
|
parsedUrl.searchParams.set('s', c.s.toString());
|
||||||
|
return parsedUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
const days = useQueryParam({ name: 'd', defaultValue: 0 });
|
||||||
|
const hours = useQueryParam({ name: 'h', defaultValue: 0 });
|
||||||
|
const minutes = useQueryParam({ name: 'm', defaultValue: 15 });
|
||||||
|
const seconds = useQueryParam({ name: 's', defaultValue: 0 });
|
||||||
|
const history = useStorage<CountDown[]>('countdown:hst', []);
|
||||||
|
|
||||||
|
const status = ref<'stopped' | 'ended' | 'running'>('stopped');
|
||||||
|
|
||||||
|
const audio = ref<HTMLAudioElement | null>(null);
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (status.value === 'ended') {
|
||||||
|
audio.value?.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const now = ref(moment());
|
||||||
|
const deadlineDate = computed(() => {
|
||||||
|
return now.value
|
||||||
|
.add(days.value, 'd')
|
||||||
|
.add(hours.value, 'h')
|
||||||
|
.add(minutes.value, 'm')
|
||||||
|
.add(seconds.value, 's')
|
||||||
|
.toDate();
|
||||||
|
});
|
||||||
|
const fmt = 'YYYY-MM-DD HH:mm:ss';
|
||||||
|
const deadlineFormatted = computed(() => {
|
||||||
|
return now.value
|
||||||
|
.add(days.value, 'd')
|
||||||
|
.add(hours.value, 'h')
|
||||||
|
.add(minutes.value, 'm')
|
||||||
|
.add(seconds.value, 's')
|
||||||
|
.format(fmt);
|
||||||
|
});
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
now.value = moment();
|
||||||
|
status.value = 'running';
|
||||||
|
const histoEntry = { d: days.value, h: hours.value, m: minutes.value, s: seconds.value };
|
||||||
|
if (!history.value.find(h => h.d === histoEntry.d && h.h === histoEntry.h && h.m === histoEntry.m && h.s === histoEntry.s)) {
|
||||||
|
history.value = [histoEntry, ...history.value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
status.value = 'stopped';
|
||||||
|
audio.value?.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ended() {
|
||||||
|
if (status.value === 'running') {
|
||||||
|
status.value = 'ended';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isEnded = computed(() => status.value === 'ended');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div max-w-600px>
|
||||||
|
<c-card :disabled="status !== 'stopped'" title="Countdown time" mb-4>
|
||||||
|
<div mb-4 flex justify-center gap-2>
|
||||||
|
<n-input-number v-model:value="days" :min="0">
|
||||||
|
<template #suffix>
|
||||||
|
days
|
||||||
|
</template>
|
||||||
|
</n-input-number>
|
||||||
|
<n-input-number v-model:value="hours" :min="0">
|
||||||
|
<template #suffix>
|
||||||
|
hours
|
||||||
|
</template>
|
||||||
|
</n-input-number>
|
||||||
|
<n-input-number v-model:value="minutes" :min="0">
|
||||||
|
<template #suffix>
|
||||||
|
minutes
|
||||||
|
</template>
|
||||||
|
</n-input-number>
|
||||||
|
<n-input-number v-model:value="seconds" :min="0">
|
||||||
|
<template #suffix>
|
||||||
|
seconds
|
||||||
|
</template>
|
||||||
|
</n-input-number>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div flex justify-center>
|
||||||
|
<c-button
|
||||||
|
@click="start"
|
||||||
|
>
|
||||||
|
Start
|
||||||
|
</c-button>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<Countdown :deadline="deadlineFormatted" :stop="status !== 'running'" mb-2 @time-elapsed="ended()" />
|
||||||
|
|
||||||
|
<n-p align="center">
|
||||||
|
Alarm at: {{ deadlineDate }}
|
||||||
|
</n-p>
|
||||||
|
|
||||||
|
<div mb-2 flex justify-center>
|
||||||
|
<c-button
|
||||||
|
:disabled="status === 'stopped'"
|
||||||
|
@click="stop"
|
||||||
|
>
|
||||||
|
Stop
|
||||||
|
</c-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-modal v-model:show="isEnded" mask-closable="false">
|
||||||
|
<n-card
|
||||||
|
style="width: 600px"
|
||||||
|
title="Timer finished"
|
||||||
|
:bordered="false"
|
||||||
|
size="huge"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
>
|
||||||
|
<p>Timer ellapsed!</p>
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="stop()">
|
||||||
|
OK
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-card>
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
|
<c-card v-if="history" title="History">
|
||||||
|
<div flex justify-center gap-1>
|
||||||
|
<template v-for="(entry, index) in history" :key="index">
|
||||||
|
{{ index > 0 ? ' / ' : '' }}
|
||||||
|
<n-a :href="getCountDownHref(entry)">
|
||||||
|
{{ entry.d > 0 ? `${entry.d} days` : '' }}
|
||||||
|
{{ entry.h > 0 ? `${entry.h}h` : '' }}
|
||||||
|
{{ entry.m > 0 ? `${entry.m}m` : '' }}
|
||||||
|
{{ entry.s > 0 ? `${entry.s}s` : '' }}
|
||||||
|
</n-a>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<audio ref="audio" loop src="/Beep.mp3" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Alarm } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Countdown',
|
||||||
|
path: '/countdown',
|
||||||
|
description: 'Countdown and alarm at ellapsed duration',
|
||||||
|
keywords: ['countdown'],
|
||||||
|
component: () => import('./countdown.vue'),
|
||||||
|
icon: Alarm,
|
||||||
|
createdAt: new Date('2025-03-09'),
|
||||||
|
category: 'Datetime',
|
||||||
|
});
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare module "vue3-flip-countdown" {
|
||||||
|
export function Countdown(): any;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Alarm } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Time Alarm',
|
||||||
|
path: '/time-alarm',
|
||||||
|
description: 'Alarm at a specific date and time',
|
||||||
|
keywords: ['time', 'alarm'],
|
||||||
|
component: () => import('./time-alarm.vue'),
|
||||||
|
icon: Alarm,
|
||||||
|
createdAt: new Date('2025-03-09'),
|
||||||
|
category: 'Datetime',
|
||||||
|
});
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { Countdown } from 'vue3-flip-countdown';
|
||||||
|
import moment from 'moment';
|
||||||
|
import { useQueryParam } from '@/composable/queryParams';
|
||||||
|
|
||||||
|
const alarmAt = useQueryParam({ name: 'alarmAt', defaultValue: '17:30:00' });
|
||||||
|
const history = useStorage<string[]>('timealarm:hst', []);
|
||||||
|
|
||||||
|
function getTimeHref(at: string) {
|
||||||
|
const parsedUrl = new URL(window.location.href);
|
||||||
|
parsedUrl.searchParams.set('at', at);
|
||||||
|
return parsedUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = ref<'stopped' | 'ended' | 'running'>('stopped');
|
||||||
|
|
||||||
|
const audio = ref<HTMLAudioElement | null>(null);
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (status.value === 'ended') {
|
||||||
|
audio.value?.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const now = ref(moment());
|
||||||
|
const alarmAtDate = computed(() => {
|
||||||
|
const [h, m, s] = alarmAt.value.split(':');
|
||||||
|
return now.value
|
||||||
|
.set('h', Number(h))
|
||||||
|
.set('m', Number(m))
|
||||||
|
.set('s', Number(s))
|
||||||
|
.toDate();
|
||||||
|
});
|
||||||
|
|
||||||
|
const fmt = 'YYYY-MM-DD HH:mm:ss';
|
||||||
|
|
||||||
|
const alarmAtFormatted = computed(() => {
|
||||||
|
const [h, m, s] = alarmAt.value.split(':');
|
||||||
|
return now.value
|
||||||
|
.set('h', Number(h))
|
||||||
|
.set('m', Number(m))
|
||||||
|
.set('s', Number(s))
|
||||||
|
.format(fmt);
|
||||||
|
});
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
now.value = moment();
|
||||||
|
status.value = 'running';
|
||||||
|
const histoEntry = alarmAt.value;
|
||||||
|
if (!history.value.find(h => h === histoEntry)) {
|
||||||
|
history.value = [histoEntry, ...history.value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
status.value = 'stopped';
|
||||||
|
audio.value?.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ended() {
|
||||||
|
if (status.value === 'running') {
|
||||||
|
status.value = 'ended';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isEnded = computed(() => status.value === 'ended');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div max-w-600px>
|
||||||
|
<c-card :disabled="status !== 'stopped'" title="Alarm" mb-4>
|
||||||
|
<div flex justify-center>
|
||||||
|
<n-form-item label="Alarm at:" label-placement="left">
|
||||||
|
<n-time-picker v-model:formatted-value="alarmAt" />
|
||||||
|
</n-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div flex justify-center>
|
||||||
|
<c-button
|
||||||
|
@click="start"
|
||||||
|
>
|
||||||
|
Start
|
||||||
|
</c-button>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<Countdown :deadline="alarmAtFormatted" :stop="status !== 'running'" mb-2 @time-elapsed="ended()" />
|
||||||
|
|
||||||
|
<n-p align="center">
|
||||||
|
Alarm at: {{ alarmAtDate }}
|
||||||
|
</n-p>
|
||||||
|
|
||||||
|
<div mb-2 flex justify-center>
|
||||||
|
<c-button
|
||||||
|
:disabled="status === 'stopped'"
|
||||||
|
@click="stop"
|
||||||
|
>
|
||||||
|
Stop
|
||||||
|
</c-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<n-modal v-model:show="isEnded" mask-closable="false">
|
||||||
|
<n-card
|
||||||
|
style="width: 600px"
|
||||||
|
title="Timer finished"
|
||||||
|
:bordered="false"
|
||||||
|
size="huge"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
>
|
||||||
|
<p>Timer ellapsed!</p>
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="stop()">
|
||||||
|
OK
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-card>
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
|
<c-card v-if="history" title="History">
|
||||||
|
<div flex justify-center gap-1>
|
||||||
|
<template v-for="(entry, index) in history" :key="index">
|
||||||
|
{{ index > 0 ? ' / ' : '' }}
|
||||||
|
<n-a :href="getTimeHref(entry)">
|
||||||
|
{{ entry }}
|
||||||
|
</n-a>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</c-card>
|
||||||
|
|
||||||
|
<audio ref="audio" loop src="/Beep.mp3" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare module "vue3-flip-countdown" {
|
||||||
|
export function Countdown(): any;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user