|
mini
Jan 27, 2012 17:29:21 GMT -4
Post by MonsterControl on Jan 27, 2012 17:29:21 GMT -4
/****************************************** * * Build Your Own Mini-Profile v 0.1 * Coded by Ross of http://support.proboards.com * and http://101support.proboards.com * and http://swg.proboards4.com * this code cannot be reposted outside of the * forums listed above unless done so by myself * *******************************************/
var td = document.getElementsByTagName('td'); var mp_num = 0; var gp_num = 0; var cur_num = 0;
function setMpValue(id, value) { if(document.getElementsByName(id).item(cur_num)) { var obj = document.getElementsByName(id).item(cur_num); if(value) { obj.innerHTML = obj.innerHTML.replace(/##value/gi, value); } else if(obj.nodeName.match(/^td$/i)) { while(!obj.nodeName.match(/^tr$/i)) { obj = obj.parentNode; } obj.style.display = 'none'; } else { obj.style.display = 'none'; } } }
for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).innerHTML.match(/Posts:\s/)) { td.item(i).className = td.item(i).className + ' mini_profile'; cur_num = mp_num; var username = td.item(i).innerHTML.split(/<br>/i)[0]; var rank = (td.item(i).innerHTML.match(/<\/a><\/b><br>(.+?(<br><img.+?>)?)<br>/i))? RegExp.$1 : false; var customtitle = (td.item(i).innerHTML.match(/<\/a><\/b><br>.+?<br><img.+?><br>(.+?)<br>member\sis/i))? RegExp.$1 : false; var status = (td.item(i).innerHTML.match(/member\sis\s(<b>)?(.+?)(<\/b>)?<br>/i))? RegExp.$2 : false; var center = td.item(i).getElementsByTagName('center').item(0).innerHTML; var avatar = (center.match(/^(<img.+?>)?<br>/i))? RegExp.$1 : false; var personaltext = (center.match(/<br><br>(.+?)</i))? RegExp.$1 : false; if(personaltext) { var temp = center.split(personaltext)[1].replace(/<br>/gi, ''); var contacticons = (temp != '')? temp : false; } else if(avatar) { var temp = center.split(avatar)[1].replace(/<br>/gi, ''); var contacticons = (temp != '')? temp : false; } else { var temp = center.replace(/<br>/gi, ''); var contacticons = (temp != '')? temp : false; } var joined = (td.item(i).innerHTML.match(/Joined:\s(.+?)(<br>|$)/i))? RegExp.$1 : false; var posts = (td.item(i).innerHTML.match(/Posts:\s(.+?)(<br>|$)/i))? RegExp.$1 : false; var user_location = (td.item(i).innerHTML.match(/Location:\s(.+?)(<br>|$)/i))? RegExp.$1 : false; var gender = (td.item(i).innerHTML.match(/Gender:\s(.+?)(<br>|$)/i))? RegExp.$1 : false; var karma = (td.item(i).innerHTML.match(/Karma:\s(.+?)(<br>|$)/i))? RegExp.$1 : false; var karmalinks = (td.item(i).innerHTML.match(/<br>\[\s(.+?)\s\](<br>|$)/i))? RegExp.$1 : false; var money = (td.item(i).innerHTML.match(/Money:\s(.+?)(<br>|$)/i))? RegExp.$1 : false;
td.item(i).appendChild(document.getElementById('mini_profile_member').cloneNode(true)); td.item(i).lastChild.style.display = 'block';
setMpValue('user_name', username); setMpValue('rank', rank); setMpValue('custom_title', customtitle); setMpValue('status', status); setMpValue('avatar', avatar); setMpValue('personal_text', personaltext); setMpValue('contact_icons', contacticons); setMpValue('joined', joined); setMpValue('posts', posts); setMpValue('location', user_location); setMpValue('gender', gender); setMpValue('karma', karma); setMpValue('karma_links', karmalinks); setMpValue('money', money);
while(td.item(i).firstChild && !td.item(i).firstChild.id) { td.item(i).removeChild(td.item(i).firstChild); } td.item(i).lastChild.removeAttribute('id'); mp_num ++; } else if(td.item(i).width == '20%' && td.item(i).innerHTML.match(/Guest/)) { td.item(i).className = td.item(i).className + ' mini_profile'; cur_num = gp_num; var guestname = (td.item(i).innerHTML.match(/<\/a>(.+?)<br>/i))? RegExp.$1 : false;
td.item(i).appendChild(document.getElementById('mini_profile_guest').cloneNode(true)); td.item(i).lastChild.style.display = 'block';
setMpValue('guest_name', guestname);
while(td.item(i).firstChild && !td.item(i).firstChild.id) { td.item(i).removeChild(td.item(i).firstChild); } td.item(i).lastChild.removeAttribute('id'); gp_num ++; } }
<script type="text/javascript"> <!-- /****************************************** * * Build Your Own Mini-Profile v 0.2 * Coded by Ross of http://support.proboards.com * and http://101support.proboards43.com * and http://swg.proboards4.com * this code cannot be reposted outside of the * forums listed above unless done so by myself * *******************************************/
if(location.href.match(/(ion=(display|(pm|calendar)?view|search2|(user)?recent)|error)/)) { var new_script = document.createElement('script'); new_script.type = "text/javascript"; new_script.src = "http://freelancedev.net/ecreations/codes/build_your_own_mini_profile/v0-2.js"; document.getElementsByTagName('head').item(0).appendChild(new_script); } //--> </script>
|
|
|
mini
Jan 27, 2012 17:30:51 GMT -4
Post by MonsterControl on Jan 27, 2012 17:30:51 GMT -4
<style type="text/css"> <!-- .mini_profile { padding: 0px; } .mini_profile .titlebg { background-image: url(Gradient URL); } //--> </style> <span id="mini_profile_member" style="display: none; margin-top: 20px;"> <table class="bordercolor" width="80%" align="center" cellspacing="1" cellpadding="2"> <tr> <td style="width: 100%; text-align: center; padding: 3px;" class="titlebg"> <b> User Profile </b> </td> </tr> <tr> <td align="center" class="windowbg"> <center> <span id="custom_title" name="custom_title">##value<br /></span> <span id="avatar" name="avatar">##value<br /></span> <span id="user_name" name="user_name">##value</span> <br /> <span id="rank" name="rank">##value</span> <hr size="1" /> User is <span id="status" name="status"><b>##value</b></span> <br /> <span id="joined" name="joined">Joined: ##value<br /></span> <span id="gender" name="gender">Gender: ##value<br /></span> <span id="posts" name="posts">Posts: ##value<br /></span> <span id="location" name="location">Location: ##value<br /></span> <span id="karma" name="karma">Reputation: ##value<br /></span> <span id="karma_links" name="karma_links">##value<br /></span> <hr size="1" /> <span id="contact_icons" name="contact_icons">##value</span> </center> </td> </tr> <tr> <td style="height: 25px;" class="titlebg"> </td> </tr> </table> </span> <span id="mini_profile_guest" style="display: none; margin-top: 20px;"> <table class="bordercolor" width="80%" align="center" cellspacing="1" cellpadding="2"> <tr> <td style="width: 100%; text-align: center; padding: 3px;" class="titlebg"> <b> Guest Profile </b> </td> </tr> <tr> <td align="center"> <span id="guest_name" name="guest_name">##value</span> <br /> <b>Guest</b> </td> </tr> </table> </span>
How to make your own layout
First of all, start off with a hidden span tag with the id of "mini_profile_member". ie. <span id="mini_profile_member" style="display: none;"> </span>
Within this tag (between display: none;"> and </span>), you can enter pretty much any HTML coding you need to achieve the desired layout. To add information from the mini-profile, you will be using more span tags (note: you can actually use pretty much any HTML tag you want but I find span to be the easiest to work with). Wherever you want the information to appear, put something along the lines of <span id="item name" name="item name">##value</span>
A full list of available item names can be found below. You can use any HTML within the span tag but in the event of the necessary information not being available (ie. User not having entered it in their profile) then the whole tag will become hidden. Put ##value in the place of where you want the information to appear. eg. <span id="posts" name="posts">This user has ##value posts.</span>
If you want to use tables in the design of your mini-profile, then do not give the id and name attributes to either the table itself or a row. If you want a row to be hidden when the information is not available, then give the name and id attributes to the cell instead. eg. <table border="1"> <tr><td id="posts" name="posts">Posts: ##value</td></tr> </table>
Once you have done that, you will need to do the same for the Guest Profile. Just use "mini_profile_guest" as the main span id instead. If you have any problems, try looking at existing layouts first. If they don't answer your question, then do post it below
Item Names I'm pretty sure they're all self explanatory
user_name rank custom_title status avatar personal_text contact_icons joined posts location gender karma karma_links money (If a money hack is installed on your forum) guest_name
|
|