Blob Blame History Raw
From 28dc99ae657768f1724e0bd3a0f598acf1073407 Mon Sep 17 00:00:00 2001
From: Ruben <ruben@rubenkerkhof.com>
Date: Sun, 17 Oct 2010 17:21:19 +0200
Subject: [PATCH 09/14] 15_add-configure-file.diff from Debian

---
 ajaxterm.conf      |   13 +++++++++++++
 ajaxterm.html      |    3 ++-
 ajaxterm.js        |    8 ++++++++
 configure.makefile |    2 ++
 4 files changed, 25 insertions(+), 1 deletions(-)
 create mode 100644 ajaxterm.conf

diff --git a/ajaxterm.conf b/ajaxterm.conf
new file mode 100644
index 0000000..41bd097
--- /dev/null
+++ b/ajaxterm.conf
@@ -0,0 +1,13 @@
+// Ajaxterm configuration file
+//
+// This is a javascript snippet
+//
+// Don't forget to restart ajaxterm after editing this file
+
+
+// Sets the terminal width (default: 80)
+width=80;
+
+// Sets the terminal height (default: 25)
+height=25;
+
diff --git a/ajaxterm.html b/ajaxterm.html
index 9edf759..095e7d6 100644
--- a/ajaxterm.html
+++ b/ajaxterm.html
@@ -7,9 +7,10 @@
 	<script type="text/javascript" src="sarissa.js"></script>
 	<script type="text/javascript" src="sarissa_dhtml.js"></script>
 	<script type="text/javascript" src="ajaxterm.js"></script>
+	<script type="text/javascript" src="ajaxterm_config.js"></script>
 	<script type="text/javascript">
 	window.onload=function() {
-		t=ajaxterm.Terminal("term",80,25);
+		t=ajaxterm.Terminal("term",width,height);
 	};
 	</script>
 </head>
diff --git a/ajaxterm.js b/ajaxterm.js
index 07eca3b..74eeb39 100644
--- a/ajaxterm.js
+++ b/ajaxterm.js
@@ -4,6 +4,14 @@ ajaxterm.Terminal_ctor=function(id,width,height) {
 	if(window.ActiveXObject)
 		ie=1;
 	var sid=""+Math.round(Math.random()*1000000000);
+
+	if (width==0) {
+		width=80;
+	}
+	if (height==0) {
+		height=25;
+	}
+
 	var query0="s="+sid+"&w="+width+"&h="+height;
 	var query1=query0+"&c=1&k=";
 	var buf="";
diff --git a/configure.makefile b/configure.makefile
index b3c678f..a30dc23 100644
--- a/configure.makefile
+++ b/configure.makefile
@@ -6,7 +6,9 @@ install:
 	install -d "%(lib)s"
 	install ajaxterm.bin "%(bin)s/ajaxterm"
 	install -m 644 ajaxterm.css ajaxterm.html ajaxterm.js qweb.py sarissa.js sarissa_dhtml.js "%(lib)s"
+	install -m 644 ajaxterm.conf "%(etc)s"
 	install -m 755 ajaxterm.py "%(lib)s"
+	ln -s /etc/ajaxterm.conf "%(lib)s"/ajaxterm_config.js
 	gzip --best -c ajaxterm.1 > ajaxterm.1.gz
 	install -d "%(man)s"
 	install ajaxterm.1.gz "%(man)s"
-- 
1.7.3.1