-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle MicroPython and support worker access to window
- Loading branch information
Showing
3 changed files
with
49 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,54 @@ | ||
/* LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE */ | ||
|
||
function table() { | ||
return $("<table>").addClass("ltk-table"); | ||
} | ||
(function ltk() { | ||
const start = new Date().getTime(); | ||
|
||
function tableTitle(table, column, title) { | ||
var header = table.find("tr"); | ||
if (!header.length) { | ||
header = $("<tr>") | ||
.addClass("ltk-table-header") | ||
.appendTo(table); | ||
window.time = () => { | ||
return (new Date().getTime() - start) | ||
} | ||
for (var n=header.find(".ltk-table-title").length; n<=column; n++) { | ||
$("<th>") | ||
.addClass("ltk-table-title") | ||
.appendTo(header); | ||
|
||
window.table = () => { | ||
return $("<table>").addClass("ltk-table"); | ||
} | ||
header.find(".ltk-table-title").eq(column).text(title) | ||
} | ||
|
||
function tableCell(table, column, row) { | ||
for (var n=table.find(".ltk-table-row").length; n<=row; n++) { | ||
$("<tr>") | ||
.addClass("ltk-table-row") | ||
.addClass(`ltk-row-${n}`) | ||
.appendTo(table); | ||
window.tableTitle = (table, column, title) => { | ||
var header = table.find("tr"); | ||
if (!header.length) { | ||
header = $("<tr>") | ||
.addClass("ltk-table-header") | ||
.appendTo(table); | ||
} | ||
for (var n=header.find(".ltk-table-title").length; n<=column; n++) { | ||
$("<th>") | ||
.addClass("ltk-table-title") | ||
.appendTo(header); | ||
} | ||
header.find(".ltk-table-title").eq(column).text(title) | ||
} | ||
const rowElement = table.find(".ltk-table-row").eq(row) | ||
for (var n=rowElement.find(".ltk-table-cell").length; n<=column; n++) { | ||
$("<td>") | ||
.addClass("ltk-table-cell") | ||
.addClass(`ltk-row-${row}`) | ||
.addClass(`ltk-col-${n}`) | ||
.appendTo(rowElement); | ||
|
||
window.tableCell = (table, column, row) => { | ||
for (var n=table.find(".ltk-table-row").length; n<=row; n++) { | ||
$("<tr>") | ||
.addClass("ltk-table-row") | ||
.addClass(`ltk-row-${n}`) | ||
.appendTo(table); | ||
} | ||
const rowElement = table.find(".ltk-table-row").eq(row) | ||
for (var n=rowElement.find(".ltk-table-cell").length; n<=column; n++) { | ||
$("<td>") | ||
.addClass("ltk-table-cell") | ||
.addClass(`ltk-row-${row}`) | ||
.addClass(`ltk-col-${n}`) | ||
.appendTo(rowElement); | ||
} | ||
return rowElement.find(".ltk-table-cell").eq(column) | ||
} | ||
return rowElement.find(".ltk-table-cell").eq(column) | ||
} | ||
|
||
function tableGet(table, column, row) { | ||
return tableCell(table, column, row).text() | ||
} | ||
window.tableGet = (table, column, row) => { | ||
return tableCell(table, column, row).text() | ||
} | ||
|
||
function tableSet(table, column, row, value) { | ||
tableCell(table, column, row).text(value) | ||
} | ||
window.tableSet = (table, column, row, value) => { | ||
tableCell(table, column, row).text(value) | ||
} | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters