Post by Jordan Reposter on Sept 5, 2011 22:36:31 GMT -5
Code by Jordan
This is a remake of FireIndy's Selectable Music In Profile which doesn't work in version 4.5. It allows each user to play music on their main profile page which can be editted on their Modify Profile page.
Global Footers
<script type="text/javascript"><!--
/*
Personal Music in Profile
Concept by FireIndy
Recreated by Triad for v4.5
support.proboards.com
*/
var hide = true; // Set true to hide the media.
var loop = false; // Set true to loop the media forever.
if(location.href.match(/on=(displ|search2|viewpr|pmv|(user)?rece|cal\w+iew)/)){
var td = document.getElementsByTagName("td");
for(x=6; x<td.length; x++){
if(td[x].width == "20%" && td[x].innerHTML.match(/(\[mu:(.+?)\])/i)){
var d = RegExp.$2;
td[x].innerHTML = td[x].innerHTML.replace(RegExp.$1, "");
if(location.href.match(/on=viewprofile/i)){
var e = "<div style='text-align: center;'><embed src='"+d.replace(/\s/gi, '')+"' ";
if(hide) e += "hidden='true' ";
e += "autostart='true' loop='"+loop+"' /></div>";
document.write(e);
break;
}
}
}
}
if(document.modifyForm){
var tb = document.modifyForm.personaltext.parentNode.parentNode.parentNode.parentNode;
var _input = document.createElement("input");
_input.type = "text";
_input.size = "35";
_input.id = "music";
if(document.modifyForm.personaltext.value.match(/(\[mu:(.+?)\])/i)){
_input.value = RegExp.$2;
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace(RegExp.$1, "");
}
var font_1 = document.createElement("font");
font_1.size = "2";
font_1.appendChild(document.createTextNode("Profile Music:"));
var font_2 = document.createElement("font");
font_2.size= "1"
font_2.appendChild(document.createTextNode("If you wish to have music played on your main profile page, enter the URL here."));
var _row = tb.insertRow(-1);
var _cell = _row.insertCell(0);
_cell.width = "160";
_cell.appendChild(font_1);
_cell = _row.insertCell(1);
_cell.width = "245";
_cell.appendChild(_input);
_cell = _row.insertCell(2);
_cell.width = "245";
_cell.appendChild(font_2);
function addMusic(){
var p = document.modifyForm.personaltext;
if(document.getElementById("music").value.length > 0){
p.maxLength = p.value.length + document.getElementById("music").value.length + 8;
p.value += "[mu:" + document.getElementById('music').value + "]";
} else if(p.value.match(/(\[mu:.+?\])/i)){
p.value = p.value.replace(RegExp.$1, "");
}
}
if(document.addEventListener)
document.modifyForm.addEventListener("submit", addMusic, false);
else if(document.attachEvent)
document.modifyForm.attachEvent("onsubmit", addMusic);
else
document.modifyForm.onsubmit = addMusic;
}
//-->
</script>
This script stores the music URL in the personal text so if you ever remove it you will see something like this left over.
Enjoy.
June 29, 2010: Updated due to modifications in the DOM.
This is a remake of FireIndy's Selectable Music In Profile which doesn't work in version 4.5. It allows each user to play music on their main profile page which can be editted on their Modify Profile page.
Global Footers
<script type="text/javascript"><!--
/*
Personal Music in Profile
Concept by FireIndy
Recreated by Triad for v4.5
support.proboards.com
*/
var hide = true; // Set true to hide the media.
var loop = false; // Set true to loop the media forever.
if(location.href.match(/on=(displ|search2|viewpr|pmv|(user)?rece|cal\w+iew)/)){
var td = document.getElementsByTagName("td");
for(x=6; x<td.length; x++){
if(td[x].width == "20%" && td[x].innerHTML.match(/(\[mu:(.+?)\])/i)){
var d = RegExp.$2;
td[x].innerHTML = td[x].innerHTML.replace(RegExp.$1, "");
if(location.href.match(/on=viewprofile/i)){
var e = "<div style='text-align: center;'><embed src='"+d.replace(/\s/gi, '')+"' ";
if(hide) e += "hidden='true' ";
e += "autostart='true' loop='"+loop+"' /></div>";
document.write(e);
break;
}
}
}
}
if(document.modifyForm){
var tb = document.modifyForm.personaltext.parentNode.parentNode.parentNode.parentNode;
var _input = document.createElement("input");
_input.type = "text";
_input.size = "35";
_input.id = "music";
if(document.modifyForm.personaltext.value.match(/(\[mu:(.+?)\])/i)){
_input.value = RegExp.$2;
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace(RegExp.$1, "");
}
var font_1 = document.createElement("font");
font_1.size = "2";
font_1.appendChild(document.createTextNode("Profile Music:"));
var font_2 = document.createElement("font");
font_2.size= "1"
font_2.appendChild(document.createTextNode("If you wish to have music played on your main profile page, enter the URL here."));
var _row = tb.insertRow(-1);
var _cell = _row.insertCell(0);
_cell.width = "160";
_cell.appendChild(font_1);
_cell = _row.insertCell(1);
_cell.width = "245";
_cell.appendChild(_input);
_cell = _row.insertCell(2);
_cell.width = "245";
_cell.appendChild(font_2);
function addMusic(){
var p = document.modifyForm.personaltext;
if(document.getElementById("music").value.length > 0){
p.maxLength = p.value.length + document.getElementById("music").value.length + 8;
p.value += "[mu:" + document.getElementById('music').value + "]";
} else if(p.value.match(/(\[mu:.+?\])/i)){
p.value = p.value.replace(RegExp.$1, "");
}
}
if(document.addEventListener)
document.modifyForm.addEventListener("submit", addMusic, false);
else if(document.attachEvent)
document.modifyForm.attachEvent("onsubmit", addMusic);
else
document.modifyForm.onsubmit = addMusic;
}
//-->
</script>
This script stores the music URL in the personal text so if you ever remove it you will see something like this left over.
[mu:http://musicurl.wav]If you would like this code to store the URL in the signature like FireIndy's did, please use this code instead.
Enjoy.
June 29, 2010: Updated due to modifications in the DOM.