diff --git a/iframe.html b/iframe.html
index ccd2604..cd7330f 100644
--- a/iframe.html
+++ b/iframe.html
@@ -6,6 +6,7 @@
+
diff --git a/index.html b/index.html
index c0a628a..fc8742e 100644
--- a/index.html
+++ b/index.html
@@ -11,6 +11,7 @@
+
diff --git a/js/example.js b/js/example.js
index f99ecf3..fdc8284 100755
--- a/js/example.js
+++ b/js/example.js
@@ -34,8 +34,11 @@ $(function(){
}
graph_or_table = 0;
+ table = $.getUrlVar('table');
+ alert(table);
+ $('body').prepend(unescape(LZW.decompress(table)));
- $('#input_table', window.parent.document).clone().prependTo('body');
+ //$('#input_table', window.parent.document).clone().prependTo('body');
$('thead th:last-child').remove();
$('tbody td:last-child').remove();
$('tbody tr:last').remove();
diff --git a/js/lzw.js b/js/lzw.js
new file mode 100644
index 0000000..2b46aa8
--- /dev/null
+++ b/js/lzw.js
@@ -0,0 +1,74 @@
+var LZW = {
+ compress: function (uncompressed) {
+ "use strict";
+ // Build the dictionary.
+ var i,
+ dictionary = {},
+ c,
+ wc,
+ w = "",
+ result = [],
+ dictSize = 256;
+ for (i = 0; i < 256; i += 1) {
+ dictionary[String.fromCharCode(i)] = i;
+ }
+
+ for (i = 0; i < uncompressed.length; i += 1) {
+ c = uncompressed.charAt(i);
+ wc = w + c;
+ if (dictionary[wc]) {
+ w = wc;
+ } else {
+ result.push(dictionary[w]);
+ // Add wc to the dictionary.
+ dictionary[wc] = dictSize++;
+ w = String(c);
+ }
+ }
+
+ // Output the code for w.
+ if (w !== "") {
+ result.push(dictionary[w]);
+ }
+ return result;
+ },
+
+
+ decompress: function (compressed) {
+ "use strict";
+ // Build the dictionary.
+ var i,
+ dictionary = [],
+ w,
+ result,
+ k,
+ entry = "",
+ dictSize = 256;
+ for (i = 0; i < 256; i += 1) {
+ dictionary[i] = String.fromCharCode(i);
+ }
+
+ w = String.fromCharCode(compressed[0]);
+ result = w;
+ for (i = 1; i < compressed.length; i += 1) {
+ k = compressed[i];
+ if (dictionary[k]) {
+ entry = dictionary[k];
+ } else {
+ if (k === dictSize) {
+ entry = w + w.charAt(0);
+ } else {
+ return null;
+ }
+ }
+
+ result += entry;
+
+ // Add w+entry[0] to the dictionary.
+ dictionary[dictSize++] = w + entry.charAt(0);
+
+ w = entry;
+ }
+ return result;
+ }
+}
diff --git a/js/main.js b/js/main.js
index d4a26e3..be086f4 100644
--- a/js/main.js
+++ b/js/main.js
@@ -84,6 +84,7 @@ $('document').ready(function(){
});
var address = 'iframe.html';
address = address.concat('?', $.param(values));
+ address = address.concat('&table=', LZW.compress(escape($('#input_table').parent().html())));
$('').attr('src', address).attr('id', 'table_iframe').attr('frameBorder', '0').attr('style', 'height:100%;').appendTo('#result .centered');
$('.alert').alert('close');