Replacing onebox loading gif with css spinner

This commit is contained in:
Kris 2018-06-19 12:56:43 -04:00
parent 2ff226e509
commit 0d81633da9
1 changed files with 390 additions and 386 deletions

View File

@ -1,530 +1,534 @@
a.loading-onebox { a.loading-onebox {
background: { &:before {
image: image-url("spinner_96.gif"); content: "";
position: 0; display: inline-flex;
size: 20px; float: left;
height: 25px; margin: 3px 5px 0 0;
repeat: no-repeat; position: relative;
} height: 10px;
padding-left: 25px; width: 10px;
border: 2px solid $primary-low-mid;
border-right-color: transparent;
border-radius: 50%;
-webkit-animation: rotate-forever 1s infinite linear;
animation: rotate-forever 1s infinite linear;
}
} }
.onebox-result { .onebox-result {
@include post-aside; @include post-aside;
margin-top: 15px; margin-top: 15px;
padding: 12px; padding: 12px;
font-size: $font-0; font-size: $font-0;
> .source { > .source {
margin-bottom: 12px; margin-bottom: 12px;
margin-right: 10px; margin-right: 10px;
display: block; display: block;
color: $primary; color: $primary;
position: relative; position: relative;
height: 20px; height: 20px;
.info { .info {
a { a {
color: black; color: black;
text-decoration: none; text-decoration: none;
padding-right: 10px; padding-right: 10px;
} }
position: absolute; position: absolute;
font-size: $font-0; font-size: $font-0;
img.favicon { img.favicon {
margin-right: 3px; margin-right: 3px;
} }
} }
} }
.onebox-result-body { .onebox-result-body {
padding-top: 5px; padding-top: 5px;
img { img {
max-height: 80%; max-height: 80%;
max-width: 25%; max-width: 25%;
height: auto; height: auto;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
} }
h3, h3,
h4 { h4 {
margin: 0; margin: 0;
} }
code { code {
max-height: 400px; max-height: 400px;
} }
.metrics { .metrics {
clear: both; clear: both;
padding-bottom: 25px; padding-bottom: 25px;
.metric { .metric {
display: inline-block; display: inline-block;
padding-left: 33px; padding-left: 33px;
float: left; float: left;
} }
} }
} }
} }
// RottenTomatoes Onebox // RottenTomatoes Onebox
.onebox-result { .onebox-result {
.onebox-result-body { .onebox-result-body {
img.verdict { img.verdict {
float: none; float: none;
margin-right: 7px; margin-right: 7px;
} }
img.popcorn { img.popcorn {
float: none; float: none;
margin-left: 20px; margin-left: 20px;
margin-right: 5px; margin-right: 5px;
} }
} }
} }
@mixin onebox-favicon($class, $image) { @mixin onebox-favicon($class, $image) {
&.#{$class} .source { &.#{$class} .source {
background: image-url("favicons/#{$image}.png") no-repeat; background: image-url("favicons/#{$image}.png") no-repeat;
background-size: 16px 16px; background-size: 16px 16px;
padding-left: 20px; padding-left: 20px;
} }
} }
aside.onebox { aside.onebox {
border: 5px solid $primary-low; border: 5px solid $primary-low;
margin-bottom: 1em; margin-bottom: 1em;
padding: 12px 25px 12px 12px; padding: 12px 25px 12px 12px;
font-size: $font-0; font-size: $font-0;
header { header {
margin-bottom: 8px; margin-bottom: 8px;
a[href] { a[href] {
color: dark-light-choose($primary-medium, $secondary-medium); color: dark-light-choose($primary-medium, $secondary-medium);
text-decoration: none; text-decoration: none;
} }
} }
@include onebox-favicon("stackexchange", "stackexchange"); @include onebox-favicon("stackexchange", "stackexchange");
@include onebox-favicon("twitterstatus", "twitter"); @include onebox-favicon("twitterstatus", "twitter");
@include onebox-favicon("wikipedia", "wikipedia"); @include onebox-favicon("wikipedia", "wikipedia");
@include onebox-favicon("githubblob", "github"); @include onebox-favicon("githubblob", "github");
@include onebox-favicon("githubcommit", "github"); @include onebox-favicon("githubcommit", "github");
@include onebox-favicon("githubpullrequest", "github"); @include onebox-favicon("githubpullrequest", "github");
@include onebox-favicon("githubissue", "github"); @include onebox-favicon("githubissue", "github");
@include onebox-favicon("githubgist", "github"); @include onebox-favicon("githubgist", "github");
@include onebox-favicon("amazon", "amazon"); @include onebox-favicon("amazon", "amazon");
@include onebox-favicon("instagram", "instagram"); @include onebox-favicon("instagram", "instagram");
@include onebox-favicon("googledocs", "google_branding/logo_drive_48px"); @include onebox-favicon("googledocs", "google_branding/logo_drive_48px");
.onebox-body { .onebox-body {
clear: both; clear: both;
h3, h3,
h4 { h4 {
font-size: $font-up-1; font-size: $font-up-1;
margin: 0 0 10px 0; margin: 0 0 10px 0;
} }
a[href] { a[href] {
color: dark-light-choose($tertiary, $tertiary); color: dark-light-choose($tertiary, $tertiary);
text-decoration: none; text-decoration: none;
} }
a[href]:visited { a[href]:visited {
color: dark-light-choose($tertiary, $tertiary); color: dark-light-choose($tertiary, $tertiary);
} }
img { img {
max-height: 170px; max-height: 170px;
max-width: 20%; max-width: 20%;
@media all and (max-width: 600px) { @media all and (max-width: 600px) {
max-width: 35%; max-width: 35%;
} }
height: auto; height: auto;
width: auto; width: auto;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
&.onebox-full-image { &.onebox-full-image {
max-height: none; max-height: none;
max-width: none; max-width: none;
width: initial; width: initial;
height: initial; height: initial;
} }
} }
[style*="--aspect-ratio"] > :first-child { [style*="--aspect-ratio"] > :first-child {
width: 100%; width: 100%;
} }
[style*="--aspect-ratio"] > img { [style*="--aspect-ratio"] > img {
height: auto; height: auto;
} }
// this allows us to load all onebox images without jiggle // this allows us to load all onebox images without jiggle
// see: http://cssmojo.com/aspect-ratio-using-custom-properties-and-calc/ // see: http://cssmojo.com/aspect-ratio-using-custom-properties-and-calc/
@supports (--custom: property) { @supports (--custom: property) {
.aspect-image { .aspect-image {
max-height: 170px; max-height: 170px;
--magic-ratio: calc(var(--aspect-ratio) + 0.15); --magic-ratio: calc(var(--aspect-ratio) + 0.15);
width: calc(128px * var(--magic-ratio)); width: calc(128px * var(--magic-ratio));
max-width: 20%; max-width: 20%;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
height: auto; height: auto;
img { img {
width: 100%; width: 100%;
height: inherit; height: inherit;
max-width: initial; max-width: initial;
max-height: initial; max-height: initial;
float: none; float: none;
margin-right: none; margin-right: none;
} }
} }
// full size images for instagram, twitter, etc. // full size images for instagram, twitter, etc.
.aspect-image-full-size { .aspect-image-full-size {
max-height: 500px; max-height: 500px;
width: calc(500px * var(--aspect-ratio)); width: calc(500px * var(--aspect-ratio));
max-width: 100%; max-width: 100%;
img { img {
width: 100%; width: 100%;
height: inherit; height: inherit;
max-width: initial; max-width: initial;
max-height: initial; max-height: initial;
float: none; float: none;
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
} }
} }
[style*="--aspect-ratio"] { [style*="--aspect-ratio"] {
position: relative; position: relative;
} }
[style*="--aspect-ratio"]::before { [style*="--aspect-ratio"]::before {
content: ""; content: "";
display: block; display: block;
padding-bottom: calc(100% / (var(--aspect-ratio))); padding-bottom: calc(100% / (var(--aspect-ratio)));
} }
[style*="--aspect-ratio"] > :first-child { [style*="--aspect-ratio"] > :first-child {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
height: 100%; height: 100%;
} }
} }
// tighten bottom margin on last para // tighten bottom margin on last para
p:last-child { p:last-child {
margin-bottom: 4px; margin-bottom: 4px;
} }
// twitter fixes // twitter fixes
.tweet-images { .tweet-images {
display: block; display: block;
clear: both; clear: both;
img.tweet-image { img.tweet-image {
margin-top: 1em; margin-top: 1em;
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
float: none; float: none;
} }
} }
&.user-onebox { &.user-onebox {
.fa { .fa {
margin-right: 5px; margin-right: 5px;
} }
.full-name, .full-name,
.location { .location {
margin-right: 10px; margin-right: 10px;
} }
} }
// instagram fixes // instagram fixes
.instagram-images { .instagram-images {
clear: both; clear: both;
.instagram-image { .instagram-image {
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
float: none; float: none;
} }
} }
} }
} }
@mixin gdocs-logo($type) { @mixin gdocs-logo($type) {
&.g-#{$type}-logo { &.g-#{$type}-logo {
background: image-url("favicons/google_branding/logo_#{$type}_48px.png") background: image-url("favicons/google_branding/logo_#{$type}_48px.png") no-repeat;
no-repeat; }
}
} }
.googledocs-onebox-logo { .googledocs-onebox-logo {
width: 60px; width: 60px;
height: 50px; height: 50px;
float: left; float: left;
@include gdocs-logo("docs"); @include gdocs-logo("docs");
@include gdocs-logo("forms"); @include gdocs-logo("forms");
@include gdocs-logo("sheets"); @include gdocs-logo("sheets");
@include gdocs-logo("slides"); @include gdocs-logo("slides");
@include gdocs-logo("calendar"); @include gdocs-logo("calendar");
@include gdocs-logo("drive"); @include gdocs-logo("drive");
} }
// Google Calendar Placeholder // Google Calendar Placeholder
.gdocs-onebox-splash { .gdocs-onebox-splash {
background-color: blend-primary-secondary(30%); background-color: blend-primary-secondary(30%);
color: $primary; color: $primary;
border: 1px inset $primary; border: 1px inset $primary;
.gdocs-onebox-logo { .gdocs-onebox-logo {
display: inline-block; display: inline-block;
width: 128px; width: 128px;
height: 128px; height: 128px;
&.g-calendar-logo { &.g-calendar-logo {
background: image-url("favicons/google_branding/logo_calendar_128px.png") background: image-url("favicons/google_branding/logo_calendar_128px.png") no-repeat;
no-repeat; }
} }
}
} }
aside.onebox .onebox-body .onebox-avatar { aside.onebox .onebox-body .onebox-avatar {
max-height: none; max-height: none;
max-width: none; max-width: none;
height: 60px; height: 60px;
width: 60px; width: 60px;
} }
blockquote { blockquote {
aside.onebox { aside.onebox {
@include post-aside; @include post-aside;
} }
} }
// -- Onebox Github Code Blob -- // -- Onebox Github Code Blob --
pre.onebox code ol.lines li:before { pre.onebox code ol.lines li:before {
position: absolute; position: absolute;
display: inline-block; display: inline-block;
width: 35px; width: 35px;
left: -40px; left: -40px;
color: #afafaf; color: #afafaf;
text-align: right; text-align: right;
padding-right: 5px; padding-right: 5px;
font-size: $font-down-1; font-size: $font-down-1;
line-height: $line-height-large; line-height: $line-height-large;
content: counter(li-counter); content: counter(li-counter);
counter-increment: li-counter; counter-increment: li-counter;
} }
pre.onebox code ol { pre.onebox code ol {
margin-left: 0; margin-left: 0;
line-height: $line-height-large; line-height: $line-height-large;
} }
pre.onebox code { pre.onebox code {
background-color: dark-light-choose(#fff, #000); background-color: dark-light-choose(#fff, #000);
} }
pre.onebox code li { pre.onebox code li {
padding-left: 5px; padding-left: 5px;
} }
pre.onebox code ol.lines { pre.onebox code ol.lines {
position: relative; position: relative;
margin: 0 0 0 40px; margin: 0 0 0 40px;
} }
pre.onebox code ol.lines li { pre.onebox code ol.lines li {
list-style-type: none; list-style-type: none;
padding-left: 5px; padding-left: 5px;
margin-left: 0; margin-left: 0;
border-left: 1px solid #cfcfcf; border-left: 1px solid #cfcfcf;
min-height: 1.5em; //show empty li lines min-height: 1.5em; //show empty li lines
white-space: pre; white-space: pre;
} }
pre.onebox code li.selected { pre.onebox code li.selected {
background-color: dark-light-choose(#f8eec7, #541); background-color: dark-light-choose(#f8eec7, #541);
} }
pre.onebox code { pre.onebox code {
white-space: normal; white-space: normal;
} }
//Onebox - Github - Pull request //Onebox - Github - Pull request
.onebox-body .github-commit-status { .onebox-body .github-commit-status {
background: #f5f5f5; background: #f5f5f5;
border-radius: 5px; border-radius: 5px;
margin: 0 0 5px 100px; margin: 0 0 5px 100px;
padding: 10px; padding: 10px;
} }
.onebox-body .status_tag { .onebox-body .status_tag {
display: inline-block; display: inline-block;
color: #fff; color: #fff;
padding: 1px 4px; padding: 1px 4px;
border-radius: 3px; border-radius: 3px;
font-weight: bold; font-weight: bold;
margin-bottom: 5px; margin-bottom: 5px;
text-transform: capitalize; text-transform: capitalize;
} }
.onebox-body .build_status { .onebox-body .build_status {
padding: 2px; padding: 2px;
font-size: $font-down-1; font-size: $font-down-1;
} }
.onebox-body .status_tag.open { .onebox-body .status_tag.open {
background-color: #6cc644; background-color: #6cc644;
} }
.onebox-body .status_tag.merged { .onebox-body .status_tag.merged {
background-color: #6e5494; background-color: #6e5494;
} }
.onebox-body .status_tag.closed { .onebox-body .status_tag.closed {
background-color: #bd2c00; background-color: #bd2c00;
} }
.onebox-body .github-content-right { .onebox-body .github-content-right {
margin-left: 100px; margin-left: 100px;
} }
//Onebox - Twitter - Status //Onebox - Twitter - Status
aside.onebox.twitterstatus .onebox-body { aside.onebox.twitterstatus .onebox-body {
h4 { h4 {
margin-bottom: 0; margin-bottom: 0;
} }
} }
// thumbnail, oddly, ONLY applies to twitter avatar // thumbnail, oddly, ONLY applies to twitter avatar
.onebox.twitterstatus { .onebox.twitterstatus {
.thumbnail { .thumbnail {
width: 48px; width: 48px;
height: 48px; height: 48px;
} }
p, p,
.tweet { .tweet {
white-space: pre-wrap; white-space: pre-wrap;
padding-top: 3px; padding-top: 3px;
margin-left: 70px; margin-left: 70px;
} }
.date { .date {
clear: left; clear: left;
padding-top: 10px; padding-top: 10px;
} }
} }
// Onebox - Imgur - Album // Onebox - Imgur - Album
.onebox.imgur-album { .onebox.imgur-album {
.outer-box { .outer-box {
position: absolute; position: absolute;
z-index: z("base"); z-index: z("base");
overflow: hidden; overflow: hidden;
font-size: $font-down-1; font-size: $font-down-1;
color: #fff; color: #fff;
background-color: rgba(0, 0, 0, 0.6); background-color: rgba(0, 0, 0, 0.6);
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 100%; max-width: 100%;
padding: 5px 0; padding: 5px 0;
.inner-box { .inner-box {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
word-wrap: normal; word-wrap: normal;
white-space: nowrap; white-space: nowrap;
.album-title { .album-title {
width: 100%; width: 100%;
font-size: $font-up-1; font-size: $font-up-1;
line-height: $line-height-large; line-height: $line-height-large;
color: #ccc; color: #ccc;
text-decoration: none; text-decoration: none;
} }
} }
} }
} }
// resize stackexchange onebox image // resize stackexchange onebox image
aside.onebox.stackexchange .onebox-body { aside.onebox.stackexchange .onebox-body {
img:not(.onebox-avatar) { img:not(.onebox-avatar) {
max-height: 60%; max-height: 60%;
max-width: 10%; max-width: 10%;
} }
.tags { .tags {
color: gray; color: gray;
} }
} }
.onebox-metadata { .onebox-metadata {
color: dark-light-choose($primary-medium, $secondary-medium); color: dark-light-choose($primary-medium, $secondary-medium);
} }
.onebox.xkcd .onebox-body { .onebox.xkcd .onebox-body {
img { img {
max-width: 100% !important; max-width: 100% !important;
float: none !important; float: none !important;
} }
} }
// pdf onebox // pdf onebox
.onebox.pdf .onebox-body { .onebox.pdf .onebox-body {
.pdf-onebox-logo { .pdf-onebox-logo {
width: 60px; width: 60px;
height: 50px; height: 50px;
float: left; float: left;
background: image-url("favicons/pdf_64px.png") no-repeat; background: image-url("favicons/pdf_64px.png") no-repeat;
background-size: 48px 48px; background-size: 48px 48px;
display: inline-block; display: inline-block;
} }
.filesize { .filesize {
color: gray; color: gray;
} }
} }
// whitelistedgeneric twitter labels // whitelistedgeneric twitter labels
.onebox.whitelistedgeneric { .onebox.whitelistedgeneric {
.label1, .label1,
.label2 { .label2 {
color: dark-light-choose($primary-medium, $secondary-medium); color: dark-light-choose($primary-medium, $secondary-medium);
} }
.label1 { .label1 {
float: left; float: left;
} }
.label2 { .label2 {
float: right; float: right;
} }
} }
.onebox { .onebox {
&.whitelistedgeneric, &.whitelistedgeneric,
&.gfycat { &.gfycat {
.site-icon { .site-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 3px; margin-right: 3px;
} }
} }
} }
.onebox.gfycat p { .onebox.gfycat p {
span.label1 a { span.label1 a {
white-space: nowrap; white-space: nowrap;
} }
} }
.onebox.instagram { .onebox.instagram {
div.instagram-description { div.instagram-description {
color: dark-light-choose($primary-medium, $secondary-medium); color: dark-light-choose($primary-medium, $secondary-medium);
padding-top: 10px; padding-top: 10px;
} }
} }
.onebox.githubcommit { .onebox.githubcommit {
pre.message { pre.message {
padding: 0; padding: 0;
} }
} }
// mobile specific style // mobile specific style
.mobile-view article.onebox-body { .mobile-view article.onebox-body {
border-top: none; border-top: none;
} }