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.

Dice in quick replies not working.

2 posters

Go down

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
Neko Overlord
Neko Overlord
Forumember

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

https://auroranovusrp.forumotion.com/

Back to top Go down

Solved Re: Dice in quick replies not working.

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

skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: Dice in quick replies not working.

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

that did the trick.
Neko Overlord
Neko Overlord
Forumember

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

https://auroranovusrp.forumotion.com/

Back to top Go down

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
skouliki
skouliki
Manager
Manager

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

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum