Eric,

Once again inspired by you work, I recall that on https://www.w3schools.com/ a 
search is "enhanced by Google" and the results appear in a drop down.

I wonder if we could develop this for tiddlywiki?


Regards
Tony

On Friday, June 5, 2020 at 10:00:56 AM UTC+10, Eric Shulman wrote:
>
> On Thursday, June 4, 2020 at 1:17:55 PM UTC-7, Eric Shulman wrote:
>>
>> This might help get you in the right direction:
>> \define google(term)
>> <a href={{{ [[https://www.google.com?q=$(currentTiddler)$+$term$]split[ 
>> ]join[+]] }}} target="_blank">$term$</a>
>> \end 
>>
>  
> Here's another version that doesn't need to define a macro and also 
> provides an input field for the search term:
> <$edit-text tiddler="$:/temp/google" tag="input" placeholder="enter search 
> text" default="" />
> <$button message="tm-open-external-window" param={{{ [[
> https://www.google.com?q=]] +[addsuffix<currentTiddler>] +[addsuffix[+]] 
> +[addsuffix{$:/temp/google}] +[split[ ]join[+]] }}}>
>    search
> </$button>
>
> 1) Define a tiddler (e.g., "Google") containing the above code
> 2) Create any other tiddler containing the following:
> {{||Google}}
>
> How it works:
> * As with the previous macro version, the desired URL is constructed using 
> the currentTiddler value
> * Instead of using a macro parameter to insert the search term, and 
> $edit-text widget is used to save the term input into a temporary tiddler, 
> $:/temp/google
> * The contents of $:/temp/google are appended to the constructed URL
> * A $button widget is used to open a new 'external' browser window with 
> the fully constructed URL
>
> To use it:
> * Instead of invoking a macro (i.e., <<google ...>>), transclusion is used 
> (i.e., {{||Google}} to display the input field and button
> * Note the use of || in the transclusion.  This allows the *context* of 
> the containing tiddler to be applied, which means that the value of 
> currentTiddler is the title of the tiddler in which the transclusion 
> occurs, rather than the title of the tiddler in which the input field and 
> button are defined.
>
> Again, let me know how it goes...
>
> enjoy,
> -e
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/63c843cd-33d9-426b-a769-46d2bff22d76o%40googlegroups.com.

Reply via email to