Skip to content

Commit c67b8e6

Browse files
committed
improve/update versioning
1 parent 2df6234 commit c67b8e6

135 files changed

Lines changed: 48043 additions & 123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/v1/tableexport-1.0.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/v1/v1.0/css/table2csv.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
body {
2+
margin: 20px 8px;
3+
background: #f1f1f1;
4+
}
5+
6+
table, th, td {
7+
border: 1px inset rgb(102, 137, 158);
8+
}
9+
10+
table {
11+
margin: 40px auto;
12+
}
13+
14+
caption {
15+
padding: 10px;
16+
}
17+
18+
td {
19+
line-height: 1.2;
20+
padding: 8px;
21+
}
22+
23+
th {
24+
font-size: 1.1em;
25+
background: #8dbdd8;
26+
padding: 8px;
27+
}
28+
29+
tr:nth-of-type(even) {
30+
background: #d9eaf0;
31+
}
32+
33+
tr:nth-of-type(odd) {
34+
background: #fff;
35+
}
36+
37+
/* helper functions */
38+
.txt-center {
39+
text-align: center;
40+
}
41+
42+
/* plugin specific styling */
43+
.export {
44+
display: inline-block;
45+
white-space: nowrap;
46+
margin: 2px;
47+
}

src/v1/v1.0/index.html

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Table2csv Plugin</title>
6+
<link href="css/table2csv.css" rel="stylesheet">
7+
<link rel="shortcut icon" href="favicon.ico">
8+
</head>
9+
<body>
10+
11+
<div>
12+
<h4>Download</h4>
13+
<a href="table2csv.zip" download="table2csv.zip"><button>table2csv.zip</button></a>
14+
</div>
15+
<table id="Population-list">
16+
<caption><h2>Countries by population</h2></caption>
17+
<thead>
18+
<tr>
19+
<th>Rank</th>
20+
<th>Country</th>
21+
<th>Population</th>
22+
<th>% of world population</th>
23+
<th>Date</th>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
<tr>
28+
<td>1</td>
29+
<td>China</td>
30+
<td>1,370,570,000</td>
31+
<td>18.9%</td>
32+
<td>June 24, 2015</td>
33+
</tr>
34+
<tr>
35+
<td>2</td>
36+
<td>India</td>
37+
<td>1,273,140,000</td>
38+
<td>17.6%</td>
39+
<td>June 24, 2015</td>
40+
</tr>
41+
<tr>
42+
<td>3</td>
43+
<td>United States</td>
44+
<td>321,268,000</td>
45+
<td>4.43%</td>
46+
<td>June 24, 2015</td>
47+
</tr>
48+
<tr>
49+
<td>4</td>
50+
<td>Indonesia</td>
51+
<td>255,461,700</td>
52+
<td>3.52%</td>
53+
<td>July 1, 2015</td>
54+
</tr>
55+
<tr>
56+
<td>5</td>
57+
<td>Brazil</td>
58+
<td>204,503,000</td>
59+
<td>2.82%</td>
60+
<td>June 24, 2015</td>
61+
</tr>
62+
<tr>
63+
<td>6</td>
64+
<td>Pakistan</td>
65+
<td>190,156,000</td>
66+
<td>2.62%</td>
67+
<td>June 24, 2015</td>
68+
</tr>
69+
<tr>
70+
<td>7</td>
71+
<td>Nigeria</td>
72+
<td>183,523,000</td>
73+
<td>2.53%</td>
74+
<td>July 1, 2015</td>
75+
</tr>
76+
<tr>
77+
<td>8</td>
78+
<td>Bangladesh</td>
79+
<td>126,880,000</td>
80+
<td>2.19%</td>
81+
<td>June 24, 2015</td>
82+
</tr>
83+
<tbody>
84+
</table>
85+
86+
<table id="Country-list">
87+
<thead>
88+
<tr>
89+
<th>Country</th>
90+
</tr>
91+
</thead>
92+
<tbody>
93+
<tr>
94+
<td>China</td>
95+
</tr>
96+
<tr>
97+
<td>India</td>
98+
</tr>
99+
<tr>
100+
<td>United States</td>
101+
</tr>
102+
<tr>
103+
<td>Indonesia</td>
104+
</tr>
105+
<tr>
106+
<td>Brazil</td>
107+
</tr>
108+
<tr>
109+
<td>Pakistan</td>
110+
</tr>
111+
<tr>
112+
<td>Nigeria</td>
113+
</tr>
114+
<tr>
115+
<td>Bangladesh</td>
116+
</tr>
117+
<tbody>
118+
</table>
119+
120+
<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
121+
<script type="text/javascript" src="js/jquery.table2csv.js"></script>
122+
123+
<script>
124+
$(function () {
125+
$('table').table2CSV({
126+
type: "csv",
127+
buttonContent: "Export to csv",
128+
fileName: "id"
129+
});
130+
$('table').table2CSV({
131+
type: "txt",
132+
buttonContent: "Export to txt",
133+
fileName: "id"
134+
});
135+
});
136+
</script>
137+
138+
</body>
139+
</html>
140+
141+

src/v1/v1.0/js/Blob.js

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
/* Blob.js
2+
* A Blob implementation.
3+
* 2014-05-27
4+
*
5+
* By Eli Grey, http://eligrey.com
6+
* By Devin Samarin, https://github.com/eboyjr
7+
* License: X11/MIT
8+
* See LICENSE.md
9+
*/
10+
11+
/*global self, unescape */
12+
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
13+
plusplus: true */
14+
15+
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
16+
17+
(function (view) {
18+
"use strict";
19+
20+
view.URL = view.URL || view.webkitURL;
21+
22+
if (view.Blob && view.URL) {
23+
try {
24+
new Blob;
25+
return;
26+
} catch (e) {}
27+
}
28+
29+
// Internally we use a BlobBuilder implementation to base Blob off of
30+
// in order to support older browsers that only have BlobBuilder
31+
var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
32+
var
33+
get_class = function(object) {
34+
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
35+
}
36+
, FakeBlobBuilder = function BlobBuilder() {
37+
this.data = [];
38+
}
39+
, FakeBlob = function Blob(data, type, encoding) {
40+
this.data = data;
41+
this.size = data.length;
42+
this.type = type;
43+
this.encoding = encoding;
44+
}
45+
, FBB_proto = FakeBlobBuilder.prototype
46+
, FB_proto = FakeBlob.prototype
47+
, FileReaderSync = view.FileReaderSync
48+
, FileException = function(type) {
49+
this.code = this[this.name = type];
50+
}
51+
, file_ex_codes = (
52+
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
53+
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
54+
).split(" ")
55+
, file_ex_code = file_ex_codes.length
56+
, real_URL = view.URL || view.webkitURL || view
57+
, real_create_object_URL = real_URL.createObjectURL
58+
, real_revoke_object_URL = real_URL.revokeObjectURL
59+
, URL = real_URL
60+
, btoa = view.btoa
61+
, atob = view.atob
62+
63+
, ArrayBuffer = view.ArrayBuffer
64+
, Uint8Array = view.Uint8Array
65+
;
66+
FakeBlob.fake = FB_proto.fake = true;
67+
while (file_ex_code--) {
68+
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
69+
}
70+
if (!real_URL.createObjectURL) {
71+
URL = view.URL = {};
72+
}
73+
URL.createObjectURL = function(blob) {
74+
var
75+
type = blob.type
76+
, data_URI_header
77+
;
78+
if (type === null) {
79+
type = "application/octet-stream";
80+
}
81+
if (blob instanceof FakeBlob) {
82+
data_URI_header = "data:" + type;
83+
if (blob.encoding === "base64") {
84+
return data_URI_header + ";base64," + blob.data;
85+
} else if (blob.encoding === "URI") {
86+
return data_URI_header + "," + decodeURIComponent(blob.data);
87+
} if (btoa) {
88+
return data_URI_header + ";base64," + btoa(blob.data);
89+
} else {
90+
return data_URI_header + "," + encodeURIComponent(blob.data);
91+
}
92+
} else if (real_create_object_URL) {
93+
return real_create_object_URL.call(real_URL, blob);
94+
}
95+
};
96+
URL.revokeObjectURL = function(object_URL) {
97+
if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
98+
real_revoke_object_URL.call(real_URL, object_URL);
99+
}
100+
};
101+
FBB_proto.append = function(data/*, endings*/) {
102+
var bb = this.data;
103+
// decode data to a binary string
104+
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
105+
var
106+
str = ""
107+
, buf = new Uint8Array(data)
108+
, i = 0
109+
, buf_len = buf.length
110+
;
111+
for (; i < buf_len; i++) {
112+
str += String.fromCharCode(buf[i]);
113+
}
114+
bb.push(str);
115+
} else if (get_class(data) === "Blob" || get_class(data) === "File") {
116+
if (FileReaderSync) {
117+
var fr = new FileReaderSync;
118+
bb.push(fr.readAsBinaryString(data));
119+
} else {
120+
// async FileReader won't work as BlobBuilder is sync
121+
throw new FileException("NOT_READABLE_ERR");
122+
}
123+
} else if (data instanceof FakeBlob) {
124+
if (data.encoding === "base64" && atob) {
125+
bb.push(atob(data.data));
126+
} else if (data.encoding === "URI") {
127+
bb.push(decodeURIComponent(data.data));
128+
} else if (data.encoding === "raw") {
129+
bb.push(data.data);
130+
}
131+
} else {
132+
if (typeof data !== "string") {
133+
data += ""; // convert unsupported types to strings
134+
}
135+
// decode UTF-16 to binary string
136+
bb.push(unescape(encodeURIComponent(data)));
137+
}
138+
};
139+
FBB_proto.getBlob = function(type) {
140+
if (!arguments.length) {
141+
type = null;
142+
}
143+
return new FakeBlob(this.data.join(""), type, "raw");
144+
};
145+
FBB_proto.toString = function() {
146+
return "[object BlobBuilder]";
147+
};
148+
FB_proto.slice = function(start, end, type) {
149+
var args = arguments.length;
150+
if (args < 3) {
151+
type = null;
152+
}
153+
return new FakeBlob(
154+
this.data.slice(start, args > 1 ? end : this.data.length)
155+
, type
156+
, this.encoding
157+
);
158+
};
159+
FB_proto.toString = function() {
160+
return "[object Blob]";
161+
};
162+
FB_proto.close = function() {
163+
this.size = this.data.length = 0;
164+
};
165+
return FakeBlobBuilder;
166+
}(view));
167+
168+
view.Blob = function Blob(blobParts, options) {
169+
var type = options ? (options.type || "") : "";
170+
var builder = new BlobBuilder();
171+
if (blobParts) {
172+
for (var i = 0, len = blobParts.length; i < len; i++) {
173+
builder.append(blobParts[i]);
174+
}
175+
}
176+
return builder.getBlob(type);
177+
};
178+
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));

0 commit comments

Comments
 (0)