Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-13 Thread HansWobbe
+1 for this, simply because its been a very powerful methodology throughout 
my programming experience with APL's execute function and the expressions 
of LISP.  I certainly agree that power tools are dangerous (especially in 
these modern days of exploits) but that means you simply have to take 
care when using them and Trust the source of any that you accept.  Oh, 
and Make backups! :-)

Cheers,
Hans


I believe there is a certain demand for something equivalent to TiddlySpace 
 and...

 config.evaluateMacroParameters = full;

 ...allowing users and authors to explicitly enable javascript urls in 
 their wikis,
 even script tags ...via a different config tiddler.

 Best wishes, Tobias.


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-12 Thread PMario
On Monday, January 12, 2015 at 4:34:28 PM UTC+1, Tobias Beer wrote:

 Hi Stephen,
  

 That being the case, I'm surprised that this works: 
 http://tbdemo.tiddlyspot.com/#Console%20Log%20Of%20Tiddler%20Sizes

 Perhaps I'm missing a key difference between inline Javascript in an 
 Onclick and what looks like inline Javascript in an a href=javascript.


This is a bug, because of security concerns. see: 
https://github.com/Jermolene/TiddlyWiki5/issues/1350


 I think it would be quite a bummer if bookmarklets would no longer work.


In FireFox some bookmarklets, that are loaded or access http:// URIs are 
blocked if your current page is https:// 
There may be more restrictions in the future. 

-m


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-12 Thread Tobias Beer
Hi Mario,
 

 This is a bug, because of security concerns. see: 
 https://github.com/Jermolene/TiddlyWiki5/issues/1350


I believe there is a certain demand for something equivalent to TiddlySpace 
and...

config.evaluateMacroParameters = full;

...allowing users and authors to explicitly enable javascript urls in their 
wikis,
even script tags ...via a different config tiddler.

Best wishes, Tobias.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-12 Thread Tobias Beer
Hi Stephen,
 

 That being the case, I'm surprised that this works: 
 http://tbdemo.tiddlyspot.com/#Console%20Log%20Of%20Tiddler%20Sizes

 Perhaps I'm missing a key difference between inline Javascript in an 
 Onclick and what looks like inline Javascript in an a href=javascript.


I think it would be quite a bummer if bookmarklets would no longer work.

As for running code in the console, it's really more of a conscious act to 
run that code...
Some browsers, e.g. Firefox have even started to ask you if you really want 
to do that.

Best wishes, Tobias.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-09 Thread Jeremy Ruston
  Generally the javascript pulls in data from the input element and pushes
the results to a different output element.

The native TiddlyWiki way to handle this would be to use data binding:
for the JavaScript to pull the data from a tiddler, and have that tiddler
bound to an edit control via the edit-text widget. The output would be
written to another tiddler, bound to the output element.

 Although it is an approach that hadn't occurred to me, unfortunately it
doesn't seem to work in TW5. I can't tell you why it doesn't.

whatever's example doesn't work because TW5 doesn't support inline
JavaScript within HTML elements in wikitext. It would be a security risk in
some situations as it would mean that any wikitext tiddler might
potentially contain executable JavaScript, which may be malicious.

TiddlyWiki works very differently than traditional jQuery-style DOM
development. I'd recommend the tiddlywiki.com/dev documentation as a good
place to start (particularly the material from cjhunt).

Best wishes

Jeremy.



On Thu, Jan 8, 2015 at 3:54 PM, Danielo Rodríguez rdani...@gmail.com
wrote:


 Hello Stephen,

 My keyboard snippets plugin uses a similar approach. Maybe you can base
 your work on it to make your own version, or you can extend the plugin
 itself.

 Regards.


 El domingo, 4 de enero de 2015 20:42:25 UTC+1, Stephen Kimmel escribió:

 This works in TWC.


 Although it is an approach that hadn't occurred to me, unfortunately it
 doesn't seem to work in TW5. I can't tell you why it doesn't.

 Thanks for the suggestion, though.

  --
 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 tiddlywiki+unsubscr...@googlegroups.com.
 To post to this group, send email to tiddlywiki@googlegroups.com.
 Visit this group at http://groups.google.com/group/tiddlywiki.
 For more options, visit https://groups.google.com/d/optout.




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-08 Thread Danielo Rodríguez

Hello Stephen,

My keyboard snippets plugin uses a similar approach. Maybe you can base 
your work on it to make your own version, or you can extend the plugin 
itself.

Regards.


El domingo, 4 de enero de 2015 20:42:25 UTC+1, Stephen Kimmel escribió:

 This works in TWC.


 Although it is an approach that hadn't occurred to me, unfortunately it 
 doesn't seem to work in TW5. I can't tell you why it doesn't.

 Thanks for the suggestion, though.


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-04 Thread 'Stephen Kimmel' via TiddlyWiki
 

Many of the javascripts that I work with on conventional web-pages use the 
general form of an input element of some type, a button to call the 
javascript and a separate output element of some type, frequently a 
textarea. Generally the javascript pulls in data from the input element and 
pushes the results to a different output element. TiddlyWiki’s handling of 
javascript seems to be predicated on the idea that the calling element 
gathers the input from wherever, passes the parameters to the javascript 
which then passes the results back to the calling element. 

Those aren’t the same and I’ve reworked a number of scripts to accomplish 
the same result. So far most of them have worked if they are a bit clunky. 
I did one where, instead of having the script pull the input parameters 
once, do the calculation in a loop and have the script push the answer out 
140 times, I had 140 separate calls to the script that did the calculation 
once. That didn’t seem like the right way to go so I’ve been revisiting 
what I know about Javascript. 

When I stumbled into the routine that became what is below, I saw several 
pieces of what I wanted to do. The script has no parameters as such, pulls 
the input from one html element, does something with it, and pushes the 
result out to two other html elements. That is ultimately what I want to 
accomplish. That is what I haven’t mastered in TiddlyWiki. I don’t 
understand why it doesn’t work. 

This works in a conventional html web-page but I haven’t been able to make 
it work in TiddlyWiki.If you play with this, you'll note that though you 
clicked the button, the selected area of the textarea was still active, 
even though the textarea did lose the focus. 

!DOCTYPE html
 html
 body

 textarea rows=4 cols=50 id=myTextarea
 342 Alvin Road
 Houston, Texas
 USA
 Earth
 Solar System/textarea

 textarea rows=4 cols=50 id=myTextarea2
 Nothing here/textarea

 pClick the button to copy the highlighted content to myTextarea2./p

 button type=button onclick=myFunction()Copy highlighted/button

 p id=demoNothing yet/p

 script
 function myFunction() {

var txt = document.getElementById(myTextarea);
 var start = txt.selectionStart;
 var finish = txt.selectionEnd;
 var sel = txt.value.substring(start, finish);
 document.getElementById(myTextarea2).value = sel;
 document.getElementById(demo).innerHTML = sel+ was extracted from 
 Textarea 1 and pushed into Textarea 2
 }
 /script

 /body
 /html

 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-04 Thread whatever
Hi!

Stephan's right. Once you click away, the textarea isn't the active element 
anymore. If the actual textarea is under your control, add the onchange 
handler to it or something. I have a bit of an issue imagining what it is 
you're trying to achieve and how.

w

On Saturday, January 3, 2015 8:20:20 PM UTC+1, Stephen Kimmel wrote:

 One of my javascript routines that I've been trying to convert from a 
 regular html file to a tiddlywiki contains a group of lines that look like 
 this:

 var txt = document.getElementById(myTextarea);
 var start = txt.selectionStart;
 var finish = txt.selectionEnd;
 var selected = txt.value.substring(start, finish);


 which returns the portion of the text inside the textarea myTextarea as 
 selected. The routine seems to work fine outside a TiddlyWiki environment 
 but getting it to work inside TiddlyWiki has defeated me so far. It seems 
 that the first statement is probably the culprit. 

 Is this sort of operation even possible in TiddlyWiki?


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Javascript Interaction with a Textarea

2015-01-04 Thread Jeremy Ruston
Hi Stephen

 One of my javascript routines that I've been trying to convert from a
regular html file to a tiddlywiki contains a group of lines that look like
this:

I think you'll need to subclass the edit-text widget to do this. Can you
explain what you're trying to achieve?

Best wishes

Jeremy.


On Sun, Jan 4, 2015 at 9:43 AM, whatever kbrezov...@gmail.com wrote:

 Hi!

 Stephan's right. Once you click away, the textarea isn't the active
 element anymore. If the actual textarea is under your control, add the
 onchange handler to it or something. I have a bit of an issue imagining
 what it is you're trying to achieve and how.

 w


 On Saturday, January 3, 2015 8:20:20 PM UTC+1, Stephen Kimmel wrote:

 One of my javascript routines that I've been trying to convert from a
 regular html file to a tiddlywiki contains a group of lines that look like
 this:

 var txt = document.getElementById(myTextarea);
 var start = txt.selectionStart;
 var finish = txt.selectionEnd;
 var selected = txt.value.substring(start, finish);


 which returns the portion of the text inside the textarea myTextarea as
 selected. The routine seems to work fine outside a TiddlyWiki environment
 but getting it to work inside TiddlyWiki has defeated me so far. It seems
 that the first statement is probably the culprit.

 Is this sort of operation even possible in TiddlyWiki?

  --
 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 tiddlywiki+unsubscr...@googlegroups.com.
 To post to this group, send email to tiddlywiki@googlegroups.com.
 Visit this group at http://groups.google.com/group/tiddlywiki.
 For more options, visit https://groups.google.com/d/optout.




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-04 Thread whatever
This is normal HTML. In TW, you can't use the body tag and the script tag 
can't be inside the html tags. Then there's problem with place and stuff, 
so I suggest using the code of the function directly in the onclick handler 
of the button, like this:
html
textarea rows=4 cols=50 id=myTextarea
342 Alvin Road
Houston, Texas
USA
Earth
Solar System/textarea

textarea rows=4 cols=50 id=myTextarea2
Nothing here/textarea

pClick the button to copy the highlighted content to myTextarea2./p

button type=button onclick=var txt = 
document.getElementById('myTextarea'); var start = txt.selectionStart; var 
finish = txt.selectionEnd; var sel = txt.value.substring(start, finish); 
document.getElementById('myTextarea2').value = sel; 
document.getElementById('demo').innerHTML = sel+' was extracted from 
Textarea 1 and pushed into Textarea 2';Copy highlighted/button

p id=demoNothing yet/p
/html

This works in TWC.

w


On Saturday, January 3, 2015 8:20:20 PM UTC+1, Stephen Kimmel wrote:

 One of my javascript routines that I've been trying to convert from a 
 regular html file to a tiddlywiki contains a group of lines that look like 
 this:

 var txt = document.getElementById(myTextarea);
 var start = txt.selectionStart;
 var finish = txt.selectionEnd;
 var selected = txt.value.substring(start, finish);


 which returns the portion of the text inside the textarea myTextarea as 
 selected. The routine seems to work fine outside a TiddlyWiki environment 
 but getting it to work inside TiddlyWiki has defeated me so far. It seems 
 that the first statement is probably the culprit. 

 Is this sort of operation even possible in TiddlyWiki?


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-04 Thread 'Stephen Kimmel' via TiddlyWiki


 This works in TWC.


Although it is an approach that hadn't occurred to me, unfortunately it 
doesn't seem to work in TW5. I can't tell you why it doesn't.

Thanks for the suggestion, though.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-03 Thread Stephan Hradek
I'm using it heavily here in my bookmarklets: 
http://tw5magick.tiddlyspot.com/

Search for example for STRIKE.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-03 Thread 'Stephen Kimmel' via TiddlyWiki
Correct me if I'm wrong. Aren't the bookmarklets separate from TiddlyWiki 
but are scripts installed in the browser and launched external to 
Tiddlywiki? Would it be possible to store them as javascripts in tiddlers 
and be part of the wiki independent of the browser?

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Javascript Interaction with a Textarea

2015-01-03 Thread Stephan Hradek


Am Sonntag, 4. Januar 2015 00:04:55 UTC+1 schrieb Stephen Kimmel:

 Correct me if I'm wrong. Aren't the bookmarklets separate from TiddlyWiki


Yes, but they can be used with tiddlywiki. I think this is proof that your 
code should work. 
 

 Would it be possible to store them as javascripts in tiddlers and be part 
 of the wiki independent of the browser?


That should be possible. Except that you wouldn't be able to call them 
without loosing focus of your textarea. So mine won't work when invoked by 
clicking a button. It might be possible to invoke them using keyboard 
shortcuts, but I've never tried. 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.