-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhlalfundinfo.js
114 lines (94 loc) · 3.82 KB
/
hlalfundinfo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ar _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
// Function to set blank values for elements with "hlal-data" attribute on page load
function setBlankValues() {
const elements = document.querySelectorAll("[hlal-data]");
elements.forEach((element) => {
element.innerText = ""; // Set the text content to blank
});
}
// Attach the function to the DOMContentLoaded event
document.addEventListener("DOMContentLoaded", setBlankValues);
document.addEventListener("DOMContentLoaded", function () {
const sheetURL =
"https://docs.google.com/spreadsheets/d/1SFZiD8RgHuxCLqxqvXGe82d4XlI_7WhJBTcI9OFXATE/export?format=csv"; // Updated Sheet URL
fetch(sheetURL)
.then((response) => response.text())
.then((data) => {
const rows = data.split("\n").map((row) => {
// Add a comma at the end of each row
return row + ",";
});
console.log("Fetched Data:");
console.log(rows); // Log the fetched rows data
const getValueByColumnName = (columnName) => {
const headerRow = rows[0].split(",");
const columnIndex = headerRow.findIndex(
(header) => header.trim() === columnName
);
if (columnIndex !== -1) {
return rows[1].split(",")[columnIndex];
}
return "";
};
const elements = document.querySelectorAll("[hlal-data]");
elements.forEach((element) => {
const attributeName = element.getAttribute("hlal-data");
const value = getValueByColumnName(attributeName);
element.innerText = value;
});
console.log("Processed Data:");
console.log(elements); // Log the processed elements data
})
.catch((error) => {
console.error("Error fetching Google Sheet data:", error);
});
});
/*
document.addEventListener("DOMContentLoaded", function () {
const sheetURL =
"https://docs.google.com/spreadsheets/d/1SFZiD8RgHuxCLqxqvXGe82d4XlI_7WhJBTcI9OFXATE/export?format=csv"; // Updated Sheet URL
fetch(sheetURL)
.then((response) => response.text())
.then((data) => {
const rows = data.split("\n").map((row) => {
// Add a comma at the end of each row
return row + ",";
});
console.log("Fetched Data:");
console.log(rows); // Log the fetched rows data
const getValueByColumnName = (columnName) => {
const headerRow = rows[0].split(",");
const columnIndex = headerRow.findIndex(
(header) => header.trim() === columnName
);
if (columnIndex !== -1) {
const value = rows[1].split(",")[columnIndex];
return value.trim() !== "" ? value : "Blank";
}
return "Column Not Found";
};
const elements = document.querySelectorAll("[hlal-data]");
elements.forEach((element) => {
const attributeName = element.getAttribute("hlal-data");
const value = getValueByColumnName(attributeName);
element.innerText = value;
});
console.log("Processed Data:");
console.log(elements); // Log the processed elements data
})
.catch((error) => {
console.error("Error fetching Google Sheet data:", error);
});
});
*/
}