Skip to content

Commit 7ef8bcc

Browse files
authored
Merge pull request #56 from ioigoume/slow-post-notice-csp-compliant-assets
Slow Post - js and css changes
2 parents d326653 + d12dba4 commit 7ef8bcc

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

resources/css/default.scss

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,3 +863,82 @@ div.preferredidp {
863863
.left {
864864
float: left;
865865
}
866+
/*Margins*/
867+
.mt-0 { margin-top: 0 !important; }
868+
.mt-1 { margin-top: .25rem !important; }
869+
.mt-2 { margin-top: .5rem !important; }
870+
.mt-3 { margin-top: 1rem !important; }
871+
.mt-4 { margin-top: 1.5rem !important; }
872+
.mt-5 { margin-top: 3rem !important; }
873+
874+
.mb-0 { margin-bottom: 0 !important; }
875+
.mb-1 { margin-bottom: .25rem !important; }
876+
.mb-2 { margin-bottom: .5rem !important; }
877+
.mb-3 { margin-bottom: 1rem !important; }
878+
.mb-4 { margin-bottom: 1.5rem !important; }
879+
.mb-5 { margin-bottom: 3rem !important; }
880+
/*Padding*/
881+
.p-0 { padding: 0 !important; }
882+
.p-1 { padding: .25rem !important; }
883+
.p-2 { padding: .5rem !important; }
884+
.p-3 { padding: 1rem !important; }
885+
.p-4 { padding: 1.5rem !important; }
886+
.p-5 { padding: 3rem !important; }
887+
888+
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
889+
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
890+
891+
/*Loader*/
892+
.loader {
893+
position: fixed;
894+
top: 50%;
895+
left: 50%;
896+
transform: translate(-50%, -50%);
897+
display: block;
898+
width: 16px;
899+
height: 16px;
900+
border-radius: 50%;
901+
margin: 15px auto;
902+
background: #FFF;
903+
box-shadow: -24px 0 #FFF, 24px 0 #FFF;
904+
box-sizing: border-box;
905+
animation: shadowPulse 2s linear infinite;
906+
z-index: 10000;
907+
}
908+
.loader::before {
909+
content: "";
910+
position: absolute;
911+
left: 50%;
912+
top: 50%;
913+
width: 120px; /* square width */
914+
height: 120px; /* square height (same as width) */
915+
transform: translate(-50%, -50%);
916+
background: rgba(0, 0, 0, 0.04); /* subtle halo for contrast */
917+
border-radius: 12px; /* rounded corners */
918+
pointer-events: none;
919+
z-index: -1; /* behind the loader dots */
920+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); /* faint inner edge for visibility */
921+
}
922+
923+
@media (forced-colors: active) {
924+
.loader::before {
925+
background: Canvas;
926+
border: 2px solid ButtonText;
927+
box-shadow: none;
928+
}
929+
}
930+
931+
@keyframes shadowPulse {
932+
33% {
933+
background: #FFF;
934+
box-shadow: -24px 0 #db0100, 24px 0 #FFF;
935+
}
936+
66% {
937+
background: #db0100;
938+
box-shadow: -24px 0 #FFF, 24px 0 #FFF;
939+
}
940+
100% {
941+
background: #FFF;
942+
box-shadow: -24px 0 #FFF, 24px 0 #db0100;
943+
}
944+
}

resources/css/postSubmit.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import 'default';
2+
13
input#postLoginSubmitButton {
24
display: none;
35
}

resources/js/post/post.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,28 @@
55
* the SSO
66
*/
77
ready(function () {
8-
document.getElementById('postLoginSubmitButton').click();
8+
// Reveal #slowPostMessage after a delay (default 30000 ms).
9+
// If you want to change the delay per page, set data-slow-post-delay on the element.
10+
const el = document.getElementById('slowPostMessage');
11+
if (el) {
12+
const pageTitle = document.getElementById('page-title');
13+
const attr = (el.dataset && el.dataset.slowPostDelay) || el.getAttribute('data-slow-post-delay');
14+
let delay = parseInt(attr, 10);
15+
if (!Number.isFinite(delay) || delay < 0) delay = 30000;
16+
17+
setTimeout(function () {
18+
el.classList.remove('hidden');
19+
if (pageTitle) {
20+
pageTitle.classList.remove('hidden');
21+
}
22+
}, delay);
23+
}
24+
25+
// Automatically click the input button to redirect the user to
26+
// the SSO
27+
const btn = document.getElementById('postLoginSubmitButton');
28+
if (btn) {
29+
// Schedule the click on the next event loop turn so pending UI updates can render first
30+
setTimeout(function () { btn.click(); }, 0);
31+
}
932
});

0 commit comments

Comments
 (0)