Skip to content

Instantly share code, notes, and snippets.

View Arlen22's full-sized avatar

Arlen Beiler Arlen22

View GitHub Profile
@Arlen22
Arlen22 / New Journal button
Last active August 29, 2015 13:57
New Journal buttons (public domain)
\define tiddlerText()
title: My New Tiddler
This is a test. It should show an unsubstituted variable with a message. $($(test)$)$
\end
<$set name="test" value="substituteVariables works!" >
<$button message="tw-new-tiddler" class="btn-invisible" param=<<tiddlerText>> >{{$:/core/images/new-button}}</$button>
<$button message="tw-new-tiddler" class="btn-invisible" param=<<substituteVariables tiddler:"new-tiddler-test" >> >{{$:/core/images/new-button}}</$button>
</$set>
@Arlen22
Arlen22 / fieldmangler.js:execute()
Created March 27, 2014 13:09
Add create param to fieldmangler.js using x-tiddler deserializer. (public domain)
FieldManglerWidget.prototype.execute = function() {
// Get our parameters
this.mangleTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
this.createText = this.getAttribute("create",false);
// Process create param
if(this.createText) {
var createTiddler = $tw.wiki.deserializeTiddlers("application/x-tiddler",this.createText);
createTiddler[0]['title'] = this.mangleTitle;
if(!this.wiki.tiddlerExists(this.mangleTitle))
this.wiki.addTiddler(createTiddler[0]);
@Arlen22
Arlen22 / $:_Arlen22_toggle-centered-button
Last active August 29, 2015 13:57
Two tiddlers which pass a create argument to the fieldmangler widget. They are designed for use in a topmenu in TW5.
\define createStateTiddler()
tags: $:/tags/stylesheet
$(default)$
\end
\define state-1-css()
\end
\define state-2-css()
@media (min-width: 770px) { .story-river { margin: 0 auto; } .sidebar-header { left: 50%; right: 0; padding-left: 413px; } }