Dice Rolls results customisation 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.

    Dice Rolls results customisation

    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Dice Rolls results customisation

    Post by Kami-sama June 8th 2017, 12:28 am

    Technical Details


    Forum version : #phpBB2
    Position : Founder
    Concerned browser(s) : Google Chrome
    Who the problem concerns : Yourself
    Forum link : ( link is hidden, you must reply to see )

    Description of problem

    Hello! I have couple questions about dice rolls.

    1) Following script provided here - https://help.forumotion.com/t141900-quick-reply-display-dice-rolls?highlight=dice - where is the best place to put it in? The scripts page or templates?

    2) Is there a way to customise the dice rolls result? Now it says something like:

    The member 'Kami-sama' has done the following action : Dice roll
    #1 'First' :
    #1 Result : 7

    I would like to at least translate it (the forum is not in english)

    Regards,
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 8th 2017, 5:50 pm

    The code should be added in the javascript page. About the second problem, the texts can be modified, but I'll need a link to a forum page that display's those texts(I don't use dice rolls on my forum so I don't know how it works).
    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Kami-sama June 8th 2017, 8:57 pm

    Hello Wolfuryo,

    The issue is basically, you select one account in the forum and automatic result is posted as a message bellow the roll itself with that selected account. There are no specific tags in the message (that would mark it as dice roll result, like special IDs or classes). I have an idea how to just translate it (done that before), but would be interesting to modify the layout itself ://
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 8th 2017, 9:41 pm

    The only way to modify it would be by using javascript in this case. I don't there are any templates for dice rolls so that's the only way.
    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Kami-sama June 9th 2017, 5:23 pm

    But I don't think that it will affect it well. As I mention, there are no specific Tags in the dice roll result post.... I wish there were more templates available.
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 9th 2017, 8:50 pm

    You'll have to do something like this:
    Code:
    $(function(){
    $(":contains('Text to modify')").text("New text");
    })
    You have to modify
    Code:
    Text to modify
    with the old text(the default one) and
    Code:
    New text
    with the updated text.
    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Kami-sama June 9th 2017, 9:03 pm

    How to check if for example SPAN element contains another SPAN element AND other text?
    Example:
    Code:
    <span><span>Text</span>Other Text</span>


    $("span:contains('<span>Text</span>Other Text')").text("New text");


    As I tested, it has some issues with <> and " I think.
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 9th 2017, 9:08 pm

    This should work:
    Code:
    $("span>span:contains('Text')")
    :contains only works with text nodes, not html elements. If you need to select for example a span that contains another span, you have to use span>span


    Last edited by Wolfuryo on June 9th 2017, 9:10 pm; edited 1 time in total
    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Kami-sama June 9th 2017, 9:09 pm

    Oh, then it will apply style or whatever to the first span?
    Nice Very Happy was looking for that for an hour now ;DD
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 9th 2017, 9:12 pm

    If you want to apply some styles to that, you should add a class via jquery and than style the elem via css:
    Code:
    $("span>span:contains('Text')").addClass("class_name")
    Or if you want to add an id, you have to use
    Code:
    .attr("id", "id_name")
    Kami-sama
    Kami-sama
    Forumember


    Female Posts : 407
    Reputation : 12
    Language : EN, RU, DE, LT
    Location : Lithuania

    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Kami-sama June 9th 2017, 9:34 pm

    I am just concerned, that this will really slow down the page load time....
    avatar
    Guest
    Guest


    Dice Rolls results customisation Empty Re: Dice Rolls results customisation

    Post by Guest June 9th 2017, 9:38 pm

    It should not slow it down too much, no more than half of a millisecond. Make sure to place the script just in a page where it is needed, so that it does not loads on pages where it is no need for it. Smile