You can, but often you need to rewrite the startup parts a little.
Or, if you aren't that hot with Javascript, mention the external
library here and ask if anyone else has got it going. You might get
lucky and find someone who's already done it, or, some developer might
think it's useful and kludge it up for you.
Cheers
;D
--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)
When I looked at the Javascript at that URL, it looks like it just
adds some elements to the page with document.write.
Have you tried just pasting the html directly in to the tiddler
(inside html tags)?
InlineJavascript does not recognize (and does not need) the "type=..."
attribute. Remove that syntax and it should work:
<script src="..."></script>
Note: normally, javascript that invokes document.write() will
completely replace the content of your currently loaded TW document
(fortunately, this doesn't affect the saved file content, just the
loaded image)
However, InlineJavascriptPlugin automatically "defangs"
document.write() prior to invokation of the script, so it writes its
output into the tiddler in which it is placed, rather than trying to
overwrite the whole document.
Daniel Baird wrote:
> Have you tried just pasting the html directly in to the tiddler
> (inside html tags)?
Unfortunately, when wikify passes the source to the browser, it
processes the HTML but does NOT run any embedded <script>...</script>
code.
-e
HTH,
Eric Shulman
TiddlyTools / ELS Design Studios
On 10 Sep 2006, Edgar Javison wrote:
> Unfortunately, it only returned the result of the script and I couldn't
> open my TW anymore! Good thing I had a backup file, so I didn't lose my
> file.
Whilst I'd be the last person to decry backups, you can easily open
your broken TW file in a _plain text_ editor and remove (or fix) the
offending tiddler.
Of course if you choose to use a word processor, we'll all laugh ;)
chris :-)
> > I have Eric Shulman's InlineJavascriptPlugin and been working around to
> > embed this script into my mainmenu:
> >
> > <script type="text/javascript" src="
> > http://embed.technorati.com/embed/y7n4ruq9mj.js"></script>
InlineJavascript does not recognize (and does not need) the "type=..."
attribute. Remove that syntax and it should work:
<script src="..."></script>
On 10 Sep 2006, Edgar Javison wrote:
> Thanks for telling me that I could edit it through a text editor. I'll
> keep that in mind next time around...
It's strange, it should be so obvious - it's "only" HTML and
javascript after all, but it seems so much more and not something a
simple editor could handle!
I guess you spotted in the options that you can have TW make backup
copies when you use its save feature?
chris :-)
Yes, but TW creates sooooo many backup copies! I wish it would overwrite what it last backed-up instead of create a new back-up everytime you save. Don't you think so?
oops! The document.write() 'fixup' feature currently only works for
scripts that are defined *inline* (i.e., NOT using the src="..."
syntax). However, your script *can* work without modification in TW,
by using just a tiny bit of "digital gymnastics" to embed the source
code directly in a tiddler instead of using an external src="..." URL
reference:
First, use "save link as..." from your browser to create a *local file*
containing the script code from the remote URL:
http://embed.technorati.com/embed/y7n4ruq9mj.js
Then, open the .js file in a text editor (*not* the browser) and also
open your TW document (in the browser). Copy/paste the contents from
the .js file into a new tiddler (e.g., "TechnoratiScript"):
<script>
**paste script code here**
</script>
As soon as you press "done", the script will be invoked and you should
see the desired results...
I am working on a way to extend the same 'fixup' handling to script
libraries (i.e., included via src="...") but, for now at least, the
copy/paste approach should provide a viable workaround.
HTH,
-e
if (!config.options.txtMaxBackups) config.options.txtMaxBackups="10";Cheers,
and change it to:
if (!config.options.txtMaxBackups) config.options.txtMaxBackups="1";
yup... that's the idea.
"Trans-cluding" tiddlers containing inline scripts is a great way to
quickly add little snippets of re-usable javascript code to your
tiddler content. For example,
http://www.TiddlyTools.com/#RefreshTiddler
can be used to add a "refresh" link to any tiddler (clicking the link
forces that tiddler to be redisplayed):
-----
<script label="refresh">
var here=story.findContainingTiddler(place);
if (here)
story.refreshTiddler(here.getAttribute("tiddler"),null,true);
</script>
-----
You can even use some simple parameters via "$n" substitutions. The
syntax for passing parameters to a transcluded tiddler uses the
TiddlerWithParamsPlugin in TW2.0.x... and is built-in to TW2.1:
-----
<<tiddler TiddlerName with: param1 param2 param3...>>
-----
Before the content from TiddlerName is transcluded, it is scanned for
substitution markers (e.g., $1, $2, $3, etc.), which are replaced by
the "param1", "param2", "param3", values. Then, when the content is
rendered and the inline script is invoked, the substituted values are
used within the script.
For example, check out
http://www.TiddlyTools.com/#ScrollBox
It provides a simple way to display tiddler content inside a scrollable
fixed-height area:
-----
@@display:block;height:$2;overflow:auto;<<tiddler
$1>>@@@@display:block;text-align:right;^^scroll for more...^^@@
-----
The syntax to use it is:
<<tiddler ScrollBox with: TiddlerName height>>
where TiddlerName is the tiddler with the content to be displayed, and
'height' is any CSS-compliant vertical measurement (e.g., "20em",
"500px", etc), used to limit the height of the display area.
enjoy,
oops! While the ScrollBox tiddler does use $1 and $2 substitutions, it
doesn't actually contain any inline javascript.
Here's a better example that uses parameter passing AND inline scripts
together:
http://www.TiddlyTools.com/#ReplaceTiddlerTitle
This script lets you change the title that is *displayed* on a tiddler,
without renaming the tiddler itself. For example: A tiddler called
"ThisIsAnUglyTiddlerName" can be displayed as "Welcome to my blog!"
when it is actually rendered.
-e
What I meant was that the script seemed to just write out some divs
and other html elements.. it seems like you could look through the
javascript and work out what those elements were, and type those in
literally.
;D
> You can even use some simple parameters via "$n" substitutions. The
...
> For example, check out
> http://www.TiddlyTools.com/#ScrollBox
Don't tag them. Inline scripts are invoked when the tiddlers they are
contained in are rendered. Note that RefreshTiddler is an example of
an 'onclick' script. Rather than invoking the enclosed javascript code
right away, a link is embedded in the tiddler content (using the text
from the label="..." plugin script syntax) and the code is only
actually performed when the link is subsequently clicked.
-e