The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Quick Reply : Display Dice Rolls

View previous topic View next topic Go down

Solved Quick Reply : Display Dice Rolls

Post by Bones! on July 13th 2015, 10:00 am

Title is what it means.

How would one display dice rolls in "Quick Reply"? This is a template edit or can it be done with CSS?


Last edited by Kaseki on July 31st 2015, 3:13 am; edited 1 time in total

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Guest on July 13th 2015, 1:27 pm

[dice="what dice"][/dice]

Guest
Guest


Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Bones! on July 14th 2015, 4:24 am

Nah. not using the BBC code.

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Ange Tuteur on July 14th 2015, 7:30 am

Hi @Kaseki,

You can add the dice to the quick reply by editing the toolbar to include faroll. Go to Module > JavaScript codes management > Create a new script

Placement : In the topics
Code:
$(function() {
  toolbar = toolbar.replace('fahide', 'fahide,faroll');
});

Save and the button should be after the hide button

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Bones! on July 14th 2015, 8:49 pm

@Ange Tuteur wrote:Hi @Kaseki,

You can add the dice to the quick reply by editing the toolbar to include faroll. Go to Module > JavaScript codes management > Create a new script

Placement : In the topics
Code:
$(function() {
 toolbar = toolbar.replace('fahide', 'fahide,faroll');
});

Save and the button should be after the hide button
That's actually really cool...

But I mean by using the Game Master thing, not a button that makes the BBC.
Like this from Standard Replies to Quick Replies.

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Ange Tuteur on July 15th 2015, 11:44 am

Ooh, in this case add the following script in the topics :
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="http://illiweb.com/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);
});

That should add the dice below the editor.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Bones! on July 18th 2015, 3:28 am

@Ange Tuteur wrote:Ooh, in this case add the following script in the topics :
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="http://illiweb.com/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);
});

That should add the dice below the editor.
Magical~

Any way to center that code?

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Str0ng on July 18th 2015, 9:20 am

Hey! Sorry for the invasion on this thread. But is possible to have it also working for Phpbb3? Thanks! Razz

By the way this is awesome!

Str0ng
Forumember

Posts : 52
Reputation : 7
Language : Spanish

http://www.seasonal-trackers.com

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Guest on July 18th 2015, 10:36 am

@Str0ng wrote:Hey! Sorry for the invasion on this thread. But is possible to have it also working for Phpbb3? Thanks! Razz

By the way this is awesome!

Also, phpbb2. XD

Guest
Guest


Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Pizza Boi on July 19th 2015, 1:50 pm

@Str0ng wrote:Hey! Sorry for the invasion on this thread. But is possible to have it also working for Phpbb3? Thanks! Razz

By the way this is awesome!

Hi Very Happy

The OP's profile states Invision Laughing hehe. PunBB too please Very Happy .

Regards,
Pizza Boi

Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Bones! on July 21st 2015, 1:43 am

Bump?

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Ange Tuteur on July 22nd 2015, 10:20 am

Adding this to your CSS should center it.
Code:
#list_dice {
text-align:center;
}

To the rest of you : it'd be best to open your own topics as this is just one too many requests to handle in another person's topic.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by Bones! on July 31st 2015, 3:13 am

@Ange Tuteur wrote:Adding this to your CSS should center it.
Code:
#list_dice {
text-align:center;
}

To the rest of you : it'd be best to open your own topics as this is just one too many requests to handle in another person's topic.
Thank you~

Bones!
Forumember

Posts : 168
Reputation : 19
Language : English, CCS, HTML
Location : Behind you

http://www.unknownlandsrp.com/

Back to top Go down

Solved Re: Quick Reply : Display Dice Rolls

Post by SLGray on July 31st 2015, 4:24 am

Topic solved and archived


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36639
Reputation : 2441
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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