You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
6.7 KiB

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]='<a href="' + forum_url + 'act=moderation&code=calc&tid=' + tid + '">Ïåðåñ÷èòàòü âñå â òåìå</a>';
}
menu[1]='<a href="' + forum_url + 'act=subscription&code=add&tid=' + tid + '">Ïîäïèñêà íà òåìó</a>';
menu[2]='<a href="' + forum_url + 'act=_topic&code=forward&tid=' + tid + '">Ñîîáùèòü äðóãó</a>';
menu[3]='<a href="' + forum_url + 'act=_topic&code=print&tid=' + tid + '">Âåðñèÿ äëÿ ïå÷àòè</a>';
return menu;
};
function ForumMenu( fid, moderation, forum_url ){
var menu=new Array();
if (moderation){
menu[0]='<a href="' + forum_url + 'showforum=' + fid + '&code=hidden">Ïîêàçàòü âñå ñêðûòûå òåìû</a>';
menu[1]='<a href="' + forum_url + 'act=getforum&code=calc&fid=' + fid + '">Ïåðåñ÷èòàòü âñå â ôîðóìå</a>';
}
menu[3]='<a href="' + forum_url + 'showforum=' + fid + '&code=today">Àêòèâíûå òåìû</a>';
menu[4]='<a href="' + forum_url + 'showforum=' + fid + '&code=noreply">Òåìû áåç îòâåòîâ</a>';
return menu;
};
function PostEditMenu( pid, forum_url, page, post_n ){
var menu=new Array();
menu[0]='<a onclick="ajax_post_edit(\'' + pid + '\'); return false;" href="#">' + menu_short + '</a>';
menu[1]='<a href="' + forum_url + 'act=post&code=02&pid=' + pid + '&p=' + page + '&pn=' + post_n + '">' + menu_full + '</a>';
return menu;
};
function FUserMenu( url, m_id, group, forum_url ){
var menu=new Array();
menu[0]='<a href="' + dle_root + 'user/' + url + '">' + menu_profile + '</a>';
menu[1]='<a href="' + dle_root + 'index.php?do=pm&doaction=newpm&user=' + m_id + '">' + menu_send + '</a>';
menu[2]='<a href="' + forum_url + 'act=getforum&code=user&mname=' + url + '">Íàéòè òåìû ïîëüçîâàòåëÿ</a>';
if (group == '1') {
menu[3]='<a onclick="window.open(\'' + dle_root + dle_admin + '?mod=editusers&action=edituser&id=' + m_id + '\', \'User\',\'toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500\'); return false;" href="#">' + menu_uedit + '</a>';
}
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();
}
};