PageSourceSearch

https://moust-kan.ru/local/templates/moust-kan/js/blind.js

js moust-kan.ru collected 2026-10-02 22:04:41 UTC 12,441 bytes, 322 lines download raw bytes

1$(function() {
2      $('.blind-trigger').blindWorkaround();  
3
4
5
6});
7
8(function($) {
9
10   $.fn.blindWorkaround = function(options) {
11      var siteTitle = $('.site-title');
12      return this.each(function() {
13         var cont = $(this),
14            o = $.extend({}, $.fn.blindWorkaround.defaults, options, cont.data('blindWorkaround')),
15            b = $('body'),
16            header = siteTitle.length > 0 ? siteTitle : $('body'),
17            blindLine = '<div class="blind-line hidden">' +
18               '<div class="inner work clerfix">' +
19               '<div class="contrast-control">' +//color
20                    '<span >Цветовая гамма</span>' +
21               '<a href="#" class="black-and-white ">Аа</a>' +
22               '<a href="#" class="white-and-black">Аа</a>' +
23                    '<a href="#" class="black-and-blue">Аа</a>' +
24                    '<a href="#" class="brown-and-beige">Аа</a>' +
25                    '<a href="#" class="green-and-brown">Аа</a>' +
26               '</div>' +//color                                        
27                    
28                    '<div class="spacing-control">' +//space
29                    '<span >Кернинг</span>' +
30               '<a href="#" class="space_s">А а а</a>' +
31               '<a href="#" class="space_m">А а а</a>' +
32               '<a href="#" class="space_l">А а а</a>' +
33               '</div>' +//space
34                    
35                    '<div class="img-control">' +//img
36                    '<span >Изображения</span>' +
37               '<p class="img_on" onclick="Img(1)"></p>' +
38               '<p class="img_gray" onclick="Img(2)"></p>' +
39               '<p class="imgoff" onclick="Img(3)"></p>' +
40               '</div>' +//img
41                    
42                    '<div class="speech-control">' +//mute
43                    '<span >Голосовая озвучка текста</span>' +
44                    '<div class="text-to-speech " id="text-to-speech" onclick="Mute()" title="Озвучка текста">'+//mute
45                    '<div class="switch"></div>' +
46                    '</div>' +
47                    '</div>' +//mute
48                    
49               '<div class="size-control">' +//size
50                    '<span >Размер</span>' +
51               '<a href="#" class="font_s">Аа</a>' +
52               '<a href="#" class="font_m">Аа</a>' +
53               '<a href="#" class="font_l">Аа</a>' +
54               '</div>' +//size
55                    
56                    '<div class="interval-control">' +//interval
57                    '<span >Интервал</span>' +
58               '<a href="#" class="interval_s">Мал.</a>' +
59               '<a href="#" class="interval_m">Сред.</a>' +
60               '<a href="#" class="interval_l">Бол.</a>' +
61               '</div>' +//interval
62                    
63                    '<div class="family-control">' +//family
64                    '<span >Шрифт</span>' +
65               '<a href="#" class="roman">Times NR</a>' +
66                    '<a href="#" class="arial">Arial</a>' +
67               '</div>' +//family
68                    
69                    '<div class="get-reset">' +//reset               
70               '<a href="#" onclick="blindReset()">Сброс настроек</a>' +
71               '</div>' +//reset 
72                    
73               '<div class="get-back">' +//back             
74               '<a href="#">Обычная версия</a>' +
75               '</div>' +//back                  
76 "<script data-b24-form='click/19/8ikxu9' data-skip-moving='true'>(function(w,d,u){var s=d.createElement('script');s.async=true;s.src=u+'?'+(Date.now()/180000|0);var h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);})(window,document,'https://24.rizon.pro/upload/crm/form/loader_19_8ikxu9.js');</script>"
77                +  
78               '<p class="b24-web-form-popup-btn-19 rizon-srm">Установить на свой сайт</p>' +                                                            
79                    '</div>' +
80               '</div>',
81            blindLinks, getBack,
82            defaultClasses = 'black-and-white font_s';
83
84         init();
85         function init() {
86            prepareBlindLine();
87            bindTriggers();
88            checkLocal();
89         };
90
91         function prepareBlindLine() {
92            header.prepend($(blindLine));
93            blindLine = $('.blind-line');
94            getBack = $('.get-back a', blindLine);
95            blindLinks = $('a', blindLine).not(getBack);
96         };
97
98         function bindTriggers() {
99            cont
100               .off('click.turnonblind')
101               .on('click.turnonblind', function(e) {
102                  e.preventDefault();
103                  if (b.hasClass('blindOn')) {
104                     hideBlindLine();
105                     saveLocal();
106                  } else {
107                     showBlindLine(true);
108                     saveLocal();
109                  }
110               });
111
112            getBack
113               .off('click.turnoffblind')
114               .on('click.turnoffblind', function(e) {
115                  e.preventDefault();
116                  if (b.hasClass('blindOn')) {
117                     hideBlindLine();
118                     saveLocal();
119                  }
120               });
121
122            blindLinks
123               .off('click.triggerClass')
124               .on('click.triggerClass', function(e) {
125                  e.preventDefault();
126                  el = $(this);
127                  el.siblings().removeClass('active').each(function() {
128                     b.removeClass($(this).attr('class'));
129                  });
130                  b.addClass(el.attr('class'));
131                  el.addClass('active');
132                  saveLocal();
133               });
134         };
135
136         function showBlindLine(defaultRun) {
137            b.addClass('blindOn');
138            if (defaultRun) {
139               b.addClass(defaultClasses);
140            }
141            blindLine.removeClass('hidden');
142            if (x==1) { $("#text-to-speech").addClass('text-to-speech-on');}
143         };
144
145         function hideBlindLine() {
146            var classes = '';
147            blindLinks.each(function() {
148               classes += $(this).attr('class') + ' ';
149            });
150            b.removeClass('blindOn');
151            b.removeClass(classes);
152            blindLine.addClass('hidden');
153              var trigger = localStorage.getItem("trigger");
154              localStorage.setItem("trigger", 0);
155              $("body").removeClass("imgoff");
156              $("body").removeClass("img_gray");
157              $('.img-alt').remove();
158            $(document).mouseup(function (e){ // attach the mouseup event for all div and pre tags
159      setTimeout(function() { // When clicking on a highlighted area, the value stays highlighted until after the mouseup event, and would therefore stil be captured by getSelection. This micro-timeout solves the issue. 
160         responsiveVoice.cancel(); // stop anything currently being spoken
161 //speak the text as returned by getSelectionText
162     
163      }, 0);
164   });
165
166
167  $('a').mouseenter(function() { // Attach this function to all mouseenter events for 'a' tags 
168  responsiveVoice.cancel(); // Cancel anything else that may currently be speaking
169 
170    });
171     
172       $("#text-to-speech").removeClass('text-to-speech-on');
173        x=0;  
174        localStorage.setItem("x", x);
175         };
176
177         function saveLocal() {
178            localStorage.setItem('bodyClasses', b.attr('class'));
179         };
180
181         function checkLocal() {
182            var classes = localStorage.getItem('bodyClasses');
183            if (classes) {
184               b.addClass(classes);
185               if (classes.indexOf('blindOn') > -1) {
186                  showBlindLine();
187               }
188               for (var i = 0; i < classes.split(' ').length; i++) {
189                  $('.' + classes.split(' ')[i]).addClass('active');
190               }
191            }
192         };
193
194      });
195
196   };
197
198   $.fn.blindWorkaround.defaults = {
199
200   };
201
202
203
204})(jQuery);
205
206   jQuery(document).ready(function() {
207        var trigger = localStorage.getItem("trigger");
208            var blindImg = localStorage.getItem("blindImg");
209                if (trigger == 1) { 
210                   
211                    if (blindImg == "imgoff") {
212                        $("body").addClass("imgoff");
213                        $("body").removeClass("img_gray");
214                        $(".imgoff").addClass("active");
215                        $('img').each(function () {
216                           $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
217                     })
218                  }
219                  if (blindImg == "img_gray") {
220                        $("body").addClass("img_gray");
221                        $("body").removeClass("imgoff");
222                        $(".img_gray").addClass("active");
223                  }
224                }
225
226    });
227
228     function Img(el){
229        var blindImg = localStorage.getItem("blindImg");
230            if (el==3) {
231                $("body").addClass("imgoff");
232                $(".imgoff").addClass("active");
233                   if (blindImg != "imgoff"){
234                      $('img').each(function () {
235                        $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
236                      })
237                   }
238                localStorage.setItem("blindImg", "imgoff");
239
240                   $("body").removeClass("img_gray");
241                   $("body").removeClass("img_on");
242                   $(".img_on").removeClass("active");
243                   $(".img_gray").removeClass("active");
244            }
245            if (el==2) {
246                $("body").addClass("img_gray");
247                $(".img_gray").addClass("active");
248
249                localStorage.setItem("blindImg", "img_gray");
250
251                   $("body").removeClass("img_on");
252                   $("body").removeClass("imgoff");
253                   $(".img_on").removeClass("active");
254                   $(".imgoff").removeClass("active");
255                   $('.img-alt').remove();
256                  
257            }
258            if (el==1) {
259                $("body").addClass("img_on");
260                $(".img_on").addClass("active");
261         
262                localStorage.setItem("blindImg", "img_on");
263
264                   $("body").removeClass("img_gray");
265                   $("body").removeClass("imgoff");
266                   $(".img_gray").removeClass("active");
267                   $(".imgoff").removeClass("active");
268                   $('.img-alt').remove();
269                   
270            }
271
272    }
273    
274
275
276     $(".blind-trigger").click(function () {
277        var trigger = localStorage.getItem("trigger");
278        var blindImg = localStorage.getItem("blindImg");
279            if (trigger == 0) { 
280                localStorage.setItem("trigger", 1);
281                if (blindImg == "imgoff") {
282                    $("body").addClass("imgoff");
283                    $(".imgoff").addClass("active");
284                    $('img').each(function () {
285                      $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
286                    })
287                }
288            }
289            if (trigger == 1) {
290                 localStorage.setItem("trigger", 0);
291                 $("body").removeClass("imgoff");
292                 $('.img-alt').remove();
293            }
294            else{
295                 localStorage.setItem("trigger", 1);
296            }
297        });
298     
299      /*
300      $(".get-back > a").click(function () {
301                 var trigger = localStorage.getItem("trigger");
302		         $("body").removeClass("imgoff");
303		         $("body").removeClass("img_gray");
304		         $('.img-alt').remove();
305		         localStorage.setItem("trigger", 0);
306        });
307*/
308
309
310    function blindReset(){
311      var blindImg = localStorage.getItem("blindImg");
312	      $("body").removeClass("imgoff");
313	      $("body").removeClass("img_gray");
314	      $('.img-alt').remove();
315	      localStorage.setItem("blindImg", "");
316
317	  var bodyClasses = localStorage.getItem("bodyClasses");
318	  	  $("body").removeClass();
319	  	  $("body").addClass("blindOn black-and-white font_l");
320	  	  localStorage.removeItem("bodyClasses");
321	  	  localStorage.setItem("bodyClasses", "blindOn black-and-white font_l");
322    }

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.