<div class="chat-form">
<script type="text/javascript" src="http://yandex.st/jquery/1.6.2/jquery.min.js"></script>
<script LANGUAGE="JavaScript1.1">
document.oncontextmenu = function(){return false;};
</script>
<?php
$_OPTIMIZATION["title"] = "Аккаунт - Чат";
if(!isset($_SESSION["user"]))
return;
header("Content-type: text/html; charset=windows-1251");
$db->query("SET NAMES cp1251");
?>
<script type="text/javascript" src="/js/cookies.js" /></script>
<script type="text/javascript" src="/js/jqu.js" /></script>
<script type="text/javascript">
function insert_comm(open, close, no_focus)
{
msgfield = (document.all) ? document.all.forma_com : document.forms['form_com']['comment'];
if (document.selection && document.selection.createRange)
{
if (no_focus != '1' ) msgfield.focus();
sel = document.selection.createRange();
sel.text = open + sel.text + close;
if (no_focus != '1' ) msgfield.focus();
}else if (msgfield.selectionStart || msgfield.selectionStart == '0'){
var startPos = msgfield.selectionStart;
var endPos = msgfield.selectionEnd;
msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length);
msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length;
if (no_focus != '1' ) msgfield.focus();
}else{
msgfield.value += open + close;
if (no_focus != '1' ) msgfield.focus();
}return;}
function reset_chat(){
$.ajax({
type: "POST",
url: "/ajax/chat.php?p=get",
data: "",
success: function(result){
if($("#chat #chat_scroll").html() != result)
$("#chat #chat_scroll").html(result);
$("#chat #chat_scroll").scrollTo(9999);
}
});
}
function reset_online(){
$.ajax({
type: "POST",
url: "/ajax/chat.php?p=online",
data: "",
success: function(result){
$("#chat #chat-online").html(result);
}
});
}
function reset_warning(){
$("#chat .bbcode #warnings").text('');
}
function swich_close(){
$('body').css('padding-bottom', '7px');
$('#chat').css('bottom', '-150px');
$.cookie('swich', 'close');
}
function swich_open(){
$('body').css('padding-bottom', '157px');
$('#chat').css('bottom', '-0px');
$.cookie('swich', 'open');
}
$(function(){
reset_chat();
reset_online();
setInterval(reset_chat, 700);
setInterval(reset_online, 5000);
setInterval(reset_warning, 9000);
$('#chat #form_com').submit(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "/ajax/chat.php?p=send",
data: $('#chat #form_com').serialize(),
success: function(result){
$("#chat .bbcode #warnings").html(result);
if(result == '<span style="color:#0f0">Сообщение отправлено</span>'){
$('#chat .message input[name="comment"]').val('');
reset_chat();
}
}
});
});
$('#chat #chat_scroll .user').click(function(){
$('#chat .message input[name="comment"]').val($(this).text() + $('#chat .message input[name="comment"]').val());
});
$('#chat #chat-online .user').click(function(){
$('#chat .message input[name="comment"]').val($(this).text() + $('#chat .message input[name="comment"]').val());
});
});
</script>
<style type="text/css" href="/style/style.css">
#chat{position:relative;
bottom:<?php
if(!isset($_SESSION['chathide']))
$_SESSION["chathide"] = false;
if(isset($_GET['chats'])){
if($_SESSION['chathide'] == false)
$_SESSION["chathide"] = true;
else
$_SESSION["chathide"] = false;
}
echo $_SESSION['chathide'] == false?'10':'-155';
?>px; margin-top:10px; width:978px; background:#272727; padding:15px 10px 2px 12px; z-index:1; background:#7777;}
#chat #chat_scroll{height:160px; width:968px; display: inline-block; font-size:14px; padding:2px; overflow: auto; line-height:20px;}
#chat .swich{position:absolute; display:block; right:-2px; top:-31px; cursor:pointer; height:33px; width:155px; background:url(/img/chat/swich.png); text-align:center; line-height:33px;}
#chat #chat_scroll .user{font-weight:900; color:00f; text-decoration:underline; cursor:pointer;}
#chat #chat_scroll .user:hover{text-decoration:none;}
#chat #chat-online .user:hover{text-decoration:none;}
#chat #chat_scroll .to{background:#a4c5a3;}
#chat #chat_scroll .private{color:#f00;}
#chat #chat_scroll .time{color:#fff; float:left;}
#chat .message input[name="comment"]{background:#474747;
float:left;
border:1px solid #858484;
width:818px;
box-shadow: inset 10px 0px 20px rgba(0,0,0,0.2);
margin:15px 6px 5px 0px;
padding:0px 15px 0px 15px;
height:45px;
font-size:16px;}
#chat .message input[name="message_sub"]{
-moz-box-shadow:inset 0px 1px 0px 0px #5ad61d;
-webkit-box-shadow:inset 0px 1px 0px 0px #5ad61d;
box-shadow:inset 0px 1px 0px 0px #5ad61d;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #47b710), color-stop(1, #266508));
background:-moz-linear-gradient(top, #47b710 5%, #266508 100%);
background:-webkit-linear-gradient(top, #47b710 5%, #266508 100%);
background:-o-linear-gradient(top, #47b710 5%, #266508 100%);
background:-ms-linear-gradient(top, #47b710 5%, #266508 100%);
background:linear-gradient(to bottom, #47b710 5%, #266508 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#47b710', endColorstr='#266508',GradientType=0);
background-color:#47b710;
text-decoration:none;
border: none;
color:#FFFFFF;
width:148px;
padding:10px 0px 9px 0px;
margin:15px 6px 5px 0px;
cursor:pointer;
font-size:20px;
font-family: 'PT Sans', sans-serif;}
</style>
<div id="chat">
<!--<div id="chat_scroll">Загрузка...</div>-->
<div id="clear: both;"></div>
<div class="message">
<form id="form_com" action="#form_com" method="post">
<input type="text" id="comment" placeholder="Сообщение" name="comment" maxlength="255" />
<input type="hidden" name="to" />
<input type="submit" name="message_sub" value="Отправить" />
</div>
</div>
</form>
<div class="clr"></div>
</div>
Кажись нашелКто нибудь знает как в чате этого скрипта, сделать, чтобы преложение было не вверху, когда его отправляешь, а внизу ???
А то как то не удобно все время скролить вверх)) выдернул его а понять не могу....
Код:<div class="chat-form"> <script type="text/javascript" src="http://yandex.st/jquery/1.6.2/jquery.min.js"></script> <script LANGUAGE="JavaScript1.1"> document.oncontextmenu = function(){return false;}; </script> <?php $_OPTIMIZATION["title"] = "Аккаунт - Чат"; if(!isset($_SESSION["user"])) return; header("Content-type: text/html; charset=windows-1251"); $db->query("SET NAMES cp1251"); ?> <script type="text/javascript" src="/js/cookies.js" /></script> <script type="text/javascript" src="/js/jqu.js" /></script> <script type="text/javascript"> function insert_comm(open, close, no_focus) { msgfield = (document.all) ? document.all.forma_com : document.forms['form_com']['comment']; if (document.selection && document.selection.createRange) { if (no_focus != '1' ) msgfield.focus(); sel = document.selection.createRange(); sel.text = open + sel.text + close; if (no_focus != '1' ) msgfield.focus(); }else if (msgfield.selectionStart || msgfield.selectionStart == '0'){ var startPos = msgfield.selectionStart; var endPos = msgfield.selectionEnd; msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length); msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length; if (no_focus != '1' ) msgfield.focus(); }else{ msgfield.value += open + close; if (no_focus != '1' ) msgfield.focus(); }return;} function reset_chat(){ $.ajax({ type: "POST", url: "/ajax/chat.php?p=get", data: "", success: function(result){ if($("#chat #chat_scroll").html() != result) $("#chat #chat_scroll").html(result); $("#chat #chat_scroll").scrollTo(9999); } }); } function reset_online(){ $.ajax({ type: "POST", url: "/ajax/chat.php?p=online", data: "", success: function(result){ $("#chat #chat-online").html(result); } }); } function reset_warning(){ $("#chat .bbcode #warnings").text(''); } function swich_close(){ $('body').css('padding-bottom', '7px'); $('#chat').css('bottom', '-150px'); $.cookie('swich', 'close'); } function swich_open(){ $('body').css('padding-bottom', '157px'); $('#chat').css('bottom', '-0px'); $.cookie('swich', 'open'); } $(function(){ reset_chat(); reset_online(); setInterval(reset_chat, 700); setInterval(reset_online, 5000); setInterval(reset_warning, 9000); $('#chat #form_com').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: "/ajax/chat.php?p=send", data: $('#chat #form_com').serialize(), success: function(result){ $("#chat .bbcode #warnings").html(result); if(result == '<span style="color:#0f0">Сообщение отправлено</span>'){ $('#chat .message input[name="comment"]').val(''); reset_chat(); } } }); }); $('#chat #chat_scroll .user').click(function(){ $('#chat .message input[name="comment"]').val($(this).text() + $('#chat .message input[name="comment"]').val()); }); $('#chat #chat-online .user').click(function(){ $('#chat .message input[name="comment"]').val($(this).text() + $('#chat .message input[name="comment"]').val()); }); }); </script> <style type="text/css" href="/style/style.css"> #chat{position:relative; bottom:<?php if(!isset($_SESSION['chathide'])) $_SESSION["chathide"] = false; if(isset($_GET['chats'])){ if($_SESSION['chathide'] == false) $_SESSION["chathide"] = true; else $_SESSION["chathide"] = false; } echo $_SESSION['chathide'] == false?'10':'-155'; ?>px; margin-top:10px; width:978px; background:#272727; padding:15px 10px 2px 12px; z-index:1; background:#7777;} #chat #chat_scroll{height:160px; width:968px; display: inline-block; font-size:14px; padding:2px; overflow: auto; line-height:20px;} #chat .swich{position:absolute; display:block; right:-2px; top:-31px; cursor:pointer; height:33px; width:155px; background:url(/img/chat/swich.png); text-align:center; line-height:33px;} #chat #chat_scroll .user{font-weight:900; color:00f; text-decoration:underline; cursor:pointer;} #chat #chat_scroll .user:hover{text-decoration:none;} #chat #chat-online .user:hover{text-decoration:none;} #chat #chat_scroll .to{background:#a4c5a3;} #chat #chat_scroll .private{color:#f00;} #chat #chat_scroll .time{color:#fff; float:left;} #chat .message input[name="comment"]{background:#474747; float:left; border:1px solid #858484; width:818px; box-shadow: inset 10px 0px 20px rgba(0,0,0,0.2); margin:15px 6px 5px 0px; padding:0px 15px 0px 15px; height:45px; font-size:16px;} #chat .message input[name="message_sub"]{ -moz-box-shadow:inset 0px 1px 0px 0px #5ad61d; -webkit-box-shadow:inset 0px 1px 0px 0px #5ad61d; box-shadow:inset 0px 1px 0px 0px #5ad61d; background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #47b710), color-stop(1, #266508)); background:-moz-linear-gradient(top, #47b710 5%, #266508 100%); background:-webkit-linear-gradient(top, #47b710 5%, #266508 100%); background:-o-linear-gradient(top, #47b710 5%, #266508 100%); background:-ms-linear-gradient(top, #47b710 5%, #266508 100%); background:linear-gradient(to bottom, #47b710 5%, #266508 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#47b710', endColorstr='#266508',GradientType=0); background-color:#47b710; text-decoration:none; border: none; color:#FFFFFF; width:148px; padding:10px 0px 9px 0px; margin:15px 6px 5px 0px; cursor:pointer; font-size:20px; font-family: 'PT Sans', sans-serif;} </style> <div id="chat"> <!--<div id="chat_scroll">Загрузка...</div>--> <div id="clear: both;"></div> <div class="message"> <form id="form_com" action="#form_com" method="post"> <input type="text" id="comment" placeholder="Сообщение" name="comment" maxlength="255" /> <input type="hidden" name="to" /> <input type="submit" name="message_sub" value="Отправить" /> </div> </div> </form> <div class="clr"></div> </div>
поделись подскажи если не трудно а то ковырять впадлуКажись нашел
поделись подскажи если не трудно а то ковырять впадлу
url: "/ajax/chat.php?p=get",
в тайтле же указан ффскрипт в фасткоре?
РИЧ в принцепи примерно ответил ))поделись подскажи если не трудно а то ковырять впадлу