Dice in quick replies not working. Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    Dice in quick replies not working.

    Neko Overlord
    Neko Overlord
    Forumember


    Female Posts : 86
    Reputation : 4
    Language : English, CSS, HTML, JavaScript
    Location : United States

    Solved Dice in quick replies not working.

    Post by Neko Overlord September 24th 2018, 6:40 am

    Technical Details


    Forum version : #Invision
    Position : Founder
    Concerned browser(s) : Google Chrome
    Screenshot of problem : https://i.servimg.com/u/f61/19/04/52/50/screen12.png
    Who the problem concerns : All members
    When the problem appeared : just a few minutes earlier.
    Forum link : http://fairytail-endless-rp.forumotion.com/

    Description of problem

    The code I have below is what I have in my JavaScript codes. I'm not sure why it isn't working.

    Code:
    $(function() {
      var block = document.createElement('DIV'),
          quick = document.getElementById('quick_reply'),
          reply = $('.i_reply')[0],
          storage = window.localStorage;
     
      if (!quick || !reply) return;
      if (storage && storage.faDice && storage.faDiceExp > +new Date - 1*60*60*1000) block.innerHTML = storage.faDice;
      else $.get(reply.parentNode.href, function(d) {
        var dice = $('#list_dice', d)[0];
        block.appendChild(dice.previousSibling);
        block.appendChild(dice);
     
        if (storage) {
          storage.faDice = block.innerHTML;
          storage.faDiceExp = +new Date;
        }
      });
     
      window.add_dice = function(dice_number,dice,number) {
        var content = document.getElementById('post_dice').innerHTML;
        document.getElementById('dice_to_del').innerHTML = '';
        document.getElementById('dice_to_del').id = '';
        var new_tr = document.createElement('tr');
        new_tr.appendChild(document.createElement('td'));
        new_tr.firstChild.innerHTML = '<span class="postbody">Dices roll #' + (dice_number + 1) + ' : </span><select name="post_dice_' + dice_number + '" id="post_dice_' + dice_number + '" value="' + dice + '">' + content + '</select><span class="postbody"> <label for="nb_rolls_' + dice_number + '">Dice rolls : </label><input type="text" size="2" maxlength="3" name="nb_rolls_' + dice_number + '" id="nb_rolls_' + dice_number + '" value="' + number + '" /> <span id="dice_to_del"><a href="javascript:add_dice(' + (dice_number + 1) + ',\'\',1)"><img class="sprite-tabs_more" src="https://2img.net/i/fa/empty.gif" alt="plus" /></a></span></span>';
        document.getElementById('list_dice').lastChild.appendChild(new_tr);
        var select_dice = document.getElementById('post_dice_' + dice_number);
        if ( dice == '' ) select_dice.selectedIndex = 0;
        for ( var i = 1; select_dice.options[i]; i++ ) select_dice.options[i].selected = ( select_dice.options[i].value == dice );
      };
     
      quick.appendChild(block);
    });


    Last edited by Rin-Senpai on September 24th 2018, 10:14 pm; edited 1 time in total
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15391
    Reputation : 1709
    Language : English,Greek
    Location : Greece

    Solved Re: Dice in quick replies not working.

    Post by skouliki September 24th 2018, 7:44 am


    Neko Overlord
    Neko Overlord
    Forumember


    Female Posts : 86
    Reputation : 4
    Language : English, CSS, HTML, JavaScript
    Location : United States

    Solved Re: Dice in quick replies not working.

    Post by Neko Overlord September 24th 2018, 10:14 pm

    that did the trick.
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15391
    Reputation : 1709
    Language : English,Greek
    Location : Greece

    Solved Re: Dice in quick replies not working.

    Post by skouliki September 24th 2018, 10:37 pm

    great

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules