-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths.js
More file actions
144 lines (126 loc) · 3.43 KB
/
s.js
File metadata and controls
144 lines (126 loc) · 3.43 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//get assets
var current = window.location.href;
var base = "https://www.youtube-nocookie.com/embed/"
var startPos = current.indexOf("?v=") + 3;
var videoId = current.substring(startPos, startPos + 11);
var patched = base + videoId;
console.log(patched);
//clear current page
var body = document.body;
while (body.firstChild) {
body.removeChild(body.firstChild);
}
//inject video player
// Create the header element
var header = document.createElement('header');
header.classList.add('header');
header.innerHTML = `
<h1>Video Player</h1>
<input type="text" class="search-bar" placeholder="Search...">
`;
var searchInput = header.querySelector('.search-bar');
searchInput.addEventListener('keyup', function(event) {
if (event.key === 'Enter') {
var searchTerm = searchInput.value.trim();
if (searchTerm !== '') {
var searchUrl = 'https://www.youtube.com/results?search_query=' + encodeURIComponent(searchTerm);
window.location.href = searchUrl;
}
}
});
// Create the main content element
var mainContent = document.createElement('main');
mainContent.classList.add('main-content');
mainContent.innerHTML = `
<div class="video-player">
<iframe src="${patched}" frameborder="0" allowfullscreen></iframe>
</div>
`;
// Create the footer element
var footer = document.createElement('footer');
footer.classList.add('footer');
footer.innerHTML = `
<p>© 2024 lemonscripting. All rights reserved.</p>
`;
// Append elements to document.body
document.body.appendChild(header);
document.body.appendChild(mainContent);
document.body.appendChild(footer);
// Create and append the style element for CSS
var styleElement = document.createElement('style');
styleElement.textContent = `
/* Reset default margin and padding */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Basic styling for the body */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 0;
}
/* Header styling */
.header {
background-color: #333;
color: #fff;
padding: 2rem; /* Increased padding for header */
display: flex;
justify-content: space-between;
align-items: center;
}
.header h1 {
font-size: 2rem; /* Increased font size for header title */
}
.search-bar {
padding: 0.5rem;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
width: 250px; /* Adjust width as needed */
}
.search-bar:focus {
outline: none;
border-color: #007bff;
}
/* Main content styling */
.main-content {
max-width: 1000px; /* Increase max-width for wider content */
margin: 20px auto;
padding: 0 20px;
}
.video-player {
position: relative;
width: 100%;
padding-top: 56.25%; /* Aspect ratio 16:9 */
max-width: 100%; /* Ensure the video player does not exceed its container */
}
.video-player iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
/* Footer styling */
.footer {
text-align: center;
padding: 2rem; /* Increased padding for footer */
background-color: #333;
color: #fff;
position: fixed;
bottom: 0;
width: 100%;
}
`;
// Append the style element to the document head
document.head.appendChild(styleElement);
//extra
if (window.location.href.indexOf('watch?v=') !== -1) {
console.log('in a video');
} else {
console.log('The URL does not contain "watch?v="');
}