view editor.tp @ 11:5447cff52da6

Use tabletproglang in editor
author Mike Pavone <pavone@retrodev.com>
date Wed, 21 Mar 2012 21:42:38 -0700
parents
children 6e4851a204a5
line wrap: on
line source
#{
//mquery functions
q <- foreign: :query {}
qall <- foreign: :query {}
each <- foreign: :iterable fun {}
addClass <- foreign: :node className {}
removeClass <- foreign: :node className {}

//tabletprog JS helpers
setP <- foreign: :object property val {}
getP <- foreign: :object property {}

//js builtins
console <- foreign: #{
	log <- foreign: #{}
}

main <- {
	each: (qall: "li") :idx el {
		el setP: "onclick" :event {
			srcel <- (q: "#src")
			srcel setP: "innerHTML" (srcel getP: "innerHTML") + (el getP: "innerHTML")
		}
	}
	(q: "#ops_button") setP: "onclick" :event {
		addClass: (q: ".controls") "showops"
	}
	
	(q: "#builtin_button") setP: "onclick" :event {
		removeClass: (q: ".controls") "showops"
	}
}

}