Suggestion for a Bookmarklet

7 views
Skip to first unread message

Morris Gray

unread,
Feb 10, 2009, 12:09:16 AM2/10/09
to TiddlyWikiDev
Out of date plugins can be a problem for both users and developers.

Below is a forEach script I found somewhere and cobbled it up to list
all systemConfig tiddlers to take pertinent information from plugin
headers. I have been using it with a proxy to inject it into a
developer's TiddlyWiki to check for the latest versions and again to
check my own.

Obviously that method is not for everyone but as a Bookmarklet it may
be a tool that would encourage users to strive for the latest plugins
for their older TiddlyWikis.

It is so handy and useful I thought it would make a good Bookmarklet,
not only for users to keep their distribution TiddlyWikis up to date
but, it could be a good diagnostic tool for developers to quickly
check a user's TiddlyWiki for out of date plugins and conflicts when
they are having problems.

I wonder if it would be practical to make a Bookmarklet with the same
capabilities.

---------------------------
<<forEachTiddler
where 'tiddler.tags.contains("systemConfig")'
sortBy 'tiddler.title.toLowerCase()'
write '"|[[" + tiddler.title +"]]" + "|[["+tiddler.text.length
+"]]" + "|[[" +tiddler.modified.formatString("YYYY.0MM.0DD") + "]]|"
+ store.getTiddlerSlice(tiddler.title, "Author") + "|"
+ store.getTiddlerSlice(tiddler.title, "Version") + "|"
+ store.getTiddlerSlice(tiddler.title, "CoreVersion")+"|\n"'
begin '"|sortable|k\n"
+"|>|>|>|>|>|!Information from Plugin Headers|h\n"
+ "|!Plugin|!Size|!Modified|!Author|!Version|!CoreVersion|h
\n"'>>
----------------------------

Morris

FND

unread,
Feb 10, 2009, 5:36:03 AM2/10/09
to Tiddly...@googlegroups.com
> list all systemConfig tiddlers to take pertinent information from
> plugin headers
> [...]

> as a Bookmarklet it may be a tool that would encourage users to strive for the latest plugins
> for their older TiddlyWikis.

I agree that this would be desirable - there's a ticket to have such
info accessible via the backstage:
http://trac.tiddlywiki.org/ticket/438

FWIW, a lot of this info is already being gathered, so one could create
a bookmarklet* from something like the following:
---------------
(function() {

var plugins = installedPlugins.map(function(itm) {
return [
itm.Name || "N/A",
itm.Version || "N/A",
itm.Author || "N/A"
].join("; ");
});

var info = version.title + " " + formatVersion() + "\n" +
plugins.join("\n") + "\n";

wikify(info, document.body);

})();
---------------
(for lack of a better idea, this just appends the plugin info to the
bottom of the page)


-- F.


* e.g. using one of these tools:
http://xdexavier.googlepages.com/sharebookmarklet.html
http://subsimple.com/bookmarklets/jsbuilder.htm
http://4umi.com/web/bookmarklet/edit.php

Eric Shulman

unread,
Feb 10, 2009, 10:57:09 AM2/10/09
to TiddlyWikiDev
> a bookmarklet* from something like the following:
You can also use
http://www.TiddlyTools.com/#InlineJavascriptPlugin
to create "instant bookmarklets", like this:

<script label="click me">
... code goes here...
</script>

InlineJavascriptPlugin uses the label="..." syntax to render a command
link that will invoke the script as an 'onclick' handler rather than
running it immediately upon processing the script definition. In
addition, when rendering the link, the plugin also *automatically*
adds code to the command link so that you can simply drag the
resulting link to your browser's toolbar to create an "instant
bookmarklet".

Here's an example of a command that does almost exactly what is being
discussed:
http://www.TiddlyTools.com/#ShowDocumentInfo

Note: you don't have to install either InlineJavascriptPlugin or
ShowDocumentInfo to create the bookmarklet in your browser. Just view
the script tiddler on TiddlyTools and then drag the link from there to
your browser... from then on, you can use the bookmarklet to get info
on *any* TiddlyWiki you are viewing, even read-only, remotely hosted
documents that were written by other people, even if the plugin and
script have never been installed in those documents!

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

those that don't have installed

enjoy,
-e

Morris Gray

unread,
Feb 11, 2009, 9:33:35 AM2/11/09
to TiddlyWikiDev
Thanks FND, and Eric I took your code and got this far, You know how
I like tables:-) But I think it needs to be wikified or something
could you help me to make a table? That's the first step then I'd like
to make a bookmarklet from it.
------------------------
<script label="Plugin Identifier">
var plugins=window.store.getTaggedTiddlers('systemConfig','title');
var out=[];
out+='\n\n'+plugins.map(function(t)
{
return '|[['+t.title+']]|'
+t.modified.formatString('YYYY.0MM.0DD')
+' | '+ store.getTiddlerSlice(t.title, "Author")
+' | '+ store.getTiddlerSlice(t.title, "Version")
+' |' + store.getTiddlerSlice(t.title, "CoreVersion")
+' | ';
}).join('\n');
return out;
</script>
--------------------------------
Thanks,
Morris

Morris Gray

unread,
Feb 11, 2009, 9:41:26 AM2/11/09
to TiddlyWikiDev
I just got the table.

}).join('|\n');

That proves you never really think properly until after you hit send.

Morris

Eric Shulman

unread,
Feb 11, 2009, 9:43:28 AM2/11/09
to TiddlyWikiDev
> Thanks FND, and Eric I took your code and got this far,  You know how
> I like tables:-)  But I think it needs to be wikified or something
> could you help me to make a table? That's the first step then I'd like
> to make a bookmarklet from it.
> ------------------------

Unlike a regular inline script, there is no current 'place' defined
when processing a bookmarklet, so you can't simply return some text
containing wiki syntax, because there's nowhere to render that
content... that's why the ShowDocumentInfo script uses an alert()
dialog to display the output.

The easiest way to get wiki-formatted output from a bookmarklet is to
store the output in a shadow tiddler and then display that shadow,
like this:

config.shadowTiddlers.DocumentInfo = out;
story.displayTiddler(null,'DocumentInfo');

Morris Gray

unread,
Feb 11, 2009, 11:23:30 AM2/11/09
to TiddlyWikiDev
> The easiest way to get wiki-formatted output from a bookmarklet is to
> store the output in a shadow tiddler and then display that shadow,
> like this:
>
> config.shadowTiddlers.DocumentInfo = out;
> story.displayTiddler(null,'DocumentInfo');

I'm not sure I know how to do that with a script doesn't that require
systemConfig, at any rate I don't know where to start.

Also I don't know why the last line of the data falls outside the
table. Here's the final script, can you see what's happening?


---------------------
<script label="Plugin Identifier">
var plugins=window.store.getTaggedTiddlers('systemConfig','title');
var out="|bgcolor:#abf; Title |bgcolor:#abf; Date |
bgcolor:#abf;padding-left:1em;Size|bgcolor:#abf; Author |bgcolor:#abf;
Version |bgcolor:#abf;CoreVersion |h\n";
out+=plugins.map(function(t)
{
return '|[['+t.title+']]|'
+t.modified.formatString('YYYY.0MM.0DD')
+'| '+t.text.length
+'|'+store.getTiddlerSlice(t.title, "Author")
+' |'+ store.getTiddlerSlice(t.title, "Version")
+' |' + store.getTiddlerSlice(t.title,
"CoreVersion");
}).join('|\n');
return out;
</script>
------------------------

Morris

Eric Shulman

unread,
Feb 11, 2009, 12:07:14 PM2/11/09
to TiddlyWikiDev
> > config.shadowTiddlers.DocumentInfo = out;
> > story.displayTiddler(null,'DocumentInfo');
>
> I'm not sure I know how to do that with a script doesn't that require
> systemConfig, at any rate I don't know where to start.

You use those two lines in place of "return out" in the inline/
bookmarklet script!

> Also I don't know why the last line of the data falls outside the
> table.  Here's the final script, can you see what's happening?

You are missing a newline at the end of the output.

In any event, here's a brand new TiddlyTools 'instant bookmarklet'
that does what you are trying to achieve:

http://www.TiddlyTools.com/#ShowPluginInfo

Morris Gray

unread,
Feb 11, 2009, 5:19:27 PM2/11/09
to TiddlyWikiDev
That's terrific Eric. I almost got there first:-) Thanks for all your
help.

Morris
Reply all
Reply to author
Forward
0 new messages