Log In · Register

 
smilies in comments, my code isn't working
Amie91280
post 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!

CODEBOX: -> right click -> copy/paste



and here's the site I'm trying to get them on: My test Xanga
 
 
Start new topic
Replies (1 - 8)
HelloSunshine
post Dec 21 2004, 08:35 PM
Post #2


High Voltage!∞
*******

Group: Official Member
Posts: 4,728
Joined: Jul 2004
Member No: 29,157



hmm..I can see the smilies on my computer... ermm.gif
 
Amie91280
post Dec 21 2004, 08:37 PM
Post #3


I heart Xanga
****

Group: Member
Posts: 103
Joined: Sep 2004
Member No: 47,755



Do they show up in the comments though? I can get them working in the entries, but they aren't showing up in the comments for me.
 
krismiss678
post Dec 21 2004, 08:39 PM
Post #4


(¯`·._.·[fly away]·._.·´¯)
****

Group: Member
Posts: 240
Joined: Apr 2004
Member No: 11,583



no ill do it. hang on one second and ill write you a code.
 
krismiss678
post Dec 21 2004, 08:44 PM
Post #5


(¯`·._.·[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(\'&nbsp;' +
                 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(\'&nbsp;' +
                 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
post Dec 21 2004, 08:46 PM
Post #6


I heart Xanga
****

Group: Member
Posts: 103
Joined: Sep 2004
Member No: 47,755



Awesome, it works! What was I doing wrong? I got them to work before but today I just couldn't! Thanks so much!!
 
krismiss678
post Dec 21 2004, 08:48 PM
Post #7


(¯`·._.·[fly away]·._.·´¯)
****

Group: Member
Posts: 240
Joined: Apr 2004
Member No: 11,583



aww no problem! it was because you have to put this code in there:

<img src="URL">

no biggie, but it would definately explain why it wouldnt work... enjoy!! =]~ <3
 
Amie91280
post Dec 21 2004, 08:49 PM
Post #8


I heart Xanga
****

Group: Member
Posts: 103
Joined: Sep 2004
Member No: 47,755



Thanks again, I'll save the code so I can just change the URL's for the next set I make! I've never been helped so fast on here before! thanks happy.gif
 
sherryvu
post Dec 22 2004, 02:42 PM
Post #9


Senior Member
*******

Group: Member
Posts: 3,826
Joined: Jan 2004
Member No: 2,330



QUOTE(Amie91280 @ Dec 21 2004, 8:49 PM)
Thanks again, I'll save the code so I can just change the URL's for the next set I make! I've never been helped so fast on here before! thanks happy.gif

[ topic closed ]
 

Closed TopicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: