Yahoo Pipes Badge and inline javascript

42 views
Skip to first unread message

Alex Hough

unread,
Mar 26, 2008, 7:09:47 AM3/26/08
to Tiddl...@googlegroups.com
Hello

I am wondering if I can get this script into a tiddler.  It is a badge for a Yahoo pipe.  The badge looks great in blogger.
I think that badges might be better for reading pipes than Bidix's RSS reader. 


I have Eric's inline javascript installed, and tried to add this pipe (an aggregation of osmosoft blogs)
My tiddler contains:

<script src="http://pipes.yahoo.com/js/imagebadge.js">{"pipe_id":"675454c2103c86ef2bf2dc428078ca28","_btype":"image"}</script>

But there is an error: "SyntaxError: invalid label"

Any help much appreciated.

Alex



FND

unread,
Mar 26, 2008, 7:47:06 AM3/26/08
to Tiddl...@googlegroups.com
> I am wondering if I can get this script into a tiddler.

I'm not familiar with these Yahoo badges.

Generally, I'd say that links to external scripts should go into the
MarkupPostHead shadow tiddler (note that Eric's IJSP SCRIPT tags are
different from HTML SCRIPT tags).

The stuff within that SCRIPT tag of yours seems a little odd (looks like
it's missing a context object or something). Where did you get those
instructions from?


-- F.

Alex Hough

unread,
Mar 26, 2008, 7:56:13 AM3/26/08
to Tiddl...@googlegroups.com
Hi FND,

if you goto
http://pipes.yahoo.com/pipes/pipe.info?_id=675454c2103c86ef2bf2dc428078ca28

you will see, in thetoip left hand corner, above "image" get as a badge.

When you click on 'get as a badge' then 'embed' you get this code:


<script src="http://pipes.yahoo.com/js/imagebadge.js">{"pipe_id":"675454c2103c86ef2bf2dc428078ca28","_btype":"image"}</script>

You are then told to paste it into your site.

I thought that Eric's plugin would enable me to add javascript like using <html></html>

Could I  put the code at http://pipes.yahoo.com/js/imagebadge.js into my TW and make a macro which enables  "pipe_id":"675454c2103c86ef2bf2dc428078ca28","_btype":"image"
to run on the code.

Alex

Eric Shulman

unread,
Mar 26, 2008, 9:34:11 AM3/26/08
to TiddlyWiki
> I thought that Eric's plugin would enable me to add javascript like using
> <html></html>

Not exactly.

In TiddlyWiki, any <html></html> blocks are simply passed to the
browser for rendering via an 'innerHTML' assignment. Unfortunately,
the browser does *not* invoke any <script>...</script> contained in
that html (it is simply ignored). This is the reason that
InlineJavascriptPlugin is needed, so at least you can embed scripts
*outside* of an HTML block. The plugin works by taking everything in
between <script> and </script> and simply passes it through
javascript's eval() function to invoke that code...

As Fred (FND) notes:
> > The stuff within that SCRIPT tag of yours seems a little odd (looks like
> > it's missing a context object or something). Where did you get those
> > instructions from?

The Yahoo Pipes usage is unusual (at least it is something that I've
not seen done before), so its not clear to me how it is supposed to
work in the first place. It appears that they expect the **object
definition** within the <script>...</script> to be somehow
instantiated as data (which eval() apparently doesn't support,
reporting an 'invalid label' error), and that data is then supposed to
be immediately available to the script loaded by the src="..." syntax
(which InlineJavascriptPlugin *does* process). I will need to dig
through their code to figure out what, if anything, can be done to
make it work.

For 'pure' browser-based script processing, you could try putting
their code in a special tiddler called [[MarkupPreBody]] or
[[MarkupPostBody]]. Then, when you save your document, the content
from those tiddlers is automatically inserted directly into the TW
source file, so that it is processed immediately upon loading the
document. Of course, this doesn't give you the ability to embed the
Yahoo Pipes badge inside tiddler content, but that's about the best
you are going to get (at least until I figure out what they are
doing!)

HTH,
-e
Reply all
Reply to author
Forward
0 new messages