1/** 2 * @see http://stackoverflow.com/q/7616461/940217 3 * @return {number} 4 */ 5String.prototype.hashCode = function(){ 6 if (Array.prototype.reduce){ 7 return this.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0) >>> 0; 8 } 9 var hash = 0; 10 if (this.length === 0) return hash; 11 for (var i = 0; i < this.length; i++) { 12 var character = this.charCodeAt(i); 13 hash = ((hash<<5)-hash)+character; 14 hash = hash & hash; // Convert to 32bit integer 15 } 16 return hash >>> 0; 17} 18 19//work with calendar 20function explode( delimiter, string ) { // Split a string by string 21 var emptyArray = { 0: '' }; 22 if ( arguments.length != 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' ){return null;} 23 if ( delimiter === '' || delimiter === false || delimiter === null ){return false;} 24 if ( typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' ){return emptyArray;} 25 if ( delimiter === true ) {delimiter = '1';} 26 return string.toString().split ( delimiter.toString() ); 27} 28 29var showTooltips = function(){ 30 31 $('.masters_list li').each(function() { 32 var parent = $(this).parent().get(0); 33 34 $(this).hover(function() { 35 $(this).addClass('plus'); 36 }, 37 function() { 38 $(this).removeClass('plus'); 39 }); 40 41 var col = $('.masters_list li').length; 42 var colY = 5; 43 var colStr = Math.round(col/colY); 44 45 for (var i = 1; i <= colStr; i++) { 46 var numY = (i*colY); 47 var elt = $('.masters_list li').eq(numY); 48 } 49 }); 50} 51 52$(document).ready(function(){ 53 //datepicker 54 $("#datepicker").datepick({ 55 showOtherMonths: true, 56 selectOtherMonths: false, 57 changeMonth: false, 58 dateFormat: 'dd.mm.yyyy', 59 multiSelect: 3000, 60 monthsToShow: [2, 1], 61 multiSeparator: '; ', 62 minDate: new Date(), 63 prevText: '', 64 nextText: '', 65 todayText: 'РабоÑие дни' 66 }); 67 68 showTooltips(); 69 70 list('.all_masters li'); 71 72 73 $('.articles h3 span').each(function() { 74 $(this).parent().next('div.layer').css('display', 'none'); 75 $(this).bind('click', function() { 76 $(this).parent().next('div.layer').slideToggle('normal'); 77 }); 78 }); 79 80 selects('.customSelectWrap .assyst_menu'); 81 82//set today date on calendar 83var toDay = new Date(); 84//$("#workCalendar").datepick("setDate",toDay); 85//set today date on text 86var day = (toDay.getDate().toString().length == 1) ? "0"+toDay.getDate().toString() : toDay.getDate(); 87var month = (toDay.getMonth().toString().length == 1) ? "0"+(toDay.getMonth()+1).toString() : toDay.getMonth()+1; 88var year = toDay.getFullYear(); 89$("#getWorkCalendar").text(day+"."+month+"."+year); 90 91 92$("#workCalendar").datepick({ 93 dateFormat: 'dd.mm.yyyy', 94 minDate: new Date(), 95 defaultDate: new Date(), 96 selectDefaultDate: true, 97 prevText: '', 98 nextText: '', 99 todayText: '', 100 onSelect: function(date) { 101 var newDate = new Date(date.toString()); 102 var day = (newDate.getDate().toString().length == 1) ? "0"+newDate.getDate().toString() : newDate.getDate(); 103 var month = (newDate.getMonth().toString().length == 1) ? "0"+(newDate.getMonth()+1).toString() : newDate.getMonth()+1; 104 var year = newDate.getFullYear(); 105 106 $("#getWorkCalendar").text(day+"."+month+"."+year); 107 $("#wrkdayselected").text(day+"."+month+"."+year); 108 109 //show loader 110 111 112 $.post("/get_masters_on_date",{date: day+"."+month+"."+year, branch: 1},function(data){ 113 114 switch(data['status']){ 115 case "ok": 116 $("#masters_mainpage_list_luna").html(""); 117 $("#masters_mainpage_list_luna").html(data['html_list']); 118 // $("#masters_list_with_photos").html(data['html_list_with_photos']); 119 /* $(document.body).animate({ 'scrollTop': $('#wrkdayselected').offset().top - $('#floatingnavbar').height() }, 200); */ 120 // jump without animation: 121 /* $(document.body).scrollTop($('#wrkdayselected').offset().top - $('#floatingnavbar').height()); */ 122 // even simpler, but changes URL 123 /* location.hash = '#wrkdayselected'; */ 124 showTooltips(); 125 break; 126 case "err": 127 switch(data['msg']){ 128 case "nodata": 129 alert("ÐÑибка: не Ñказана даÑа."); 130 break; 131 case "empty": 132 // Temporary 133 alert("Ðа ÑказаннÑÑ Ð´Ð°ÑÑ ÑаÑпиÑÐ°Ð½Ð¸Ñ ÐµÑе неÑ."); 134 break; 135 default: 136 alert("ÐеизвеÑÑÐ½Ð°Ñ Ð¾Ñибка, обÑаÑиÑеÑÑ Ð¿Ð¾Ð¶Ð°Ð»ÑйÑÑа к админиÑÑÑаÑоÑÑ."); 137 break; 138 } 139 break; 140 } 141 },"json"); 142 143 $.post("/get_masters_on_date",{date: day+"."+month+"."+year, branch: 2},function(data){ 144 145 switch(data['status']){ 146 case "ok": 147 $("#masters_mainpage_list_parnas").html(""); 148 $("#masters_mainpage_list_parnas").html(data['html_list']); 149 // $("#masters_list_with_photos").html(data['html_list_with_photos']);
150 $(document.body).animate({ 'scrollTop': $('#wrkdayselected').offset().top - $('#floatingnavbar').height() }, 200); 151 // jump without animation: 152 /* $(document.body).scrollTop($('#wrkdayselected').offset().top - $('#floatingnavbar').height()); */ 153 // even simpler, but changes URL 154 /* location.hash = '#wrkdayselected'; */ 155 showTooltips(); 156 break; 157 case "err": 158 switch(data['msg']){ 159 case "nodata": 160 alert("ÐÑибка: не Ñказана даÑа."); 161 break; 162 case "empty": 163 // Temporary 164 alert("Ðа ÑказаннÑÑ Ð´Ð°ÑÑ ÑаÑпиÑÐ°Ð½Ð¸Ñ ÐµÑе неÑ."); 165 break; 166 default: 167 alert("ÐеизвеÑÑÐ½Ð°Ñ Ð¾Ñибка, обÑаÑиÑеÑÑ Ð¿Ð¾Ð¶Ð°Ð»ÑйÑÑа к админиÑÑÑаÑоÑÑ."); 168 break; 169 } 170 break; 171 } 172 },"json"); 173 174 } 175}); 176 177 178$("#getWorkCalendar").click(function(){ 179 $("#workCalendar").toggle(); 180}); 181 182$("#tellfriend input[name='email']").focus(function(){ 183 if($(this).val() == "ÐведиÑе e-mail дÑÑга"){ 184 $(this).val(""); 185 } 186}); 187 188$("#tellfriend input[name='email']").blur(function(){ 189 if($(this).val() == ""){ 190 $(this).val("ÐведиÑе e-mail дÑÑга"); 191 } 192}); 193 194 195$("#tellfriend .formSubmit").click(function(){ 196 197 $("#tellfriend_err").text(""); 198 $("#tellfriend_err").removeClass("tellfriend_err"); 199 $("#tellfriend_err").removeClass("tellfriend_success"); 200 201 var email = $("#tellfriend input[name='email']").val(); 202 203 var text = ""; 204 205 if(email == "" || email == "ÐведиÑе e-mail дÑÑга"){ 206 text = "ÐожалÑйÑÑа ÑкажиÑе email дÑÑга."; 207 $("#tellfriend_err").text(text); 208 $("#tellfriend_err").addClass("tellfriend_err"); 209 }else{ 210 //ÐÑпÑавка акÑии 211 $.post("/action_to_friends",{email: email},function(json){ 212 if(json){ 213 text = "ÐиÑÑмо ÑÑпеÑно оÑпÑавлено!"; 214 $("#tellfriend_err").addClass("tellfriend_success"); 215 }else{ 216 text = "ÐÑибка, непÑавилÑнÑй email."; 217 $("#tellfriend_err").addClass("tellfriend_err"); 218 } 219 $("#tellfriend_err").text(text); 220 },"json"); 221 } 222 223 224 return false; 225}); 226 227 228}); 229 230function list(givenClass) { 231 $(givenClass).each(function() { 232 var col = $(givenClass).length; 233 var colY = 3; 234 var colStr = Math.floor(col/colY); 235 for (var i = 1; i <= colStr; i++) { 236 var numY = (i*colY); 237 var elt = $(givenClass).eq(numY); 238 $(elt).css({'clear':'left'}); 239 $(elt).prev().css({'margin-right':'0'}); 240 } 241 }); 242} 243 244function selects(givenClass) { 245 var elt = givenClass + ' ul li'; 246 247 $('.thing').each(function(i) { 248 $(this).hide(); 249 var thingId = 'elt' + i; 250 $(this).attr('id', thingId); 251 }); 252 253 $(elt).each(function(i) { 254 var eltName = 'elt' + i; 255 $(this).attr('name', eltName); 256 }); 257 258 var myHash = document.location.hash; 259 260 if (givenClass === '.lpp_menu') { 261 var ifredirected = getCookie('lastLayer'); 262 if (ifredirected !== null) ifredirected = ifredirected.substring(3); 263 if (ifredirected !== '' && ifredirected !== null && myHash === '') { 264 myHash = '#' + ifredirected; 265 } 266 setCookie('lastLayer', ''); 267 //ifredirected = ''; 268 } 269 270 271 272 var selects = $('div.customSelectWrap'); 273 selects.each(function(){ 274 var self = $(this), visible, hidden; 275 visible = self.find('.customSelectView'); 276 hidden = self.find('.customSelectHidden'); 277 self.toggle(function(){ 278 hidden.show(); 279 return false; 280 }, function(){ 281 hidden.hide(); 282 return false; 283 }); 284 hidden.find('li').click(function(){ 285 visible.find('input:hidden').val($(this).attr('data-value')); 286 var str = $(this).text(); 287 visible.find('input:visible').val(str); 288 }) 289 }); 290 291 292 293 if (myHash !== '') { 294 $(myHash).css('display', 'block'); 295 var cnt = myHash.replace('#',''); 296 $(elt+'[name='+cnt+']').addClass('active'); 297 } else { 298 var firstli = $(elt)[0]; 299 $(firstli).addClass('active'); 300 var firstThing = $('.thing')[0]; 301 $(firstThing).css('display', 'block'); 302 myHash = '#' + $(firstThing).attr('id'); 303 } 304 305 //document.location.hash = myHash; 306 307 //var arr = [0]; 308 309 $(elt).each(function(i) { 310 $(this).find('span').css('border-bottom', '1px dashed #333'); 311 if ($(this).hasClass('active')) $(this).find('span').css('border-bottom', 'none'); 312 $(this).bind("click", function() { 313 if (!$(this).hasClass('active')) { 314 315 var anchorName = $(this).attr('name'); 316 document.location.hash = anchorName; 317 318 $(elt).removeClass('active'); 319 $(elt).find('span').css('border-bottom', '1px dashed #333'); 320 321 $('.thing').hide(); 322 323 $(this).addClass('active'); 324 $(this).find('span').css('border', 'none'); 325
326 $('.thing[id=' + $(this).attr('name') + ']').toggle(); 327 if (!jQuery.support.cssFloat) { //пÑовеÑка на бÑаÑзеÑ, можно вÑÑÑавиÑÑ Ð»Ñбое ÑвойÑÑво 328 $(document).scrollTop(0); 329 } 330 } 331 }); 332 333 $(this).bind("mouseover",function() { 334 if (!$(this).hasClass('active')) { 335 $(this).css('cursor', 'pointer'); 336 $(this).find('span').css('border-bottom', 'none'); 337 } 338 }); 339 340 $(this).bind("mouseout",function() { 341 if (!$(this).hasClass('active')) { 342 $(this).css('cursor', ''); 343 $(this).find('span').css('border-bottom', '1px dashed #333'); 344 } 345 }); 346 }); 347} 348 349// Show the floating nav when main menu is scrolled off screen. 350$(function() { 351 if (document.documentElement.clientWidth > 640) { 352 // Stick the #nav to the top of the window 353 var nav = $('nav .main_menu'); 354 var floatnav = $('#floatingnavbar'); 355 var navHomeY = nav.offset().top + nav.height(); 356 var isShown = false; 357 var $w = $(window); 358 $w.scroll(function() { 359 var scrollTop = $w.scrollTop(); 360 var shouldBeShown = scrollTop > navHomeY; 361 if (shouldBeShown && !isShown) { 362 // floatnav.show(); 363 floatnav.slideDown(400); 364 isShown = true; 365 } 366 else if (!shouldBeShown && isShown) 367 { 368 // floatnav.hide(); 369 floatnav.slideUp(400); 370 isShown = false; 371 } 372 }); 373 } 374}); 375 376// Cosmetics for the mobile-style pop-up menu 377$(function() { 378 $("input#toggle-mobile-menu").change(function() { 379 var label = $("#mobilenav > label"); 380 label.toggleClass("popupisopen"); 381 label.text( (this.checked) ? '\u00D7' : '\u2630' ); 382 }); 383}); 384 385// Mobile-style phone and callback popup overlay 386$(function() { 387 $("#floatingnavbar > div.phone").click(function() { 388 $('#toggle-mobile-menu').prop('checked', false); 389 $("#floatingnavbar > div.baroverlay").toggleClass("baroverlayopen"); 390 }); 391}); 392 393$(function() { 394 $("#baroverlayclose").click(function() { 395 $("#floatingnavbar > div.baroverlay").removeClass("baroverlayopen"); 396 }); 397}); 398 399 400function RusPluralYearsStr(n) { 401 var m=n%10, l=n%100; 402 return n + '\xA0' + (((m==1)&&(l!=11))?'год':(((m==2)&&(l!=12)||(m==3)&&(l!=13)||(m==4)&&(l!=14))?'года':'леÑ')); 403}
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.