JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>Extract schedule</title>
<script src="wet-boew/build/js/jquery.min.js"></script>
<script src="wet-boew/src/js/dependencies/parserTable.js"></script>
<!--
http://jsfiddle.net/3t2A8/
-->
<script>
//<![CDATA[
(function ($) {
$(document).ready(function() {
var _pe = window.pe || {
fn : {}
};
var tblNumber = 0;
// For each table
$('table').each(function () {
$('#output').append('Parsing the table number: ' + tblNumber + '<br>');
// console.log('Parsing the table number: ' + tblNumber);
tblNumber += 1;
var currentTable = this;
// Parser the complex table
_pe.fn.parsertable.parse($(currentTable));
// Retreive the parsed data
var parsedData = $(currentTable).data().tblparser;
//
// Information about the column structure, nice that is consistant
//
// Day: Cell index position (0 based)
// Mo: 3
// Di: 7
// Mi: 11
// Do: 15
// Fr: 19
// Sa: 23
// Row Title Location at index position 0
// "i" represent the center column position
for (var i = 3; i < 24; i += 4) {
var currentDay;
// Get the day
currentDay = $(parsedData.row[0].cell[i].elem).text();
$('#output').append(' Day: ' + currentDay + '<br>');
// console.log('Day: ' + currentDay);
// Get all the events for that day, excluding the first row and the last row
for (var j = 1; j < parsedData.col[i].cell.length - 2; j += 1) {
// Frist column
...
JavaScript
/*!
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
* wet-boew.github.com/wet-boew/License-eng.txt / wet-boew.github.com/wet-boew/Licence-fra.txt
*/
/**
* Table Parser - Table usability - Core plugin
*
* @author: Pierre Dubois
*
*/
/*global jQuery: false*/
(function ($) {
"use strict";
var _pe = window.pe || {
fn : {}
};
_pe.fn.parsertable = {
onParserError: undefined,
parse : function (elm) {
var obj = elm,
// Event handler for issue error found durring the table parsing process
errorTrigger = function (numerr, obj) {
// FYI - 31 Type of Error can be raised
if (typeof _pe.fn.parsertable.onParserError === "function") {
_pe.fn.parsertable.onParserError(numerr, obj);
}
// $(obj).trigger('parser.table.error', err, obj);
// console.log("Trigger ERROR: " + err); // Debug Mode
},
groupZero = {
allParserObj: [],
nbDescriptionRow: 0 // To remove ??
},
colgroupFrame = [],
columnFrame = [],
uidElem = 0,
currentRowLevel = 0,
currentRowPos = 0,
spannedRow = [],
tableCellWidth = 0,
headerRowGroupCompleted = false,
summaryRowGroupEligible = false,
currentRowHeader = [],
currentTbodyID,
theadRowStack = [],
stackRowHeader = false,
// Row Group Variable
rowgroupHeaderRowStack = [],
currentRowGroup,
currentRowGroupElement,
lstRowGroup = [],
rowgroupheadercalled = false,
hasTfoot = $(obj).has('tfoot'),
lastHeadingSummaryColPos,
...