Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/captcha-solver"]
path = lib/captcha-solver
url = https://github.com/Garv767/captcha-solver.git
17 changes: 10 additions & 7 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -1383,11 +1383,11 @@ function renderProfilePanel(profileData, container, dayOrder) {
let dayOnUpdate = '';
if (dayOrderSpan) {
dayOnUpdate = dayOrderSpan.textContent.replace(/Day Order:/, '').trim(); // Extract day order from the span
console.log("renderProfilePanel: dayOrderSpan:", dayOnUpdate);
//console.log("renderProfilePanel: dayOrderSpan:", dayOnUpdate);
}

const dayOrderToday = dayOrder; //|| dayOnUpdate; // Default to 'N/A' if not provided\
console.log("renderProfilePanel: dayOrderToday:", dayOrderToday);
//console.log("renderProfilePanel: dayOrderToday:", dayOrderToday);
// Check if a profile panel already exists to avoid duplication during refreshes
let profilePanel = container.querySelector('.profile-panel');
if (!profilePanel) {
Expand Down Expand Up @@ -1797,6 +1797,8 @@ function replaceSlotsWithCourseTitles(courseData, timetableTable) {
});

// Replace slots with course titles
let slotId = 1;

for (let rowIndex = 1; rowIndex < allTableRows.length; rowIndex++) { // Iterate all rows after initial removals
const row = allTableRows[rowIndex];
if (!row) continue;
Expand Down Expand Up @@ -1831,6 +1833,7 @@ function replaceSlotsWithCourseTitles(courseData, timetableTable) {
cell.style.color = '';
cell.style.fontWeight = '';
cell.style.position = '';
cell.id = `slot-${slotId++}`; // Assign unique ID

let cellText = cell.textContent.trim();
// Clean cell text to get the slot (e.g., "A / B" -> "A")
Expand Down Expand Up @@ -2057,7 +2060,7 @@ async function backgroundFetchAllData(currentNetId, titleElement, previousAttend
try {
//Fetch Course Registration data to get profile and batch
console.log("backgroundFetchAllData: Fetching Course Registration data...");
const registrationPageUrl = "https://academia.srmist.edu.in/#My_Time_Table_Attendance";
const registrationPageUrl = "https://academia.srmist.edu.in/#Page:My_Time_Table_2023_24"; //#My_Time_Table_Attendance";
const { iframeDoc: regIframeDoc, iframe: regIframe } = await createHiddenIframe(
registrationPageUrl,
['div.cntdDiv table:not(.course_tbl)', 'table.course_tbl']
Expand Down Expand Up @@ -2118,7 +2121,7 @@ async function backgroundFetchAllData(currentNetId, titleElement, previousAttend
}

// Step 3: Fetch attendance and marks data
/*console.log("backgroundFetchAllData: Fetching Attendance and Marks data...");
console.log("backgroundFetchAllData: Fetching Attendance and Marks data...");
const attendanceUrl = "https://academia.srmist.edu.in/#Page:My_Attendance";
const { iframeDoc: attendanceIframeDoc, iframe: attendanceIframe } = await createHiddenIframe(
attendanceUrl,
Expand All @@ -2129,7 +2132,7 @@ async function backgroundFetchAllData(currentNetId, titleElement, previousAttend
fetchedData.attendanceData = extractAttendanceDataFromDocument(attendanceIframeDoc);
fetchedData.marksData = extractMarksDataFromDocument(attendanceIframeDoc);
attendanceIframe.remove();
console.log("backgroundFetchAllData: Attendance and marks data fetched and processed.");*/
console.log("backgroundFetchAllData: Attendance and marks data fetched and processed.");

// Store the combined data
const storageKey = `unfuglyData_${currentNetId}`;
Expand All @@ -2143,7 +2146,7 @@ async function backgroundFetchAllData(currentNetId, titleElement, previousAttend
marksData: fetchedData.marksData,
lastUpdated: new Date().toISOString()
};
console.log(dataToCache.editedSlots, "edited slots preserved");
//console.log(dataToCache.editedSlots, "edited slots preserved");
chrome.storage.local.set({ [storageKey]: dataToCache }, () => {
if (chrome.runtime.lastError) console.error("Error saving all data to cache:", chrome.runtime.lastError);
else console.log("backgroundFetchAllData: All data saved to cache.");
Expand Down Expand Up @@ -2275,7 +2278,7 @@ function handleCurrentPage() {

if (hash.includes('#WELCOME')) {
handleWelcomePage();
} else if (hash.includes('#My_Time_Table_Attendance')) { //'#Page:My_Time_Table_2023_24'
} else if (hash.includes('#Page:My_Time_Table_2023_24')) { //#My_Time_Table_Attendance
//handleTimetablePage();
} else if (hash.includes('#Page:My_Attendance')) {
try {
Expand Down
20 changes: 9 additions & 11 deletions editTimetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function handleSlotClick(event) {
const slot = event.currentTarget;
if (!slot.classList.contains('editedSlot'))slot.dataset.originalBg = slot.style.backgroundColor; // Store original background color
let slotTitle = slot.title.trim();
console.log("Clicked slot title:", slotTitle.slice(6));
//console.log("Clicked slot title:", slotTitle.slice(6));
const titleSpan = slot.getElementsByClassName('editedSlot-editedTitle')[0] || document.createElement('span');
//titleSpan.textContent = courseInfo.title;
titleSpan.style.fontWeight = '600';
Expand Down Expand Up @@ -67,7 +67,7 @@ function removeEdits() {
event.stopPropagation(); // Prevent triggering the slot click event
cell.classList.remove('edited-slot');
cell.style.backgroundColor = cell.dataset.originalBg;
console.log(cell.dataset.originalBg, "Reverted slot :", cell.style.backgroundColor);
//console.log(cell.dataset.originalBg, "Reverted slot :", cell.style.backgroundColor);
const titleSpan = cell.getElementsByClassName('editedSlot-editedTitle')[0];
const classroomSpan = cell.getElementsByClassName('editedSlot-editedClassroom')[0];
if(titleSpan) titleSpan.remove();
Expand All @@ -78,14 +78,14 @@ function removeEdits() {
chrome.storage.local.get(`unfuglyData_${currentNetId}`, (result) => {
const existingData = result[`unfuglyData_${currentNetId}`] || {};
const editedSlots = existingData.editedSlots || {};
const slotId = cell.title.slice(6).trim();
const slotId = cell.id; //.title.slice(6).trim();
delete editedSlots[slotId];
existingData.editedSlots = editedSlots;
chrome.storage.local.set({ [`unfuglyData_${currentNetId}`]: existingData }, () => {
if (chrome.runtime.lastError) {
console.error("Error updating local storage:", chrome.runtime.lastError);
} else {
console.log('Edit removed and storage updated');
//console.log('Edit removed and storage updated');
}
});
});
Expand Down Expand Up @@ -128,13 +128,11 @@ function saveEdits() {
existingData.editedSlots = existingData.editedSlots || {};

editedSlots.forEach(slot => {
const slotId = slot.title.slice(6).trim();
const slotId = slot.id;
const editedTitle = slot.getElementsByClassName('editedSlot-editedTitle') ? slot.getElementsByClassName('editedSlot-editedTitle')[0].textContent : '';
const editedClassroom = slot.getElementsByClassName('editedSlot-editedClassroom') ? slot.getElementsByClassName('editedSlot-editedClassroom')[0].textContent.replace('Room: ', '') : '';

existingData.editedSlots[slotId] = {
originalTitle: null,
originalClassroom: null,
editedTitle: editedTitle,
editedClassroom: editedClassroom
};
Expand Down Expand Up @@ -178,7 +176,7 @@ function loadEdits() {
} else {
console.log("Loading edit for slotId:", slotId, editedSlots[slotId].editedTitle);
}*/
const slot = timetable.querySelector(`td[title^="Slot: ${slotId}"]`);
const slot = timetable.querySelector(`#${slotId}`); //(`td[title^="Slot: ${slotId}"]`);
if (slot) {
//console.log("Applying edit to slot:", slotId, slot);
if(!slot.dataset.originalBg) slot.dataset.originalBg = slot.style.backgroundColor; // Store original background color
Expand Down Expand Up @@ -217,7 +215,7 @@ function hideEdits() {
//saveEdits();
const timetable = document.querySelector('#timetable-content-container > table'); // > tbody');
const editedSlot = timetable ? timetable.querySelectorAll('.edited-slot') : [];
console.log("Hiding edits for slots:", editedSlot);
//console.log("Hiding edits for slots:", editedSlot);
editedSlot.forEach(cell => {
const originalTitleSpan = cell.getElementsByClassName('editedSlot-originalTitle')[0];
const originalClassroomSpan = cell.getElementsByClassName('editedSlot-originalClassroom')[0];
Expand All @@ -231,7 +229,7 @@ function hideEdits() {

cell.classList.remove('edited-slot');
cell.style.backgroundColor = cell.dataset.originalBg;
console.log(cell.dataset.originalBg, "Reverted slot :", cell.style.backgroundColor);
//console.log(cell.dataset.originalBg, "Reverted slot :", cell.style.backgroundColor);

});

Expand Down Expand Up @@ -339,5 +337,5 @@ function initializeEdits() {
timetableHeading.appendChild(editMenu);
timetableHeading.style.marginBottom = '0px';
setActive(showButton); // Default active button
console.log("Edit menu initialized.");
//console.log("Edit menu initialized.");
}
1 change: 1 addition & 0 deletions lib/captcha-solver
Submodule captcha-solver added at 7e87b1
10 changes: 6 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"manifest_version": 3,
"name": "Unfugly",
"version": "1.05.5",
"version": "1.05.8",
"description": "Revamp your Academia with a unified dashboard and Auto-generates a downloadable timetable",
"permissions": [

"storage"
],
"host_permissions": [
"https://academia.srmist.edu.in/*",
"https://creatorapp.zoho.com/srm_university/*"
"https://creatorapp.zoho.com/srm_university/*",
"http://localhost:8000/*"
],
"content_scripts": [
{
"matches": ["https://academia.srmist.edu.in/*", "https://creatorapp.zoho.com/srm_university/*"],
"js": ["lib/html2canvas.min.js", "content.js", "editTimetable.js"],
"css": ["styles.css"]
"js": ["lib/html2canvas.min.js", "solveCaptcha.js", "content.js", "editTimetable.js"],
"css": ["styles.css"],
"all_frames": false
}
],
"background": [
Expand Down
Loading