diff --git a/app/assets/images/favicons/amazon.png b/app/assets/images/favicons/amazon.png deleted file mode 100644 index b2ef6045ee1..00000000000 Binary files a/app/assets/images/favicons/amazon.png and /dev/null differ diff --git a/app/assets/images/favicons/apple.png b/app/assets/images/favicons/apple.png deleted file mode 100644 index da6b59f17f2..00000000000 Binary files a/app/assets/images/favicons/apple.png and /dev/null differ diff --git a/app/assets/images/favicons/github.png b/app/assets/images/favicons/github.png deleted file mode 100644 index d19beac3d0c..00000000000 Binary files a/app/assets/images/favicons/github.png and /dev/null differ diff --git a/app/assets/images/favicons/rottentomatoes.png b/app/assets/images/favicons/rottentomatoes.png deleted file mode 100644 index acd019cad32..00000000000 Binary files a/app/assets/images/favicons/rottentomatoes.png and /dev/null differ diff --git a/app/assets/images/favicons/twitter.png b/app/assets/images/favicons/twitter.png deleted file mode 100644 index d46388dc360..00000000000 Binary files a/app/assets/images/favicons/twitter.png and /dev/null differ diff --git a/app/assets/images/favicons/wikipedia.png b/app/assets/images/favicons/wikipedia.png deleted file mode 100644 index 050c5df90c7..00000000000 Binary files a/app/assets/images/favicons/wikipedia.png and /dev/null differ diff --git a/app/assets/javascripts/discourse/app/initializers/post-decorations.js b/app/assets/javascripts/discourse/app/initializers/post-decorations.js index 8d59d50a4bf..0eacb93d0b4 100644 --- a/app/assets/javascripts/discourse/app/initializers/post-decorations.js +++ b/app/assets/javascripts/discourse/app/initializers/post-decorations.js @@ -1,5 +1,6 @@ import highlightSyntax from "discourse/lib/highlight-syntax"; import lightbox from "discourse/lib/lightbox"; +import { iconHTML } from "discourse-common/lib/icon-library"; import { setTextDirections } from "discourse/lib/text-direction"; import { setupLazyLoading } from "discourse/lib/lazy-load-images"; import { withPluginApi } from "discourse/lib/plugin-api"; @@ -75,6 +76,33 @@ export default { { id: "safari-video-poster", afterAdopt: true, onlyStream: true } ); } + + const oneboxTypes = { + amazon: "discourse-amazon", + githubblob: "fab-github", + githubcommit: "fab-github", + githubpullrequest: "fab-github", + githubissue: "fab-github", + githubfile: "fab-github", + githubgist: "fab-github", + twitterstatus: "fab-twitter", + wikipedia: "fab-wikipedia-w", + }; + + api.decorateCookedElement( + (elem) => { + elem.querySelectorAll(".onebox").forEach((onebox) => { + Object.entries(oneboxTypes).forEach(([key, value]) => { + if (onebox.classList.contains(key)) { + onebox + .querySelector(".source") + .insertAdjacentHTML("afterbegin", iconHTML(value)); + } + }); + }); + }, + { id: "onebox-source-icons" } + ); }); }, }; diff --git a/app/assets/stylesheets/common/base/onebox.scss b/app/assets/stylesheets/common/base/onebox.scss index b8c0a81bbaa..29eb1a03e0c 100644 --- a/app/assets/stylesheets/common/base/onebox.scss +++ b/app/assets/stylesheets/common/base/onebox.scss @@ -105,6 +105,15 @@ aside.onebox { display: flex; margin-bottom: 1em; + .d-icon { + margin-right: 5px; + margin-top: 2px; + + &.d-icon-fab-twitter { + color: var(--twitter); + } + } + a[href] { color: var(--primary-med-or-secondary-med); text-decoration: none; @@ -112,15 +121,6 @@ aside.onebox { } @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("githubfile", "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"); @include onebox-favicon("googledrive", "google_branding/logo_drive_48px"); diff --git a/lib/svg_sprite/svg_sprite.rb b/lib/svg_sprite/svg_sprite.rb index 9a2d18b9831..d8b5ee74704 100644 --- a/lib/svg_sprite/svg_sprite.rb +++ b/lib/svg_sprite/svg_sprite.rb @@ -31,7 +31,6 @@ module SvgSprite "book", "book-reader", "bookmark", - "discourse-bookmark-clock", "briefcase", "calendar-alt", "caret-down", @@ -58,9 +57,11 @@ module SvgSprite "crosshairs", "cube", "desktop", + "discourse-amazon", "discourse-bell-exclamation", "discourse-bell-one", "discourse-bell-slash", + "discourse-bookmark-clock", "discourse-compress", "discourse-expand", "download", @@ -85,6 +86,7 @@ module SvgSprite "fab-linux", "fab-twitter", "fab-twitter-square", + "fab-wikipedia-w", "fab-windows", "far-bell", "far-bell-slash", diff --git a/vendor/assets/svg-icons/discourse-additional.svg b/vendor/assets/svg-icons/discourse-additional.svg index 343b5b6abce..0ffba1b76ec 100644 --- a/vendor/assets/svg-icons/discourse-additional.svg +++ b/vendor/assets/svg-icons/discourse-additional.svg @@ -27,4 +27,9 @@ Additional SVG icons + + + + +