Skip to content

Commit

Permalink
240429.1605
Browse files Browse the repository at this point in the history
  • Loading branch information
refiaa committed Apr 29, 2024
1 parent 7f40e56 commit 2d720d9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Advanced-Twins.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Advanced Twins for University of Tsukuba
// @namespace https://github.com/refiaa
// @version 240426.1707
// @version 240429.1605
// @description Provide Advanced function for Twins (University of Tsukuba)
// @author refiaa
// @match https://twins.tsukuba.ac.jp/campusweb/*
Expand Down Expand Up @@ -454,10 +454,22 @@
addLinkToCell(cell, isSyllabus) {
if (cell.querySelector('.syllabus-link')) return;

const courseCodeElement = cell.querySelector('a');
if (!courseCodeElement && !isSyllabus) return;
let courseCode = '';

if (isSyllabus) {
const courseCodeCell = cell.parentElement.querySelector('td:nth-child(3)');
if (courseCodeCell) {
courseCode = courseCodeCell.textContent.trim();
}
} else {
const courseCodeElement = cell.querySelector('td[valign="top"]');
if (courseCodeElement) {
const textContent = courseCodeElement.textContent.trim();
const lines = textContent.split('\n');
courseCode = lines[0].trim();
}
}

const courseCode = isSyllabus ? cell.parentElement.querySelector('a')?.textContent.trim() : courseCodeElement?.textContent.trim();
if (!courseCode) return;

const link = document.createElement('a');
Expand All @@ -474,7 +486,10 @@
const linkContainer = document.createElement('div');
linkContainer.classList.add('syllabus-link-container');
linkContainer.appendChild(link);
cell.appendChild(linkContainer);

if (!cell.querySelector('.syllabus-link-container')) {
cell.appendChild(linkContainer);
}
}

addDeleteButton(cell) {
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
・Adjusted display element positioning to use relative units (viewport height and width) instead of fixed pixels.
```

### 240429.1605
```
・履修登録期限ではない科目にシラバス確認ボタンを追加できなかった問題を修正
```


----
### Any bugs?
Expand Down

0 comments on commit 2d720d9

Please sign in to comment.