ruhs2 / Systumm /template /static /script.js
ruhscps's picture
Create static/script.js
4362d29 verified
Raw History Blame Contribute Delete
3.62 kB
// --- Navigation & UI Logic ---
let homeBtn = document.querySelector(".home-btn");
let abtBtn = document.querySelector(".about-btn");
let dldBtn_outer = document.querySelector(".downloadBtn");
let file_name = document.querySelector(".file-name");
let about_nav = document.querySelector(".about-nav");
let footer = document.querySelector('footer');
if (document.getElementById("heading")?.classList.contains("title")) {
document.querySelector(".title").textContent = 'SYSTUMM';
}
homeBtn.classList.add('active');
abtBtn.addEventListener("click", () => {
dldBtn_outer.style.display = "none";
file_name.style.display = "none";
footer.style.display = "none";
about_nav.style.display = "block";
});
homeBtn.addEventListener("click", () => {
dldBtn_outer.style.display = "flex";
file_name.style.display = "block";
footer.style.display = "block";
window.location.href = "#main";
about_nav.style.display = "none";
});
function toggleWidth(element) {
let links = document.querySelectorAll('.about-nav a');
links.forEach(link => link.classList.remove('active'));
element.classList.add('active');
}
function toggleWidthnav(element) {
let links = document.querySelectorAll('.nryt a');
links.forEach(link => link.classList.remove('active'));
element.classList.add('active');
}
// --- Player Initialization ---
var div = document.getElementById('myDiv');
if (div) {
var text = div.textContent;
if (text.length > 300) {
div.textContent = text.slice(0, 300) + "....";
}
}
const controls = [
'play-large', 'rewind', 'play', 'fast-forward',
'progress', 'current-time', 'duration',
'captions', 'settings', 'pip', 'airplay', 'fullscreen'
];
document.addEventListener('DOMContentLoaded', () => {
const player = Plyr.setup('.player', { controls });
});
// --- Security (Disable Right Click / Inspect) ---
document.addEventListener("contextmenu", e => e.preventDefault());
document.addEventListener('keydown', e => {
if (e.key === 'F12' || (e.ctrlKey && e.shiftKey && e.key === 'I') || (e.ctrlKey && e.key === 'u') || e.ctrlKey || e.shiftKey || e.altKey) {
e.preventDefault();
}
});
// --- External Player Routing ---
const videolink = window.location.href;
const streamlink = videolink.replace("/watch/", "/dl/");
function vlc_player() { window.location.href = `vlc://${streamlink}`; }
function mx_player() { window.location.href = `intent:${streamlink}#Intent;package=com.mxtech.videoplayer.ad;end`; }
function n_player() { window.location.href = `nplayer-${streamlink}`; }
function streamDownload() { window.location.href = streamlink; }
function copyStreamLink() {
const linkToCopy = streamlink.toLowerCase();
if (!navigator.clipboard) {
navigator.clipboard = {
writeText: function(text) {
return new Promise((resolve, reject) => {
try {
const textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
resolve();
} catch (err) { reject(err); }
});
}
};
}
navigator.clipboard.writeText(linkToCopy)
.then(() => alert('Stream link copied successfully!'))
.catch(err => alert('Failed to copy link. Please try manually.'));
}