Post by Matt on Apr 21, 2006 15:37:09 GMT -5
Crossbrowser: Have tested IE & FF sucussfully
What it does: Allows users to choose certain things that they do in every single post, ie: tag-on text, or bold, or a certain color. With this it does it for them automatically without them having to do it in every post.
Created By: Eric
Global Footer
Main Footer
What it does: Allows users to choose certain things that they do in every single post, ie: tag-on text, or bold, or a certain color. With this it does it for them automatically without them having to do it in every post.
Created By: Eric
Global Footer
<script type="text/javascript">
<!--
if(location.href.match(/action=post/i))
{
function addPref(){
if(document.cookie.match(/pprefs\=(((.+?);)|.+)/i))
{
var res = RegExp.$1;
var prefs = res.split(',');
for(p=0;p<prefs.length;p++)
{
if(prefs[p].match(/^t(.+)$/i))
{
var tagOn = RegExp.$1;
tagOn = tagOn.replace(/\&com/g,',');
tagOn = tagOn.replace(/\&sem/g,'\;');
tagOn = tagOn.replace(/\\n/g,'\n');
tagOn = '\n' + tagOn;
pF.message.value += tagOn;
}else if(prefs[p].match(/(^[biu]{1}$)/i)){
var tag = RegExp.$1;
pF.message.value = '['+tag+']'+pF.message.value;
pF.message.value += '[/'+tag+']';
}else if(prefs[p].match(/^c(\#?([\w\s]+))/i)){
var color = RegExp.$1;
pF.message.value = '[color='+color+']'+pF.message.value;
pF.message.value += '[/color]';
}
}
}
}
var pF = document.postForm;
pF.onsubmit = function(){addPref();}
}
//-->
</script>
Main Footer
<script type="text/javascript">
<!--
function update()
{
var bold = document.getElementById('b');
var ital = document.getElementById('i');
var under = document.getElementById('u');
var color = document.getElementById('c').value;
var tagOn = document.getElementById('t').value;
tagOn = tagOn.replace(/(\r)?\n/g,'\\n');
tagOn = tagOn.replace('"','\"');
tagOn = tagOn.replace("'","\'");
tagOn = tagOn.replace(',','&com');
tagOn = tagOn.replace(';','&sem');
var addCookie = '';
if(tagOn != "") addCookie += 't'+tagOn+',';
if(bold.checked) addCookie += 'b,';
if(ital.checked) addCookie += 'i,';
if(under.checked) addCookie += 'u,';
if(color != "") addCookie += 'c'+color+',';
var d = new Date();
d.setDate(d.getDate() + 36500);
document.cookie = 'pprefs='+addCookie+';expires='+d;
theTD.innerHTML = '<b>Your preferences have been set.</b>';
}
if(location.href.match(/action\=viewprofile/i))
{
var td = document.getElementsByTagName('td');
for(p=0;p<td.length;p++)
{
if(td[p].colSpan == "2" && td[p].innerHTML.match(/Bookmarks/i))
{
td[p].firstChild.firstChild.innerHTML += ' - <a href="index.cgi?action=pprefs">Posting '
+'Preferences</a>';
}
}
}else if(location.href.match(/action\=pprefs/i)){
var table='<table border="0" cellpadding="3" cellspacing="0" width="100%">'
+'<tr><td>Bold:</td><td colspan="2"><input type="checkbox" id="b" /></td></tr>'
+'<tr><td>Italic:</td><td colspan="2"><input type="checkbox" id="i" /></td></tr>'
+'<tr><td>Underline:</td><td colspan="2"><input type="checkbox" id="u" /></td></tr>'
+'<tr><td>Color:</td><td colspan="2"><input type="text" id="c" /></td></tr>'
+'<tr><td>Tag-On</td><td><textarea id="t"></textarea></td><td>This is where you '
+'can put something at the end of every post. Your other posting preferences will be applied to it. Should '
+'you use different tags for your tag-on please just use them as you normally would on a post.'
+'</td></tr>'
+'<tr><td colspan="3"><input type="submit" value="Update" onclick="javascript:update();" /></td>'
+'</tr></table>';
var td = document.getElementsByTagName('td');
document.title = document.title.replace(/An Error Has Occurred/i,'Posting Preferences');
for(p=0;p<td.length;p++)
{
if(td[p].innerHTML.match(/An Error Has Occurred/i))
{
td[p].innerHTML = td[p].innerHTML.replace(/An Error Has Occurred/i,'Posting Preferences');
}
if(td[p].innerHTML.match(/Invalid addModule call\./i) && td[p].className == "windowbg")
{
var theTD = td[p];
theTD.innerHTML = table
}
}
if(document.cookie.match(/pprefs\=(((.+?);)|.+)/i))
{
var res = RegExp.$1;
var prefs = res.split(',');
for(p=0;p<prefs.length;p++)
{
if(prefs[p].match(/^t(.+)$/i))
{
var tagOn = RegExp.$1;
tagOn = tagOn.replace(/\&com/g,',');
tagOn = tagOn.replace(/\&sem/g,'\;');
tagOn = tagOn.replace(/\\n/g,'\n');
document.getElementById('t').value = tagOn;
}else if(prefs[p].match(/(^[biu]{1}$)/i)){
var tag = RegExp.$1;
document.getElementById(tag).checked = true;
}else if(prefs[p].match(/^c(\#?([\w\s]+))/i)){
var color = RegExp.$1;
document.getElementById('c').value = color;
}
}
}
}
//-->
</script>