Move the editions into a subfolder

This commit is contained in:
Jeremy Ruston
2012-11-16 21:20:27 +00:00
parent 544711fe59
commit 719d89ca04
721 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
/*
jquery.tw.js
addition of tw 'namespace'
*/
(function($) {
if(!$.tw) {
$.tw = {};
$.tw.extend = $.extend;
}
})(jQuery);

View File

@@ -0,0 +1,58 @@
/*
jquery.tw.macro.js
macro parameter expansion
*/
(function($) {
$.tw.extend({
expandMacroParams: function(params) {
// expand the macro parameters into a name:value hash
// all parameters are also given a numeric name, starting at 1
var opts = {};
var unnamed = 1;
var name,val;
var t = $.trim(params);
var s = 0;
var i = findNakedSpace(t,s);
var param = i==-1 ? t.substr(s) : t.substring(s,i);
while(true) {
var ci = param.indexOf(':');
if(ci==-1) {
// parameter is unnamed
name = param ? unnamed++ : null;
val = param;
} else {
name = param.substr(0,ci);
val = param.substr(ci+1);
}
val = $.trim(val);
if(val.charAt(0)=='"' && val.charAt(val.length-1)=='"') {
val = val.substr(1,val.length-2);
}
if(name)
opts[name] = val;
if(i==-1)
break;
s = i+1;
i = findNakedSpace(t,s);
param = i==-1 ? t.substr(s) : t.substring(s,i);
}
return opts;
}
});
// Private functions.
function findNakedSpace(text,start) {
// find the next space not surrounded by quotes
var d = text.indexOf(' ',start);
if(d==-1)
return -1;
var qs = text.indexOf('"',start);
if(qs==-1 || qs > d)
return d;
var qe = text.indexOf('"',qs+1);
if(qe==-1)
return d;
return findNakedSpace(text,qe+1);
}
})(jQuery);

View File

@@ -0,0 +1,15 @@
/*
jquery.tw.macro.today.js
jQuery TiddlyWiki <<today>> macro
*/
(function($) {
$.fn.tw_today = function(args) {
args.format = args.format || args[1];
var opts = $.extend({},$.fn.tw_today.defaults,args);
var now = new Date();
var text = now.formatString(opts.format.trim());
this.append("<span>"+text+"</span>");
return this;
};
$.fn.tw_today.defaults = {format:"ddd mmm 0DD 0hh:0mm:0ss YYYY"};
})(jQuery);