Skip to content

Commit 99a60f6

Browse files
committed
Forgot to cleanup and build before initial commit
1 parent 01f1ab4 commit 99a60f6

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

dist/jquery.table2excel.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,34 @@
2929

3030
Plugin.prototype = {
3131
init: function () {
32-
this.template = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>";
33-
this.tableRows = "";
32+
var e = this;
33+
e.template = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><!--[if gte mso 9]><xml>";
34+
e.template += "<x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions>";
35+
e.template += "<x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>";
36+
e.tableRows = "";
3437

3538
// get contents of table except for exclude
36-
$(this.element).find("tr").not(this.settings.exclude).each(function (i,o) {
37-
this.tableRows += "<tr>" + $(o).html() + "</tr>";
39+
$(e.element).find("tr").not(this.settings.exclude).each(function (i,o) {
40+
e.tableRows += "<tr>" + $(o).html() + "</tr>";
3841
});
3942
this.tableToExcel(this.tableRows, this.settings.name);
4043
},
4144
tableToExcel: function (table, name) {
42-
this.uri = "data:application/vnd.ms-excel;base64,";
43-
this.base64 = function (s) {
45+
var e = this;
46+
e.uri = "data:application/vnd.ms-excel;base64,";
47+
e.base64 = function (s) {
4448
return window.btoa(unescape(encodeURIComponent(s)));
4549
};
46-
this.format = function (s, c) {
50+
e.format = function (s, c) {
4751
return s.replace(/{(\w+)}/g, function (m, p) {
4852
return c[p];
4953
});
5054
};
51-
this.ctx = {
55+
e.ctx = {
5256
worksheet: name || "Worksheet",
5357
table: table
5458
};
55-
window.location.href = this.uri + this.base64(this.format(this.template, this.ctx));
59+
window.location.href = e.uri + e.base64(e.format(e.template, e.ctx));
5660
}
5761
};
5862

dist/jquery.table2excel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jquery.table2excel.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
Plugin.prototype = {
2323
init: function () {
2424
var e = this;
25-
e.template = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>";
25+
e.template = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><!--[if gte mso 9]><xml>";
26+
e.template += "<x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions>";
27+
e.template += "<x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>";
2628
e.tableRows = "";
2729

2830
// get contents of table except for exclude
2931
$(e.element).find("tr").not(this.settings.exclude).each(function (i,o) {
30-
debugger;
3132
e.tableRows += "<tr>" + $(o).html() + "</tr>";
3233
});
33-
debugger;
3434
this.tableToExcel(this.tableRows, this.settings.name);
3535
},
3636
tableToExcel: function (table, name) {
@@ -48,7 +48,6 @@
4848
worksheet: name || "Worksheet",
4949
table: table
5050
};
51-
debugger;
5251
window.location.href = e.uri + e.base64(e.format(e.template, e.ctx));
5352
}
5453
};

0 commit comments

Comments
 (0)