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.
The forum of the forums
2 posters

    Certain Text Change

    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Certain Text Change

    Post by Ace 1 June 9th 2015, 1:58 pm

    Can anyone tell me how to make a word (or words) with a certain string in them to be changed to another string and have a color added to them?

    For example, FM has the "You have 1 new message" but with a yellowish color. My forum does not do this. Another thing is that I want to change any word with "Plazma Burst 2" to "Plazma Burst 2"

    CSS and JavaScript are preferred.

    Thanks.
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Re: Certain Text Change

    Post by Ace 1 June 11th 2015, 3:42 am

    Bump
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Re: Certain Text Change

    Post by Ace 1 June 12th 2015, 12:20 pm

    Bumpperrr
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    Certain Text Change Empty Re: Certain Text Change

    Post by Niko June 12th 2015, 12:57 pm

    Hello,

    is your forum version #phpBB3 Certain Text Change Fmphpb11 ?

    and for
    Another thing is that I want to change any word with "Plazma Burst 2" to "Plazma Burst 2"
    did you try the censor function of forumotion? thumleft

    Have a nice day! :rose:
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Re: Certain Text Change

    Post by Ace 1 June 12th 2015, 1:19 pm

    @Niko phpbb3.

    And Ik about the censor function I was talking about changing the text and the color of the word.
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    Certain Text Change Empty Re: Certain Text Change

    Post by Niko June 13th 2015, 1:40 pm

    Maybe you could try setting the "replacing-world" as:
    Code:
    [color=red]text[/color]

    or
    Code:
    <font color="red">text</font>

    I think one of this two solution could work well Wink
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Re: Certain Text Change

    Post by Ace 1 June 13th 2015, 2:37 pm

    XD @Niko I meant that any word on the forum with a certain string automatically turns to another color or string.

    Example: I type "Hey Forumotion".

    Result: "Hey ForuMotion"


    CSS and JavaScript are preferred.
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    Certain Text Change Empty Re: Certain Text Change

    Post by Niko June 14th 2015, 4:03 pm

    @Ace 1 did you try with the censor function before? Wink

    anyway, if you prefer #javascript this code should work:
    Code:
    $(document).ready(function() {
      var c = document.getElementsByClassName('content clearfix');
        for (i=0; i<c.length; i++) {   
          c[i].innerHTML = c[i].innerHTML.replace(/twitter/g,'<b><font color="#00a5cd">twitter</font></b>');    }});

    for example this code replace the word twitter with twitter Wink
    Exclamation the only limitation is that the first element (here: twitter) must be replace with the exact word or sentence you want to replace. This way, twitter will be replace, but not Twitter

    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Certain Text Change Empty Re: Certain Text Change

    Post by Ace 1 June 19th 2015, 9:13 pm

    @Niko thanks so much!!

      Current date/time is September 22nd 2024, 5:32 pm