smilies in comments, my code isn't working |
smilies in comments, my code isn't working |
Dec 21 2004, 08:33 PM
Post
#1
|
|
![]() I heart Xanga ![]() ![]() ![]() ![]() Group: Member Posts: 103 Joined: Sep 2004 Member No: 47,755 |
I made my own smilies and they work in my entries, but I can't for the life of me get them to work in the comments on my one skin. I'm making a celestial skin for my friend so I made smilies to match. I have Xmas ones I made on my Xanga and they work, but when I use the exact same code on the celestial skin, they don't. I replaced the URL's with the new ones, tried a few different codes, and even copied and pasted the code that's on my site that works. It still didn't work on the new skin! Could it be something in the skin coding? I'll post the smilie code even though I'm pretty sure it's right. I'd REALLY apprecuate any ideas because I'm at a total loss! Thanks!
|
|
|
|
![]() |
Dec 21 2004, 08:44 PM
Post
#2
|
|
|
(¯`·._.·[fly away]·._.·´¯) ![]() ![]() ![]() ![]() Group: Member Posts: 240 Joined: Apr 2004 Member No: 11,583 |
CODE <!-- begin code provided by createblog.com --> <!-- begin code provided by createblog.com --> <script type="text/javascript"> function typeSmiley(sSmiley) { if (document.getElementsByTagName('textarea')[0].getAttribute('name') == 'bdescr') var editor = document.getElementsByTagName('textarea')[0]; else { var allTextAreas = document.getElementsByTagName('textarea'); for (i = 0; i < allTextAreas.length; ++i) { if (allTextAreas[i].getAttribute('name') == 'bdescr') { var editor = allTextAreas[i]; break; } } } editor.value = editor.value + sSmiley; } function replaceTextSmileys() { // ***add textual emoticons to the array below var textSmileys = new Array( " +smile+", " +boo hoo+", " +wink+", " +goofy+", " +laugh+", " +mad+", " +!@#$+", " +bitter+", " +huh+", " +clueless+", " +wtf+", " +shocked+", " +stunned+", " +surprised+", " +whatever+", " +bummed+", " +pleased+", " +cool+", " +blush+", " +shy+", " +kiss+", " +smooch+", " +heart+"); // *** add the url's from the corresponding images below var realSmileys = new Array( <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Happy.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Sad.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_winky.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_silly.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Laughing.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Angry.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Censored.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_bitter.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Confused.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Clueless.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_WTF.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Shocked.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Stunned.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_surprised.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Whatevah.gif>, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Bummed.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_pleased.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Cool.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Blush.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Shy.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Kiss.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Smooch.gif">, <img src="http://img.photobucket.com/albums/v473/Amie91280/Smilies/Celestial_Heart.gif">); // *** number of smileys that will be displayed per row var maxNumberOfSmileysPerRow = 8; // *** button size in pixels var buttonSize = 30; // preloading images var preloadedImages = new Array(realSmileys.length); for (i = 0; i < preloadedImages.length; ++i) { preloadedImages[i] = new Image(); preloadedImages[i].src = realSmileys[i]; } var allTableData = document.getElementsByTagName('td'); var indx; var smiley; var replacement; for (var i = 0; i < allTableData.length; ++i ) { for ( var n = 0; n < textSmileys.length; ++n ) { if ((allTableData[i].innerHTML.toUpperCase().indexOf('TABLE') == -1) && (allTableData[i].innerHTML.indexOf('previewHTML()') == -1)) { indx = allTableData[i].innerHTML.indexOf(textSmileys[n]); if (indx != -1) { while (indx != -1) { replacement = ''; indx = allTableData[i].innerHTML.indexOf(textSmileys[n]); smiley = '<img src=\"' + realSmileys[n] + '">' replacement = allTableData[i].innerHTML.replace(textSmileys[n],smiley); allTableData[i].innerHTML = replacement; } } } } } if (document.URL.indexOf('weblogs') != -1) { var smileyCollection = new Array(realSmileys.length); var smileyBar = ''; if (document.getElementById('htmleditor')) { for (i = 0; i < smileyCollection.length; ++i) { smileyCollection[i] = '<button type="button" value="" ' + 'style="width:' + buttonSize + 'px; height:' + buttonSize + 'px;" onclick="javascript:insertHTML(\' ' + textSmileys[i] + '\'); return false;">' + '<img src=\"' + realSmileys[i] + '" alt="' + textSmileys[i] + '"></button>'; } } else { for (i = 0; i < smileyCollection.length; ++i) { smileyCollection[i] = '<button type="button" value="" ' + 'style="width:' + buttonSize + 'px; height:' + buttonSize + 'px;" onclick="javascript:typeSmiley(\' ' + textSmileys[i] + '\'); return false;">' + '<img src=\"' + realSmileys[i] + '" alt="' + textSmileys[i] + '"></button>'; } } for (i = 0; i < smileyCollection.length; ++i) { if (i != 0) if ( (i/maxNumberOfSmileysPerRow).toString().indexOf('.') == -1) smileyBar = smileyBar + '<BR>'; smileyBar = smileyBar + smileyCollection[i]; } // add SmileyBar infoLink = '<br>'; smileyBarHtml = '<br><b>USE EMOTICONS</b><br><font style="font-size: xx-small">' + 'USE THEM WITH COMMENT!! =D</font> ' + infoLink + smileyBar + '<br><br>'; if (navigator.userAgent.indexOf('Mac') == -1) { if (document.getElementById('htmleditor')) var obj1 = document.getElementById('htmleditor').parentNode; else { if (document.getElementsByTagName('textarea')[0].getAttribute('name') == 'bdescr') var obj1 = document.getElementsByTagName('textarea')[0].parentNode; else { var allTextAreas = document.getElementsByTagName('textarea'); for (i = 0; i < allTextAreas.length; ++i) { if (allTextAreas[i].getAttribute('name') == 'bdescr') { var obj1 = allTextAreas[i].parentNode; break; } } } } var obj2 = document.createElement('span'); obj2.setAttribute('ID','idSmileyBar'); obj2.innerHTML = smileyBarHtml; obj1.insertBefore(obj2,obj1.firstChild); } else { // alternative solution for the Mac for (var i = 0; i < allTableData.length; ++i ) { if ((allTableData[i].innerHTML.toUpperCase().indexOf('TABLE') == -1) && (allTableData[i].innerHTML.indexOf('previewHTML()') == -1)) { if (allTableData[i].innerHTML.toUpperCase().indexOf('(OPTIONAL)') != -1) { var temp = allTableData[i].innerHTML; allTableData[i].innerHTML = temp + '<br>' + smileyBarHtml; break; } } } } } } if (document.URL.indexOf('weblogs') != -1) replaceTextSmileys(); </script> <!-- end code provided by createblog.com --> try that. it should work.. |
|
|
|
Amie91280 smilies in comments Dec 21 2004, 08:33 PM
xSWEETxCANDiix hmm..I can see the smilies on my computer... Dec 21 2004, 08:35 PM
Amie91280 Do they show up in the comments though? I can get... Dec 21 2004, 08:37 PM
krismiss678 no ill do it. hang on one second and ill write you... Dec 21 2004, 08:39 PM
Amie91280 Awesome, it works! What was I doing wrong? I... Dec 21 2004, 08:46 PM
krismiss678 aww no problem! it was because you have to put... Dec 21 2004, 08:48 PM
Amie91280 Thanks again, I'll save the code so I can just... Dec 21 2004, 08:49 PM
Sherry_Vu QUOTE(Amie91280 @ Dec 21 2004, 8:49 PM)Thanks... Dec 22 2004, 02:42 PM![]() ![]() |