Random Text Bric

Hi,
did anyone use the Random Text Bric ? I don’t understand how to use the Bric ? Can anyone help me please ?
tom

It’s dead easy. Look in the side panel and apply a tag type e.g H3 and fill in the content below. Select Item 2 and repeat but change the content as needed. If you need more just add a new item.

N.B This is not scrolling text that alternates. It is simply random, so one time you visit the site it says one thing and another time it might say something else. Being random you may find an entry is repeated three times, then changes twice etc. It’s literally random.

Hi @Flashman
thanks for your answer. Ok - I understand. I search for something similar but for example in the morning the text is: good morning. And when you watch the page later the text is good evening …
So I can set when wich text was shown … Sorry for my bad english :blush:

I am not sure how that would be done, but somebody else may have a suggestion.

Hi @tom2,

You can do something like this… (there are a number of ways). Using the code bric, make sure you have preview on the code bric turned off.

<p id="greeting"></p>

<script>
    var today = new Date()
    var currentHr = today.getHours()

    if (currentHr >= 0 && currentHr < 12) {
        document.getElementById("greeting").innerHTML = 'Good Morning';
    } else if (currentHr >= 12 && currentHr < 17) {
        document.getElementById("greeting").innerHTML = 'Good Afternoon';
    } else {
        document.getElementById("greeting").innerHTML = 'Good Evening';
    }
</script>

I found this script online. The script adds the greeting to the P tags by finding the ID “gretting”. Since it looks for the ID, you can use h1,h2… etc.

1 Like

Hello @tom2 I had a similar solution, but having problem with > and < in code widget so I can’t publish solution. Now @Norm help me out and back to normal.

A different solution, but with same result as @PeteSharp present I done in my blocs site.

Have a look @ https://blocs.pt

Have fun…

1 Like

Yeah, looking forward to maybe a new implementation of the code editor in the code bric this year :wink:

Being able to use short cut keys would be nice. Option/CMD and arrow keys etc would be awesome, at the moment, if you do that the window just loses focus.

1 Like

Your absolutely right. I use “Atom” and “Brackets” with Solis to create/change/update the snippet code and then only when I finish I paste the code in code widget.

Before was nice to have the preview working so we can see how the code works in page while we create the webpage, now with the preview turned off i have to make a lot preview in browser or switch screens with solis.

Hope @Norm will fix this and probably could give us a nice new year present with a new code editor. There are some codes like <p> when you type it creates the close ones automatically, but for the rest ( { <script> etc. not yet, but I’m not complaining it is very nice to have this widget so we can personalize a lot of parts in the webpages we create.

Yep, that annoys the crap out of me, when you go to make a change, it places the closing tag, even when you have one already lol.

I mainly use Sublime Text. I haven’t spent the time to learn all its features yet.

Yes I like Sublime Text too, but 80$ is too much I found out “Visual Studio Code” it is free and have a lot of the features Sublime Text have, but for simple snippets I rather use “Brackets”.

About the <p> and not recognizing the final ones when they already be there, makes my nerves as well…

I haven’t seen brackets before. Im going to try it out.

Maybe Norm can fork it and use it in Blocs :crazy_face:

Yes probably is easy (don’t know) for Solis it connects directly with brackets.

1 Like

Yeah Solis is pretty neat like that. Sublime connects too.

Hi @PeteSharp and @Pealco

thanks a lot for your help. But when I understand right the only way to do this at this moment is with the html bric ?

tom :blush:

Hey @tom2

You can put the code in the footer And then add “greeting” as an ID of any text tags (p, h1,h2 etc) anywhere you want it to display.