blob: d5351e990d04fa5ca2b9843934f7381a3f6da18e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
<script lang="ts">
import { browser } from '$app/environment';
import { parseM3U, type Channel } from '$lib/m3u';
import { onMount } from 'svelte';
import Masonry from 'svelte-bricks';
let channels: Channel[] = [];
let filter = '';
onMount(
async () =>
(channels = parseM3U(
await (await fetch('https://raw.githubusercontent.com/luongz/iptv-jp/main/jp.m3u')).text()
)
.filter((channel) => channel.tvgLogo)
.map((channel, index) => ({ ...channel, id: index })))
);
</script>
<input type="text" placeholder="Search" bind:value={filter} class="filter" />
<div class="channels">
<Masonry
items={channels.filter((channel) =>
(
channel.name.toLowerCase() +
channel.groupTitle.toLowerCase() +
channel.tvgId.toLowerCase()
).includes(filter.toLowerCase())
)}
minColWidth={(browser ? window.innerWidth < 768 : false) ? 150 : 200}
gap={15}
let:item
>
<div class="channel-container">
<a href={`https://hlsjs.video-dev.org/demo/?src=${item.url}`} target="_blank">
<img src={item.tvgLogo} alt="Channel icon" class="channel-icon" />
</a>
<span class="channel-title">
<a
href={`https://hlsjs.video-dev.org/demo/?src=${item.url}`}
target="_blank"
class="channel-title-primary"
>
[{item.groupTitle}] {item.name}
</a>
<br />
<a
href={'#'}
on:click={() => {
navigator.clipboard.writeText(item.url);
alert('Copied M3U8 URL to clipboard!');
}}
>
Copy M3U8 URL
</a>
</span>
</div>
</Masonry>
</div>
<style>
:root {
--border-radius: 8px;
--space: 1rem;
}
a {
text-decoration: none;
color: #c6c6c6;
transition: color 0.1s ease-in-out;
}
a:hover {
color: #2a6496;
}
.channels {
padding: calc(var(--space) / 2);
}
.channel-container {
background: #1d1d1d;
padding: var(--space);
border-radius: var(--border-radius);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
position: relative;
}
.channel-icon {
border-radius: var(--border-radius);
max-width: 100%;
max-height: 100%;
margin-bottom: var(--space);
}
.filter {
width: calc(100% - (var(--space) * 3));
padding: var(--space);
border-radius: var(--border-radius);
border: none;
margin: calc(var(--space) / 2);
background: #242424;
border: none;
color: #fff;
font-size: 1rem;
}
.filter:focus {
outline: none;
}
.channel-title-primary {
color: #fff;
}
:global(body) {
background-color: #121212;
color: #fff;
}
</style>
|