|
Post by Streamstrider on Sept 26, 2011 16:42:38 GMT -8
I've been having trouble with this code. It won't show up in the mini-profile after it has been selected (although you still see something of a result of it in the personal text) as seen here.
Another person is having a similar problem, or at least, one in which the code is not working for her. Thread located here.
I wonder if the mini-profile modification has anything to do with it? Or placement? Dunno. That's why I came to ask you. XD <script type="text/javascript"> <!--
/*Personal Moods - By iAlex - Open Source*/
var iMoodList=[ "Happy", "Wink", "Grin", "Cheesy", "Angry", "Sad", "Shocked", "Cool", "Confused", "Sarcastic", "Silly", "Embarrassed", "Silent", "Unsure", "Kiss", "Crying" //No comma on last line ];
if(document.modifyForm){ var iMoodTable = document.modifyForm.personaltext.parentNode.parentNode.parentNode.parentNode.parentNode; var iMoodDiv=document.createElement('div'); iMoodDiv.innerHTML='<table cellpadding="2" cellspacing="2" border="0"><tr><td width="154" valign="top"><font size="-1">Mood:</font></td><td width="245"><font size="-1" id="iMoodFont"></font></td><td width="245"><font size="-2">If you wish to display a mood, select it here.</font></td></tr></table>'; iMoodTable.parentNode.insertBefore(iMoodDiv, iMoodTable); var iMoodFont=document.getElementById('iMoodFont'); var iMoodSelect=document.createElement('select'); var iMoodText=document.modifyForm.personaltext; iMoodSelect.options[0]=new Option('Mood'); for(i=0;i<iMoodList.length;i++){ iMoodSelect.options[iMoodSelect.length]=new Option(iMoodList[i]); } if(iMoodText.value.match(/\[Mo0:(\d+)\]/)){ iMoodSelect.selectedIndex=RegExp.$1; iMoodText.value=iMoodText.value.replace(/\[Mo0:(\d+)\]/g, ''); } iMoodFont.appendChild(iMoodSelect); if(document.addEventListener){ document.modifyForm.addEventListener('submit', function(){ iMoodText.value=iMoodText.value+'[Mo0:'+iMoodSelect.selectedIndex+']'; }, false); } else{ document.modifyForm.attachEvent('onsubmit', function(){ iMoodText.value=iMoodText.value+'[Mo0:'+iMoodSelect.selectedIndex+']'; }); } } if(location.href.match(/action=(display|viewprofile|(user)?recent|calendarview|search2|pmview)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){ var iTd=document.getElementsByTagName('td'); for(i=0;i<iTd.length;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(/\[Mo0:(\d+)\]/)){ if(RegExp.$1>0){ var iMoodDisplay=document.createElement('div'); iMoodDisplay.innerHTML='Mood: '+iMoodList[RegExp.$1-1]; iTd.item(i).appendChild(iMoodDisplay); } iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[Mo0:(\d+)\]/g, ''); } } }
//--> </script>
|
|
|
Post by Wormopolis on Sept 26, 2011 19:48:34 GMT -8
mini profile remodels almost ALWAYS affect codes that mod the mini profile. running before might mean the remodel removes it completely, runnign after might keep it from working because the mp is no longer recognizable.
making it run after is usually easier then trying to rewrite a mp remodel to accomodate the added object. is the code after the remodel?
|
|
|
Post by Streamstrider on Sept 26, 2011 20:27:50 GMT -8
The code is all the way at the end. However, before you do anything, I was already going to ask you about the remodel later, so maybe I should put this on hold, unless you can figure out a fairly easy way to fix it?
|
|
|
Post by Wormopolis on Sept 26, 2011 21:38:18 GMT -8
change this
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(/\[Mo0:(\d+)\]/)){
to this
if(iTd.item(i).width=="20%" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/Status:/) && iTd.item(i).innerHTML.match(/\[Mo0:(\d+)\]/)){
but its going to put it at the bottom...
|
|
|
Post by Streamstrider on Sept 26, 2011 22:50:09 GMT -8
It worked. Is there a way to put it in a box? With the border color of the forums and the background color of windowbg2, and a padding of 3px? Maybe that could at least help with uniformity. And, if there could be a break between the contact icons box and this one, that would be fantastic!
|
|
|
Post by Wormopolis on Sept 27, 2011 21:30:19 GMT -8
this line:
iMoodDisplay.innerHTML='Mood: '+iMoodList[RegExp.$1-1];
is what it renders.
so maybe try
iMoodDisplay.innerHTML='<table class="bordercolor" cellspacing="1"><tr><td class="windowbg">Mood:</td><td class="windowbg">'+iMoodList[RegExp.$1-1] +'</td></tr></table>';
you might have to play with it, but it's basically HTML at that point
|
|
|
Post by Streamstrider on Sept 28, 2011 16:56:34 GMT -8
Thanks! I'll try to play with the HTML when I get out of class. See if I can't make it look somethin' fanceh.
|
|