Post by Peter on Apr 29, 2006 13:21:31 GMT
This code will alow you to select from a drop down of houses to put the use in.
<script type="text/javascript">
<!--
/*
Harry Potter - Put members into houses
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Houses...
var theHouses = [
"Slytherin", "Hufflepuff", "Gryffindor", "Ravenclaw"
];
// House text
var iHouse = "House";
// Who can pick which user goes into a house? Put the username in...ie..["admin", "Peter"];
var iHAllowed = ["admin"];
var curhou = {
house: "n/a",
rownum: 1
};
var iHDesTxt = "Select a " + iHouse.toLowerCase() + " you wish this member to be in.";
var iHDes;
var iHFont = document.createElement("font");
var mHTxt = document.createTextNode(iHouse + ":");
var iTable = document.getElementsByTagName("table");
var iCell = document.getElementsByTagName("td");
iHFont.size = "-2";
iHDes = iHFont.cloneNode(true).appendChild(document.createTextNode(iHDesTxt));
iHFont.size = "-1";
iHFont.appendChild(mHTxt);
function sortHouse(){
switch(arguments[0]){
case 1 :
document.modifyForm.personaltext.value += " [H:" + arguments[1] + "]";
break;
case 0 :
if(document.modifyForm.personaltext.value.match(/ \[H:(\d+)\]/)){
document.getElementById("hphouse").selectedIndex = RegExp.$1;
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace(/ \[H:\d+\]/, "");
}
break;
}
}
function setHPersonalTxt(){
var perTxt = document.modifyForm.personaltext;
if(perTxt.value.length >= 94 && !/\[H:\d+\]/.exec(perTxt.value)){
perTxt.value = perTxt.value.substr(0, 94);
}
}
function createSelect(){
var nSel = document.createElement("select");
nSel.id = "hphouse";
nSel.options[0] = new Option("Select House", 0);
for(h = 0; h < theHouses.length; h ++){
nSel.options[nSel.options.length] = new Option(theHouses[h], (h + 1));
}
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).width == "650" && iTable.item(t).innerHTML.match(/Disable Account:/)){
var nRow = iTable.item(t).insertRow(iTable.item(t).rows.length);
for(a = 0; a < iHAllowed.length; a ++){
if(document.cookie.match(new RegExp("\\buser=" + iHAllowed + ";?"))){
nRow.style.display = "";
break;
} else {
nRow.style.display = "none";
}
}
var nCell = nRow.insertCell(0);
nCell.appendChild(iHFont);
nCell = nRow.insertCell(1);
nCell.appendChild(nSel);
nCell = nRow.insertCell(2).appendChild(iHDes);
}
}
}
function doHMiniProfile(){
var mHFx = iHFont.cloneNode(true);
mHFx.style.fontSize = "11px";
for(c = 0; c < iCell.length; c ++){
if(iCell.item(c).width == "20%" && iCell.item(c).className == "windowbg" && iCell.item(c).innerHTML.match(/member is/)){
if(iCell.item(c).innerHTML.match(/ \[H:(\d+)\]/)){
if(RegExp.$1 != 0){
curhou.house = theHouses[(parseInt(RegExp.$1) - 1)];
}
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(/ \[H:\d+\]/, "");
}
if(iCell.item(c).innerHTML.match(/Posts: (\d+,\d+|\d+)/)){
mHFx.replaceChild(document.createTextNode(iHouse + ": " + curhou.house), mHFx.firstChild);
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
} else {
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
}
}
}
}
function doHMemberBio(){
var bHFont = document.createElement("font");
var re = />Member's Bio( -)?/;
bHFont.size = "2";
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).rows.item(0).innerHTML.match(re)){
var iRow = iTable.item(t).getElementsByTagName("tr");
for(r = 0; r < iRow.length; r ++){
if(iRow.item(r).innerHTML.match(/>Posts:</)){
curhou.rownum = (iRow.item(r).rowIndex + 1);
}
}
var nRow = iTable.item(t).insertRow(curhou.rownum);
var nCell = nRow.insertCell(0);
var cBFont = bHFont.cloneNode(true);
bHFont.appendChild(document.createTextNode(iHouse + ":"));
nCell.appendChild(bHFont);
nCell = nRow.insertCell(1);
cBFont.appendChild(document.createTextNode(curhou.house));
nCell.appendChild(cBFont);
}
}
}
if(location.href.match(/=modifyprofile&user=/) && document.modifyForm){
createSelect();
document.modifyForm.onsubmit = function(){
if(Boolean(typeof usingMoneyCode != "undefined") && usingMoneyCode){
setPersonalTxt(82);
document.getElementById("money").value.sortMoney(1);
}
setHPersonalTxt();
sortHouse(1, document.getElementById("hphouse").selectedIndex);
}
sortHouse(0);
}
if(!location.href.match(/\/index.cgi$/)){
doHMiniProfile();
}
if(location.href.match(/=viewprofile/)){
doHMemberBio();
}
//-->
</script>
Main footer.
Important: If you are using the money hack with this, please place this below it.
Goto modify a members profile, and you will be able to select which house to put the member in.
<script type="text/javascript">
<!--
/*
Harry Potter - Put members into houses
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Houses...
var theHouses = [
"Slytherin", "Hufflepuff", "Gryffindor", "Ravenclaw"
];
// House text
var iHouse = "House";
var curhou = {
house: "n/a",
rownum: 1
};
var iCell = document.getElementsByTagName("td");
function doHMiniProfile(){
for(c = 0; c < iCell.length; c ++){
var mHFx = document.createElement("font");
mHFx.style.fontSize = "11px";
if(iCell.item(c).width == "20%" && iCell.item(c).className.match(/^windowbg/) && iCell.item(c).innerHTML.match(/member is/)){
if(iCell.item(c).innerHTML.match(/ \[H:(\d+)\]/)){
if(RegExp.$1 != 0){
curhou.house = theHouses[(parseInt(RegExp.$1) - 1)];
} else {
curhou.house = "n/a";
}
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(/ \[H:\d+\]/, "");
} else {
curhou.house = "n/a";
}
if(iCell.item(c).innerHTML.match(/Posts: (\d+,\d+)|(\d+)/)){
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
} else {
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mMFx);
}
}
}
}
if(location.href.match(/(=display|\/index.cgi$)/)){
doHMiniProfile();
}
//-->
</script>
Add that to global footers
<script type="text/javascript">
<!--
/*
Harry Potter - Put members into houses
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Houses...
var theHouses = [
"Slytherin", "Hufflepuff", "Gryffindor", "Ravenclaw"
];
// House text
var iHouse = "House";
// Who can pick which user goes into a house? Put the username in...ie..["admin", "Peter"];
var iHAllowed = ["admin"];
var curhou = {
house: "n/a",
rownum: 1
};
var iHDesTxt = "Select a " + iHouse.toLowerCase() + " you wish this member to be in.";
var iHDes;
var iHFont = document.createElement("font");
var mHTxt = document.createTextNode(iHouse + ":");
var iTable = document.getElementsByTagName("table");
var iCell = document.getElementsByTagName("td");
iHFont.size = "-2";
iHDes = iHFont.cloneNode(true).appendChild(document.createTextNode(iHDesTxt));
iHFont.size = "-1";
iHFont.appendChild(mHTxt);
function sortHouse(){
switch(arguments[0]){
case 1 :
document.modifyForm.personaltext.value += " [H:" + arguments[1] + "]";
break;
case 0 :
if(document.modifyForm.personaltext.value.match(/ \[H:(\d+)\]/)){
document.getElementById("hphouse").selectedIndex = RegExp.$1;
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace(/ \[H:\d+\]/, "");
}
break;
}
}
function setHPersonalTxt(){
var perTxt = document.modifyForm.personaltext;
if(perTxt.value.length >= 94 && !/\[H:\d+\]/.exec(perTxt.value)){
perTxt.value = perTxt.value.substr(0, 94);
}
}
function createSelect(){
var nSel = document.createElement("select");
nSel.id = "hphouse";
nSel.options[0] = new Option("Select House", 0);
for(h = 0; h < theHouses.length; h ++){
nSel.options[nSel.options.length] = new Option(theHouses[h], (h + 1));
}
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).width == "650" && iTable.item(t).innerHTML.match(/Disable Account:/)){
var nRow = iTable.item(t).insertRow(iTable.item(t).rows.length);
for(a = 0; a < iHAllowed.length; a ++){
if(document.cookie.match(new RegExp("\\buser=" + iHAllowed + ";?"))){
nRow.style.display = "";
break;
} else {
nRow.style.display = "none";
}
}
var nCell = nRow.insertCell(0);
nCell.appendChild(iHFont);
nCell = nRow.insertCell(1);
nCell.appendChild(nSel);
nCell = nRow.insertCell(2).appendChild(iHDes);
}
}
}
function doHMiniProfile(){
var mHFx = iHFont.cloneNode(true);
mHFx.style.fontSize = "11px";
for(c = 0; c < iCell.length; c ++){
if(iCell.item(c).width == "20%" && iCell.item(c).className == "windowbg" && iCell.item(c).innerHTML.match(/member is/)){
if(iCell.item(c).innerHTML.match(/ \[H:(\d+)\]/)){
if(RegExp.$1 != 0){
curhou.house = theHouses[(parseInt(RegExp.$1) - 1)];
}
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(/ \[H:\d+\]/, "");
}
if(iCell.item(c).innerHTML.match(/Posts: (\d+,\d+|\d+)/)){
mHFx.replaceChild(document.createTextNode(iHouse + ": " + curhou.house), mHFx.firstChild);
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
} else {
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
}
}
}
}
function doHMemberBio(){
var bHFont = document.createElement("font");
var re = />Member's Bio( -)?/;
bHFont.size = "2";
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).rows.item(0).innerHTML.match(re)){
var iRow = iTable.item(t).getElementsByTagName("tr");
for(r = 0; r < iRow.length; r ++){
if(iRow.item(r).innerHTML.match(/>Posts:</)){
curhou.rownum = (iRow.item(r).rowIndex + 1);
}
}
var nRow = iTable.item(t).insertRow(curhou.rownum);
var nCell = nRow.insertCell(0);
var cBFont = bHFont.cloneNode(true);
bHFont.appendChild(document.createTextNode(iHouse + ":"));
nCell.appendChild(bHFont);
nCell = nRow.insertCell(1);
cBFont.appendChild(document.createTextNode(curhou.house));
nCell.appendChild(cBFont);
}
}
}
if(location.href.match(/=modifyprofile&user=/) && document.modifyForm){
createSelect();
document.modifyForm.onsubmit = function(){
if(Boolean(typeof usingMoneyCode != "undefined") && usingMoneyCode){
setPersonalTxt(82);
document.getElementById("money").value.sortMoney(1);
}
setHPersonalTxt();
sortHouse(1, document.getElementById("hphouse").selectedIndex);
}
sortHouse(0);
}
if(!location.href.match(/\/index.cgi$/)){
doHMiniProfile();
}
if(location.href.match(/=viewprofile/)){
doHMemberBio();
}
//-->
</script>
Main footer.
Important: If you are using the money hack with this, please place this below it.
Goto modify a members profile, and you will be able to select which house to put the member in.
<script type="text/javascript">
<!--
/*
Harry Potter - Put members into houses
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times.
*/
// Houses...
var theHouses = [
"Slytherin", "Hufflepuff", "Gryffindor", "Ravenclaw"
];
// House text
var iHouse = "House";
var curhou = {
house: "n/a",
rownum: 1
};
var iCell = document.getElementsByTagName("td");
function doHMiniProfile(){
for(c = 0; c < iCell.length; c ++){
var mHFx = document.createElement("font");
mHFx.style.fontSize = "11px";
if(iCell.item(c).width == "20%" && iCell.item(c).className.match(/^windowbg/) && iCell.item(c).innerHTML.match(/member is/)){
if(iCell.item(c).innerHTML.match(/ \[H:(\d+)\]/)){
if(RegExp.$1 != 0){
curhou.house = theHouses[(parseInt(RegExp.$1) - 1)];
} else {
curhou.house = "n/a";
}
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(/ \[H:\d+\]/, "");
} else {
curhou.house = "n/a";
}
if(iCell.item(c).innerHTML.match(/Posts: (\d+,\d+)|(\d+)/)){
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mHFx);
} else {
mHFx.appendChild(document.createTextNode(iHouse + ": " + curhou.house));
if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){
iCell.item(c).appendChild(document.createElement("br"));
}
iCell.item(c).appendChild(mMFx);
}
}
}
}
if(location.href.match(/(=display|\/index.cgi$)/)){
doHMiniProfile();
}
//-->
</script>
Add that to global footers