' ); } } req.open(null, 'ajax/mistaker.php', true); req.send( { action: 'send', link: form.lnk.value, text: form.text.value, comm: form.comm.value } ); } /** Поиск обновлений */ function getUpNews() { var req = new JsHttpRequest(); req.onreadystatechange = function(){ if (req.readyState == 4) { if ( req.responseJS.uptime != '' ){ LastUpTime = req.responseJS.uptime; } if ( req.responseJS.id > 0 ){ $.jnotify( req.responseJS.title, req.responseJS.intro, req.responseJS.img, req.responseJS.href ); } TimerUN=setTimeout("getUpNews()",60000); } } req.open(null, 'ajax/messes.php', true); req.send( { task: 'getup', LastUpTime: LastUpTime } ); } /** Выборка выделенного текста */ function getSelectionText() { var txt = ''; if (txt = window.getSelection) txt = window.getSelection().toString(); else txt = document.selection.createRange().text; return txt; } /** Запуск часов */ function clock() { SecondsT++; if (SecondsT>59) { SecondsT=0; MinutesT++; } if (MinutesT>59) { MinutesT=0; HoursT++; } if (HoursT>23) { HoursT=0; } if (HoursT<10) {HoursT="0"+(HoursT-0)}; if (MinutesT<10) {MinutesT="0"+(MinutesT-0)}; if (SecondsT<10) {SecondsT="0"+(SecondsT-0)}; ServerTime = HoursT + ":" + MinutesT + ":" + SecondsT; if ( SecondsT%2 == 0 ) { ServerTime = HoursT + ":" + MinutesT; } else { ServerTime = HoursT + ":" + MinutesT; } document.getElementById('clocker_div').innerHTML = ServerTime; TimerT=setTimeout("clock()",1000); } /** Загрузчик*/ $(function() { /*$('img.pre').animate({opacity:"0.6"}, 800); $('img.pre').hover(function(){$(this).stop().animate({opacity:"1"}, 150);}, function(){$(this).stop().animate({opacity:"0.6"}, 150);});*/ var p = $('#top-pan').position(); if ( p ) { var fromtop = p.top; $(window).scroll(function(){ if ( $(window).scrollTop() > fromtop ){ $('#top-pan').addClass("fixed"); $('#top-pan #categories').fadeIn(); $('#top-pan.fixed #pan-content #order-list').css('left', '850'); $('#info-line-bottom-bg').css('margin-bottom','55px'); //$('#to-top').show(); } else{ $('#info-line-bottom-bg').css('margin-bottom','0px'); //$('#top-pan #categories').fadeOut(); $('#order-list').css('left', '905'); $('#top-pan').removeClass("fixed"); //$('#to-top').hide(); } }); } //Установка корзины setButts(); showNewsList(); //Запуск обновлений TimerUN=setTimeout("getUpNews()",60000); //Модуль НОВОСТИ РУБРИКИ $(".catnews ul.switcher li a").hover(function(){ if ( $(this).attr('class') == 'active' ) return; $(".catnews ul.switcher li a").removeClass("active"); $(this).addClass("active"); $(".catnews-list").hide(); $('.'+$(this).attr('id')).show(); $(this).blur(); return false; }); //Модуль ЛИЦА $(".faces ul.switcher li a").hover(function(){ if ( $(this).attr('class') == 'active' ) return; $(".faces ul.switcher li a").removeClass("active"); $(this).addClass("active"); $(".faces-list").hide(); $('.'+$(this).attr('id')).show(); $(this).blur(); return false; }); //Модуль СЛАЙДЕР /*$("ul#slider li").hover(function(){ if ( $(this).attr('class') == 'active' ) return; $("#slider li").removeClass("active"); $(this).addClass("active"); $("div.s-content").hide(); $(this).children().show(); return false; });*/ $('.comm-editer textarea').bind('focus', function() { $(this).animate({height:"88"}, 150); }); $('.comm-editer textarea').bind('blur', function() { if ( $(this).val() == '' ){ $(this).animate({height:"38"}, 150); } }); //Запускаем календарь и часы $('#now-date').hover(function(){$("#calend").fadeIn();},function(){$("#calend").fadeOut();}); $('#calend').css( "opacity", "0.97" ); //clock(); ShowDateTitle(); }); /** Комментарии */ function TestComm( form, fix ){ if ( myId == 0 && ( form.name.value == "" || form.name.value == "Ваше имя" ) ){ alert('Укажите Ваше имя'); return false; } else if ( form.text.value == "" ){ alert('Укажите комментарий'); return false; } else if ( myId == 0 ) { var dlg = document.createElement("div"); document.getElementsByTagName("body")[0].appendChild(dlg); dlg.className = "msg"; var frame = document.createElement("div"); dlg.appendChild(frame); var formhtml = '
'; formhtml += '
Зарегистрируйтесь и авторизуйтесь на сайте, чтобы добавлять комментарии без проверочного кода.
'; frame.innerHTML = formhtml; $(dlg).dialog({ modal: true, width: 350, height: 250, title: 'Укажите цифры с картинки', resizable: false, buttons:{ 'Отправить' : function(){ if ( $('#keystring').val() == '' ){ alert('Укажите проверочный код'); return false; } else{ AddComment( form ); return false; } } } }); $('#keystring').focus(); return false; } else{ AddComment( form ); } } function AddComment( form ) { var req = new JsHttpRequest(); req.onreadystatechange = function() { form.text.disabled = true; if (req.readyState == 4){ form.text.disabled = false; if ( req.responseJS.error == '' ){ form.text.value = ''; $('.msg').remove(); $('#auto_comments').append( req.responseText ); alert ('Спасибо, Ваш комментарий отправлен! После проверки он будет размещен на сайте.'); if ( form.parent.value ) { SetNoCommParent(); } } else {alert (req.responseText);} } } if ( myId == 0 ) var sends = { id: form.cid.value, type: form.type.value, parent: form.parent.value, text: form.text.value, keystring: $('#keystring').val(), name: form.name.value, mail: ( form.mail.value == 'Ваш e-mail' ? '' : form.mail.value ) }; else var sends = { id: form.cid.value, type: form.type.value, parent: form.parent.value, text: form.text.value }; req.open( null, 'ajax/comms.php?&task=addcomment', true ); req.send( sends ); } function ToCommOtv( parent ) { var parentcomm = $('.comm-parent-id').val(); if ( parentcomm == 0 ){ var commform = $('#form-comm-past').html(); $('#form-comm-past').html( '' ); } else{ var commform = $('#comm-otv-'+parentcomm).html(); $('#comm-otv-'+parentcomm).html( '' ); } $('#comm-otv-'+parent).html( commform ); $('.comm-parent-id').val( parent ); $('#comm-otv-'+parent+' .title-comm-text').html( "↑ Ответить на комментарий ↑" ); $('#comm-otv-'+parent+' .no-parrent').show(); $('#comm-otv-'+parent+' .add-comments').addClass( 'to-parent' ); $('.comm-editer textarea').bind('focus', function() { $(this).animate({height:"88"}, 150); }); $('.comm-editer textarea').bind('blur', function() { if ( $(this).val() == '' ){ $(this).animate({height:"38"}, 150); } }); } function SetNoCommParent() { var parentcomm = $('.comm-parent-id').val(); if ( parentcomm == 0 ) return false; var commform = $('#comm-otv-'+parentcomm).html(); $('#comm-otv-'+parentcomm).html( '' ); $('#form-comm-past').html( commform ); $('.comm-parent-id').val( '0' ); $('#form-comm-past .title-comm-text').html( "Добавить комментарий" ); $('#form-comm-past .no-parrent').hide(); $('#form-comm-past .add-comments').removeClass( 'to-parent' ); $('.comm-editer textarea').bind('focus', function() { $(this).animate({height:"88"}, 150); }); $('.comm-editer textarea').bind('blur', function() { if ( $(this).val() == '' ){ $(this).animate({height:"38"}, 150); } }); } /** /Комментарии */ /** Календарь */ function ShowDateTitle() { /** Пишем заголовок */ $('#date-title div').html( MesName[mes] + ' ' + god ); /** Строим каледарик */ var countDays = new Date( god, mes+1, 0 ).getDate(); var DayFirst = new Date( god, mes, 1 ).getDay(); var dn = 1; var inmess = false; var curday = 1; var calLink = 'archive/'; var doLink = true; var html = ''; html += ''; html += ''; for ( var i = 1; i <= 42; i++ ){ if ( dn === DayFirst && inmess === false && curday == 1 ){ inmess = true; }else if ( inmess === true && curday > countDays ){ inmess = false; } if ( dn === 1 ){ html += ''; } var curMark = new Date( god, mes, curday ); html += ''; if ( dn === 0 ) { html += ''; $dn = 0; } dn++; if ( dn === 7 ){ dn = 0; } if ( inmess === false && curday > 1 ){ if ( 42 - i >= 7 ){ i = i + 7; } } } html += '
ПН
ВТ
СР
ЧТ
ПТ
СБ
ВС
'; if ( inmess === true ){ var cMess = mes+1; if ( nowMark > curMark ){ doLink = true; }else{ doLink = false; } html += ( doLink === true ? '' : '' )+curday+( doLink === true ? '' : '' ); curday++; }else{ html += ' '; } html += '
'; $('#date-list').html( html ); } function BackMes(){ if ( mes == 0 ){ mes = 11; god--; }else{ mes--; } ShowDateTitle(); } function NaxtMes(){ if ( mes == 11 ){ mes = 0; god++; }else{ mes++; } ShowDateTitle(); } /** Корзина новостей */ //находится ли ИД function in_news( id ){ for( var i = 0, l = MyNews.length; i < l; i++ ){ if( MyNews[i].id == id ){ return true; } } return false; } //Кнопка добавить function AddOLink( e, id ){ $(e).html( 'В закладки' ); } //кнопка удалить function RemOLink( e, id ){ $(e).html( 'Убрать закладку' ); } //убрать новость из закладок function RemoveNews( id ){ var req = new JsHttpRequest(); if ( in_news( id ) === false ){ setButts(); return; } var NewList = new Array(); for( var i = 0, l = MyNews.length; i < l; i++ ){ if( MyNews[i].id != id ){ NewList[NewList.length] = MyNews[i]; } } MyNews = NewList; showNewsList(); setButts(); req.open( null, 'lib/order/mynews.php?task=removeNews', true ); req.send( { id: id } ); } //добавить в закладки function AddNews( id ){ var req = new JsHttpRequest(); if ( in_news( id ) === true ){ setButts(); return; } if ( MyNews.length >= MyLimit ){ alert( MyLimitMess ); return; } $('.order-box#'+id).html( 'Загрузка...' ); req.onreadystatechange = function(){ if (req.readyState == 4) { if ( req.responseJS.error != '' ){ alert( req.responseJS.error ); return; } MyNews[MyNews.length] = { id: req.responseJS.id, title: req.responseJS.title }; showNewsList(); setButts(); } } req.open( null, 'lib/order/mynews.php?task=addNews', true ); req.send( { id: id } ); } //построение списка function showNewsList(){ if ( typeof MyNews == 'undefined' ) return; var ul = '
'; for( var i = 0, l = MyNews.length; i < l; i++ ){ var link = 'news/'+MyNews[i].id; ul += '