Skip to content
Draft
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
1 change: 0 additions & 1 deletion content-scripts/components/Navbar/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const HEADER_LINKS = {
"Mais opções": "web_base.gera_pagina?p_pagina=1831",
},
};

interface Props {
auth?: AuthSession | null;
}
Expand Down
14 changes: 14 additions & 0 deletions content-scripts/components/Navbar/HeaderAuthentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,27 @@ const Authentication = ({ auth }: Props) => {
if (auth)
return (
<div id="se-auth">
<Button
icon="ri-search-line"
variant="solid"
radius="full"
size="md"
className="icon-only"
onclick={() => togglePopover("se-search")}
/>
<Button
icon="ri-notification-line"
radius="full"
id="se-auth-notifications-button"
onclick={() => togglePopover("se-auth-notifications-menu")}
className={auth.hasNotifications ? "se-badge" : ""}
/>
<div id="se-search">
<iframe
id="search-iframe"
src="http://127.0.0.1:5500/content-scripts/components/Navbar/search.html"
></iframe>
</div>
<div id="se-auth-notifications-menu">
<input
type="radio"
Expand Down
146 changes: 146 additions & 0 deletions content-scripts/components/Navbar/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NitsigSearch</title>
<script
async
src="https://cse.google.com/cse.js?cx=532f705a46f524c37"
></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
document.body.addEventListener("click", function (event) {
if (event.target.classList.contains("gs-title")) {
event.preventDefault();
window.open(event.target.href, "_blank");
}
});
});
</script>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: rgba(140, 45, 25, 0.95);
}
.search-container {
width: 85%;
background-color: #6f1e0e;
padding: 20px;
border-radius: 8px;
}
.gcse-search {
margin-top: 20px;
}
.gsc-control-cse {
background-color: #6f1e0e !important;
border: none !important;
}
.gsc-search-button-v2 {
background-color: #4f1309 !important;
border: none !important;
padding: 9px 27px !important;
transition: background-color 0.3s ease;
margin-right: 5px;
cursor: pointer;
}
.gsc-search-button-v2:hover {
background-color: #3b0e06 !important;
}
#gsc-i-id1 {
background: none !important;
}

.gsc-orderby-container {
text-align: right !important;
padding-right: 1%;
}

.gsc-orderby-label,
.gsc-option-selector,
.gcsc-branding,
.gsc-option-selector,
.gs-web-image-box,
.gs-promotion-image-box {
display: none !important;
}
.gsc-result-info {
color: whitesmoke !important;
}
.gsc-results .gsc-cursor-box .gsc-cursor-page {
color: #d27461 !important;
}
.gsc-results .gsc-cursor-box .gsc-cursor-current-page {
color: whitesmoke !important;
}
.gsc-above-wrapper-area {
border-bottom: none !important;
}
.gsst_a .gscb_a {
display: cursor !important;
color: #8c2d19 !important;
}
.gsst_a:hover .gscb_a {
display: cursor !important;
color: #3b0e06 !important;
}
.gcsc-find-more-on-google {
color: #d27461 !important;
}
.gcsc-find-more-on-google-magnifier {
fill: #8c2d19 !important;
}
.gsc-webResult.gsc-result {
border: 0.5px solid #d27461 !important;
}
.gsc-selected-option-container {
padding: 5px 8px !important;
box-shadow: none !important;
cursor: pointer !important;
background-color: whitesmoke;
transition: background-color 0.3s ease;
}
.gsc-selected-option-container:hover {
background-color: #e5e5e5 !important;
}
.gsc-control-wrapper-cse {
max-height: 85vh;
overflow: auto;
}
.gs-result .gs-title * {
color: whitesmoke !important;
font-weight: bold !important;
}
.gs-webResult .gs-snippet {
color: rgb(222, 222, 222) !important;
}
.gs-webResult .gs-visibleUrl {
color: #d27461 !important;
}
table.gsc-search-box td.gsc-input {
padding-right: 0.5% !important;
}
.gs-no-results-result .gs-snippet,
.gs-error-result .gs-snippet {
background-color: #6f1e0e !important;
border: none !important;
}

.gs-spelling,
.gs-spelling a {
color: #e5e5e5 !important;
}
</style>
</head>
<body>
<div class="search-container">
<div class="gcse-search"></div>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions content-scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ const init = async (): Promise<void> => {
}
}

// registerGoogleSearchCallbacks();

// TODO (thePeras): Refactor this
const script = document.createElement("script");
script.src = chrome.runtime.getURL("js/cse.js");
document.body.appendChild(script);

// we run rememberLogin at last, because it's async
// TODO (luisd): make a better mechanism for functions that depend on previous
// steps and might be async
Expand Down
23 changes: 23 additions & 0 deletions css/simpler.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ body:is(body) {
justify-items: end;
}

#se-search,
#se-auth-form,
#se-auth-profile-menu,
#se-auth-notifications-menu,
Expand Down Expand Up @@ -245,6 +246,7 @@ body:is(body) {
visibility: unset;
}

#se-search,
.se-popover-open :is(#se-auth-form, #se-auth-profile-menu),
#se-auth-notifications-menu.se-popover-open,
.se-header-link-popover.se-popover-open,
Expand All @@ -265,6 +267,26 @@ body:is(body) {
padding: 1em;
}

#search-iframe {
width: 55vw;
height: 100vh;
}

#se-search {
top: 5.1em;
right: 2em;
width: 55vw;
max-height: calc(100vh - 6em);
}

#se-auth-profile-menu,
#se-auth-notifications-menu {
top: 4.5em;
right: 1em;
width: 16em;
max-height: calc(100vh - 7em);
}

#se-auth-profile-menu,
#se-auth-notifications-menu {
top: 4.5em;
Expand Down Expand Up @@ -358,6 +380,7 @@ body:is(body) {
object-fit: cover;
}

#se-search,
#se-auth-notifications-menu input {
display: none;
}
Expand Down
1 change: 1 addition & 0 deletions manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ let manifest = {
"css/custom.css",
"css/simpler.css",
"js/override-functions.js",
"js/cse.js",
"css/icons.css",
"images/publicationWebsiteLogo/*",
"images/FEUP.svg",
Expand Down
1 change: 1 addition & 0 deletions manifest/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"css/custom.css",
"css/simpler.css",
"js/override-functions.js",
"js/cse.js",
"css/icons.css",
"images/publicationWebsiteLogo/*",
"images/FEUP.svg",
Expand Down
Loading
Loading