initial commit with snapshot 20140213
This commit is contained in:
33
templates/scripts/chkcookie.js
Normal file
33
templates/scripts/chkcookie.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function create_cookie(name, value, days)
|
||||
{
|
||||
if (days)
|
||||
{
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*3600*1000));
|
||||
|
||||
var expires ="; expires="+date.toGMTString();
|
||||
}
|
||||
else
|
||||
var expires = "";
|
||||
|
||||
document.cookie += name+"="+value+expires+"; path=/";
|
||||
}
|
||||
|
||||
function read_cookie(name)
|
||||
{
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i=0; i< ca.length; i++)
|
||||
{
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function erase_cookie(name)
|
||||
{
|
||||
create_cookie(name, "", -1);
|
||||
}
|
||||
62
templates/scripts/nick.js
Normal file
62
templates/scripts/nick.js
Normal file
@@ -0,0 +1,62 @@
|
||||
var ajax;
|
||||
|
||||
function init() {
|
||||
initAjax();
|
||||
}
|
||||
|
||||
function initAjax() {
|
||||
try
|
||||
{
|
||||
ajax = new XMLHttpRequest();
|
||||
}
|
||||
catch(e) // IE <= 6
|
||||
{
|
||||
var XmlHttpVersions = [
|
||||
'MSXML2.XMLHTTP.6.0',
|
||||
'MSXML2.XMLHTTP.5.0',
|
||||
'MSXML2.XMLHTTP.4.0',
|
||||
'MSXML2.XMLHTTP.3.0',
|
||||
'MSXML2.XMLHTTP',
|
||||
'Microsoft.XMLHTTP'
|
||||
];
|
||||
for (var i=0; i < XmlHttpVersions.length && null === ajax; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
ajax = new ActiveXObject(XmlHttpVersions[i]);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (null === ajax)
|
||||
{
|
||||
throw new Error('AJAX Error');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function response() {
|
||||
if (ajax.readyState != 4 || ajax.status != 200)
|
||||
return;
|
||||
if (ajax.responseText == 'true')
|
||||
{
|
||||
document.getElementById('nick-inuse').style.display = 'inline';
|
||||
document.getElementById('nick-free').style.display = 'none';
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById('nick-inuse').style.display = 'none';
|
||||
document.getElementById('nick-free').style.display = 'inline';
|
||||
}
|
||||
}
|
||||
|
||||
function checkNick() {
|
||||
if (ajax == null)
|
||||
init();
|
||||
if (document.getElementById('nick').value == '') return 0;
|
||||
ajax.onreadystatechange = response;
|
||||
ajax.open('GET', 'index.php?mode=checknick&nick=' + document.getElementById('nick').value);
|
||||
|
||||
ajax.send(null);
|
||||
}
|
||||
70
templates/scripts/posting.js
Normal file
70
templates/scripts/posting.js
Normal file
@@ -0,0 +1,70 @@
|
||||
var bbcode = ['[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[s]', '[/s]', '[url]', '[/url]', '[center]', '[/center]', '[quote]', '[/quote]', '[code]', '[/code]'];
|
||||
|
||||
function insertTag(first, second)
|
||||
{
|
||||
postArea = document.getElementById('post');
|
||||
if (document.selection) // IE
|
||||
{
|
||||
postArea.focus();
|
||||
sel = document.selection.createRange();
|
||||
sel.text = first + sel.text + second;
|
||||
}
|
||||
else if (postArea.selectionStart || postArea.selectionStart == '0')
|
||||
{
|
||||
var startPos = postArea.selectionStart;
|
||||
var endPos = postArea.selectionEnd;
|
||||
if (startPos == endPos)
|
||||
{
|
||||
if (first == bbcode[8])
|
||||
{
|
||||
var link = prompt('Type hyperlink address', 'http://');
|
||||
if (startPos != 0)
|
||||
{
|
||||
postArea.value = postArea.value.substring(0, startPos) + '[url=' + link + '] ' + postArea.value.substring(startPos, endPos) + second + postArea.value.substring(endPos, postArea.value.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
postArea.value += '[url=' + link + '][/url]';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
postArea.value += ' ' + first + second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
postArea.value = postArea.value.substring(0, startPos) + first + postArea.value.substring(startPos, endPos) + second + postArea.value.substring(endPos, postArea.value.length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
postArea.value += ' ' + first + second;
|
||||
}
|
||||
}
|
||||
|
||||
function bbTag(item)
|
||||
{
|
||||
if(item < bbcode.length -1)
|
||||
{
|
||||
insertTag(bbcode[item], bbcode[item+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(item)
|
||||
{
|
||||
case 16:
|
||||
var firstItem = prompt('Type first item list');
|
||||
document.getElementById('post').value += "[list]\n[*]"+firstItem+"\n[/list]";
|
||||
break;
|
||||
case 18:
|
||||
var color = document.getElementById('text_color').value;//prompt('Type font color', 'black');
|
||||
insertTag('[color='+color+']', '[/color]');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function insertSmile(smile)
|
||||
{
|
||||
document.getElementById('post').value += ' ' + smile;
|
||||
}
|
||||
Reference in New Issue
Block a user