/usr/share/chronicle/themes/simple/ajax.js is in chronicle 4.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | // -*-mode: C++; style: K&R; c-basic-offset: 4 ; -*- */
//
// Simple collection of Javascript for Ajax form submission.
//
//
// Get an XMLHTTPRequest object.
//
function getXMLHTTPRequest()
{
req = false;
if(window.XMLHttpRequest)
{
try
{
req = new XMLHttpRequest();
}
catch(e)
{
req = false;
}
}
else if(window.ActiveXObject)
{
try
{
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
req = false;
}
}
}
return( req );
}
//
// Submit the comment.
//
function submitComment()
{
showProgress();
var xhr = getXMLHTTPRequest();
if(! xhr )
{
hideProgress();
return;
}
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
if(xhr.status == 200)
{
var o = document.getElementById( "output" );
o.innerHTML = xhr.responseText;
}
else
{
var o = document.getElementById( "output" );
o.innerHTML = "Failed HTTP code " + xhr.status + " " + xhr.responseText;
}
hideProgress();
}
};
data = 'ajax=1';
data = data + '&id=' + escape(document.forms[0].id.value );
data = data + '&captcha=' + escape( document.forms[0].captcha.value );
data = data + '&id=' + escape(document.forms[0].id.value );
data = data + '&captcha=' + escape( document.forms[0].captcha.value );
data = data + '&name=' + escape( document.forms[0].name.value );
data = data + '&mail=' + escape( document.forms[0].mail.value );
data = data + '&body=' + escape( document.forms[0].body.value );
//
// Make the request
//
xhr.open("POST", "/cgi-bin/comments.cgi", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
}
//
// Show our progress marker.
//
function showProgress()
{
var i = document.getElementById( "progress" );
if ( i )
{
i.style.display = 'block';
}
}
//
// Hide our progress marker.
//
function hideProgress()
{
var i = document.getElementById( "progress" );
if ( i )
{
i.style.display = 'none';
}
}
function showCloud()
{
var i = document.getElementById( "tags" );
if ( i )
{
i.style.display = 'block';
}
i = document.getElementById( "tags_toggle" );
if ( i )
{
i.style.display = 'none';
}
}
function hideCloud()
{
var i = document.getElementById( "categories" );
if ( i )
{
i.style.display = 'none';
}
}
function toggle_visibility(id)
{
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
|