function ajax_post_edit ( p_id ){ if ( ! c_cache[ p_id ] || c_cache[ p_id ] == '' ){ c_cache[ p_id ] = $('#post-id-'+p_id).html(); } ShowLoading(''); $.get( forum_ajax + "editpost.php", { id: p_id, action: "edit" }, function(data){ HideLoading(''); RunAjaxJS('post-id-'+p_id, data); setTimeout(function() { $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $("#post-id-" + p_id).offset().top - 70}, 700); }, 100); }); return false; }; function ajax_cancel_post_edit( p_id ){ if ( c_cache[ p_id ] != "" ) {$("#post-id-"+p_id).html(c_cache[ p_id ]);} return false; }; function ajax_save_post_edit( c_id ){ var post_txt = ''; comm_edit_id = c_id; post_txt = $('#forum_post_'+c_id).val(); ShowLoading(''); $.post(forum_ajax + "editpost.php", { id: c_id, post_text: post_txt, action: "save" }, function(data){ HideLoading(''); $("#post-id-"+c_id).html(data); }); return false; }; function doAddPost(){ var form = document.getElementById('forum-post-form'); if (form.post_text.value == '' || form.post_text.value == ''){alert ( dle_req_field );return false;} ShowLoading(''); $.post(forum_ajax + "addpost.php", { topic_id: form.topic_id.value, forum_id: form.forum_id.value, post_id: form.post_id.value, topic_title: form.topic_title.value, name: form.name.value, mail: form.mail.value, post_text: form.post_text.value, skin: dle_skin }, function(data){ HideLoading(''); RunAjaxJS('ajax-post', data); if (data != 'error' && document.getElementById('blind-animation')) { $("html"+( ! $.browser.opera ? ",body" : "")).animate({scrollTop: $("#ajax-post").offset().top - 70}, 1100); setTimeout(function() { $('#blind-animation').show('blind',{},0)}, 0); } }); }; function postDelete(url){ var agree=confirm( 'Вы действительно хотите удалить это сообщение?' ); if (agree) document.location=url; }; function topicDelete(url){ var agree=confirm( 'Вы действительно хотите удалить эту тему?' ); if (agree) document.location=url; }; function rowDelete(url){ var agree=confirm( 'Вы действительно хотите удалить эту запись?' ); if (agree) document.location=url; }; function TopicMenu( tid, forum_url, moderation ){ var menu=new Array(); if (moderation) { menu[0]='Пересчитать все в теме'; } menu[1]='Подписка на тему'; menu[2]='Сообщить другу'; menu[3]='Версия для печати'; return menu; }; function ForumMenu( fid, moderation, forum_url ){ var menu=new Array(); if (moderation){ menu[0]='Показать все скрытые темы'; menu[1]='Пересчитать все в форуме'; } menu[3]='Активные темы'; menu[4]='Темы без ответов'; return menu; }; function PostEditMenu( pid, forum_url, page, post_n ){ var menu=new Array(); menu[0]='' + menu_short + ''; menu[1]='' + menu_full + ''; return menu; }; function FUserMenu( url, m_id, group, forum_url ){ var menu=new Array(); menu[0]='' + menu_profile + ''; menu[1]='' + menu_send + ''; menu[2]='Найти темы пользователя'; if (group == '1') { menu[3]='' + menu_uedit + ''; } return menu; }; function navigation(pages_count, url){ var page = prompt("Перейти к странице", ""); if (page) { if (pages_count >= page) { window.location.href = url + page; } } }; function PostLink(link){ url = window.location; var enterCause = prompt("Копирование прямой ссылки", url + "#post-" + link); }; function select_id( sid ){ var saved = new Array(); var clean = new Array(); var add = 1; tmp = document.modform.selected_id.value; if( tmp != "" ) { saved = tmp.split(","); } for( i = 0 ; i < saved.length; i++ ) { if ( saved[i] != "" ) { if ( saved[i] == sid ) { add = 0; } else { clean[clean.length] = saved[i]; } } } if ( add ) { clean[ clean.length ] = sid; } newvalue = clean.join(','); document.modform.selected_id.value = newvalue; }; function ShowHide( name, open ){ if (document.getElementById( name ).style.display != "none") { document.getElementById( name ).style.display = "none"; } else { document.getElementById( name ).style.display = ""; } if (open) { document.getElementById( name ).style.display = ""; } }; function PostPreviewCompleted(){ var post_main_obj = document.getElementById( 'post-preview' ); var post_box_top = _get_obj_toppos( post_main_obj ); if ( post_box_top ) { scroll( 0, post_box_top - 70 ); } }; function PostPreview(){ var post_text = ""; post_text = document.getElementById('forum-post-form').post_text.value; if (post_text == ''){alert('Заполните все необходимые поля');return false} ShowLoading(''); $.post(forum_ajax + "post.preview.php", { post_text: post_text, skin: dle_skin}, function(data){ HideLoading(''); $("#post-preview").html(data); }); }; function uploadsform(open_url){ $("#uploads-form").remove(); ShowLoading(''); $.post(forum_ajax + "uploads.form.php", {open_url: open_url}, function(data){ HideLoading(''); $("body").append( data ); $('#uploads-form').dialog({ autoOpen: true, width: 470, buttons: { "Закрыть": function() { $(this).dialog("close"); $("#uploads-form").remove(); }}}); }); return false; }; function forum_ins(name){ var input = document.getElementById('forum-post-form').post_text; if (dle_txt!= "") { input.value += dle_txt; } else { input.value += "[b]"+name+"[/b],"+"\n"; } }; function CtrlEnter(event, form){ if((event.ctrlKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD))) { form.submit.click(); } };