Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Sep 9, 2019
1 parent bd35c8b commit 94463af
Show file tree
Hide file tree
Showing 13 changed files with 5,797 additions and 1 deletion.
1 change: 1 addition & 0 deletions dist/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
67 changes: 67 additions & 0 deletions dist/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
(function () {
'use strict';

/* eslint-disable import/prefer-default-export */
const CHANNEL_MESSAGE = {
CONTENT_IS_MATTERMOST: "TAB_IS_MATTERMOST"
};

const ports = [];
chrome.runtime.onConnect.addListener(port => {
if (port.name !== "mattermost-uno") return;
ports[port.sender.tab.id] = port; // eslint-disable-next-line no-shadow

port.onDisconnect.addListener(port => {
const tabId = port.sender.tab.id;
delete ports[tabId];
chrome.browserAction.setTitle({
tabId,
title: "Enable Mattermost Uno"
});
chrome.browserAction.setIcon({
tabId,
path: "icons/icon-32x32-bw.png"
});
}); // eslint-disable-next-line no-shadow

port.onMessage.addListener((message, port) => {
const tabId = port.sender.tab.id;

switch (message.value) {
case CHANNEL_MESSAGE.CONTENT_IS_MATTERMOST:
chrome.browserAction.setTitle({
tabId,
title: "Disable Mattermost Uno"
});
chrome.browserAction.setIcon({
tabId,
path: "icons/icon-32x32.png"
});
break;

default:
console.error("Something went wrong.");
}
});
});
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
const {
status
} = changeInfo;
if (status !== "complete") return;
const {
url
} = tab;
if (url === undefined || !/^https:\/\/([^/]+\.mattermost|mattermost\.[^/]+|[^/]+\.mattermost\.[^/]+)/.test(url)) return;

if (ports[tabId] === undefined) {
chrome.tabs.insertCSS(tabId, {
file: "content.css"
});
chrome.tabs.executeScript(tabId, {
file: "content.js"
});
}
});

}());
91 changes: 91 additions & 0 deletions dist/content.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.post-list-holder-by-time .post.post--root .post__body {
padding-bottom: 3.75rem;
}
.post-list-holder-by-time .post.post--comment {
display: none;
}

.MattermostUno-counter {
align-items: baseline;
background-color: rgba(0, 0, 0, 0.05);
border: solid 1px rgba(0, 0, 0, 0.1);
border-radius: 0.5rem;
cursor: pointer;
display: flex;
font-size: 1.2rem;
line-height: 1.7;
margin: -3.25rem 0 0 0.5rem;
width: 600px;
padding: 0.25rem 1rem 0.35rem 0.45rem;
position: absolute;
}
body.MattermostUno--dark .MattermostUno-counter {
background-color: rgba(0, 0, 0, 0.1);
border: solid 1px rgba(255, 255, 255, 0.1);
}
.MattermostUno-counter:hover {
background-color: rgba(0, 0, 0, 0.1);
border: solid 1px rgba(0, 0, 0, 0.25);
}
body.MattermostUno--dark .MattermostUno-counter:hover {
background-color: rgba(0, 0, 0, 0.25);
border: solid 1px rgba(255, 255, 255, 0.5);
}

.MattermostUno-counterAuthors {
margin-right: 0.25rem;
}
.MattermostUno-counterAuthors > img {
border-radius: 0.25rem;
height: 2rem;
margin-right: 0.5rem;
width: 2rem;
}

.MattermostUno-counterLink {
color: rgb(17, 83, 171) !important;
font-weight: 700;
margin-left: 0.25rem;
}
body.MattermostUno--dark .MattermostUno-counterLink {
color: #f1f200 !important;
}

.MattermostUno-counterDescription {
flex-grow: 1;
margin-left: 1rem;
position: relative;
}
.MattermostUno-counterDescriptionOff {
opacity: 0.8;
transition: opacity 0.2s;
}
.MattermostUno-counter:hover .MattermostUno-counterDescriptionOff {
opacity: 0;
}
.MattermostUno-counterDescriptionOn {
bottom: 0;
left: 0;
opacity: 0;
overflow: hidden;
position: absolute;
right: 0;
text-overflow: ellipsis;
top: 0;
transition: opacity 0.2s;
white-space: nowrap;
}
.MattermostUno-counter:hover .MattermostUno-counterDescriptionOn {
opacity: 0.8;
}

.MattermostUno-counterIcon {
color: transparent;
margin: 0 0 0.45rem;
}
.MattermostUno-counter:hover .MattermostUno-counterIcon {
color: rgb(44, 44, 44);
}
body.MattermostUno--dark .MattermostUno-counter:hover .MattermostUno-counterIcon {
color: rgb(211, 211, 211);
}
Loading

0 comments on commit 94463af

Please sign in to comment.