Код: Выделить всё
<script type="text/javascript">
<!--
var http_request = getHTTPObject();
var divname = '';
var open_quick_edit = 0;
function quick_edit(post_id)
{ if (document.getElementById('quickedit')==null){
divname = 'postdiv' + post_id;
$(this).oneTime(400, function() {
if (document.getElementById('quickedit')==null){document.getElementById('postdiv' + post_id).innerHTML = '<img src="{T_THEME_PATH}/images/ajax-loader.gif" style="margin: 60px auto; display: block;" />';}
});
get_text(post_id);
contents = document.getElementById('quick_edit' + post_id).style.display = 'none';
}}
function advanced_edit(post_id, link)
{
contents = document.getElementById('quickedit').value;
window.location = link;
}
function submit_changes(post_id)
{
contents = document.forms['quickedit'].elements['textarea'].value;
contents = contents.replace(/[&]/g,"%26");
$(this).oneTime(400, function() {
if (document.getElementById('quickedit')!=null){document.getElementById('postdiv' + post_id).innerHTML = '<img src="{T_THEME_PATH}/images/ajax-loader.gif" style="margin: 60px auto; display: block;" />';}
});
get_text(post_id, contents);
contents = document.getElementById('quick_edit' + post_id).style.display = '';
editando = '';
}
function cancel_changes(post_id)
{
contents = 'cancel';
$(this).oneTime(400, function() {
if (document.getElementById('quickedit')!=null){document.getElementById('postdiv' + post_id).innerHTML = '<img src="{T_THEME_PATH}/images/ajax-loader.gif" style="margin: 60px auto; display: block;" />';}
});
get_text(post_id, contents);
contents = document.getElementById('quick_edit' + post_id).style.display = '';
}
function get_text(post_id, contents)
{
if (contents)
{
contents = '&contents=' + contents + '&submit=true';
}
else
{
contents = '';
}
param = 'post_id=' + post_id + contents;
http_request.open("POST", '{U_QUICKEDIT}', true);
http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http_request.onreadystatechange = handle_text;
http_request.send(param);
}
function handle_text()
{
if (http_request.readyState == 4)
{
if (http_request.status == 200)
{
result = http_request.responseText;
document.getElementById(divname).innerHTML = result;
}
else
{
alert('There was a problem with the request.');
}
}
}
function getHTTPObject()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
return new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.';
}
}
-->
</script>
Заранее благодарен.