1var deletePhoto = function(arg,form_num){ 2 3 new Ajax.Updater('ph_'+arg, '/photos/'+arg, { 4 method: 'delete' 5 }); 6 //$("ph_"+arg).dropOut(); 7 $(form_num+'_photo').dropOut(); 8 $(form_num+'_body').show(); 9 10}; 11 12var fillData = function(){ 13 14 if ($('lets_connect') != undefined){ 15 $('lets_connect').update("СкоÑее ÑегиÑÑÑиÑÑйÑеÑÑ! \<br\> \<span style=\'font-size:14px\'\>(ÐÐ°Ñ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑий бÑÐ´ÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½ ÑÑÐ°Ð·Ñ Ð¿Ð¾Ñле Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ ÑÑой ÑоÑмÑ)\<\/span\>"); 16 }; 17 18 if ($('close_button') != undefined){ 19 $('close_button').show(); 20 }; 21 22 if ($('user_name') != undefined){ 23 $('user_name').value = $F('second_name'); 24 }; 25 if ($('user_email') != undefined){ 26 $('user_email').value = $F('second_email'); 27 }; 28 29}; 30 31 32 33var initBBbox = function(arg, fullSmiles){ 34 var bbSmiles = '<style> \ 35 </style>\ 36 <table cellpadding="2" border="0" class="smiles"><tr><td align="center" \ 37 style="border:0px;"><a onclick="emoticon(\'>(\',\'message\');return false;" rel="nofollow" \ 38 href="javascript://"><img title="angry" src="/images/smiles/angry.gif" class="smilik" \ 39 alt=""/></a></td><td align="center" style="border:0"><a \ 40 onclick="emoticon(\':D\',\'message\');return false;" rel="nofollow" href="javascript://"><img \ 41 title="biggrin" src="/images/smiles/biggrin.gif" class="smilik" alt=""/></a></td> \ 42 <td align="center" style="border:0"><a onclick="emoticon(\'B)\',\'message\');return false;" \ 43 rel="nofollow" href="javascript://"><img title="cool" src="/images/smiles/cool.gif" \ 44 class="smilik" alt=""/></a></td></tr><tr><td align="center" style="border:0"><a \ 45 onclick="emoticon(\':c(\',\'message\');return false;" rel="nofollow" \ 46 href="javascript://"><img title="cry" src="/images/smiles/cry.gif" class="smilik" \ 47 alt=""/></a></td><td align="center" style="border:0"><a \ 48 onclick="emoticon(\'<_<\',\'message\');return false;" rel="nofollow" \ 49 href="javascript://"><img title="dry" src="/images/smiles/dry.gif" class="smilik" \ 50 alt=""/></a></td><td align="center" style="border:0"><a \ 51 onclick="emoticon(\'^_^\',\'message\');return false;" rel="nofollow" \ 52 href="javascript://"><img title="happy" src="/images/smiles/happy.gif" class="smilik" \ 53 alt=""/></a></td></tr><tr><td align="center" style="border:0"><a \ 54 onclick="emoticon(\':(\',\'message\');return false;" rel="nofollow" href="javascript://"><img \ 55 title="sad" src="/images/smiles/sad.gif" class="smilik" alt=""/></a></td><td align="center" \ 56 style="border:0"><a onclick="emoticon(\':)\',\'message\');return false;" rel="nofollow" \ 57 href="javascript://"><img title="smile" src="/images/smiles/smile.gif" class="smilik" \ 58 alt=""/></a></td><td align="center" style="border:0"><a \ 59 onclick="emoticon(\':o\',\'message\');return false;" rel="nofollow" href="javascript://"> \ 60<img title="surprised" src="/images/smiles/surprised.gif" class="smilik" \ 61 alt=""/></a></td></tr><tr><td align="center" style="border:0"><a \ 62 onclick="emoticon(\':p\',\'message\');return false;" rel="nofollow" href="javascript://"><img \ 63 title="tongue" src="/images/smiles/tongue.gif" class="smilik" alt=""/></a></td> \ 64 <td align="center" style="border:0"><a onclick="emoticon(\'%)\',\'message\');return false;" \ 65 rel="nofollow" href="javascript://"><img title="wacko" src="/images/smiles/wacko.gif" \ 66 class="smilik" alt=""/></a></td><td align="center" style="border:0"><a \ 67 onclick="emoticon(\';)\',\'message\');return false;" rel="nofollow" href="javascript://"><img \ 68 title="wink" src="/images/smiles/wink.gif" class="smilik" alt=""/></a></td></tr><tr \ 69 id="asmltrWBPvi"><td style="border:0" nowrap="" align="center" id="allSmiles" colspan="3"> \ 70 <div id="content_div" style"display:none;"><a href="#medium_box" onclick="fillSmilesBox();" id="medium_box_link" \ 71 href="javascript://">ÐÑе ÑмайлÑ</a></div></td></tr></table>'; 72 var bbBox = '<div style="padding-bottom: 2px;"> \ 73 <span id="bc1" style="padding-right: 1px;"> \
74 <input type="button" style="width: 20px; font-weight: bold;" id="b" class="codeButtons" \ 75 onclick="simpletag(\'b\',\'\',\'\',\'message\',\'\')" value="b" title="Bold"/>\ 76 </span><span id="bc2" style="padding-right: 1px;"><input type="button" style="width: 20px; \ 77 font-style: italic;" id="i" class="codeButtons" \ 78 onclick="simpletag(\'i\',\'\',\'\',\'message\',\'\')" value="i" title="Italic"/> \ 79 </span><span id="bc3" style="padding-right: 1px;"><input type="button" style="width: 20px; \ 80 text-decoration: underline;" id="u" class="codeButtons" \ 81 onclick="simpletag(\'u\',\'\',\'\',\'message\',\'\')" value="u" title="Underline"/></span><span \ 82 id="bc4" style="padding-right: 1px;"><select \ 83 onchange="alterfont(this.options[this.selectedIndex].value,\'size\',\'message\',\'\'); \ 84 this.selectedIndex=0;" class="codeButtons" id="fsize">\ 85 <option value="0">РазмеÑ</option><option value="6">6 pt</option> \ 86 <option value="7">7 pt</option><option value="8">8 pt</option> \ 87 <option value="9">9 pt</option><option value="10">10 pt</option> \ 88 <option value="11">11 pt</option><option value="12">12 pt</option> \ 89 <option value="13">13 pt</option><option value="14">14 pt</option> \ 90 <option value="15">15 pt</option><option value="16">16 pt</option> \ 91 <option value="17">17 pt</option><option value="18">18 pt</option> \ 92 <option value="19">19 pt</option><option value="20">20 pt</option> \ 93 <option value="21">21 pt</option><option value="22">22 pt</option></select></span> \ 94 <span id="bc6" style="padding-right: 1px;">\ 95 <select onchange="alterfont(this.options[this.selectedIndex].value, \ 96 \'color\',\'message\',\'\');this.selectedIndex=0;" class="codeButtons" id="fcolor"> \ 97 <option value="0">ЦвеÑ</option><option style="color: blue;" \ 98 value="blue">Синий</option><option style="color: red;" value="red">ÐÑаÑнÑй</option> \ 99 <option style="color: purple;" value="purple">РозовÑй</option> \ 100 <option style="color: orange;" value="orange">ÐÑанж.</option>\ 101 <option style="color: yellow;" value="yellow">ÐелÑÑй</option> \ 102 <option style="color: gray;" value="gray">СеÑÑй</option> \ 103 <option style="color: green;" value="green">ÐеленÑй</option>\ 104 </select></span><span id="bc7" style="padding-right: 1px;">\ 105 <input type="button" id="url" style="direction: ltr; width: 45px;" class="codeButtons" \ 106 onclick="tag_url(\'message\',\'\')" value="https://" title="URL"/></span>\ 107 <span id="bc8" style="padding-right: 1px;"> \ 108 <input type="button" id="email" style="width: 30px;" class="codeButtons" \ 109 onclick="tag_email(\'message\',\'\')" value="@" title="E-mail"/></span> \ 110 <span id="bc9" style="padding-right: 1px;"> \ 111 <input type="button" id="img" style="width: 35px;" class="codeButtons" \ 112 onclick="tag_image(\'message\',\'\')" value="img" title="Image"/></span> \ 113 <span id="bc18" style="padding-right: 1px;">\ 114 <span id="bc12" style="padding-right: 1px;"> \ 115 <input type="button" style="width: 30px;" id="list" class="codeButtons" \ 116 onclick="tag_list(\'message\',\'\')" value="list" title="List"/></span>\ 117 <span id="bc13" style="padding-right: 1px;"><input type="button" id="cdl"\ 118 class="codeButtons" onclick="simpletag(\'l\',\'cdl\',\'···\',\'message\')" \ 119 value="···" style="width: 20px; text-align: left;" title="Слева"/></span>\ 120 <span id="bc14" style="padding-right: 1px;"><input type="button" id="cdc" \ 121 class="codeButtons" onclick="simpletag(\'c\',\'cdc\',\'···\',\'message\')" \ 122 value="···" style="width: 20px; text-align: center;" title="Ðо ÑенÑÑÑ"/></span>\ 123<span id="bc15" style="padding-right: 1px;"><input type="button" id="cdr" \ 124 class="codeButtons" onclick="simpletag(\'r\',\'cdr\',\'···\',\'message\')" \ 125 value="···" style="width: 20px; text-align: right;" title="СпÑава"/>
125</span><span id="bc16" \ 126 style="padding-right: 1px;"><input type="button" class="codeButtons" \ 127 onclick="window.open(\'/bbcodes.html\',\'bbcodes\',\'scrollbars=1,width=550, \ 128 height=450,left=0,top=0\');" value="ÐодÑ" style="width: 35px;" title="ÐÑе кодÑ"/></span>\ 129 <span id="bc17" style="padding-right: 1px;"><input type="button" class="codeButtons"\ 130 onclick="closeall(\'message\',\'\');" title="ÐакÑÑÑÑ Ð²Ñе оÑкÑÑÑÑе кодÑ" value="/"\ 131 style="font-weight: bold; width: 20px;"/></span><input type="hidden" value="0" id="tagcount"/>\ 132 </div>'; 133$(arg+"_bb_box").innerHTML = bbBox; 134$(arg+"_bb_smile").innerHTML = bbSmiles; 135} 136 137var fillSmilesBox = function(){ 138 FancyZoomBox.init(); 139 preloadAnimStart(); 140 141 new Ajax.Request('/smiles.html', 142 { 143 method:'get', 144 onSuccess: function(transport){ 145 var response = transport.responseText; 146 $("medium_box").innerHTML = response; 147 preloadActive = false; 148 }, 149 onFailure: function(){ alert("Ðе ÑдаеÑÑÑ ÑоединиÑÑÑÑ Ñ ÑеÑвеÑом - повÑоÑиÑе позднее") } 150 }); 151}; 152 153var tryComment = function(){ 154 155 if ($F('comment_comment').length==0) { 156 alert("ÐожалÑйÑÑа введиÑе ÑекÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑиÑ"); 157 return false; 158 } else if ($F('writer')=="0" && $('second_name')!=undefined) { 159 160 FancyZoomBox.init(); 161 preloadAnimStart(); 162 163 new Ajax.Updater('registration_popup', '/users/registration', { 164 method: 'get', evalScripts: true, onComplete: fillData, parameters: {from: document.URL} 165 }); 166 167 closeAllPopups(); 168 $("registration_popup").show(); 169 setTimeout( "checkForm();", 3000); 170 setTimeout( "fireOnce();", 2000); 171 if ($('registration_popup') != undefined){ 172 $('registration_popup').scrollTo(); 173 }; 174 return false; 175 } else { 176 return true; 177 }; 178}; 179 180var authenticityToken = function(){ 181 return $$('input[name="authenticity_token"]')[0].value 182} 183 184var fireOnce = function(){ 185 var token = authenticityToken(); 186 var email = $('user_email').value; 187 new Ajax.Request('/users/email/', { 188 method: 'post', 189 parameters: {email: email, authenticity_token: token} 190 }); 191 192 var name = encodeURIComponent($('user_name').value); 193 new Ajax.Request('/users/name/', { 194 method: 'post', 195 parameters: {name: name, authenticity_token: token} 196 }); 197} 198 199var closeAllPopups = function(){ 200 if ($('registration_popup')!=undefined){ 201 $("registration_popup").hide(); 202 }; 203 if ($('messagebox_popup')!=undefined){ 204 $("messagebox_popup").hide(); 205 }; 206 if ($('insert_popup')!=undefined){ 207 $("insert_popup").hide(); 208 }; 209 if ($('complete_popup')!=undefined) { 210 $("complete_popup").hide(); 211 }; 212 if ($('login_popup')!=undefined) { 213 $("login_popup").hide(); 214 }; 215 if ($('user_profile')!=undefined) { 216 $("user_profile").hide(); 217 }; 218 if ($('edit_profile')!=undefined) { 219 $("edit_profile").hide(); 220 }; 221 222 if ($('theme_popup')!=undefined) { 223 $("theme_popup").hide(); 224 }; 225 // // $("blockUI").hide(); 226 // if (($('writer')!=undefined) && ($('writer').value == "1")) { 227 // $('new_comment').submit(); 228 // }; 229 230}; 231 232function swap_dom_id(arg,arg1){ 233 if ($(arg) != null){ 234 $(arg).id = arg1; 235 }; 236}; 237 238var editProfile = function(arg){ 239 new Ajax.Updater('edit_profile', '/users/'+arg+"/edit", { 240 method: 'get' 241 }); 242 closeAllPopups(); 243 if ($('edit_profile')!="undefined"){ 244 $('edit_profile').show(); 245 $('edit_profile').scrollTo(); 246 }; 247 return false; 248}; 249 250var showProfile = function(e){ 251 var element = Event.element(e); 252 var id = element.id.split('_')[1]; 253 new Ajax.Updater('user_profile', '/users/'+id, { 254 method: 'get' 255 }); 256 closeAllPopups(); 257 if ($('user_profile')!="undefined"){ 258 $('user_profile').show(); 259 $('user_profile').scrollTo(); 260 }; 261 e.stop(); 262 return false; 263}; 264 265 266var showNewTheme = function(e){ 267 var element = Event.element(e); 268 closeAllPopups(); 269 e.stop(); 270 return false;
271}; 272 273var loggedIn = function(){ 274 return ($$('.uprofile.currentUser').length > 0); 275}; 276 277var alertModerator = function(e){ 278 if (loggedIn()) { 279 var element = Event.element(e); 280 new Ajax.Updater($(element), '/moderators/alert/'+element.id.replace(/p_/,""), { 281 method: 'get' 282 }); 283 e.stop(); 284 }else{ 285 alert('ÐÑо Ð¼Ð¾Ð¶ÐµÑ Ð´ÐµÐ»Ð°ÑÑ ÑолÑко заÑегиÑÑÑиÑованнÑй полÑзоваÑелÑ.'); 286 }; 287 return false; 288}; 289 290var makeCitate = function(e){ 291 var element = Event.element(e); 292 FancyZoomBox.init(); 293 preloadActive = true; 294 preloadAnimStart(); 295 296 id = element.id.replace(/c_/,"") 297 new Ajax.Request('/posts/'+id, 298 { 299 method:'get', 300 onSuccess: function(transport){ 301 var response = transport.responseText; 302 $('message').value = "[quote] " + response + "[/quote]\n" + $('message').value; 303 preloadActive = false; 304 }, 305 onFailure: function(){ alert("Ðе ÑдаеÑÑÑ ÑоединиÑÑÑÑ Ñ ÑеÑвеÑом - повÑоÑиÑе позднее") } 306 }); 307 $('reply').scrollTo(); 308 $('message').activate(); 309 e.stop(); 310 return false; 311}; 312 313var okMessage="ÐÑавилÑно"; 314var noOkMessage="ÐепÑавилÑно"; 315var ok = false; 316 317var checkForm = function(){ 318 $("ZoomSpin").hide(); 319 ok = false; 320 321 if ($('user_password').hasClassName('check')) { 322 if (($('user_password').value.length >= 0) && ($('user_password').value.length < 5)) { 323 $('password_tip').innerHTML="ÐÑ 5 Ñимволов"; 324 $('password_tip').className ="error"; 325 } else if ($('user_password').value.length > 4) { 326 $('password_tip').innerHTML="Ok"; 327 $('password_tip').className ="control"; 328 }; 329 }; 330 331 if ($('user_password_confirmation').hasClassName('check')) { 332 if (($('user_password_confirmation').value.length >= 0) && ($('user_password_confirmation').value == $('user_password').value )) { 333 $('password_confirmation_tip').innerHTML="Ok"; 334 $('password_confirmation_tip').className ="control"; 335 } else if ( ($('user_password_confirmation').value.length >= 0) && ($('user_password_confirmation').value != $('user_password').value) ) { 336 $('password_confirmation_tip').innerHTML="ÐаÑоли Ð´Ð¾Ð»Ð¶Ð½Ñ ÑовпадаÑÑ"; 337 $('password_confirmation_tip').className ="error"; 338 } else { 339 $('password_confirmation_tip').innerHTML="ÐÑ 5 Ñимволов"; 340 $('password_confirmation_tip').className ="error"; 341 }; 342 }; 343 344 345 if ($('user_email').next().hasClassName('control') && $('user_name').next().hasClassName('control') 346 && $('user_password').next().hasClassName('control') && $('user_password_confirmation').next().hasClassName('control') 347 && ($('user_captcha').value.length == 6)) { 348 // ok = true; 349 350 // if ($('user_password').value.length < 5) { 351 // makeWrong("password_tip"); 352 // } else { 353 // makeRight("password_tip"); 354 // }; 355 // 356 // if ($('user_password_confirmation').value != $('user_password').value){ 357 // makeWrong("password_confirmation_tip"); 358 // } else { 359 // makeRight("password_confirmation_tip"); 360 // }; 361 // 362 // if ($('user_captcha').value.length == 0){ 363 // makeWrong("user_captcha_tip"); 364 // } else { 365 // makeRight("user_captcha_tip"); 366 // }; 367 368 // if (ok==true) { 369 $("register_me").removeClassName("active").addClassName("active"); 370 Element.observe('register_me', 'click', document.registration_form.submit ); 371 } else { 372 $("register_me").removeClassName("active"); 373 Element.observe('register_me', 'click', fillFormPlease ); 374 }; 375 setTimeout ( "checkForm();", 2000); 376}; 377 378var makeWrong = function( field_id ){ 379 ok = false; 380 $(field_id).innerHTML=noOkMessage; 381 $(field_id).className ="error"; 382}; 383 384var makeRight = function( field_id ){ 385 $(field_id).innerHTML=okMessage; 386 $(field_id).className ="control"; 387}; 388 389function showRegistrationPopup(){ 390 391 FancyZoomBox.init(); 392 preloadAnimStart(); 393 new Ajax.Updater('registration_popup', '/users/registration', { 394 method: 'get', evalScripts: true, onComplete: checkForm, parameters: {from: document.URL}
394 395 }); 396 397 closeAllPopups(); 398 $("registration_popup").show(); 399 //setTimeout ( "checkForm();", 3000); 400 401 return false; 402}; 403 404function showLoginPopup(){ 405 // $("blockUI").show(); 406 407 closeAllPopups(); 408 FancyZoomBox.init(); 409 preloadAnimStart(); 410 411 $("login_popup").show(); 412 413 return false; 414}; 415function fillFormPlease(){ 416 // alert("ÐожалÑйÑÑа заполниÑе ÑегиÑÑÑаÑионнÑÑ ÑоÑÐ¼Ñ Ð±ÐµÐ· оÑибок!"); 417}; 418 419function killFansyZoom(){ 420 if (FancyZoomBox.zooming) return; 421 FancyZoomBox.zooming = true; 422 new Effect.Parallel([ 423 new Effect.Move(FancyZoomBox.zoom, {x: FancyZoomBox.moveX*-1, y: FancyZoomBox.moveY*-1, sync: true}), 424 new Effect.Morph(FancyZoomBox.zoom, { 425 style: { 426 width: '1'.px(), 427 height: '1'.px() 428 }, 429 sync : true, 430 beforeStart: function(effect) { 431 FancyZoomBox.fixBackgroundsForIE(); 432 FancyZoomBox.zoom_content.innerHTML = ''; 433 FancyZoomBox.zoom_close.hide(); 434 if (FancyZoomBox.zoom.id != 'zoom') { 435 FancyZoomBox.zoom.setStyle({overflow: 'hidden'}); 436 }; 437 }, 438 afterFinish: function(effect) { 439 FancyZoomBox.unfixBackgroundsForIE(); 440 FancyZoomBox.zooming = false; 441 if (FancyZoomBox.zoom.id != 'zoom') { 442 FancyZoomBox.zoom.setStyle({ 443 width: null, 444 height: null 445 }); 446 }; 447 } 448 }), 449 new Effect.Fade(FancyZoomBox.zoom, {sync:true}) 450 ], { duration: 0.5 }); 451} 452 453function closeLoginBox(e){ 454 var ie = navigator.userAgent.match(/MSIE\s(\d)+/); 455 if (ie) { 456 $("login_popup").hide(); 457 } else { 458 FancyZoomBox.hide(e); 459 }; 460}; 461 462function closeNewThemeBox(e){ 463 var ie = navigator.userAgent.match(/MSIE\s(\d)+/); 464 if (ie) { 465 $("theme_popup").hide(); 466 } else { 467 FancyZoomBox.hide(e); 468 }; 469}; 470 471function getLength(l,m){ 472 window.status = l + " из " + m + " макÑ. кол-во Ñимволов."; 473 return l < m; 474} 475 476function limitText(limitField, limitNum) { 477 if (limitField.value.length > limitNum) { 478 limitField.value = limitField.value.substring(0, limitNum); 479 alert('Ðлина ÑекÑÑа не должна пÑевÑÑаÑÑ: ' + limitNum + ' знаков'); 480 }; 481} 482 483 484Event.observe(window, 'load', 485 function() { 486 $$('.enter_profile').invoke('observe', 'click', showProfile); 487 $$('.uprofile').invoke('observe', 'click', showProfile); 488 $$('.icon7').invoke('observe', 'click', alertModerator); 489 $$('.icon6').invoke('observe', 'click', makeCitate); 490 } 491); 492 493 494var addCompaniesToMap = function(){ 495 var icon = new GIcon(G_DEFAULT_ICON, "/images/marker1.png"); 496 icon.iconSize = new GSize(32,36); 497 icon.shadow = null; 498 icon.shadowSize = null; 499 for (var latlon in companies) { 500 var latitude, longitude; 501 latitude = latlon.split("-")[0]; 502 longitude = latlon.split("-")[1]; 503 var title = companies[latlon].map(function(company){return company.name}).join(", "); 504 var body = '<div style="max-height:155px; overflow:auto; margin-right:12px;">'+companies[latlon].map(function(company){return "<b>"+company.name+"</b><br/>\nÐдÑеÑ: "+company.address+"<br/>\n<a href=\"/companies/"+company.id+"/map\">подÑобнее...</a>"}).join("<br/>")+'</div>'; 505 map.addOverlay( 506 addInfoWindowToMarker( 507 new GMarker( 508 new GLatLng(latitude,longitude), 509 {title: title, icon: icon} 510 ), 511 body, 512 {} 513 ) 514 ); 515 }; 516}; 517 518var checkVal = function(arg){ 519 if ($(arg).value == "поиÑк по обÑÑвлениÑм"){ 520 $(arg).value = ''; 521 }; 522} 523 524var checkVal2 = function(arg){ 525 if ($(arg).value == ""){ 526 $(arg).value = "поиÑк по обÑÑвлениÑм"; 527 }; 528}; 529 530function twitter(url, text) 531{ 532 window.my_callback = function(response) 533 { 534 if(response.error_message) window.open('https://twitter.com/home/?status='+encodeURIComponent(text)+' '+url,this.target) 535 else window.open('https://twitter.com/home/?status='+encodeURIComponent(text)+' '+response.short_url,this.target) 536 }; 537 var s = document.createElement("script"); 538 s.src = "https://ggl-shortener.appspot.com/?url=" + encodeURIComponent(url) + "&jsonp=my_callback"; 539 document.body.appendChild(s); 540 541 return false;
542}; 543 544var initAfisha = function(){ 545 document.observe('dom:loaded', function(){ 546 FancyZoomBox.init(); 547 548 $$('.day-tab').invoke('observe', 'click', showDayTab); 549 550 $$(".lenta a, .images a").each(function(link, index){ 551 link.observe('click', function(event){ 552 var id = "zoomable_" + link.id; 553 var container = new Element('div', {id: id, style: 'display: none; position: absolute;'}); 554 $(document.body).insert(container); 555 var img = new Element('div'); 556 img.className = 'image'; 557 container.insert(img); 558 link.stopObserving('click'); 559 var img = new Element('img'); 560 var id = "zoomable_" + link.id; 561 var container = $(id).select('div.image').first(); 562 container.insert(img); 563 var href = link.href; 564 link.href = '#' + id; 565 new FancyZoom(link, { closeButton: false }); 566 preloadAnimStart(); 567 img.observe('load', function(){ 568 preloadActive = false; 569 FancyZoomBox.show(event); 570 }); 571 img.writeAttribute('src', href); 572 $('zoom_content').observe('click', killFansyZoom); 573 return false; 574 }); 575 }); 576 }); 577}; 578 579var showDayTab = function(){ 580 if (!this.hasClassName('active1') && !this.hasClassName('active2')) { 581 var dayTab = this; 582 var date = dayTab.id.split('_day_')[1]; 583 var object_name = dayTab.id.split('_day_')[0].split('_')[0]; 584 var object_id = dayTab.id.split('_day_')[0].split('_')[1]; 585 preloadAnimStart(); 586 new Ajax.Request('/' + object_name + 's/' + object_id + '/schedule', { 587 method:'get', 588 parameters: {date: date}, 589 onSuccess: function(transport){ 590 var response = transport.responseText; 591 $(object_name + '_' + object_id + '_list').replace(response); 592 dayTab.up('div.days').select('.active1,.active2').invoke('removeClassName', 'active1').invoke('removeClassName', 'active2'); 593 if (dayTab.hasClassName('today')) { 594 dayTab.addClassName('active1'); 595 }else{ 596 dayTab.addClassName('active2'); 597 }; 598 preloadActive = false; 599 } 600 }); 601 }; 602}; 603 604var observeCommentCaptcha = function(){ 605 if ($F('recaptcha_response_field') != null) { 606 Element.observe('recaptcha_response_field', 'keyup', function(event) { 607 if ($F('recaptcha_response_field').length > 0 && $F('comment_comment').length > 0) { 608 $('add_comment').addClassName("active"); 609 } else { 610 $('add_comment').removeClassName("active"); 611 } 612 }); 613 }; 614} 615 616var initComments = function(){ 617 $(document).observe('keyup', function(e) { 618 //$('new_comment').onsubmit = tryComment; 619 620 if (e.findElement('.comment_comment_class')) { 621 if (($F('comment_comment').length > 0) && ($F('recaptcha_response_field').length > 0)) { 622 $('add_comment').addClassName("active"); 623 } else { 624 $('add_comment').removeClassName("active"); 625 } 626 } 627 628// Element.observe('comment_comment', 'keyup', function(event) { 629// if (($F('comment_comment').length > 0) && (($('comment_captcha') == null) || ($F('comment_captcha').length == 6))) { 630// $('add_comment').addClassName("active"); 631// } else { 632// $('add_comment').removeClassName("active"); 633// } 634// }); 635 observeCommentCaptcha(); 636 637// $$('.citate').invoke('observe', 'click', function(click_event){ 638// $('comment_comment').setValue(($("t_"+$(this).id).innerHTML)); 639// Field.activate("comment_comment"); 640// $('comment_comment').scrollTo(); 641// click_event.stop(); 642// }); 643 }); 644}; 645 646var initZoom = function(){ 647 //иÑем ÑоÑки Ð´Ð»Ñ Ð·Ñма и иниÑиализиÑÑем 648 $(document).observe('dom:loaded', function() { 649 $$("img.zoomable").each(function(image, index){ 650 var id = "zoomable-"+index; 651 var src = image.src.replace(/_(medium|thumb)\./, '.'); 652 653 var el = new Element('a', {id: 'thumb-'+id, href: src, title: image.alt}); 654 image.insert({after: el}); 655 el.insert(image); 656 657 var container = new Element('div', {id: id, style: 'display: none; position: absolute;'}); 658 $(document.body).insert(container); 659 var img = new Element('div'); 660 img.className = 'image'; 661 container.insert(img); 662 if (!image.alt.blank()) { 663 var inform = new Element('div', {'class': 'zoom_inform'}); 664 inform.insert(image.alt); 665 container.insert(inform); 666 }; 667 el.observe('click', function(event){ 668 el.stopObserving('click'); 669 var img = new Element('img'); 670 var id = el.id.split("thumb-").last(); 671 var container = $(id).select('div.image').first(); 672 container.insert(img); 673 var href = el.href; 674 el.href = '#'+id;
675 new FancyZoom(el, { closeButton: false }); 676 preloadAnimStart(); 677 img.observe('load', function(){ 678 preloadActive = false; 679 FancyZoomBox.show(event); 680 }); 681 img.writeAttribute('src', href); 682 $('zoom_content').observe('click', killFansyZoom); 683 return false; 684 }); 685 }); 686 }); 687}; 688 689var initTips = function(){ 690 $('clipfield').onfocus = function() { 691 this.select() 692 }; 693 if ($('buffer') != null) { 694 $('buffer').onfocus = function() { 695 this.select() 696 }; 697 }; 698 if ($('b_blog') != null) { 699 $('b_blog').addTip('', 'РазмеÑÑиÑÑ Ð² блоге', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 700 }; 701 if ($('b_print')) { 702 $('b_print').addTip('', 'Ðа пеÑаÑÑ', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 703 }; 704 $('b_memory').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² Memori!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 705 $('b_google').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² Google Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°Ñ !', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 706 $('b_news2ru').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² News2.ru!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 707 $('b_moemesto').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² Ðоем ÐеÑÑе!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 708 $('b_smi').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² СÐÐ2!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 709 $('b_bobr').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² BobrDobr!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 710 $('b_yandex').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² ЯндекÑ.ÐÐ°ÐºÐ»Ð°Ð´ÐºÐ°Ñ !', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 711 $('b_wong').addTip('', 'ÐапомниÑÑ ÑÑÑ ÑÑÑаниÑÑ Ð² Mister Wong!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 712 $('b_twitter').addTip('', 'ÐобавиÑÑ Ð² ТвиÑÑеÑ!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 713 $('b_facebook').addTip('', 'ÐобавиÑÑ Ð² Facebook!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 714 $('b_vkontakte').addTip('', 'ÐконÑакÑе!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 715 $('b_moimir').addTip('', 'ÐобавиÑÑ Ð² Ðой ÐиÑ!', { style: 'rounded', target: true, stem: true, tipJoint: [ 'left', 'bottom' ] }); 716}; 717 718var initSubsTips = function(){ 719 ['sub_rss', 'sub_twitter', 'sub_email', 'sub_yandex', 'sub_google', 'sub_yalist', 'sub_facebook', 'sub_vkontakte', 'sub_livejournal'].each(function(sub_id){ 720 if ($(sub_id) != null) { 721 $(sub_id).addTip('', $(sub_id).title, { style: 'rounded', target: true, stem: true, tipJoint: [ 'right', 'bottom' ] }); 722 }; 723 }); 724}; 725 726var m_parent = function(arg){ 727 $('m_parent').childElements().each(function(name, index) { 728 $(name).className = ""; 729 }); 730 $("m_"+arg).className = "active"; 731}; 732 733var s_slave = function(arg){ 734 $('slave_subject').childElements().each(function(name, index) { 735 $(name).className = ""; 736 }); 737 $("s_"+arg).className = "active"; 738 $('classified_subject_id').value=arg; 739 $('status_window').appear(); 740 $("is_private").checked = true; 741 $("is_company").checked = false; 742 var spinner = $('spinner'); if(spinner != undefined){spinner.show()}; 743 new Ajax.Request('/subjects/price/', { 744 asynchronous:true, 745 evalScripts:true, method:'get', 746 onComplete:function(request){if(spinner != undefined){spinner.hide()};}, 747 parameters:"id="+arg + '&authenticity_token=' + encodeURIComponent(authenticityToken()) 748 }); 749 groupBlock('show'); 750} 751 752var initClassifiedForm = function(){ 753 $caption = new LiveValidation('classified_caption', {validMessage: ' '}); 754 $caption.add(Validate.Presence, {failureMessage: " "}); 755 756 $price = new LiveValidation('classified_price', {validMessage: ' '}); 757 $price.add( Validate.Numericality, { minimum: 0, onlyInteger: true, notANumberMessage: "ТÑебÑеÑÑÑ Ð²Ð²ÐµÑÑи ÑиÑло", tooLowMessage: "ТÑебÑеÑÑÑ Ð²Ð²ÐµÑÑи ÑиÑло", notAnIntegerMessage: "ТÑебÑеÑÑÑ Ð²Ð²ÐµÑÑи ÑиÑло" } ); 758 $('classified_price').observe('keyup', function(){ 759 this.value = this.value.gsub(" ", ''); 760 }); 761 762 $email = new LiveValidation('classified_email', {validMessage: ' ', wait:1500}); 763 $email.add( Validate.Presence, {failureMessage: " "}); 764 $email.add( Validate.Email, { failureMessage: " " } ); 765 $email.add( Validate.Length, { minimum: 4, maximum: 180, wrongLengthMessage: " ", tooShortMessage: " ", tooLongMessage:" " } ); 766 767 $phone_code = new LiveValidation('classified_phone_code', {validMessage: ' '}); 768 $phone_code.add(Validate.Presence, {failureMessage: ""}); 769 $phone_code.add( Validate.Numericality, { onlyInteger: true, notANumberMessage: " ", notAnIntegerMessage: " " } ); 770 771 $phone_mantissa = new LiveValidation('classified_phone_mantissa', {validMessage: ' '}); 772 $phone_mantissa.add(Validate.Presence, {failureMessage: ""}); 773 $phone_mantissa.add( Validate.Numericality, { onlyInteger: true, notANumberMessage: " ", notAnIntegerMessage: " " } ); 774 if (!loggedIn()) { 775 $captcha = new LiveValidation('recaptcha_response_field', {validMessage: ''}); 776 $captcha.add(Validate.Presence, {failureMessage: ''}); 777 //$captcha.add( Validate.Length, { minimum: 6, maximum: 6, wrongLengthMessage: " ", tooShortMessage: " ", tooLongMessage:" " } ); 778 }; 779 $('images_ids').value = ''; 780}; 781 782var checkCaption = function(){ 783 if ($caption.validate()){ 784 groupBlock("show"); 785 } else { 786 groupBlock("hide"); 787 }; 788} 789 790var groupBlock = function(arg){ 791 if (arg == 'show'){ 792 $('caption_window').show(); 793 $('body_window').appear(); 794 $('image_window').appear(); 795 $('head_window').appear(); 796 $('contact_window').appear(); 797 $('phone_window').appear(); 798 $('captcha_window').appear(); 799 $('button_window').enable(); 800 hidePrice(); 801 } else { 802 $('caption_window').hide(); 803 $('body_window').fade(); 804 $('image_window').fade(); 805 $('price_window').fade(); 806 $('head_window').fade(); 807 $('contact_window').fade(); 808 $('phone_window').fade(); 809 $('captcha_window').fade(); 810 } 811} 812 813var hidePrice = function(){ 814 if (showPriceBlock){ 815 $('price_window').appear(); 816 }; 817}; 818 819var checkCaptcha = function(){ 820 if (loggedIn()) { 821 return true; 822 }else{ 823 return $captcha.validate(); 824 }; 825}; 826 827var checkButton = function(){ 828 if ($email.validate()){ 829 $('email_error').fade(); 830 } else { 831 if ($('classified_email').value.length != 0){ 832 $('email_error').appear(); 833 } 834 }; 835 836 if ($phone_code.validate() && $phone_mantissa.validate()){ 837 $('phone_error').fade(); 838 } else { 839 if ($('classified_phone_code').value.length != 0 && $('classified_phone_mantissa').value.length != 0) { 840 $('phone_error').appear(); 841 } 842 }; 843 844 if ($caption.validate() && $email.validate() && $price.validate() && $phone_code.validate() && $phone_mantissa.validate() && checkCaptcha() ){ 845 $('button_window').removeClassName("btn2").addClassName("btn"); 846 } else { 847 $('button_window').removeClassName("btn").addClassName("btn2"); 848 }; 849}; 850 851var validateForm = function(){ 852 if ($caption.validate() && $email.validate() && $price.validate() && $phone_code.validate() && $phone_mantissa.validate() && checkCaptcha() ){ 853 return true; 854 } else { 855 return false;
856 }; 857}; 858 859var checkUpload = function(num){ 860 $('image_loader_'+num).show(); 861 $('new_classified').writeAttribute('action', "/classified_images/update"); 862 $('new_classified').writeAttribute('target', 'upload_frame'); 863 $('new_classified').submit(); 864}; 865 866var revert_params = function(){ 867 $('new_classified').writeAttribute('action', "/classifieds"); 868 $('new_classified').writeAttribute('target', ''); 869 $('images_ids').value = img_ids.toString(); 870}; 871 872var upload_image_callback=function(arg, id, num){ 873 $('image_loader_'+num).fade(); 874 $("image_"+num).update("<img src='"+arg+"' > <br/><a href='#' style='color:#CD0000' onclick='delImage("+ num +"); return false;'>УдалиÑÑ?</a><br/><br/>"); 875 $("image_up_"+num).fade(); 876 $("image_"+num).appear(); 877 $("image_up_"+num).value=""; 878 img_ids[num-1] = id; 879 revert_params(); 880}; 881 882var delImage = function(num){ 883 $('image_loader_'+num).fade(); 884 $("image_"+num).fade(); 885 $("image_up_"+num).value=""; 886 $("image_up_"+num).appear(); 887 $("image_"+num).update(""); 888 img_ids[num-1] = null; 889}; 890 891var upload_image_fallback = function(num, message){ 892 $('image_loader_'+num).fade(); 893 alert(message); 894 delImage(num); 895 revert_params(); 896}; 897 898function limitText(limitField, limitNum) { 899 if ($(limitField).value.length > limitNum) { 900 $(limitField).value=$(limitField).value.substring(0, limitNum); 901 }; 902}; 903 904 905// JS, вÑнеÑеннÑй из ÑазмеÑки 906 907Event.observe(window, 'load', 908 function() { 909 if ($('close_popup')!=undefined){Element.observe('close_popup', 'click', closeAllPopups )}; 910 if ($('close_popup1')!=undefined){Element.observe('close_popup1', 'click', closeAllPopups )}; 911 if ($('login_button')!=undefined) 912 { 913 new FancyZoom($('login_button'), {container: 'login_popup', closeButton: false}); 914 $('email').activate(); 915 }; 916}); 917 918Event.observe(window, 'load', 919 function() { 920 if ($('close_popup5')!=undefined){Element.observe('close_popup5', 'click', closeAllPopups )}; 921 if ($('insert_button')!=undefined) 922 { 923 new FancyZoom($('insert_button'), {container: 'insert_popup', closeButton: false}); 924 }; 925}); 926 927Event.observe(window, 'load', 928 function() { 929 if ($('close_popup4')!=undefined){Element.observe('close_popup4', 'click', closeAllPopups )}; 930 if ($('messagebox_button')!=undefined){ 931 new FancyZoom($('messagebox_button'), {container: 'messagebox_popup', closeButton: false}); 932 }; 933}); 934 935function createPlacemarkObserver(placemark) { 936 YMaps.Events.observe(placemark, placemark.Events.DragEnd, function(){ 937 var lat = placemark.getGeoPoint().getY(); 938 var lng = placemark.getGeoPoint().getX(); 939 $('company_latitude').setValue(lat); 940 $('company_longitude').setValue(lng) 941 }); 942}
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.