सामग्री पर जाएँ

"प्रयोगकर्ता:Suyash.dwivedi/Common.js" के अवतरणसभमे अन्तर

मैथिली विकिपिडियासँ, एक मुक्त विश्वकोश
Content deleted Content added
' //Sound Notification Gadget for Recent Changes $(document).ready(function() { var lastChangeId = 0; // Store last change ID var checkInterval = 30000; // Check every 30 seconds var sound = new Audio('https://suyashdwivedi.github.io/beep.mp3'); // Replace with your sound file URL function checkForChanges() { $.get('/api.php?action=query&list=recentchanges&rcprop=timestamp|title|userid|user&rcstartid=' + las...'सँग नव पन्ना बनाएल गेल
 
No edit summary
पङ्क्त्ति ४: पङ्क्त्ति ४:
var lastChangeId = 0; // Store last change ID
var lastChangeId = 0; // Store last change ID
var checkInterval = 30000; // Check every 30 seconds
var checkInterval = 30000; // Check every 30 seconds
var sound = new Audio('https://suyashdwivedi.github.io/beep.mp3'); // Replace with your sound file URL
var sound = new Audio('File:Beep 400ms.ogg'); // Replace with your sound file URL


function checkForChanges() {
function checkForChanges() {

अन्तिम परिवर्तन २२:१२, २७ सितम्बर २०२४

//Sound Notification Gadget for Recent Changes
$(document).ready(function() {
    var lastChangeId = 0; // Store last change ID
    var checkInterval = 30000; // Check every 30 seconds
    var sound = new Audio('File:Beep 400ms.ogg'); // Replace with your sound file URL

    function checkForChanges() {
        $.get('/api.php?action=query&list=recentchanges&rcprop=timestamp|title|userid|user&rcstartid=' + lastChangeId + '&rclimit=1&format=json', function(data) {
            if (data.query.recentchanges.length > 0) {
                // Get the most recent change
                var recentChange = data.query.recentchanges[0];
                lastChangeId = recentChange.rcid; // Update last change ID
                
                // Play notification sound
                sound.play();
                
                // Optionally, display an alert or log the change
                console.log('Recent change detected: ' + recentChange.title + ' by ' + recentChange.user);
            }
        });
    }

    // Start checking for changes at defined intervals
    setInterval(checkForChanges, checkInterval);
});