PageSourceSearch

https://clearway.pro/vefovi/ln.js

js clearway.pro collected 2026-10-09 21:59:28 UTC 19,937 bytes, 402 lines download raw bytes

1// Делаем куки
2function setCookie(name, value, options) {
3    options = options || {};
4    var expires = options.expires;
5    if (typeof expires === "number" && expires) {
6        var d = new Date();
7        d.setTime(d.getTime() + expires * 864e5);
8        expires = options.expires = d;
9    }
10    if (expires && expires.toUTCString) {
11        options.expires = expires.toUTCString();
12    }
13
14    value = encodeURIComponent(value);
15    var updatedCookie = name + "=" + value;
16    for (var propName in options) {
17        updatedCookie += "; " + propName;
18        var propValue = options[propName];
19        if (propValue !== true) {
20            updatedCookie += "=" + propValue;
21        }
22    }
23    document.cookie = updatedCookie;
24}
25
26// Получаем куки
27function getCookie(name) {
28    var value = "; " + document.cookie;
29    var parts = value.split("; " + name + "=");
30    if (parts.length == 2) return decodeURIComponent(parts.pop().split(";").shift());
31}
32
33// Удаляем куки (функция не работает, удаление куки идет через setCookie() на строке 129)
34function removeCookie(name) {
35    setCookie(name, "", {
36        expires: -1
37    });
38}
39
40// Функция удаления подстановочного знака класса
41function removeClassWild(element, mask) {
42    var re = mask.replace(/\*/g, "\\S+");
43    var cls = element.className.match(new RegExp("\\b" + re + "", "g"));
44    if (cls) {
45        cls.forEach(function(c) {
46            element.classList.remove(c);
47        });
48    }
49}
50
51// Инициализация всего
52var special = {
53    Reset: function() {
54        special.active = 1;
55        special.color = 1;
56        special.font_family = 1;
57        special.font_size = 1;
58        special.line_height = 1;
59        special.letter_spacing = 1;
60        special.images = 1;
61        setCookie("special", JSON.stringify(special), {
62            path: "/"
63        });
64    },
65    Set: function() {
66        var html = document.querySelector("html");
67        html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-")));
68        html.classList.add("special-color-" + special.color);
69        html.classList.add("special-font-size-" + special.font_size);
70        html.classList.add("special-font-family-" + special.font_family);
71        html.classList.add("special-line-height-" + special.line_height);
72        html.classList.add("special-letter-spacing-" + special.letter_spacing);
73        html.classList.add("special-images-" + special.images);
74
75        var buttons = document.querySelectorAll("#special button");
76        buttons.forEach(button => button.classList.remove("active"));
77
78        var colorButton = document.querySelector(".special-color button[value=\"" + special.color + "\"]");
79        if (colorButton) colorButton.classList.add("active");
80
81        var fontSizeButton = document.querySelector(".special-font-size button[value=\"" + special.font_size + "\"]");
82        if (fontSizeButton) fontSizeButton.classList.add("active");
83
84        var fontFamilyButton = document.querySelector(".special-font-family button[value=\"" + special.font_family + "\"]");
85        if (fontFamilyButton) fontFamilyButton.classList.add("active");
86
87        var lineHeightButton = document.querySelector(".special-line-height button[value=\"" + special.line_height + "\"]");
88        if (lineHeightButton) lineHeightButton.classList.add("active");
89
90        var letterSpacingButton = document.querySelector(".special-letter-spacing button[value=\"" + special.letter_spacing + "\"]");
91        if (letterSpacingButton) letterSpacingButton.classList.add("active");
92
93        var imagesButton = document.querySelector(".special-images button");
94        if (imagesButton) imagesButton.value = special.images;
95
96        special.ToggleImages();
97        setCookie("special", JSON.stringify(special), {
98            path: "/"
99        });
100    },
101    ToggleImages: function() {
102        var images = document.querySelectorAll("img");
103        images.forEach(img => {
104            if (special.images) {
105                if (img.dataset.src) img.src = img.dataset.src;
106                if (img.dataset.srcset) img.srcset = img.dataset.srcset;
107            } else {
108                img.dataset.src = img.src;
109                if (img.srcset) img.dataset.srcset = img.srcset;
110                img.removeAttribute("src");
111                if (img.srcset) img.removeAttribute("srcset");
112            }
113        });
114    },
115    Off: function() {
116        var html = document.querySelector("html");
117        html.classList.remove("special");
118        if (document.querySelector('link[href="/vefovi/special.min.css"]')) {
119          document.querySelector('link[href="/vefovi/special.min.css"]').remove();
120        }
121        removeClassWild(html, "special-*");
122        var audioElements = document.querySelectorAll("i.special-audio, audio");
123        audioElements.forEach(element => element.remove());
124        if (responsiveVoice && responsiveVoice.isPlaying()) responsiveVoice.cancel();
125        var specialButton = document.querySelector("#specialButton");
126        if (specialButton) {
127            specialButton.style.display = 'block';
128            //removeCookie("special");
129            setCookie("special", "", {
130                path: "/"
131            });
132        } else {
133            var userAgent = navigator.userAgent;
134            if (userAgent.indexOf("MSIE ") >= 0) {
135                var url = window.location.href;
136                if (url.indexOf("template=") >= 0) {
137                    window.location.href = url.replace(/template=\d+/g, "template=0");
138                } else {
139                    window.location.href = url + "?template=0";
140                }
141            } else {
142                fetch(window.location.origin + window.location.pathname, {
143                    method: 'POST',
144                    headers: {
145                        'Content-Type': 'application/x-www-form-urlencoded'
146                    },
147                    body: 'template=0'
148                }).then(() => {
149                    window.location.href = window.location.origin + window.location.pathname;
150                });
151            }
152        }
153    },
154    On: function() {
155        var head = document.querySelector("head");
156        var link = document.createElement("link");
157        link.rel = "stylesheet";
158        link.href = "/vefovi/special.min.css";
159        head.appendChild(link);
160
161        if (!special.active) special.Reset();
162
163        var specialButton = document.querySelector("#specialButton");
164        if (specialButton) {
165            special.active = 1;
166            setCookie("special", JSON.stringify(special), {
167                path: "/"
168            });
169            specialButton.style.display = 'none';
170        }
171
172        var html = document.querySelector("html");
173        html.classList.add("special");
174
175        var specialPanel = document.createElement("div");
176        specialPanel.innerHTML = `
177            <div id="special">
178                <div class="special-panel">
179                    <div class="special-font-size"><span>Шрифт:</span>
180                        <button title="Маленький шрифт" value="1"><i>A</i></button>
181                        <button title="Средний шрифт" value="2"><i>A</i></button>
182                        <button title="Большой шрифт" value="3"><i>A</i></button>
183                    </div>
184                    <div class="special-color"><span>Цвет:</span>
185                        <button title="Цвет черным по белому" value="1"><i>Ц</i></button>
186                        <button title="Цвет белым по черному" value="2"><i>Ц</i></button>
187                        <button title="Цвет синим по голубому" value="3"><i>Ц</i></button>
188                    </div>
189                    <div class="special-images"><span>Изображения:</span>
190                        <button title="Выключить/включить изображения"><i></i></button>
191                    </div>
192                    <div class="special-audio"><span>Звук:</span>
193                        <button title="Включить/выключить воспроизведение текста" value="0"><i></i></button>
194                    </div>
195                    <div class="special-settings"><span>Настройки:</span>
196                        <button title="Дополнительные настройки"><i></i></button>
197                    </div>
198                    <div class="special-quit"><span>Обычная версия:</span>
199                        <button title="Обычная версия сайта"><i></i></button>
200                    </div>
201                </div>
202                <div id="special-settings-body">
203                    <hr/>
204                    <h2>Настройки шрифта:</h2>
205                    <div class="special-font-family"><span>Выберите шрифт:</span>
206                        <button value="1"><i>Arial</i></button>
207                        <button value="2"><i>Times</i></button>
208                    </div>
209                    <div class="special-letter-spacing"><span>Интервал между буквами (<em>Кернинг</em>):</span>
210                        <button value="1"><i>Стандартный</i></button>
211                        <button value="2"><i>Средний</i></button>
212                        <button value="3"><i>Большой</i></button>
213                    </div>
214                    <div class="special-line-height"><span>Интервал между строками:</span>
215                        <button value="1"><i>Стандартный<br/>интервал</i></button>
216                        <button value="2"><i>Полуторный<br/>интервал</i></button>
217                        <button value="3"><i>Двойной<br/>интервал</i></button>
218                    </div>
219                    <h2>Выбор цветовой схемы:</h2>
220                    <div class="special-color">
221                        <button value="1"><i>Черным<br/>по белому</i></button>
222                        <button value="2"><i>Белым<br/>по черному</i></button>
223                        <button value="3"><i>Темно-синим<br/>по голубому</i></button>
224                        <button value="4"><i>Коричневым<br/>по бежевому</i></button>
225                        <button value="5"><i>Зеленым<br/>по темно-коричневому</i></button>
226                    </div>
227                    <hr/>
228                    <div class="special-reset"><button>
228<i>Параметры по умолчанию</i></button></div>
229                    <div class="special-settings-close"><button><i>Закрыть</i></button></div>
230                    <div class="avtor"><a href="https://` + location.hostname + `" target="_blank">` + location.hostname + `</a></div>
231                </div>
232            </div>
233        `;
234        document.body.prepend(specialPanel);
235
236        special.Set();
237
238        // Обработка нажатий на функциональные кнопки
239        var buttons = document.querySelectorAll("#special button");
240        buttons.forEach(button => {
241            button.addEventListener("click", function() {
242                var parent = this.parentNode.className.replace("special-", "");
243                if (parent) {
244                    var buttons = document.querySelectorAll("#special .special-" + parent + " button");
245                    buttons.forEach(button => button.classList.remove("active"));
246
247                    switch (parent) {
248                        case "color":
249                            special.color = parseInt(this.value);
250                            this.classList.add("active");
251                            html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-color-")));
252                            html.classList.add("special-color-" + this.value);
253                            setCookie("special", JSON.stringify(special), {
254                                path: "/"
255                            });
256                            break;
257                        case "font-size":
258                            special.font_size = parseInt(this.value);
259                            this.classList.add("active");
260                            html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-font-size-")));
261                            html.classList.add("special-font-size-" + this.value);
262                            setCookie("special", JSON.stringify(special), {
263                                path: "/"
264                            });
265                            break;
266                        case "font-family":
267                            special.font_family = parseInt(this.value);
268                            this.classList.add("active");
269                            html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-font-family-")));
270                            html.classList.add("special-font-family-" + this.value);
271                            setCookie("special", JSON.stringify(special), {
272                                path: "/"
273                            });
274                            break;
275                        case "line-height":
276                            special.line_height = parseInt(this.value);
277                            this.classList.add("active");
278                            html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-line-height-")));
279                            html.classList.add("special-line-height-" + this.value);
280                            setCookie("special", JSON.stringify(special), {
281                                path: "/"
282                            });
283                            break;
284                        case "letter-spacing":
285                            special.letter_spacing = parseInt(this.value);
286                            this.classList.add("active");
287                            html.classList.remove(...Array.from(html.classList).filter(cls => cls.startsWith("special-letter-spacing-")));
288                            html.classList.add("special-letter-spacing-" + this.value);
289                            setCookie("special", JSON.stringify(special), {
290                                path: "/"
291                            });
292                            break;
293                        case "images":
294                            special.images = special.images ? 0 : 1;
295                            this.value = special.images;
296                            special.ToggleImages();
297                            setCookie("special", JSON.stringify(special), {
298                                path: "/"
299                            });
300                            break;
301                        case "audio":
302                            if (this.value == 1) {
303                                var audioIcons = document.querySelectorAll("i.special-audio");
304                                audioIcons.forEach(icon => icon.remove());
305                                if (responsiveVoice && responsiveVoice.isPlaying()) responsiveVoice.cancel();
306                                var textElements = document.querySelectorAll("p,h1,h2,h3,h4,h5,h6,li,dt,dd,.audiotext");
307                                textElements.forEach(element => element.removeEventListener("mouseover", special.audioHandler));
308                                this.value = 0;
309                            } else {
310                                responsiveVoice.speak("Включено озвучивание текста.", "Russian Female");
311                                this.classList.add("active");
312                                this.value = 1;
313                                var textElements = document.querySelectorAll("p,h1,h2,h3,h4,h5,h6,li,dt,dd,.audiotext,a,b");
314                                textElements.forEach(element => element.addEventListener("mouseover", special.audioHandler));
315                            }
316                            break;
317                        case "settings":
318                            document.querySelector("#special-settings-body").style.display = 'block';
319                            break;
320                        case "settings-close":
321                            document.querySelector("#special-settings-body").style.display = 'none';
322                            break;
323                        case "reset":
324                            special.Reset();
325                            special.Set();
326                            document.querySelector("#special-settings-body").style.display = 'none';
327                            break;
328                        case "quit":
329                            special.Off();
330                            break;
331                    }
332                }
333            });
334        });
335
336        // Обработчик кнопок дополнительных настроек
337        document.querySelector(".special-settings button").addEventListener("click", function() {
338            document.querySelector("#special-settings-body").style.display = 'block';
339        });
340
341        // Close settings button handler
342        document.querySelector(".special-settings-close button").addEventListener("click", function() {
343            document.querySelector("#special-settings-body").style.display = 'none';
344        });
345
346        // Обработчик кнопки «Закрыть настройки»
347        document.querySelector(".special-reset button").addEventListener("click", function() {
348            special.Reset();
349            special.Set();
350            document.querySelector("#special-settings-body").style.display = 'none';
351        });
352
353        // Обработчик кнопки выхода из специального режима
354        document.querySelector(".special-quit button").addEventListener("click", function() {
355            special.Off();
356            document.getElementById("special").remove();
357        });
358    }
359};
360
361// Инициализировать специальный режим, если установлены куки
362var specialCookie = getCookie("special");
363if (specialCookie) {
364    specialc = JSON.parse(specialCookie);
365    if (specialc.active) special.On();
366}
367
368// Добавить прослушиватель событий для специальной кнопки
369var specialButton = document.querySelector("#specialButton");
370if (specialButton) {
371    specialButton.addEventListener("click", special.On);
372}
373
374// Адаптивная голосовая интеграция (упрощенная версия)
375if (typeof responsiveVoice !== "undefined") {
376    console.log("ResponsiveVoice already loaded");
377} else {
378    var responsiveVoice = {
379        speak: function(text, voice, params) {
380            var utterance = new SpeechSynthesisUtterance(text);
381            utterance.voice = window.speechSynthesis.getVoices().find(v => v.name === voice);
382            if (params) {
383                utterance.rate = params.rate || 1;
384                utterance.pitch = params.pitch || 1;
385                utterance.volume = params.volume || 1;
386            }
387            window.speechSynthesis.speak(utterance);
388        },
389        isPlaying: function() {
390            return window.speechSynthesis.speaking;
391        },
392        cancel: function() {
393            window.speechSynthesis.cancel();
394        }
395    };
396}
397
398// Обработчик звука для текстовых элементов
399special.audioHandler = function() {
400    if (responsiveVoice && responsiveVoice.isPlaying()) responsiveVoice.cancel();
401    responsiveVoice.speak(this.textContent.trim(), "Russian Female");
402};

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.