http://trac.tiddlywiki.org/changeset/9809
FND
2009-05-29 12:14:25 +0000 (Fri, 29 May 2009)
170
moved obsolete files related to jQuery.tw namespace
Ideally, there should be a branch dedicated to archiving these exploratory
efforts so they can be removed from Trunk.
---------------
D Trunk/core/jquery/plugins/jquery.tw.js
D Trunk/core/jquery/plugins/jquery.tw.macro.js
D Trunk/core/jquery/plugins/jquery.tw.macro.today.js
A Trunk/core/jquery/plugins/obsolete/
A Trunk/core/jquery/plugins/obsolete/jquery.tw.js
A Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.js
A Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.today.js
---------------
Deleted: Trunk/core/jquery/plugins/jquery.tw.js
Deleted: Trunk/core/jquery/plugins/jquery.tw.macro.js
Deleted: Trunk/core/jquery/plugins/jquery.tw.macro.today.js
Copied: Trunk/core/jquery/plugins/obsolete/jquery.tw.js (from rev 9808,
Trunk/core/jquery/plugins/jquery.tw.js)
===================================================================
--- Trunk/core/jquery/plugins/obsolete/jquery.tw.js
(rev 0)
+++ Trunk/core/jquery/plugins/obsolete/jquery.tw.js 2009-05-29 12:14:25 UTC
(rev 9809)
@@ -0,0 +1,10 @@
+/*
+jquery.tw.js
+addition of tw 'namespace'
+*/
+(function($) {
+ if(!$.tw) {
+ $.tw = {};
+ $.tw.extend = $.extend;
+ }
+})(jQuery);
Copied: Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.js (from rev 9808,
Trunk/core/jquery/plugins/jquery.tw.macro.js)
===================================================================
--- Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.js
(rev 0)
+++ Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.js 2009-05-29
12:14:25 UTC (rev 9809)
@@ -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);
Copied: Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.today.js (from rev
9808, Trunk/core/jquery/plugins/jquery.tw.macro.today.js)
===================================================================
--- Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.today.js
(rev 0)
+++ Trunk/core/jquery/plugins/obsolete/jquery.tw.macro.today.js 2009-05-29
12:14:25 UTC (rev 9809)
@@ -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);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---