diff options
| author | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-14 17:13:52 +0100 | 
|---|---|---|
| committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-14 17:13:52 +0100 | 
| commit | fef5855bd63d8c7033e2d2d48e2d478d3f632580 (patch) | |
| tree | ec9fe60561609c12a1a5292e110b6bf8fbf6893c /web/js | |
| parent | 3d1bcca02e1063e3082a101d76020fcdeb77b445 (diff) | |
Provide basic UI for template-testing
Still leaves a lot to be desired, but is a good start.
References #151
Diffstat (limited to 'web/js')
| -rw-r--r-- | web/js/nms-template.js | 37 | ||||
| -rw-r--r-- | web/js/nms.js | 4 | 
2 files changed, 39 insertions, 2 deletions
| diff --git a/web/js/nms-template.js b/web/js/nms-template.js new file mode 100644 index 0000000..cad92b0 --- /dev/null +++ b/web/js/nms-template.js @@ -0,0 +1,37 @@ +"use strict"; + +var nmsTemplate = nmsTemplate || { + +} + +nmsTemplate.test = function() { +	var input = document.getElementById("template-input"); +	var output = document.getElementById("template-output"); +	$.ajax({ +		type: "POST", +		url: "/api/templates/test", +		async: false, +		data: input.value, +		dataType: "text", +		success: function (indata, textStatus, jqXHR) { +			var output = document.getElementById("template-output"); +			output.value = indata; +		} +	}); +} + +nmsTemplate.fromFile = function(template) { +	var input = document.getElementById("template-input"); +	var output = document.getElementById("template-output"); +	$.ajax({ +		type: "GET", +		url: "/templates/" + template, +		async: false, +		data: input.value, +		dataType: "text", +		success: function (indata, textStatus, jqXHR) { +			var output = document.getElementById("template-input"); +			output.value = indata; +		} +	}); +} diff --git a/web/js/nms.js b/web/js/nms.js index 30fb8ff..362aebc 100644 --- a/web/js/nms.js +++ b/web/js/nms.js @@ -518,7 +518,7 @@ function moveTimeFromKey(e,key)  function keyPressed(e)  { -	if (e.target.nodeName == "INPUT") { +	if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") {  		return false;  	}  	if(e.key) { @@ -624,7 +624,7 @@ function restoreSettings()   */  function nmsUpdateNavbarGraph() {  	var img = document.getElementById("navbar-graph"); -	var w = Math.floor(window.innerWidth / 3); +	var w = Math.floor(window.innerWidth / 4);  	if (window.innerWidth > 2300)  		w += 400; | 
