1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Add embed Mode (#23)

* add embed mode [#21]

* fix stupid typo c:

* fix typo - episode 2

* Recompile CSS & fix lien number container height

Co-authored-by: Lukas Schulte Pelkum <kbrt@protonmail.com>
This commit is contained in:
Ringo Hoffmann 2021-10-13 18:06:15 +02:00 committed by GitHub
parent b11d4eb478
commit dbbd3d24e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 3 deletions

View File

@ -7,13 +7,30 @@ html, body {
font-family: 'Source Code Pro', monospace; font-family: 'Source Code Pro', monospace;
} }
html.embedded .navigation, body.embedded .navigation {
display: none;
}
html.embedded .container, body.embedded .container {
margin: 0;
}
html.embedded #content, html.embedded #linenos, body.embedded #content, body.embedded #linenos {
padding-top: 10px;
min-height: calc(100vh - 50px);
}
html.embedded #footer, body.embedded #footer {
font-size: 0.8em;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; height: 10px;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: none; background: #000000;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,21 @@ html, body {
background-color: #000000; background-color: #000000;
color: #ffffff; color: #ffffff;
font-family: 'Source Code Pro', monospace; font-family: 'Source Code Pro', monospace;
&.embedded {
.navigation {
display: none;
}
.container {
margin: 0;
}
#content, #linenos {
padding-top: 10px;
min-height: calc(100vh - 50px);
}
#footer {
font-size: 0.8em;
}
}
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
@ -14,7 +29,7 @@ html, body {
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: none; background: #000000;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {

View File

@ -45,6 +45,12 @@ export async function initialize() {
setupButtonFunctionality(); setupButtonFunctionality();
setupKeybinds(); setupKeybinds();
// When embedded inside an iframe, add "embedded"
// class to body element.
if (window != window.parent) {
document.body.classList += " embedded";
}
// Enable encryption if enabled from last session // Enable encryption if enabled from last session
if (localStorage.getItem("encryption") === "true") { if (localStorage.getItem("encryption") === "true") {
BUTTON_TOGGLE_ENCRYPTION_ELEMENT.classList.add("active"); BUTTON_TOGGLE_ENCRYPTION_ELEMENT.classList.add("active");