Post by Ross on Apr 11, 2006 1:55:15 GMT -8
Main Footer
What this code does is it gives you a summary of a PM conversation. This summary will appear below both the message on the "PM View" page and the posting form on the "Send PM" page. Due to the way this code works, it will not function with older PMs; it will only effect messages sent after installing the code.
<script type="text/javascript">
<!--
/* PM Summary System v0.1
Copyright Ross
support.proboards.com
Do not redistribute without permission */
var summaryArray = [];
function extractQuote() {
var message = document.postForm.message.value.replace(/(\n|\r)/gi, '[br]');
if(message.match(/(^\[quote\](.+?)\[\/quote\]$)/im)) {
summaryArray.push(new Array(document.postForm.to.value, RegExp.$2.replace(/\[(quote|summ=.+?)\].+?\[\/(quote|summ)\]/gi, '').replace(/\[br\]\[br\]/gi,'')));
}
while(message.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
summaryArray.push(new Array(RegExp.$2, RegExp.$3));
message = message.replace(RegExp.$1,'');
}
if(location.href.match(/noquote/i)) {
document.postForm.message.value = '';
} else {
document.postForm.message.value = message.replace(/\[br\]/gi, '\n');
}
}
function saveSummary() {
for(s=0; s<summaryArray.length; s++) {
document.postForm.message.value += '[summ='+summaryArray[0]+']'+summaryArray[1]+'[/summ]';
}
}
function showMessage() {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).vAlign == 'top') {
while(td.item(i).innerHTML.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
summaryArray.push(new Array(RegExp.$2, RegExp.$3));
td.item(i).innerHTML = td.item(i).innerHTML.replace(RegExp.$1, '');
}
var a = td.item(i-1).getElementsByTagName('a');
a.item(0).href = a.item(1).href+'&noquote';
break;
}
}
}
function previewMessage() {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).vAlign == 'top') {
while(td.item(i).innerHTML.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
td.item(i).innerHTML = td.item(i).innerHTML.replace(RegExp.$1, '');
}
}
}
}
function parse(mes) {
var ubbc = [
[/\[hr\]/gi, '<hr>'],
[/\[b\](.+?)\[\/b\]/gi, '<b>$1</b>'],
[/\[u\](.+?)\[\/u\]/gi, '<u>$1</u>'],
[/\[i\](.+?)\[\/i\]/gi, '<i>$1</i>'],
[/\[s\](.+?)\[\/s\]/gi, '<s>$1</s>'],
[/\[sub\](.+?)\[\/sub\]/gi, '<sub>$1</sub>'],
[/\[sup\](.+?)\[\/sup\]/gi, '<sup>$1</sup>'],
[/\[left\](.+?)\[\/left\]/gi, '<p align="left">$1</p>'],
[/\[right\](.+?)\[\/right\]/gi, '<p align="right">$1</p>'],
[/\[center\](.+?)\[\/center\]/gi, '<center>$1</center>'],
[/\(.+?)\[\/color\]/gi, '<font color="$1">$2</font>'],
[/\(.+?)\[\/size\]/gi, '<font size="$1">$2</font>'],
[/\(.+?)\[\/font\]/gi, '<font family="$1">$2</font>'],
[/\[move\](.+?)\[\/move\]/gi, '<marquee>$1</marquee>'],
[/\[blockquote\](.+?)\[\/blockquote\]/gi, '<blockquote>$1</blockquote>'],
[/\(.+?)\[\/email\]/gi, '<a href="mailto:$1">$2</a>'],
Modified 07.30.10 by Trublu to remove the red to fix display issue:
document.postForm[red].parentNode[/red].parentNode.appendChild(document.createElement('br'));
document.postForm[red].parentNode[/red].parentNode.appendChild(showSummary());
What this code does is it gives you a summary of a PM conversation. This summary will appear below both the message on the "PM View" page and the posting form on the "Send PM" page. Due to the way this code works, it will not function with older PMs; it will only effect messages sent after installing the code.
<script type="text/javascript">
<!--
/* PM Summary System v0.1
Copyright Ross
support.proboards.com
Do not redistribute without permission */
var summaryArray = [];
function extractQuote() {
var message = document.postForm.message.value.replace(/(\n|\r)/gi, '[br]');
if(message.match(/(^\[quote\](.+?)\[\/quote\]$)/im)) {
summaryArray.push(new Array(document.postForm.to.value, RegExp.$2.replace(/\[(quote|summ=.+?)\].+?\[\/(quote|summ)\]/gi, '').replace(/\[br\]\[br\]/gi,'')));
}
while(message.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
summaryArray.push(new Array(RegExp.$2, RegExp.$3));
message = message.replace(RegExp.$1,'');
}
if(location.href.match(/noquote/i)) {
document.postForm.message.value = '';
} else {
document.postForm.message.value = message.replace(/\[br\]/gi, '\n');
}
}
function saveSummary() {
for(s=0; s<summaryArray.length; s++) {
document.postForm.message.value += '[summ='+summaryArray
}
}
function showMessage() {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).vAlign == 'top') {
while(td.item(i).innerHTML.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
summaryArray.push(new Array(RegExp.$2, RegExp.$3));
td.item(i).innerHTML = td.item(i).innerHTML.replace(RegExp.$1, '');
}
var a = td.item(i-1).getElementsByTagName('a');
a.item(0).href = a.item(1).href+'&noquote';
break;
}
}
}
function previewMessage() {
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).colSpan == '3' && td.item(i).vAlign == 'top') {
while(td.item(i).innerHTML.match(/(\[summ=(.+?)\](.+?)\[\/summ\])/i)) {
td.item(i).innerHTML = td.item(i).innerHTML.replace(RegExp.$1, '');
}
}
}
}
function parse(mes) {
var ubbc = [
[/\[hr\]/gi, '<hr>'],
[/\[b\](.+?)\[\/b\]/gi, '<b>$1</b>'],
[/\[u\](.+?)\[\/u\]/gi, '<u>$1</u>'],
[/\[i\](.+?)\[\/i\]/gi, '<i>$1</i>'],
[/\[s\](.+?)\[\/s\]/gi, '<s>$1</s>'],
[/\[sub\](.+?)\[\/sub\]/gi, '<sub>$1</sub>'],
[/\[sup\](.+?)\[\/sup\]/gi, '<sup>$1</sup>'],
[/\[left\](.+?)\[\/left\]/gi, '<p align="left">$1</p>'],
[/\[right\](.+?)\[\/right\]/gi, '<p align="right">$1</p>'],
[/\[center\](.+?)\[\/center\]/gi, '<center>$1</center>'],
[/\(.+?)\[\/color\]/gi, '<font color="$1">$2</font>'],
[/\(.+?)\[\/size\]/gi, '<font size="$1">$2</font>'],
[/\(.+?)\[\/font\]/gi, '<font family="$1">$2</font>'],
[/\[move\](.+?)\[\/move\]/gi, '<marquee>$1</marquee>'],
[/\[blockquote\](.+?)\[\/blockquote\]/gi, '<blockquote>$1</blockquote>'],
[/\(.+?)\[\/email\]/gi, '<a href="mailto:$1">$2</a>'],
Modified 07.30.10 by Trublu to remove the red to fix display issue:
document.postForm[red].parentNode[/red].parentNode.appendChild(document.createElement('br'));
document.postForm[red].parentNode[/red].parentNode.appendChild(showSummary());