I couldn't resist the temptation to put a JavaScript macro together, so
I've er… put a JavaScript macro together :)
This simplifies usage of the "topic" and "topiclink" macros, described in
my previous post, to just this:
<<topic "Q & A Start" "00:01:25">>
<<topiclink "Eric Discusses how he creates the Wiki Way" "02:08:08">>
If you want to try it out, create a tiddler called
"$:/.rich/macros/youtime.js". This one doesn't need a tag, but at the
bottom of the tiddler edit area, you'll need to set its type to
"application/javascript", plus add a field called "module-type" whose value
is "macro". Paste the tiddler's content from the attached file,
"youtime.txt".
You can then change the content of "$:/.rich/macros/topic" to this:
\define topic(description, timecode)
<<youtime "$(youtubeid)$" "$timecode$">> ''---'' $description$
\end
\define topiclink(description, timecode)
<<youtime "$(youtubeid)$" "$timecode$">> ''---''
[[$description$|$(hangoutprefix)$ - $description$]]
\end
This causes "topic" and "topiclink" to use the "youtime" macro defined in
"$:/.rich/macros/youtime.js". The "youtime" macro generates a timed YouTube
link and can be used on its own, like this:
<<youtime "EU-H0xhga08" "00:01:25">>
If this works for you, you can delete the "$:/.rich/macros/youtube" tiddler
I offered yesterday :)
— æ
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
/*\
title: $:/.rich/macros/youtime.js
type: application/javascript
module-type: macro
\*/
(function(){
"use strict";
exports.name = "youtime";
exports.params = [
{ name: "youtubeid" },
{ name: "timecode" }
];
exports.run = function(youtubeid, timecode) {
youtubeid = youtubeid || "no-video-specified";
var hms = timecode || "00:00:00";
var bits = hms.split(":");
var h = bits[0], m = bits[1], s = bits[2], m = h*60 + m*1;
var output = ["[[", hms, "|http://www.youtube.com/watch?v=", youtubeid];
if(timecode) {
output.push("&t=", m + "m", s + "s");
}
output.push("]]");
return output.join("");
};
})();
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.