PageSourceSearch

https://nrpk.info/templates/beez_20/js/blind.js

js nrpk.info collected 2026-10-03 01:53:28 UTC 12,417 bytes, 320 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               '<p class="b24-web-form-popup-btn-19 rizon-srm">Установить на свой сайт</p>' +                                                            
77                    '</div>' +
78               '</div>',
79            blindLinks, getBack,
80            defaultClasses = 'black-and-white font_l';
81
82         init();
83         function init() {
84            prepareBlindLine();
85            bindTriggers();
86            checkLocal();
87         };
88
89         function prepareBlindLine() {
90            header.prepend($(blindLine));
91            blindLine = $('.blind-line');
92            getBack = $('.get-back a', blindLine);
93            blindLinks = $('a', blindLine).not(getBack);
94         };
95
96         function bindTriggers() {
97            cont
98               .off('click.turnonblind')
99               .on('click.turnonblind', function(e) {
100                  e.preventDefault();
101                  if (b.hasClass('blindOn')) {
102                     hideBlindLine();
103                     saveLocal();
104                  } else {
105                     showBlindLine(true);
106                     saveLocal();
107                  }
108               });
109
110            getBack
111               .off('click.turnoffblind')
112               .on('click.turnoffblind', function(e) {
113                  e.preventDefault();
114                  if (b.hasClass('blindOn')) {
115                     hideBlindLine();
116                     saveLocal();
117                  }
118               });
119
120            blindLinks
121               .off('click.triggerClass')
122               .on('click.triggerClass', function(e) {
123                  e.preventDefault();
124                  el = $(this);
125                  el.siblings().removeClass('active').each(function() {
126                     b.removeClass($(this).attr('class'));
127                  });
128                  b.addClass(el.attr('class'));
129                  el.addClass('active');
130                  saveLocal();
131               });
132         };
133
134         function showBlindLine(defaultRun) {
135            b.addClass('blindOn');
136            if (defaultRun) {
137               b.addClass(defaultClasses);
138            }
139            blindLine.removeClass('hidden');
140            if (x==1) { $("#text-to-speech").addClass('text-to-speech-on');}
141         };
142
143         function hideBlindLine() {
144            var classes = '';
145            blindLinks.each(function() {
146               classes += $(this).attr('class') + ' ';
147            });
148            b.removeClass('blindOn');
149            b.removeClass(classes);
150            blindLine.addClass('hidden');
151              var trigger = localStorage.getItem("trigger");
152              localStorage.setItem("trigger", 0);
153              $("body").removeClass("imgoff");
154              $("body").removeClass("img_gray");
155              $('.img-alt').remove();
156            $(document).mouseup(function (e){ // attach the mouseup event for all div and pre tags
157      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. 
158         responsiveVoice.cancel(); // stop anything currently being spoken
159 //speak the text as returned by getSelectionText
160     
161      }, 0);
162   });
163
164
165  $('a').mouseenter(function() { // Attach this function to all mouseenter events for 'a' tags 
166  responsiveVoice.cancel(); // Cancel anything else that may currently be speaking
167 
168    });
169     
170       $("#text-to-speech").removeClass('text-to-speech-on');
171        x=0;  
172        localStorage.setItem("x", x);
173         };
174
175         function saveLocal() {
176            localStorage.setItem('bodyClasses', b.attr('class'));
177         };
178
179         function checkLocal() {
180            var classes = localStorage.getItem('bodyClasses');
181            if (classes) {
182               b.addClass(classes);
183               if (classes.indexOf('blindOn') > -1) {
184                  showBlindLine();
185               }
186               for (var i = 0; i < classes.split(' ').length; i++) {
187                  $('.' + classes.split(' ')[i]).addClass('active');
188               }
189            }
190         };
191
192      });
193
194   };
195
196   $.fn.blindWorkaround.defaults = {
197
198   };
199
200
201
202})(jQuery);
203
204   jQuery(document).ready(function() {
205        var trigger = localStorage.getItem("trigger");
206            var blindImg = localStorage.getItem("blindImg");
207                if (trigger == 1) { 
208                   
209                    if (blindImg == "imgoff") {
210                        $("body").addClass("imgoff");
211                        $("body").removeClass("img_gray");
212                        $(".imgoff").addClass("active");
213                        $('img').each(function () {
214                           $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
215                     })
216                  }
217                  if (blindImg == "img_gray") {
218                        $("body").addClass("img_gray");
219                        $("body").removeClass("imgoff");
220                        $(".img_gray").addClass("active");
221                  }
222                }
223
224    });
225
226     function Img(el){
227        var blindImg = localStorage.getItem("blindImg");
228            if (el==3) {
229                $("body").addClass("imgoff");
230                $(".imgoff").addClass("active");
231                   if (blindImg != "imgoff"){
232                      $('img').each(function () {
233                        $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
234                      })
235                   }
236                localStorage.setItem("blindImg", "imgoff");
237
238                   $("body").removeClass("img_gray");
239                   $("body").removeClass("img_on");
240                   $(".img_on").removeClass("active");
241                   $(".img_gray").removeClass("active");
242            }
243            if (el==2) {
244                $("body").addClass("img_gray");
245                $(".img_gray").addClass("active");
246
247                localStorage.setItem("blindImg", "img_gray");
248
249                   $("body").removeClass("img_on");
250                   $("body").removeClass("imgoff");
251                   $(".img_on").removeClass("active");
252                   $(".imgoff").removeClass("active");
253                   $('.img-alt').remove();
254                  
255            }
256            if (el==1) {
257                $("body").addClass("img_on");
258                $(".img_on").addClass("active");
259         
260                localStorage.setItem("blindImg", "img_on");
261
262                   $("body").removeClass("img_gray");
263                   $("body").removeClass("imgoff");
264                   $(".img_gray").removeClass("active");
265                   $(".imgoff").removeClass("active");
266                   $('.img-alt').remove();
267                   
268            }
269
270    }
271    
272
273
274     $(".blind-trigger").click(function () {
275        var trigger = localStorage.getItem("trigger");
276        var blindImg = localStorage.getItem("blindImg");
277            if (trigger == 0) { 
278                localStorage.setItem("trigger", 1);
279                if (blindImg == "imgoff") {
280                    $("body").addClass("imgoff");
281                    $(".imgoff").addClass("active");
282                    $('img').each(function () {
283                      $(this).after($('<span class="img-alt">').html($(this).attr('alt')));
284                    })
285                }
286            }
287            if (trigger == 1) {
288                 localStorage.setItem("trigger", 0);
289                 $("body").removeClass("imgoff");
290                 $('.img-alt').remove();
291            }
292            else{
293                 localStorage.setItem("trigger", 1);
294            }
295        });
296     
297      /*
298      $(".get-back > a").click(function () {
299                 var trigger = localStorage.getItem("trigger");
300		         $("body").removeClass("imgoff");
301		         $("body").removeClass("img_gray");
302		         $('.img-alt').remove();
303		         localStorage.setItem("trigger", 0);
304        });
305*/
306
307
308    function blindReset(){
309      var blindImg = localStorage.getItem("blindImg");
310	      $("body").removeClass("imgoff");
311	      $("body").removeClass("img_gray");
312	      $('.img-alt').remove();
313	      localStorage.setItem("blindImg", "");
314
315	  var bodyClasses = localStorage.getItem("bodyClasses");
316	  	  $("body").removeClass();
317	  	  $("body").addClass("blindOn black-and-white font_l");
318	  	  localStorage.removeItem("bodyClasses");
319	  	  localStorage.setItem("bodyClasses", "blindOn black-and-white font_l");
320    }

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.