|
// Edwin's Mini Profile (without karma links)
if(location.href.match(/n=(search2|(user)?rece|display|pmvi|goto|calendar|viewpro)/)){
var grabMp = document.getElementsByTagName("td"); for(i=0; i < grabMp.length; i++){ if(grabMp[i].className.match(/windowbg/i) && grabMp[i].width=="20%" && grabMp[i].innerHTML.match(/Joined:/i)){
var grabDiffer = grabMp[i].getElementsByTagName('center')[0]; var userName = grabMp[i].innerHTML.split(/<br>/i)[0]; var userRank = grabMp[i].innerHTML.split(/<br>/i)[1]; var rankStars = grabMp[i].innerHTML.split(/<br>/i)[2]; var customT = grabMp[i].innerHTML.split(/<br>/i)[3]; var onOrOff = grabMp[i].innerHTML.match(/member is (.+?)<br\s?\/?>/i) ? RegExp.$1: ''; var posts = grabMp[i].innerHTML.match(/Posts: (.+?)<br\s?\/?>/i) ? RegExp.$1: ''; var joined = grabMp[i].innerHTML.match(/Joined: (.+?)<br\s?\/?>/i) ? RegExp.$1: ''; karma = grabMp[i].innerHTML.split('Karma: ')[1].split(/<br/i)[0];
if(grabMp[i].innerHTML.match(/Gender:/i)){ var gender = grabMp[i].innerHTML.match(/Gender: (.+?)<br\s?\/?>/i) ? RegExp.$1: ''; }else{ var gender ='Choosing...'; } var avvy = grabMp[i].getElementsByTagName("center")[0]; var pText = avvy.innerHTML.split(/<br>/i)[2]; if(avvy.firstChild.nodeName == 'IMG') { var avatar = '<img src="'+avvy.firstChild.src+'" />'; } else { var avatar = ''; }
var mpTab ='<table width="100%" class="bordercolor" cellspacing="1" cellpadding="3">'; mpTab +='<tr><td class="mClass" align="center" colspan="2" height="23">'+userName+'</td></tr>'; mpTab +='<tr><td class="windowbg" align="center" colspan="2" cellpadding="3">'+avatar+'<br/>'+rankStars+'<br/><b>'+userRank+'</b><br/>'+pText+'</td></tr>'; mpTab += '<tr><td class="windowbg" width="50%" align="center">Status: '+onOrOff+'</td></tr>'; mpTab += '<tr><td class="windowbg" width="50%" align="center">Gender: '+gender+'</td></tr>'; mpTab += '<tr><td class="windowbg" width="50%" align="center">Posts: '+posts+'</td></tr>'; mpTab +='<tr><td class="windowbg" align="center" colspan="2">Joined: '+joined+'</td></tr>'; mpTab +='<tr><td class="windowbg" align="center" colspan="2">Wealth: '+karma+'σ</td></tr>'; mpTab +='</table>';
grabMp[i].innerHTML = mpTab; } } }
That's my code. The problem I have is the fact that it isn't cross-browser (there are things out of place in Internet Explorer). Any help?
|
|
|
|
Just a note, custom title CAN be more than one line, so using that specific split causes a problem. Also, you assign var grabDiffer = grabMp .getElementsByTagName('center')[0]; but you never use that variable. Might wanna remove it since "avvy" does the same thing.
Anyways, your problem is this. In IE, empty items in a split are auto-deleted. Meaning, assume the center's innerHTML looks like this: Whee<br><br>Dude
If you split the innerHTML by a BR, you get these results:
IE | Fx | 0 => Whee 1 => Dude | 0 => Whee 1 => (blank) 2 => Dude |
Make sense? The solution is to use either a RegExp match OR to use a smart split. However, the problem comes from the fact that the HTML there isn't always blank. So, it's easier to use the RegExp method. There's a few different open source miniprofile objects you can look at in the Open Source board. (One by Aaron and one by myself)
|
|
|
|
|
Just a note, custom title CAN be more than one line, so using that specific split causes a problem. Also, if they don't have a custom title, that would return 'member is online/offline'.
|
Extreme Data
|
|
|
|
Just a note, custom title CAN be more than one line, so using that specific split causes a problem. Also, if they don't have a custom title, that would return 'member is online/offline'. I'm surprised I didn't catch that one... o.o
|
|
|
|
|
As was I. Hence why, when I was posting that, I was thinking I may have been wrong for some reason.
|
Extreme Data
|
|
|