Skip to content
Mark Nadal edited this page May 14, 2019 · 3 revisions

Here are some example commands I have written, maybe they'll be useful. Real documentation will come as more is demanded:

// on fires when shortcut keydowns or on touch after command selected and then touchdown
meta.edit({name: "Add", combo: ['A']});
meta.edit({name: "Row", combo: ['A', 'R'],
	on: function(eve){
		m.tap().append('<div class="hold center" style="min-height: 9em; padding: 2%;">');
	}
});
meta.edit({name: "Columns", combo: ['A','C'],
	on: function(eve){
		var on = m.tap(), tmp, c;
		var html = '<div class="unit col" style="min-height: 9em; padding: 2%;"></div>';
		if(!on.children('.col').length){ html += html }
		c = (tmp = on.append(html).children('.col')).length;
		tmp.each(function(){
			$(this).css('width', (100/c)+'%');
		})
	}
});
meta.edit({name: "Text", combo: ['A','T'],
	on: function(eve){
		m.tap().append('<p contenteditable="true">Text</p>');
	}
});
meta.edit({name: "Move", combo: ['M']});
;(function(){
	$(document).on('click', function(){
		var tmp = $('.meta-on');
		if(!tmp.length){ return }
		tmp.removeClass('meta-on');
	})
	meta.edit({combo: [38], // up
		on: function(eve){
			var on = m.tap().removeClass('meta-on');
			on = on.prev().or(on.parent()).or(on);
			on.addClass('meta-on');
		}, up: function(){ 
		}
	});
	meta.edit({combo: [40], // down
		on: function(eve){
			var on = m.tap().removeClass('meta-on');
			on = on.next().or(on.children().first()).or(on);
			on.addClass('meta-on');
		}, up: function(){ 
		}
	});
	meta.edit({combo: [39], // right
		on: function(eve){
			var on = m.tap().removeClass('meta-on');
			on = on.children().first().or(on.next()).or(on.parent()).or(on);
			on.addClass('meta-on');
		}, up: function(){ 
		}
	});
	meta.edit({combo: [37], // left
		on: function(eve){
			var on = m.tap().removeClass('meta-on');
			on = on.parent().or(on);
			on.addClass('meta-on');
		}, up: function(){ 
		}
	});
}());
meta.edit({name: "Turn", combo: ['T']});
meta.edit({name: "Size", combo: ['S']});
meta.edit({name: "X", combo: ['S','X'],
	on: function(eve){
		var on = m.tap(), was = on.width();
		$(document).on('mousemove.tmp', function(eve){
			var be = was + ((eve.pageX||0) - was);
			on.css({'max-width': be, width: '100%'});
		})
	}, up: function(){ $(document).off('mousemove.tmp') }
});
meta.edit({name: "Y", combo: ['S','Y'],
	on: function(eve){
		var on = m.tap(), was = on.height();
		$(document).on('mousemove.tmp', function(eve){
			var be = was + ((eve.pageY||0) - was);
			on.css({'min-height': be});
		})
	}, up: function(){ $(document).off('mousemove.tmp') }
});
meta.edit({name: "Fill", combo: ['F'],
	on: function(eve){
		var on = m.tap();
		meta.ask('Color name, code, or URL?', function(color){
			var css = on.closest('p').length? 'color' : 'background';
			on.css(css, color);
		});
	}
});

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Clone this wiki locally