Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e5abf87e | ||
|
|
e161dea9da |
+1
-1
@@ -1,4 +1,4 @@
|
||||
node_modules/
|
||||
docs/
|
||||
*.log
|
||||
.DS_Store
|
||||
dist/
|
||||
@@ -0,0 +1,4 @@
|
||||
docs/
|
||||
*.log
|
||||
.git
|
||||
.github
|
||||
@@ -2889,7 +2889,12 @@
|
||||
headerButtons.prepend(installBtn);
|
||||
}
|
||||
|
||||
function isYakTubeInstance() {
|
||||
return window.location.hostname.includes('yaktube.yakhub.com.tr') || getInstanceName() === 'YakTube';
|
||||
}
|
||||
|
||||
function injectApkDownloadButton() {
|
||||
if (!isYakTubeInstance()) return;
|
||||
// 1. If inside APK: NEVER show APK button
|
||||
if (isInsideYakTubeApp) {
|
||||
var existBtnApp = document.getElementById('yaktube-apk-download-btn');
|
||||
@@ -2934,6 +2939,7 @@
|
||||
}
|
||||
|
||||
function injectSidebarApkLink() {
|
||||
if (!isYakTubeInstance()) return;
|
||||
// If inside APK: NEVER show in sidebar
|
||||
if (isInsideYakTubeApp) {
|
||||
var existLink = document.getElementById('yaktube-sidebar-apk-link');
|
||||
@@ -2981,3 +2987,132 @@
|
||||
});
|
||||
checkAndInjectWatchPageComments();
|
||||
})();
|
||||
|
||||
// 5. Background Play (Screen-Off / Minimize) & MediaSession Lock-Screen Controls
|
||||
(function initBackgroundPlaybackEngine() {
|
||||
var videoState = {
|
||||
hasPlayed: false,
|
||||
pausedByUser: false,
|
||||
pausedAt: null
|
||||
};
|
||||
|
||||
function attachVideoListeners(video) {
|
||||
if (!video || video.hasAttribute('data-yaktube-bgplay-hooked')) return;
|
||||
video.setAttribute('data-yaktube-bgplay-hooked', 'true');
|
||||
|
||||
video.addEventListener('play', function () {
|
||||
videoState.hasPlayed = true;
|
||||
videoState.pausedByUser = false;
|
||||
updateMediaSessionMetadata(video);
|
||||
});
|
||||
|
||||
video.addEventListener('pause', function () {
|
||||
videoState.pausedAt = Date.now();
|
||||
// If document is visible when paused, it was paused manually by the user
|
||||
if (!document.hidden) {
|
||||
videoState.pausedByUser = true;
|
||||
}
|
||||
});
|
||||
|
||||
video.addEventListener('ended', function () {
|
||||
videoState.hasPlayed = false;
|
||||
videoState.pausedByUser = true;
|
||||
});
|
||||
|
||||
video.addEventListener('timeupdate', function () {
|
||||
updateMediaSessionPosition(video);
|
||||
});
|
||||
}
|
||||
|
||||
function handleVisibilityChange() {
|
||||
if (!document.hidden) return; // Screen is active
|
||||
|
||||
var video = getVideoElement();
|
||||
if (!video) return;
|
||||
|
||||
// If user hasn't played or deliberately paused, do not auto-resume
|
||||
if (!videoState.hasPlayed || videoState.pausedByUser) return;
|
||||
|
||||
var now = Date.now();
|
||||
if (videoState.pausedAt && now - videoState.pausedAt > 1500 && videoState.pausedByUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Resume playback when screen locks or tab switches
|
||||
setTimeout(function () {
|
||||
if (video.paused && !videoState.pausedByUser) {
|
||||
video.play().catch(function () {});
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange, false);
|
||||
document.addEventListener('webkitvisibilitychange', handleVisibilityChange, false);
|
||||
|
||||
// MediaSession API Integration (Lock Screen, Bluetooth, Smart Watches)
|
||||
function updateMediaSessionMetadata(video) {
|
||||
if (!('mediaSession' in navigator)) return;
|
||||
|
||||
var titleEl = document.querySelector('h1.video-title, .video-name, my-video-watch h1, .title');
|
||||
var title = titleEl ? titleEl.textContent.trim() : 'YakTube Video';
|
||||
var authorEl = document.querySelector('.actor-name, .channel-name, .video-channel-name, a.actor-link');
|
||||
var artist = authorEl ? authorEl.textContent.trim() : 'YakTube';
|
||||
|
||||
var artwork = [];
|
||||
var thumbEl = document.querySelector('meta[property="og:image"]');
|
||||
if (thumbEl && thumbEl.content) {
|
||||
artwork.push({ src: thumbEl.content, sizes: '512x512', type: 'image/jpeg' });
|
||||
}
|
||||
|
||||
try {
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: title,
|
||||
artist: artist,
|
||||
album: 'YakTube',
|
||||
artwork: artwork
|
||||
});
|
||||
|
||||
navigator.mediaSession.setActionHandler('play', function () {
|
||||
video.play();
|
||||
announce('Video oynatılıyor.');
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('pause', function () {
|
||||
videoState.pausedByUser = true;
|
||||
video.pause();
|
||||
announce('Video duraklatıldı.');
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('seekbackward', function (details) {
|
||||
var skipTime = details.seekOffset || 10;
|
||||
video.currentTime = Math.max(0, video.currentTime - skipTime);
|
||||
announce(skipTime + ' saniye geri sarıldı.');
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('seekforward', function (details) {
|
||||
var skipTime = details.seekOffset || 10;
|
||||
video.currentTime = Math.min(video.duration || 99999, video.currentTime + skipTime);
|
||||
announce(skipTime + ' saniye ileri sarıldı.');
|
||||
});
|
||||
navigator.mediaSession.setActionHandler('stop', function () {
|
||||
videoState.pausedByUser = true;
|
||||
video.pause();
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function updateMediaSessionPosition(video) {
|
||||
if (!('mediaSession' in navigator) || !navigator.mediaSession.setPositionState) return;
|
||||
if (isNaN(video.duration) || isNaN(video.currentTime) || video.duration <= 0) return;
|
||||
try {
|
||||
navigator.mediaSession.setPositionState({
|
||||
duration: video.duration,
|
||||
playbackRate: video.playbackRate || 1,
|
||||
position: Math.min(video.currentTime, video.duration)
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Auto-hook active video elements
|
||||
setInterval(function () {
|
||||
var video = getVideoElement();
|
||||
if (video) attachVideoListeners(video);
|
||||
}, 1000);
|
||||
})();
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "peertube-plugin-yaktube-ondemand",
|
||||
"version": "1.4.6",
|
||||
"version": "1.4.8",
|
||||
"description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube",
|
||||
"main": "main.js",
|
||||
"library": "./main.js",
|
||||
|
||||
Reference in New Issue
Block a user