Open fbgallet opened 3 years ago
Thanks! Just what is needed!
@fbgallet very nice smartblock! Quick suggestion, you can now nest a css code block under {{[[roam/css]]}} and it'll run.
This plug-in is not work at SmartBlocks V2, is there any update for SBv2?
This plug-in is not work at SmartBlocks V2, is there any update for SBv2?
Uptade for SBv2 is published here: https://roamresearch.com/?server-port=3333#/app/Roam-En-Francais/page/-9fGz51_v
@fbgallet I've very much enjoyed the timestamped button. But the Elapsed Time in my Roam has not been working properly for two days. It said "Block threw an error while running". I've updated to SBv2. Could you tell me what I should do to have it fixed? Thanks!
@fbgallet I've very much enjoyed the timestamped button. But the Elapsed Time in my Roam has not been working properly for two days. It said "Block threw an error while running". I've updated to SBv2. Could you tell me what I should do to have it fixed? Thanks!
Hi @helenysli , have you installed the Sb v2 compatible version from the SmartBlock Store (Cmd/Ctrl + p, then search for "store") ? For the current version, you need also Roam42 installed in your graph.
Be sure, before installing the new version, to remove the previous one from your graph. Once the Sb will we installed from the store, the updates will be more easy (one click on "Update" button in the store).
@fbgallet It worked! It turned out that I hadn't actually updated to SBv2. Thank you very much for the great work. It does make my life easier.
Version 0.22, June 1st, 2021 Download JSON file (.zip to extract, then import JSON file in your graph) to better preserve the structure of the code: Timestamp button for interstitial journaling v0.22.zip
π Description: simple Timestamp buttons
Really simple SmartBlocks duplicating the timestamp button at each use, and properly positioning the cursor to write straight away.
You need to add the first button in you daily template (or create one), see image below. Just copy/past this: {{πβ¦:42SmartBlock:Time interval button}} where "Time interval button" is the name of the SmartBlock to run here (change to "Time button" if you want the "only beginning time" version, or "Time interval button + elapsed time" if you want an automatic calcul of elapsed time (see next section)).
You can change the time format from <%TIME%> to <%TIMEAMPM%> if you prefer (don't work actually with Elapsed time SmartBlock).
π Description: Elapsed time calculator (included from v0.2)
Copy/Paste code below in your graph, or (more reliable) import JSON file. It should be used in combination with 'Timestamp button + elapsed time' SmartBlock and button {{πβ¦:42SmartBlock:Time interval button + elapsed time}} added in your daily template.
The SmartBlock calculates the time elapsed between to timestamps (minutes, no more than 1440).
Then it test if it's less or more than a given limit. There is two kind of limits:
Limits are linked to trigger words, searched in current block and first children block (case insensitive). There is 3 ways to set trigger words:
If there is no trigger word in the block, default time limit is used (see user settings in JS block). Default is 60' (it means that the popup notification appears if elapsed time is more than 60'). Set it to 0 if you want the popup every time.
By default, if there is some trigger word, a popup notification will appear, and you have to confirm for applying formatting (if it's less, or more, or exactly the elapsed time required), if not the popup desappear after 6 seconds. There is a user setting for desactivating this notification and automatic apply the formatting. Nb: you can use keyboard to confirm: the focus is automatically set on the right button, you have just to press Enter to apply formatting.
Of course, formatting (that is a string inserted in the current block, after the elapsed time) can set by user, also in the JS code. By default it's using the css code below (block background color is set to red or green), but you can just insert a word or an icon, or nothing.
This video shows the main features
π Change log
v0.22 (June 1st, 2021)
β Prerequisites for this SmartBlock
Roam42 must be installed (instructions here).
For formating the blocks depending on the elapsed time, you can use this css (very simple example) (it's included in the JSON file):
π· Screenshot
(Content of the code block doesn't appear entirely in the screenshot below)
π‘ Additional Info
Download JSON file (.zip to extract, then import JSON file in your graph) to better preserve the structure of the code: Timestamp button for interstitial journaling v0.22.zip
βοΈ #42SmartBlock code:
Copy/Paste the code below anywhere in your graph (for example in the page 'SmartBlocks'). Proceed in two times: first, the Smartblocks, then the Javascript code, to insert in the code block of the last Smartblock (if you are not sure, you should better import the JSON file):
42SmartBlock Time button
42SmartBlock Time interval button
42SmartBlock End time
42SmartBlock Time interval button + elapsed time
42SmartBlock Elapsed time
<%JA:Β ```javascript ```Β %> <%NOBLOCKOUTPUT%>
β Copy/paste the code below in the code block in the Elapsed time Smartblock (remove 'javascript' at the top of the code):