itube-specs 0.0.205 → 0.0.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div class="f-video-autoplay">
3
+ <button
4
+ type="button"
5
+ class="f-video-autoplay__button"
6
+ @click="value = !value"
7
+ >
8
+ {{ $t('autoplay_next_video')}}
9
+ </button>
10
+ <FToggle
11
+ class="f-video-autoplay__toggle"
12
+ v-model="value"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ const value = ref(true);
19
+
20
+ onMounted(() => {
21
+ const saved: string | null = localStorage.getItem('autoplay');
22
+ if (!saved) {
23
+ localStorage.setItem('autoplay', 'on');
24
+ }
25
+ value.value = saved === null ? true : saved === 'on';
26
+ });
27
+
28
+ watch(() => value.value, (newValue) => localStorage.setItem('autoplay', newValue ? 'on' : 'off'))
29
+ </script>
@@ -0,0 +1,21 @@
1
+ export const useFormatTimeAgo = (t, time: number) => {
2
+ const pastDate = new Date(time * 1000);
3
+ const now = new Date();
4
+
5
+ const diffInMs = Number(now) - Number(pastDate);
6
+ const diffInDays = Math.floor(diffInMs / (1000 * 60 * 60 * 24));
7
+
8
+ if (diffInDays === 0) {
9
+ return t('date.today');
10
+ } else if (diffInDays === 1) {
11
+ return t('date.day_ago');
12
+ } else if (diffInDays < 30) {
13
+ return `${diffInDays} ${t('date.days_ago')}`;
14
+ } else if (diffInDays < 365) {
15
+ const diffInMonths = Math.floor(diffInDays / 30);
16
+ return `${diffInMonths} ${t('date.month')}${diffInMonths > 1 ? 's' : ''} ${t('date.ago')}`;
17
+ } else {
18
+ const diffInYears = Math.floor(diffInDays / 365);
19
+ return `${diffInYears} ${t('date.year')}${diffInYears > 1 ? 's' : ''} ${t('date.ago')}`;
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.205",
4
+ "version": "0.0.207",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {