TiddlyWiki.org

Changeset 4939

Show
Ignore:
Timestamp:
14/05/08 13:52:30 (2 months ago)
Author:
psd
Message:

TiddlyProcessing? - includes Simon Baird's viewmacro and refresh button

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/contributors/PaulDowney/plugins/ProcessingjsPlugin.js

    r4864 r4939  
    1515 
    1616//{{{ 
    17  
    1817// Ensure Plugin is only installed once. 
    1918if(!version.extensions.Processingjs) { 
     
    2524                var id = "processingcanvas"+this.counter; 
    2625                var canvas = createTiddlyElement(place,"canvas",id); 
    27                  
     26 
    2827                // inlined code 
    2928                var code = paramString; 
     
    3433                } 
    3534 
    36                 // allows use as a view macro 
    37                 if (paramString == '') { 
     35                // or with no params, grab code from this tiddler 
     36                if (paramString.trim() == '') { 
    3837                        code = tiddler.text; 
    3938                } 
     39 
     40                createTiddlyElement(place,"br"); 
     41                var restartBtn = createTiddlyButton(place,"restart","restart",function() { 
     42                                story.refreshTiddler(tiddler.title,null,true); 
     43                                return false; 
     44                        }, 
     45                        'processingRestart' // it's a class so you can style the button 
     46                ); 
    4047 
    4148                Processing(canvas,code); 
    4249        } 
    4350}; 
     51 
     52// requires 2.4 
     53merge(config.macros.view.views,{ 
     54        processing: function(value,place,params,wikifier,paramString,tiddler) { 
     55                wikify("<<Processing\n"+value+"\n>>",place,highlightHack,tiddler); 
     56        } 
     57}); 
    4458 
    4559/*