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.

Dice Rolls results customisation

View previous topic View next topic Go down

Dice Rolls results customisation

Post by Kami-sama on 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 - http://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
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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).
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Re: Dice Rolls results customisation

Post by Kami-sama on 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
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Re: Dice Rolls results customisation

Post by Kami-sama on 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
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Re: Dice Rolls results customisation

Post by Kami-sama on 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
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Re: Dice Rolls results customisation

Post by Kami-sama on 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
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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")
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Re: Dice Rolls results customisation

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

I am just concerned, that this will really slow down the page load time....
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Re: Dice Rolls results customisation

Post by Justice™ on 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
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.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