discourse/app/assets/stylesheets/common/base/onebox.scss

583 lines
11 KiB
SCSS
Raw Normal View History

2013-09-06 03:37:07 +08:00
a.loading-onebox {
2018-06-20 01:07:16 +08:00
&:before {
content: "";
display: inline-flex;
float: left;
margin: 3px 5px 0 0;
position: relative;
height: 10px;
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;
}
2013-09-06 03:37:07 +08:00
}
.onebox-result {
2018-06-20 01:07:16 +08:00
@include post-aside;
margin-top: 15px;
padding: 12px;
font-size: $font-0;
> .source {
margin-bottom: 12px;
margin-right: 10px;
display: block;
color: $primary;
position: relative;
height: 20px;
.info {
a {
color: black;
text-decoration: none;
padding-right: 10px;
}
position: absolute;
font-size: $font-0;
img.favicon {
margin-right: 3px;
}
}
}
.onebox-result-body {
padding-top: 5px;
img {
max-height: 80%;
max-width: 25%;
height: auto;
float: left;
margin-right: 10px;
}
h3,
h4 {
margin: 0;
}
code {
max-height: 400px;
}
.metrics {
clear: both;
padding-bottom: 25px;
.metric {
display: inline-block;
padding-left: 33px;
float: left;
}
}
}
2013-09-06 03:37:07 +08:00
}
// RottenTomatoes Onebox
.onebox-result {
2018-06-20 01:07:16 +08:00
.onebox-result-body {
img.verdict {
float: none;
margin-right: 7px;
}
img.popcorn {
float: none;
margin-left: 20px;
margin-right: 5px;
}
}
2013-09-06 03:37:07 +08:00
}
2014-01-28 06:58:53 +08:00
@mixin onebox-favicon($class, $image) {
2018-06-20 01:07:16 +08:00
&.#{$class} .source {
background: image-url("favicons/#{$image}.png") no-repeat;
background-size: 16px 16px;
padding-left: 20px;
}
2014-01-28 06:58:53 +08:00
}
aside.onebox {
2018-06-20 01:07:16 +08:00
border: 5px solid $primary-low;
margin-bottom: 1em;
padding: 12px 25px 12px 12px;
font-size: $font-0;
header {
margin-bottom: 8px;
a[href] {
color: dark-light-choose($primary-medium, $secondary-medium);
text-decoration: none;
}
}
@include onebox-favicon("stackexchange", "stackexchange");
@include onebox-favicon("twitterstatus", "twitter");
@include onebox-favicon("wikipedia", "wikipedia");
@include onebox-favicon("githubblob", "github");
@include onebox-favicon("githubcommit", "github");
@include onebox-favicon("githubpullrequest", "github");
@include onebox-favicon("githubissue", "github");
@include onebox-favicon("githubgist", "github");
@include onebox-favicon("amazon", "amazon");
@include onebox-favicon("instagram", "instagram");
@include onebox-favicon("googledocs", "google_branding/logo_drive_48px");
.onebox-body {
clear: both;
h3,
h4 {
font-size: $font-up-1;
margin: 0 0 10px 0;
}
a[href] {
color: dark-light-choose($tertiary, $tertiary);
text-decoration: none;
}
a[href]:visited {
color: dark-light-choose($tertiary, $tertiary);
}
img {
max-height: 170px;
max-width: 20%;
@media all and (max-width: 600px) {
max-width: 35%;
}
height: auto;
width: auto;
float: left;
margin-right: 10px;
&.onebox-full-image {
max-height: none;
max-width: none;
width: initial;
height: initial;
}
}
[style*="--aspect-ratio"] > :first-child {
width: 100%;
}
[style*="--aspect-ratio"] > img {
height: auto;
}
// this allows us to load all onebox images without jiggle
// see: http://cssmojo.com/aspect-ratio-using-custom-properties-and-calc/
@supports (--custom: property) {
.aspect-image {
max-height: 170px;
--magic-ratio: calc(var(--aspect-ratio) + 0.15);
width: calc(128px * var(--magic-ratio));
max-width: 20%;
float: left;
margin-right: 10px;
height: auto;
img {
width: 100%;
height: inherit;
max-width: initial;
max-height: initial;
float: none;
margin-right: none;
}
}
// full size images for instagram, twitter, etc.
.aspect-image-full-size {
max-height: 500px;
width: calc(500px * var(--aspect-ratio));
max-width: 100%;
img {
width: 100%;
height: inherit;
max-width: initial;
max-height: initial;
float: none;
padding: 5px 5px 5px 5px;
}
}
[style*="--aspect-ratio"] {
position: relative;
}
[style*="--aspect-ratio"]::before {
content: "";
display: block;
padding-bottom: calc(100% / (var(--aspect-ratio)));
}
[style*="--aspect-ratio"] > :first-child {
position: absolute;
top: 0;
left: 0;
height: 100%;
}
}
// tighten bottom margin on last para
p:last-child {
margin-bottom: 4px;
}
// twitter fixes
.tweet-images {
display: block;
clear: both;
img.tweet-image {
margin-top: 1em;
max-width: 100%;
max-height: 100%;
float: none;
}
}
&.user-onebox {
.fa {
margin-right: 5px;
}
.full-name,
.location {
margin-right: 10px;
}
}
// instagram + reddit fixes
.instagram-images,
.scale-images {
2018-06-20 01:07:16 +08:00
clear: both;
2018-08-31 11:10:36 +08:00
position: relative;
.instagram-video-icon {
&:before {
Upgrade to FontAwesome 5 (take two) (#6673) * Add missing icons to set * Revert FA5 revert This reverts commit 42572ff * use new SVG syntax in locales * Noscript page changes (remove login button, center "powered by" footer text) * Cast wider net for SVG icons in settings - include any _icon setting for SVG registry (offers better support for plugin settings) - let themes store multiple pipe-delimited icons in a setting - also replaces broken onebox image icon with SVG reference in cooked post processor * interpolate icons in locales * Fix composer whisper icon alignment * Add support for stacked icons * SECURITY: enforce hostname to match discourse hostname This ensures that the hostname rails uses for various helpers always matches the Discourse hostname * load SVG sprite with pre-initializers * FIX: enable caching on SVG sprites * PERF: use JSONP for SVG sprites so they are served from CDN This avoids needing to deal with CORS for loading of the SVG Note, added the svg- prefix to the filename so we can quickly tell in dev tools what the file is * Add missing SVG sprite JSONP script to CSP * Upgrade to FA 5.5.0 * Add support for all FA4.7 icons - adds complete frontend and backend for renamed FA4.7 icons - improves performance of SvgSprite.bundle and SvgSprite.all_icons * Fix group avatar flair preview - adds an endpoint at /svg-sprites/search/:keyword - adds frontend ajax call that pulls icon in avatar flair preview even when it is not in subset * Remove FA 4.7 font files
2018-11-27 05:49:57 +08:00
opacity: 0.8;
// ideally, the SVG used here should be in HTML and reference the SVG sprite
content: svg-uri(
'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" viewBox="0 0 512 512" fill="white"><path d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>'
);
2018-08-31 11:10:36 +08:00
}
bottom: 10px;
right: 10px;
position: absolute;
}
2018-06-20 01:07:16 +08:00
.instagram-image,
.scale-image {
2018-06-20 01:07:16 +08:00
padding: 5px 5px 5px 5px;
max-width: 100%;
max-height: 100%;
float: none;
}
}
}
2014-01-28 06:58:53 +08:00
}
@mixin gdocs-logo($type) {
2018-06-20 01:07:16 +08:00
&.g-#{$type}-logo {
background: image-url("favicons/google_branding/logo_#{$type}_48px.png")
no-repeat;
}
}
2016-08-10 20:25:04 +08:00
.googledocs-onebox-logo {
2018-06-20 01:07:16 +08:00
width: 60px;
height: 50px;
float: left;
@include gdocs-logo("docs");
@include gdocs-logo("forms");
@include gdocs-logo("sheets");
@include gdocs-logo("slides");
@include gdocs-logo("calendar");
@include gdocs-logo("drive");
2016-08-10 20:25:04 +08:00
}
// Google Calendar Placeholder
.gdocs-onebox-splash {
2018-06-20 01:07:16 +08:00
background-color: blend-primary-secondary(30%);
color: $primary;
border: 1px inset $primary;
.gdocs-onebox-logo {
display: inline-block;
width: 128px;
height: 128px;
&.g-calendar-logo {
background: image-url("favicons/google_branding/logo_calendar_128px.png")
no-repeat;
}
}
}
2015-04-24 11:42:27 +08:00
aside.onebox .onebox-body .onebox-avatar {
2018-06-20 01:07:16 +08:00
max-height: none;
max-width: none;
height: 60px;
width: 60px;
2014-03-25 12:52:40 +08:00
}
blockquote {
2018-06-20 01:07:16 +08:00
aside.onebox {
@include post-aside;
}
}
// -- Onebox Github Code Blob --
pre.onebox code ol.lines li:before {
2018-06-20 01:07:16 +08:00
position: absolute;
display: inline-block;
width: 35px;
left: -40px;
color: #afafaf;
text-align: right;
padding-right: 5px;
font-size: $font-down-1;
line-height: $line-height-large;
content: counter(li-counter);
counter-increment: li-counter;
}
pre.onebox code ol {
2018-06-20 01:07:16 +08:00
margin-left: 0;
line-height: $line-height-large;
}
2015-08-19 06:02:41 +08:00
pre.onebox code {
2018-06-20 01:07:16 +08:00
background-color: dark-light-choose(#fff, #000);
2015-08-19 06:02:41 +08:00
}
pre.onebox code li {
2018-06-20 01:07:16 +08:00
padding-left: 5px;
}
pre.onebox code ol.lines {
2018-06-20 01:07:16 +08:00
position: relative;
margin: 0 0 0 40px;
}
pre.onebox code ol.lines li {
2018-06-20 01:07:16 +08:00
list-style-type: none;
padding-left: 5px;
margin-left: 0;
border-left: 1px solid #cfcfcf;
min-height: 1.5em; //show empty li lines
white-space: pre;
}
pre.onebox code li.selected {
2018-06-20 01:07:16 +08:00
background-color: dark-light-choose(#f8eec7, #541);
}
pre.onebox code {
2018-06-20 01:07:16 +08:00
white-space: normal;
}
2014-09-29 12:33:20 +08:00
//Onebox - Github - Pull request
.onebox-body .github-commit-status {
2018-06-20 01:07:16 +08:00
background: #f5f5f5;
border-radius: 5px;
margin: 0 0 5px 100px;
padding: 10px;
2014-09-29 12:33:20 +08:00
}
.onebox-body .status_tag {
2018-06-20 01:07:16 +08:00
display: inline-block;
color: #fff;
padding: 1px 4px;
border-radius: 3px;
font-weight: bold;
margin-bottom: 5px;
text-transform: capitalize;
2014-09-29 12:33:20 +08:00
}
.onebox-body .build_status {
2018-06-20 01:07:16 +08:00
padding: 2px;
font-size: $font-down-1;
2014-09-29 12:33:20 +08:00
}
.onebox-body .status_tag.open {
2018-06-20 01:07:16 +08:00
background-color: #6cc644;
2014-09-29 12:33:20 +08:00
}
.onebox-body .status_tag.merged {
2018-06-20 01:07:16 +08:00
background-color: #6e5494;
2014-09-29 12:33:20 +08:00
}
.onebox-body .status_tag.closed {
2018-06-20 01:07:16 +08:00
background-color: #bd2c00;
2014-09-29 12:33:20 +08:00
}
.onebox-body .github-content-right {
2018-06-20 01:07:16 +08:00
margin-left: 100px;
2014-09-29 12:33:20 +08:00
}
2015-07-11 04:22:16 +08:00
2015-07-22 01:21:26 +08:00
//Onebox - Twitter - Status
aside.onebox.twitterstatus .onebox-body {
2018-06-20 01:07:16 +08:00
h4 {
margin-bottom: 0;
}
2015-07-22 01:21:26 +08:00
}
// thumbnail, oddly, ONLY applies to twitter avatar
2015-07-22 01:21:26 +08:00
.onebox.twitterstatus {
2018-06-20 01:07:16 +08:00
.thumbnail {
width: 48px;
height: 48px;
}
p,
.tweet {
white-space: pre-wrap;
padding-top: 3px;
margin-left: 70px;
}
.date {
clear: left;
padding-top: 10px;
}
2015-07-11 04:22:16 +08:00
}
// Onebox - Imgur - Album
.onebox.imgur-album {
2018-06-20 01:07:16 +08:00
.outer-box {
position: absolute;
z-index: z("base");
overflow: hidden;
font-size: $font-down-1;
color: #fff;
background-color: rgba(0, 0, 0, 0.6);
text-overflow: ellipsis;
max-width: 100%;
padding: 5px 0;
.inner-box {
padding-left: 10px;
padding-right: 10px;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: normal;
white-space: nowrap;
.album-title {
width: 100%;
font-size: $font-up-1;
line-height: $line-height-large;
color: #ccc;
text-decoration: none;
}
}
}
}
2015-11-03 21:41:15 +08:00
// resize stackexchange onebox image
2016-07-14 00:24:49 +08:00
aside.onebox.stackexchange .onebox-body {
2018-06-20 01:07:16 +08:00
img:not(.onebox-avatar) {
max-height: 60%;
max-width: 10%;
}
2016-07-14 00:24:49 +08:00
2018-06-20 01:07:16 +08:00
.tags {
color: gray;
}
2015-11-03 21:41:15 +08:00
}
2016-06-07 15:26:38 +08:00
.onebox-metadata {
2018-06-20 01:07:16 +08:00
color: dark-light-choose($primary-medium, $secondary-medium);
2016-06-07 15:26:38 +08:00
}
2016-11-28 22:14:59 +08:00
.onebox.xkcd .onebox-body {
2018-06-20 01:07:16 +08:00
img {
max-width: 100% !important;
float: none !important;
}
2016-11-28 22:14:59 +08:00
}
2017-02-08 14:38:41 +08:00
// pdf onebox
.onebox.pdf .onebox-body {
2018-06-20 01:07:16 +08:00
.pdf-onebox-logo {
width: 60px;
height: 50px;
float: left;
background: image-url("favicons/pdf_64px.png") no-repeat;
background-size: 48px 48px;
display: inline-block;
}
.filesize {
color: gray;
}
2017-02-08 14:38:41 +08:00
}
2017-11-01 18:14:00 +08:00
// whitelistedgeneric twitter labels
.onebox.whitelistedgeneric {
2018-06-20 01:07:16 +08:00
.label1,
.label2 {
color: dark-light-choose($primary-medium, $secondary-medium);
}
.label1 {
float: left;
}
.label2 {
float: right;
}
2018-02-12 23:39:52 +08:00
}
.onebox {
2018-06-20 01:07:16 +08:00
&.whitelistedgeneric,
&.gfycat {
.site-icon {
width: 16px;
height: 16px;
margin-right: 3px;
}
}
2018-02-12 23:39:52 +08:00
}
.onebox.gfycat p {
2018-06-20 01:07:16 +08:00
span.label1 a {
white-space: nowrap;
}
2017-11-01 18:14:00 +08:00
}
.onebox.instagram {
2018-06-20 01:07:16 +08:00
div.instagram-description {
color: dark-light-choose($primary-medium, $secondary-medium);
padding-top: 10px;
}
2018-03-18 23:52:05 +08:00
}
.onebox.githubcommit {
2018-06-20 01:07:16 +08:00
pre.message {
padding: 0;
}
}
.onebox.twitterstatus {
.like,
.retweet {
color: dark-light-choose($primary-medium, $secondary-medium);
padding-left: 10px;
svg {
fill: currentColor;
vertical-align: middle;
}
}
}
2017-02-08 14:38:41 +08:00
// mobile specific style
.mobile-view article.onebox-body {
2018-06-20 01:07:16 +08:00
border-top: none;
2017-02-08 14:38:41 +08:00
}
// Google Photos Album
.onebox.google-photos-album {
@extend .imgur-album;
}
// Force oneboxed videos to 16:9 aspect ratio
.onebox.video-onebox {
position: relative;
padding: 0 0 56.25% 0;
width: 100%;
video {
position: absolute;
width: 100%;
height: 100%;
}
}