File size: 3,023 Bytes
0521879
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d384b0a
 
 
 
 
 
 
 
 
0521879
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class VideoCard extends HTMLElement {
  connectedCallback() {
    const videoId = this.getAttribute('video-id') || 'dQw4w9WgXcQ';
    const title = this.getAttribute('title') || 'News Analysis Video';
    const description = this.getAttribute('description') || 'My take on current events';
    const duration = this.getAttribute('duration') || '10:00';
    const views = this.getAttribute('views') || '1.2k';
    const likes = this.getAttribute('likes') || '150';

    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: block;
          margin-bottom: 1.5rem;
        }
        .card {
          background: white;
          border-radius: 0.5rem;
          overflow: hidden;
          box-shadow: 0 1px 3px rgba(0,0,0,0.1);
          transition: box-shadow 0.3s ease;
        }
        .card:hover {
          box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
        }
        .video-container {
          position: relative;
          padding-bottom: 56.25%;
          background: #000;
        }
        iframe {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          border: none;
        }
        .content {
          padding: 1rem;
        }
        .title {
          font-weight: 600;
          font-size: 1.125rem;
          margin-bottom: 0.5rem;
          color: #1f2937;
        }
        .description {
          color: #6b7280;
          font-size: 0.875rem;
          margin-bottom: 1rem;
        }
        .meta {
          display: flex;
          align-items: center;
          color: #6b7280;
          font-size: 0.75rem;
        }
        .meta span {
          display: flex;
          align-items: center;
          margin-right: 1rem;
        }
        i {
          margin-right: 0.25rem;
          width: 1rem;
          height: 1rem;
        }
      </style>
      <div class="card">
        <div class="video-container">
          ${videoId.includes('rumble.com') ? 
            `<iframe src="https://rumble.com/embed/${videoId.split('v')[1].split('-')[0]}/?pub=4" 
                    frameborder="0" 
                    allowfullscreen></iframe>` : 
            `<iframe src="https://www.youtube.com/embed/${videoId}" 
                    frameborder="0" 
                    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
                    allowfullscreen></iframe>`}
</div>
        <div class="content">
          <h3 class="title">${title}</h3>
          <p class="description">${description}</p>
          <div class="meta">
            <span><i data-feather="clock"></i> ${duration}</span>
            <span><i data-feather="eye"></i> ${views} views</span>
            <span><i data-feather="thumbs-up"></i> ${likes} likes</span>
          </div>
        </div>
      </div>
    `;
    feather.replace({ class: 'feather', 'stroke-width': 2 });
  }
}

customElements.define('video-card', VideoCard);