Skip to content

Commit

Permalink
updated modern bas, updated name of bas-search to be more concequent …
Browse files Browse the repository at this point in the history
…with other scripts
  • Loading branch information
on committed Sep 24, 2025
1 parent d6d76b5 commit 41d0cc4
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bas-search.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name BAS Quick Search
// @name BAS - Quick Search
// @namespace http://tampermonkey.net/
// @version 1.7.9
// @version 1.7.10
// @description Quick search using `Ctrl` + `Shift` + `F` hotkey, group search with "g:" and person search with "p:" prefix. Navigate tabs with Ctrl + Left/Right keys. Navigate search results with up and down keys.
// @author Øyvind Nilsen (on@ntnu.no)
// @match https://bas.ntnu.no/*
Expand Down
180 changes: 166 additions & 14 deletions modern-bas.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,34 @@ body {
background-color: #f6faff;
}

@media (prefers-color-scheme: dark) {
.even {
background-color: rgba(70, 169, 255, 0.1);
}
}

.deleted {
background-color: #ffeaec;
}

@media (prefers-color-scheme: dark) {
.deleted {
background-color: rgba(220, 53, 69, 0.2);
}
}

/* Header */
#ntnuheader {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.5rem;
/*
background-color: var(--card-background);
border: 1px solid var(--border-color);
border-radius: var(--bs-border-radius);
*/
margin-bottom: 1.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#ntnuheader #ntnulogo {
Expand Down Expand Up @@ -129,12 +142,7 @@ body {

/* Logged in user info */
.loggedin {
grid-area: tabs;
text-align: right;
font-size: 0.875rem;
color: var(--bs-gray-700);
margin-bottom: 1rem;
padding: 0.5rem 0;
display:none;
}

.loggedin a.logoutlink {
Expand All @@ -150,7 +158,8 @@ body {
/* Actions Menu (as List Group) */
#actions h3 {
font-size: 1.25rem;
margin: 0 0 0.75rem 0;
margin: 0 0 .75rem 0;
padding-top:0.75rem;
color: var(--text-color);
}

Expand Down Expand Up @@ -203,8 +212,11 @@ body {

/* Nav Tabs */
#tabview {
#border-bottom: 1px solid var(--border-color);
#margin-bottom: 0;
/*
border-bottom: 1px solid var(--border-color);
margin-bottom: 0;
padding-bottom: 0.5rem;
*/
}

#tabview ul.yui-nav {
Expand All @@ -222,7 +234,7 @@ body {
border: 1px solid transparent;
border-top-left-radius: var(--bs-border-radius);
border-top-right-radius: var(--bs-border-radius);
#border-radius: var(--bs-border-radius);
/* border-radius: var(--bs-border-radius); */
margin-right: 0.25rem;
transition: all 0.15s ease-in-out;
}
Expand Down Expand Up @@ -378,21 +390,152 @@ img.tt:hover {
border-bottom: 0;
}

/* Bottom Section */
/* Bottom Section - Modernized from default.css */
#bottom {
grid-column: 1 / -1;
padding-top: 1.5rem;
margin-top: 1.5rem;
border-top: 1px solid var(--border-color);
}

.bottom_div {
div.bottom_div {
background-color: var(--card-background);
border: 1px solid var(--border-color);
border-radius: var(--bs-border-radius);
padding: 1.5rem;
padding: 0; /* Remove padding since activity log will handle its own */
min-height: 9rem;
height: auto;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
div.bottom_div {
background-color: var(--bs-dark-card-bg);
border-color: var(--bs-dark-border);
}
}

/* Activity Log - Modernized to match info box styling with original green header */
div.activitylog {
vertical-align: top;
margin: 0;
overflow: auto;
height: auto;
width: 100%;
background-color: var(--card-background);
border: 1px solid var(--border-color);
border-radius: var(--bs-border-radius);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

div.activitylog_full {
float: left;
clear: right;
empty-cells: show;
width: 100%;
background-color: var(--card-background);
border: 1px solid var(--border-color);
border-radius: var(--bs-border-radius);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
div.activitylog,
div.activitylog_full {
background-color: var(--bs-dark-card-bg);
border-color: var(--bs-dark-border);
}
}

div.activitylog h2 {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
font-size: 1.25rem;
font-weight: 600;
margin: 0;
padding: 1rem 1.25rem;
background-color:#e1fae5; /* Keep original bright green */
border: none;
border-bottom: 1px solid var(--border-color);
border-top-left-radius: calc(var(--bs-border-radius) - 1px);
border-top-right-radius: calc(var(--bs-border-radius) - 1px);
color: #000; /* Black text on bright green background */
margin-bottom: 0;
}

abbr {
text-decoration:none;
}

div.activitylog h2 a {
color: #000; /* Black text on green background */
text-decoration: none;
transition: color 0.15s ease-in-out;
}

div.activitylog h2 a:link,
div.activitylog h2 a:visited {
color: #000;
text-decoration: none;
}

div.activitylog h2 a:hover {
color: #333; /* Slightly lighter on hover */
text-decoration: none;
}

/* Activity log content area - styled like info box content */
div.activitylog div.amsg,
div.activitylog_full div.amsg {
padding: 0.75rem 1.25rem;
border-bottom: 1px dashed var(--border-color);
color: var(--text-color);
font-size: 0.875rem;
margin-bottom: 0;
background-color: var(--card-background);
}

@media (prefers-color-scheme: dark) {
div.activitylog div.amsg,
div.activitylog_full div.amsg {
border-bottom-color: var(--bs-dark-border);
color: var(--bs-dark-text);
background-color: var(--bs-dark-card-bg);
}
}

div.activitylog div.amsg:last-child,
div.activitylog_full div.amsg:last-child {
border-bottom: none;
margin-bottom: 0;
}

div.activitylog a:link,
div.activitylog a:visited {
color: var(--link-color);
text-decoration: none;
transition: color 0.15s ease-in-out;
}

div.activitylog a:hover {
color: var(--link-hover-color);
text-decoration: underline;
}

/* If there are nested activity logs in bottom_div, remove their own borders */
.bottom_div .activitylog,
.bottom_div .activitylog_full {
border: none;
border-radius: 0;
box-shadow: none;
margin-bottom: 0;
}

.bottom_div .activitylog h2 {
border-top-left-radius: calc(var(--bs-border-radius) - 1px);
border-top-right-radius: calc(var(--bs-border-radius) - 1px);
}

/* Legacy support for existing activity log styling */
.activitylog h2 {
font-size: 1.5rem;
font-weight: 600;
Expand Down Expand Up @@ -529,4 +672,13 @@ a:hover {
flex: none;
margin-bottom: 0.25rem;
}

div.activitylog {
margin: 0;
}

div.activitylog h2 {
font-size: 1.25rem;
padding: 0.75rem 1rem;
}
}
27 changes: 27 additions & 0 deletions modern-bas.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@
link.disabled = true;
}
});

// Create and append logout link
const loggedinDiv = document.getElementsByClassName("loggedin")[0];
if (loggedinDiv) {
const logoutLink = loggedinDiv.querySelector('a.logoutlink');
const helpLinkDiv = document.getElementById('help_link');

if (logoutLink && helpLinkDiv) {
// Avoid duplicating the link
if (!helpLinkDiv.querySelector('a[href="/logout"]')) {
const newLogoutLink = document.createElement('a');
newLogoutLink.href = logoutLink.href;
const usr_name = document.getElementsByClassName("loggedin")[0].innerText.split(' ')[0]
newLogoutLink.innerHTML = 'Log out (' + usr_name + ')';
helpLinkDiv.appendChild(newLogoutLink);
}
}
}
}

function applyClassicStyle() {
Expand All @@ -104,6 +122,15 @@
}
});

// Remove the modern logout link if it exists
const helpLinkDiv = document.getElementById('help_link');
if (helpLinkDiv) {
const modernLogoutLink = helpLinkDiv.querySelector('a[href="/logout"]');
if (modernLogoutLink) {
modernLogoutLink.remove();
}
}

console.log('✅ Classic BAS CSS restored');
}

Expand Down

0 comments on commit 41d0cc4

Please sign in to comment.