SmartBlocks icon indicating copy to clipboard operation
SmartBlocks copied to clipboard

Search YouGlish using Page Title as a default input

Open gijigae opened this issue 4 years ago • 6 comments

✂️ Copy of your #42SmartBlock from Roam

  • #42SmartBlock YouGlish
    
    • :hiccup [:a#yg-widget-0.youglish-widget
          {:data-query <%J:
      ```javascript
      return "\"" + encodeURIComponent(prompt('Enter words to lookup in YouTube.', document.title)) +"\"" ;
      ```
      %>}
      "YouGlish"]
      
    • <%NOBLOCKOUTPUT%><%JA:
      ```javascript
      var s = document.createElement('script')
      s.type = "text/javascript"
      s.src =  "https://youglish.com/public/emb/widget.js"
      document.getElementsByTagName('head')[0].appendChild(s)
      return '';```
      %>
      
    • <%CURSOR%>
      

📋 Describe the SmartBlock

YouGlish is a popular service among English language learners to search usage of words or phrases in YouTube videos. This SmartBlock searches YouGlish's database with a page title as a default input and embeds the search result into Roam.

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

None. This is an attempt to simulate YouGlish widget. Widget details can be found in YouGlish's site. If you find a better way of implementing the widget, please share it in the comment.

📷 Screenshot of your #42SmartBlock workflow/template from Roam

image

💡 Additional Info

youglish2

gijigae avatar Dec 13 '20 07:12 gijigae

Screenshot 2021-02-26 at 18 47 26

Why does it become like a link and not activate again after exiting it once? with exiting I mean closing the parent block

orkhan10 avatar Feb 26 '21 17:02 orkhan10

one more thing, how can I use it with youglish for german?

orkhan10 avatar Feb 26 '21 17:02 orkhan10

Screenshot 2021-02-26 at 18 47 26

Why does it become like a link and not activate again after exiting it once? with exiting I mean closing the parent block

Make another SmartBlock with the following two blocks in it. Let's name it as YouGlish2. When you revisit the page and want to see the YouGlish widget again, run "YouGlish2". Hope it helps.

image

gijigae avatar Feb 27 '21 04:02 gijigae

Do you mean repeat the Youglish Smartblock like this? CleanShot_2021-02-27_at_14_05_56_2x

agoodbear avatar Feb 27 '21 06:02 agoodbear

Sorry~~ I understand what you mean now thanks~

agoodbear avatar Feb 27 '21 06:02 agoodbear

I have made a small change and added an activate button to the bottom of the widget.

Button code:

{{Activate:42SmartBlock:YouGlish Reactivate:42RemoveButton=false}}

Screenshot 2021-02-27 at 14 29 39

Screenshot 2021-02-27 at 14 28 43

orkhan10 avatar Feb 27 '21 13:02 orkhan10