Post by lilsting10 on Jun 6, 2013 3:00:23 GMT -8
Or if someone can direct me to a 'v5' compatible code which does the same thing? Thanks in advance.
support.proboards.com/thread/256676/rpg-ethical-alignment-mini-profile
support.proboards.com/thread/256676/rpg-ethical-alignment-mini-profile
This code will allow each user to select an ethical alignment in their
profile, which will then be displayed in their mini profile. An
alignment scale will also be displayed in each user's mini profile.
There are a total of nine different alignments and the code provides a
link to a short wikipedia paragraph describing each of the alignments.
No editing is required.
Preview One
Preview Two
Preview Three
Cross Browser.
Global Footer.
<script type="text/javascript">
<!--
/*RPG Ethical Alignment in Mini Profile - By iAlex - Open Source*/
var
iEthList=[["Lawful Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Good"],
["Neutral Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral_Good"],
["Chaotic Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Good"],
["Lawful Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Neutral"],
["Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral"],
["Chaotic Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Neutral"],
["Lawful Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Evil"],
["Neutral Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral_Evil"],
["Chaotic Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Evil"]];
function iEthicAdd(){
var iEthSel=document.createElement('select');
var iEthPre=document.createElement('div');
iEthSel.options[0]=new Option('No Alignment', '');
for(var i=0;i<iEthList.length;i++){
iEthSel.options[iEthSel.length]=new Option(iEthList[0], iEthList[0]+': <a href="'+iEthList[1]+'" target="_blank">Read</a>');
}
var iPer=document.modifyForm.personaltext;
var iGen=document.modifyForm.gender.parentNode.parentNode.parentNode;
var iEth=iGen.cloneNode(true);
iEth.childNodes[0].firstChild.innerHTML='Ethical Alignment:';
iEth.childNodes[1].innerHTML='';
iEth.childNodes[1].appendChild(iEthSel);
iEth.childNodes[1].appendChild(iEthPre);
iEth.childNodes[2].firstChild.innerHTML='You can select an ethical
alignment from the drop down menu, which will then be displayed in your
mini profile.';
iGen.parentNode.insertBefore(iEth, iGen.nextSibling);
if(iPer.value.match(/\[A1i:(\d+)\]/)){
iEthSel.selectedIndex=RegExp.$1;
iEthPre.innerHTML=iEthSel.options[RegExp.$1].value;
iPer.value=iPer.value.replace(/\[A1i:(\d+)\]/, '');
}
function iSelCha(iSel){
iEthPre.innerHTML=iSel.value;
}
iEthSel.onchange=function(){
iSelCha(this);
}
iEthSel.onkeyup=function(){
iSelCha(this);
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', function(){
if(iEthSel.selectedIndex>0){
iPer.value=iPer.value+'[A1i:'+iEthSel.selectedIndex+']';
}
}, false);
}
else{
document.modifyForm.attachEvent('onsubmit', function(){
if(iEthSel.selectedIndex>0){
iPer.value=iPer.value+'[A1i:'+iEthSel.selectedIndex+']';
}
});
}
}
function iEthicMini(){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" &&
iTd.item(i).className.match(/windowbg(2)?/) &&
iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/member
is/) && iTd.item(i).innerHTML.match(/\[A1i:(\d+)\]/)){
var iEthHold=document.createElement('span');
iEthHold.innerHTML='<b'+'r />Alignment: <a
href="'+iEthList[RegExp.$1-1][1]+'"
target="_blank">'+iEthList[RegExp.$1-1][0]+'</a><b'+'r/><img
src="http://img378.imageshack.us/img378/2494/scale2cv3.gif"
/><span style="position: relative; right: '+(RegExp.$1*14)+'; top:
1px;"><img
src="http://img267.imageshack.us/img267/6149/userqs6.gif"
/></span>';
iTd.item(i).appendChild(iEthHold);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[A1i:(\d+)\]/g, '');
}
}
}
if(document.modifyForm){
iEthicAdd();
}
if(location.href.match(/action=(display|viewprofile|(user)?recent|calendarview|search2|pmview)/)
|| location.href.match(/index.cgi$/) &&
document.title.match(/Preview/) && document.postForm){
iEthicMini();
}
//-->
</script>
profile, which will then be displayed in their mini profile. An
alignment scale will also be displayed in each user's mini profile.
There are a total of nine different alignments and the code provides a
link to a short wikipedia paragraph describing each of the alignments.
No editing is required.
Preview One
Preview Two
Preview Three
Cross Browser.
Global Footer.
<script type="text/javascript">
<!--
/*RPG Ethical Alignment in Mini Profile - By iAlex - Open Source*/
var
iEthList=[["Lawful Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Good"],
["Neutral Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral_Good"],
["Chaotic Good",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Good"],
["Lawful Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Neutral"],
["Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral"],
["Chaotic Neutral",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Neutral"],
["Lawful Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Lawful_Evil"],
["Neutral Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Neutral_Evil"],
["Chaotic Evil",
"http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29#Chaotic_Evil"]];
function iEthicAdd(){
var iEthSel=document.createElement('select');
var iEthPre=document.createElement('div');
iEthSel.options[0]=new Option('No Alignment', '');
for(var i=0;i<iEthList.length;i++){
iEthSel.options[iEthSel.length]=new Option(iEthList[0], iEthList[0]+': <a href="'+iEthList[1]+'" target="_blank">Read</a>');
}
var iPer=document.modifyForm.personaltext;
var iGen=document.modifyForm.gender.parentNode.parentNode.parentNode;
var iEth=iGen.cloneNode(true);
iEth.childNodes[0].firstChild.innerHTML='Ethical Alignment:';
iEth.childNodes[1].innerHTML='';
iEth.childNodes[1].appendChild(iEthSel);
iEth.childNodes[1].appendChild(iEthPre);
iEth.childNodes[2].firstChild.innerHTML='You can select an ethical
alignment from the drop down menu, which will then be displayed in your
mini profile.';
iGen.parentNode.insertBefore(iEth, iGen.nextSibling);
if(iPer.value.match(/\[A1i:(\d+)\]/)){
iEthSel.selectedIndex=RegExp.$1;
iEthPre.innerHTML=iEthSel.options[RegExp.$1].value;
iPer.value=iPer.value.replace(/\[A1i:(\d+)\]/, '');
}
function iSelCha(iSel){
iEthPre.innerHTML=iSel.value;
}
iEthSel.onchange=function(){
iSelCha(this);
}
iEthSel.onkeyup=function(){
iSelCha(this);
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', function(){
if(iEthSel.selectedIndex>0){
iPer.value=iPer.value+'[A1i:'+iEthSel.selectedIndex+']';
}
}, false);
}
else{
document.modifyForm.attachEvent('onsubmit', function(){
if(iEthSel.selectedIndex>0){
iPer.value=iPer.value+'[A1i:'+iEthSel.selectedIndex+']';
}
});
}
}
function iEthicMini(){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" &&
iTd.item(i).className.match(/windowbg(2)?/) &&
iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/member
is/) && iTd.item(i).innerHTML.match(/\[A1i:(\d+)\]/)){
var iEthHold=document.createElement('span');
iEthHold.innerHTML='<b'+'r />Alignment: <a
href="'+iEthList[RegExp.$1-1][1]+'"
target="_blank">'+iEthList[RegExp.$1-1][0]+'</a><b'+'r/><img
src="http://img378.imageshack.us/img378/2494/scale2cv3.gif"
/><span style="position: relative; right: '+(RegExp.$1*14)+'; top:
1px;"><img
src="http://img267.imageshack.us/img267/6149/userqs6.gif"
/></span>';
iTd.item(i).appendChild(iEthHold);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[A1i:(\d+)\]/g, '');
}
}
}
if(document.modifyForm){
iEthicAdd();
}
if(location.href.match(/action=(display|viewprofile|(user)?recent|calendarview|search2|pmview)/)
|| location.href.match(/index.cgi$/) &&
document.title.match(/Preview/) && document.postForm){
iEthicMini();
}
//-->
</script>