您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Uzaktan Eğitim Kapısı Otomatik Gelişmiş Oynatıcı
当前为
// ==UserScript== // @name Uzaktan Eğitim Kapısı Videolarını Otomatik İzle Gelişmiş Oynayıcı // @namespace https://uzaktanegitimkapisi.cbiko.gov.tr/ // @version v3.3 // @description Uzaktan Eğitim Kapısı Otomatik Gelişmiş Oynatıcı // @author MstyCnklc // @homepage https://gf.qytechs.cn/tr/scripts/480955 // @supportURL https://gf.qytechs.cn/tr/scripts/480955/feedback // @match https://uzaktanegitimkapisi.cbiko.gov.tr/Egitimler/video* // @match https://uzaktanegitimkapisi.cbiko.gov.tr/Egitimler/Video* // @icon https://www.google.com/s2/favicons?sz=64&domain=gov.tr // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @require http://code.jquery.com/jquery-3.4.1.min.js // @license GPL-2.0-only // ==/UserScript== (function() { 'use strict'; // --- Ayar Varsayılanları --- const SETTINGS_DEFAULTS = { autoPlay: true, startMuted: false, // Yeniden adlandırıldı ve varsayılan SES AÇIK olarak ayarlandı playInBackground: true, autoConfirm: true, autoReload: true, reloadIntervalMinutes: 25, autoAdvanceNextVideo: true }; // --- Ayarları Yükle --- function loadSettings() { let settings = {}; for (const key in SETTINGS_DEFAULTS) { settings[key] = GM_getValue(key, SETTINGS_DEFAULTS[key]); } settings.reloadIntervalMinutes = parseInt(settings.reloadIntervalMinutes, 10) || SETTINGS_DEFAULTS.reloadIntervalMinutes; ['autoPlay', 'startMuted', 'playInBackground', 'autoConfirm', 'autoReload', 'autoAdvanceNextVideo'].forEach(key => { if (typeof settings[key] !== 'boolean') { // Kayıtlı değerin tipini kontrol et settings[key] = SETTINGS_DEFAULTS[key]; } }); return settings; } // --- Ayarları Kaydet --- function saveSettings(settings) { for (const key in settings) { GM_setValue(key, settings[key]); } } let currentSettings = loadSettings(); var myPlayer; var pageRefreshInterval; // --- Ayar Paneli HTML ve CSS --- GM_addStyle(` #uek-settings-button { position: fixed; bottom: 20px; right: 20px; background-color: #007bff; color: white; padding: 10px 15px; border: none; border-radius: 5px; cursor: pointer; z-index: 9999; font-size: 14px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); } #uek-settings-button:hover { background-color: #0056b3; } #uek-settings-panel { position: fixed; bottom: 70px; right: 20px; background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 20px; z-index: 10000; display: none; width: 360px; /* Genişlik biraz daha arttı */ box-shadow: 0 4px 15px rgba(0,0,0,0.15); font-family: Arial, sans-serif; } #uek-settings-panel h3 { margin-top: 0; margin-bottom: 20px; font-size: 18px; color: #343a40; text-align: center; border-bottom: 1px solid #e9ecef; padding-bottom: 10px; } #uek-settings-panel .setting-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; } #uek-settings-panel label { font-size: 14px; color: #495057; flex-grow: 1; } #uek-settings-panel input[type="checkbox"] { margin-left: 10px; transform: scale(1.1); cursor: pointer; } #uek-settings-panel input[type="number"] { width: 70px; padding: 6px 8px; border: 1px solid #ced4da; border-radius: 4px; margin-left: 10px; text-align: right; } #uek-save-settings-button { background-color: #28a745; color: white; padding: 10px 15px; border: none; border-radius: 5px; cursor: pointer; font-size: 15px; display: block; width: 100%; margin-top: 15px; transition: background-color 0.2s ease; } #uek-save-settings-button:hover { background-color: #218838; } `); const settingsButton = $('<button id="uek-settings-button">⚙️ Ayarlar</button>'); const settingsPanel = $(` <div id="uek-settings-panel"> <h3>Video İzleme Ayarları</h3> <div class="setting-item"> <label for="uek-autoPlay">Otomatik Oynat (Sayfa Yüklenince)</label> <input type="checkbox" id="uek-autoPlay"> </div> <div class="setting-item"> <label for="uek-startMuted">Videoları Sessiz Başlat</label> <input type="checkbox" id="uek-startMuted"> </div> <div class="setting-item"> <label for="uek-autoAdvanceNextVideo">Video Bitince Sonrakine Geç</label> <input type="checkbox" id="uek-autoAdvanceNextVideo"> </div> <div class="setting-item"> <label for="uek-playInBackground">Arka Planda Oynat</label> <input type="checkbox" id="uek-playInBackground"> </div> <div class="setting-item"> <label for="uek-autoConfirm">Onayları Otomatik Tıkla</label> <input type="checkbox" id="uek-autoConfirm"> </div> <div class="setting-item"> <label for="uek-autoReload">Otomatik Sayfa Yenile</label> <input type="checkbox" id="uek-autoReload"> </div> <div class="setting-item"> <label for="uek-reloadIntervalMinutes">Yenileme Sıklığı (dk):</label> <input type="number" id="uek-reloadIntervalMinutes" min="1" max="120"> </div> <button id="uek-save-settings-button">Ayarları Kaydet</button> </div> `); $('body').append(settingsButton); $('body').append(settingsPanel); function updatePanelValues() { $('#uek-autoPlay').prop('checked', currentSettings.autoPlay); $('#uek-startMuted').prop('checked', currentSettings.startMuted); // Yeni ayar için $('#uek-autoAdvanceNextVideo').prop('checked', currentSettings.autoAdvanceNextVideo); $('#uek-playInBackground').prop('checked', currentSettings.playInBackground); $('#uek-autoConfirm').prop('checked', currentSettings.autoConfirm); $('#uek-autoReload').prop('checked', currentSettings.autoReload); $('#uek-reloadIntervalMinutes').val(currentSettings.reloadIntervalMinutes); } $('#uek-settings-button').on('click', function() { currentSettings = loadSettings(); // Paneli açarken ayarları yeniden yükle (başka sekmede değişmiş olabilir) updatePanelValues(); $('#uek-settings-panel').slideToggle(200); }); $('#uek-save-settings-button').on('click', function() { currentSettings.autoPlay = $('#uek-autoPlay').is(':checked'); currentSettings.startMuted = $('#uek-startMuted').is(':checked'); // Yeni ayar için currentSettings.autoAdvanceNextVideo = $('#uek-autoAdvanceNextVideo').is(':checked'); currentSettings.playInBackground = $('#uek-playInBackground').is(':checked'); currentSettings.autoConfirm = $('#uek-autoConfirm').is(':checked'); currentSettings.autoReload = $('#uek-autoReload').is(':checked'); let newInterval = parseInt($('#uek-reloadIntervalMinutes').val()); if (isNaN(newInterval) || newInterval < 1) { newInterval = SETTINGS_DEFAULTS.reloadIntervalMinutes; $('#uek-reloadIntervalMinutes').val(newInterval); } currentSettings.reloadIntervalMinutes = newInterval; saveSettings(currentSettings); alert('Ayarlar kaydedildi!'); $('#uek-settings-panel').slideUp(200); if (pageRefreshInterval) clearInterval(pageRefreshInterval); setupPageRefresh(); if (myPlayer) { // Arka plan oynatma ayarı için event listenerları güncelle $(window).off('.uekscript'); // Öncekileri temizle if (currentSettings.playInBackground) { // Sadece gerekliyse yeniden ekle setupBackgroundPlayListeners(); } // Mevcut videonun ses durumunu anında güncelle if (typeof myPlayer.muted === 'function') { if (myPlayer.muted() !== currentSettings.startMuted) { myPlayer.muted(currentSettings.startMuted); console.log(`Video sesi ayar değişikliğiyle güncellendi: ${currentSettings.startMuted ? 'Sessiz' : 'Sesli'}`); } } } }); function applyMuteSetting(player) { if (player && typeof player.muted === 'function') { if (player.muted() !== currentSettings.startMuted) { player.muted(currentSettings.startMuted); console.log(`Video ses durumu ayarlandı: ${currentSettings.startMuted ? 'Sessiz' : 'Sesli'}`); } } } function attemptPlayWithRetries(player, retries = 5, delay = 1000) { if (!currentSettings.autoPlay || !player || typeof player.play !== 'function') { if (player) applyMuteSetting(player); // Otomatik oynatma kapalıysa bile ses ayarını uygula (manuel oynatma için) return; } console.log(`Otomatik oynatma deneniyor... (Kalan deneme: ${retries})`); player.play() .then(() => { console.log("Video başarıyla oynatılmaya başlandı."); applyMuteSetting(player); // Oynatma başarılı olduktan sonra ses ayarını uygula }) .catch(error => { console.warn(`Otomatik oynatma hatası (${error.name}): ${error.message}`); applyMuteSetting(player); // Hata durumunda bile ses ayarını uygula (belki kullanıcı manuel oynatır) if (retries > 0) { console.log(`${delay/1000} saniye sonra tekrar denenecek.`); setTimeout(() => attemptPlayWithRetries(player, retries - 1, delay), delay); } else { console.error("Maksimum otomatik oynatma denemesine ulaşıldı, video başlatılamadı."); var autoPlayButton = $('.vjs-big-play-button:visible'); if(autoPlayButton.length){ console.log("Lütfen oynatmak için büyük oynat butonuna tıklayın."); } } }); } function setupBackgroundPlayListeners() { $(window).on('blur.uekscript', function () { if (myPlayer && typeof myPlayer.play === 'function' && !myPlayer.ended() && myPlayer.paused()){ myPlayer.play().catch(e => console.warn("Arka planda oynatma hatası (blur):", e.name, e.message)); } // document.title = "UEK - Oynatılıyor..."; // Bu satır isteğe bağlı, çok sık başlık değiştirebilir }); $(window).on('focus.uekscript', function () { if (myPlayer && typeof myPlayer.play === 'function' && !myPlayer.ended() && myPlayer.paused()) { myPlayer.play().catch(e => console.warn("Arka planda oynatma hatası (focus):", e.name, e.message)); } // document.title = "Uzaktan Eğitim Kapısı"; // Bu satır isteğe bağlı }); } function initializePlayerInteractions() { if (!myPlayer) { console.warn("Oyuncu başlatılamadı (initializePlayerInteractions)."); return; } myPlayer.off('ended'); // Önceki dinleyicileri temizle myPlayer.off('error'); myPlayer.off('play'); // Oynatma başladığında sesi ayarlamak için 'play' olayını da kullanabiliriz myPlayer.on('error', function() { const error = myPlayer.error(); console.error("Video Oynatıcı Hatası:", error ? `${error.code} - ${error.message}` : "Bilinmeyen hata"); }); // Oynatma başladığında (otomatik veya manuel) ses ayarını uygula myPlayer.on('play', function() { console.log("Video 'play' olayı tetiklendi."); applyMuteSetting(myPlayer); }); // Sayfa yüklendiğinde veya yeni video geldiğinde otomatik oynatmayı dene if (currentSettings.autoPlay) { setTimeout(() => { // Oyuncunun tam hazır olması için biraz bekle attemptPlayWithRetries(myPlayer); }, 500); } else { // Otomatik oynatma kapalıysa bile, mevcut ses ayarını oyuncuya yansıt // Bu, sayfa yenilendiğinde veya yeni bir videoya geçildiğinde manuel oynatma için önemlidir. setTimeout(() => applyMuteSetting(myPlayer), 600); } if (currentSettings.playInBackground) { setupBackgroundPlayListeners(); } else { $(window).off('.uekscript'); // Arka plan dinleyicilerini kaldır } if (currentSettings.autoAdvanceNextVideo) { myPlayer.on('ended', function() { console.log("Video tamamlandı. Sonraki videoya geçilmeye çalışılıyor..."); const sonrakiVideoButonSeçicileri = [ 'button:contains("Sonraki Derse Geç")', 'a:contains("Sonraki Video")', '.uek-sonraki-buton-class', '#sonrakiVideoBtnID', '.btnSonraki', '.fa-step-forward', '.vjs-control.vjs-next-item', 'button[title*="Sonraki"]', 'a[title*="Sonraki"]', '.playerViewNextLessonButton', '.nextButton', '[data-plyr="next"]', // Plyr için '.skipControl__next', // Bazı platformlar ]; let sonrakiButon = null; for (const selector of sonrakiVideoButonSeçicileri) { try { let adayButon = $(selector + ":visible"); if (adayButon.length > 0) { sonrakiButon = adayButon.first(); console.log(`Sonraki video butonu bulundu (Seçici: ${selector}):`, sonrakiButon.text() || sonrakiButon.attr('title')); break; } } catch (e) { /* console.warn(`Seçici hatası: ${selector}`, e); */ } } if (sonrakiButon && sonrakiButon.length > 0) { console.log("Sonraki video butonuna tıklanıyor..."); sonrakiButon[0].click(); } else { console.warn("Sonraki video butonu bulunamadı. Lütfen 'sonrakiVideoButonSeçicileri' listesini kontrol edin veya manuel geçiş yapın."); } }); } } let mainIntervalTimer = 2000; // Ana interval zamanlayıcısı let mainInterval = setInterval(() => { // Oyuncu henüz yüklenmemişse veya metodları yoksa işlem yapma if (!myPlayer || typeof myPlayer.paused !== 'function' || typeof myPlayer.ended !== 'function') { return; } // Büyük oynat butonunu tıklama (eğer görünürse ve video duraklatılmışsa) // Bu, attemptPlayWithRetries başarısız olduktan sonra kullanıcıya yardımcı olabilir. if (currentSettings.autoPlay && myPlayer.paused() && !myPlayer.ended()) { var autoPlayButton = $('.vjs-big-play-button:visible'); if (autoPlayButton.length) { console.log("Büyük oynat butonu görünüyor ve video duraklatılmış, tıklanıyor (mainInterval)."); autoPlayButton.click(); // Tıkla ve sesi ayarla // applyMuteSetting(myPlayer); // click sonrası play event'i zaten halledecek } } if (currentSettings.autoConfirm) { var confirmButton = $(".swal-button--confirm:visible"); if (confirmButton.length) { console.log("Onay butonu bulundu (mainInterval), tıklanıyor..."); confirmButton.click(); } } }, mainIntervalTimer); function setupPageRefresh() { if (pageRefreshInterval) clearInterval(pageRefreshInterval); if (currentSettings.autoReload && currentSettings.reloadIntervalMinutes > 0) { console.log(`Otomatik sayfa yenileme ${currentSettings.reloadIntervalMinutes} dakika olarak ayarlandı.`); pageRefreshInterval = setInterval(function() { console.log(`Sayfa ${currentSettings.reloadIntervalMinutes} dakika sonra otomatik olarak yenilenecek.`); window.location.reload(true); }, currentSettings.reloadIntervalMinutes * 60 * 1000); } else { console.log("Otomatik sayfa yenileme devre dışı bırakıldı."); } } $(document).ready(function(){ // Ayarları en başta bir kez yükle currentSettings = loadSettings(); let playerCheckRetries = 0; const maxPlayerCheckRetries = 20; let playerCheckInterval = setInterval(function() { playerCheckRetries++; if (typeof videojs !== 'undefined' && videojs.getPlayer('CbikoPl')) { myPlayer = videojs.getPlayer('CbikoPl'); clearInterval(playerCheckInterval); console.log("Video.js oyuncusu bulundu: CbikoPl"); initializePlayerInteractions(); // Oyuncu bulunduktan sonra etkileşimleri başlat } else if (playerCheckRetries >= maxPlayerCheckRetries) { clearInterval(playerCheckInterval); console.warn("Video.js oyuncusu 'CbikoPl' belirtilen sürede bulunamadı."); } }, 500); setupPageRefresh(); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址