PageSourceSearch

https://riadalsaliheen.com/wp-content/plugins/site-custom-functions/custom-slider/scripts.js?ver=1789192420

js riadalsaliheen.com collected 2026-10-02 00:32:58 UTC 4,164 bytes, 136 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2    let currentAudio = null;
3    let currentButton = null;
4
5    function resetCurrentButton() {
6        if (currentButton) {
7            currentButton.innerHTML = '<i class="fas fa-play"></i> تشغيل';
8        }
9    }
10
11    function toggleAudio(button) {
12        const audioUrl = button.getAttribute("data-url");
13        const title = button.getAttribute("data-title") || "";
14        const artist = button.getAttribute("data-artist") || "";
15
16        if (!audioUrl) {
17            return;
18        }
19
20        if (currentAudio && currentButton === button && !currentAudio.paused) {
21            currentAudio.pause();
22            resetCurrentButton();
23            return;
24        }
25
26        if (currentAudio) {
27            currentAudio.pause();
28            resetCurrentButton();
29        }
30
31        currentAudio = new Audio(audioUrl);
32        currentButton = button;
33
34        currentAudio.play().then(function () {
35            button.innerHTML = '<i class="fas fa-pause"></i> إيقاف';
36        }).catch(function () {
37            resetCurrentButton();
38        });
39
40        currentAudio.onended = resetCurrentButton;
41
42        if ("mediaSession" in navigator && typeof MediaMetadata !== "undefined") {
43            navigator.mediaSession.metadata = new MediaMetadata({
44                title: title,
45                artist: artist,
46                artwork: [{
47                    src: "https://riadalsaliheen.com/wp-content/uploads/2023/11/جديد-الدروس-والمحاضرات-المسجلة-150x150-1.png",
48                    sizes: "512x512",
49                    type: "image/png"
50                }]
51            });
52        }
53    }
54
55    function downloadAudio(audioUrl) {
56        if (!audioUrl) {
57            return;
58        }
59
60        const link = document.createElement("a");
61        link.href = audioUrl;
62        link.setAttribute("download", "audio-file.mp3");
63        document.body.appendChild(link);
64        link.click();
65        document.body.removeChild(link);
66    }
67
68    function copyAudioLink(audioUrl) {
69        if (!audioUrl) {
70            return;
71        }
72
73        navigator.clipboard.writeText(audioUrl).then(function () {
74            alert("تم نسخ الرابط!");
75        });
76    }
77
78    function shareAudio(audioUrl) {
79        if (!audioUrl) {
80            return;
81        }
82
83        if (navigator.share) {
84            navigator.share({
85                title: "استمع إلى هذا المقطع",
86                url: audioUrl
87            });
88            return;
89        }
90
91        copyAudioLink(audioUrl);
92    }
93
94    document.addEventListener("click", function (event) {
95        const playButton = event.target.closest(".audio-play-button");
96        if (playButton) {
97            event.preventDefault();
98            toggleAudio(playButton);
99            return;
100        }
101
102        const copyButton = event.target.closest(".copy-btn");
103        if (copyButton) {
104            event.preventDefault();
105            copyAudioLink(copyButton.getAttribute("data-url"));
106            return;
107        }
108
109        const shareButton = event.target.closest(".share-btn");
110        if (shareButton) {
111            event.preventDefault();
112            shareAudio(shareButton.getAttribute("data-url"));
113            return;
114        }
115
116        const downloadButton = event.target.closest(".audiosrxv-download-btn");
117        if (downloadButton) {
118            event.preventDefault();
119            downloadAudio(downloadButton.getAttribute("data-url") || downloadButton.href);
120            return;
121        }
122
123        const tabButton = event.target.closest(".tab-button");
124        if (tabButton) {
125            const target = tabButton.getAttribute("data-target");
126            if (!target || !document.getElementById(target)) {
127                return;
128            }
129
130            document.querySelectorAll(".tab-content").forEach(tab => tab.classList.remove("active"));
131            document.querySelectorAll(".tab-button").forEach(btn => btn.classList.remove("active"));
132            document.getElementById(target).classList.add("active");
133            tabButton.classList.add("active");
134        }
135    });
136});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.