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

Commit 48b5522

Browse files
committed
1.6.1
1 parent 04b83a1 commit 48b5522

13 files changed

+5820
-1
lines changed

dist/_locales/en/messages.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

dist/background.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
(function () {
2+
'use strict';
3+
4+
/* eslint-disable import/prefer-default-export */
5+
const CHANNEL_MESSAGE = {
6+
CONTENT_IS_MATTERMOST: "TAB_IS_MATTERMOST"
7+
};
8+
9+
const ports = [];
10+
chrome.runtime.onConnect.addListener(port => {
11+
if (port.name !== "mattermost-uno") return;
12+
ports[port.sender.tab.id] = port; // eslint-disable-next-line no-shadow
13+
14+
port.onDisconnect.addListener(port => {
15+
const tabId = port.sender.tab.id;
16+
delete ports[tabId];
17+
chrome.browserAction.setTitle({
18+
tabId,
19+
title: "Enable Mattermost Uno"
20+
});
21+
chrome.browserAction.setIcon({
22+
tabId,
23+
path: "icons/icon-32x32-bw.png"
24+
});
25+
}); // eslint-disable-next-line no-shadow
26+
27+
port.onMessage.addListener((message, port) => {
28+
const tabId = port.sender.tab.id;
29+
30+
switch (message.value) {
31+
case CHANNEL_MESSAGE.CONTENT_IS_MATTERMOST:
32+
chrome.browserAction.setTitle({
33+
tabId,
34+
title: "Disable Mattermost Uno"
35+
});
36+
chrome.browserAction.setIcon({
37+
tabId,
38+
path: "icons/icon-32x32.png"
39+
});
40+
break;
41+
42+
default:
43+
console.error("Something went wrong.");
44+
}
45+
});
46+
});
47+
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
48+
const {
49+
status
50+
} = changeInfo;
51+
if (status !== "complete") return;
52+
const {
53+
url
54+
} = tab;
55+
if (url === undefined || !url.includes("mattermost")) return;
56+
57+
if (ports[tabId] === undefined) {
58+
chrome.tabs.insertCSS(tabId, {
59+
file: "content.css"
60+
});
61+
chrome.tabs.executeScript(tabId, {
62+
file: "content.js"
63+
});
64+
}
65+
});
66+
67+
}());

dist/content.css

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.post-list-holder-by-time .post.post--comment {
2+
display: none;
3+
}
4+
5+
.MattermostUno-counter {
6+
align-items: baseline;
7+
background-color: rgba(0, 0, 0, 0.05);
8+
border: solid 1px rgba(0, 0, 0, 0.1);
9+
border-radius: 0.5rem;
10+
cursor: pointer;
11+
display: flex;
12+
font-size: 1.2rem;
13+
margin: 0.5rem 0 0.6rem;
14+
max-width: 600px;
15+
padding: 0.4rem 0.75rem 0.35rem;
16+
}
17+
body.MattermostUno--dark .MattermostUno-counter {
18+
background-color: rgba(0, 0, 0, 0.1);
19+
border: solid 1px rgba(255, 255, 255, 0.1);
20+
}
21+
.MattermostUno-counter:hover {
22+
background-color: rgba(0, 0, 0, 0.1);
23+
border: solid 1px rgba(0, 0, 0, 0.25);
24+
}
25+
body.MattermostUno--dark .MattermostUno-counter:hover {
26+
background-color: rgba(0, 0, 0, 0.25);
27+
border: solid 1px rgba(255, 255, 255, 0.5);
28+
}
29+
30+
.MattermostUno-counterAuthors {
31+
margin-right: 0.25rem;
32+
}
33+
.MattermostUno-counterAuthors > img {
34+
border-radius: 0.25rem;
35+
height: 2rem;
36+
margin-right: 0.5rem;
37+
width: 2rem;
38+
}
39+
40+
.MattermostUno-counterLink {
41+
color: rgb(17, 83, 171) !important;
42+
font-weight: 700;
43+
margin-left: 0.25rem;
44+
}
45+
body.MattermostUno--dark .MattermostUno-counterLink {
46+
color: #f1f200 !important;
47+
}
48+
49+
.MattermostUno-counterDescription {
50+
flex-grow: 1;
51+
margin-left: 1rem;
52+
position: relative;
53+
}
54+
.MattermostUno-counterDescriptionOff {
55+
opacity: 0.8;
56+
transition: opacity 0.2s;
57+
}
58+
.MattermostUno-counter:hover .MattermostUno-counterDescriptionOff {
59+
opacity: 0;
60+
}
61+
.MattermostUno-counterDescriptionOn {
62+
bottom: 0;
63+
left: 0;
64+
opacity: 0;
65+
overflow: hidden;
66+
position: absolute;
67+
right: 0;
68+
text-overflow: ellipsis;
69+
top: 0;
70+
transition: opacity 0.2s;
71+
white-space: nowrap;
72+
}
73+
.MattermostUno-counter:hover .MattermostUno-counterDescriptionOn {
74+
opacity: 0.8;
75+
}
76+
77+
.MattermostUno-counterIcon {
78+
color: transparent;
79+
margin: 0 0 0.45rem;
80+
}
81+
.MattermostUno-counter:hover .MattermostUno-counterIcon {
82+
color: rgb(44, 44, 44);
83+
}
84+
body.MattermostUno--dark .MattermostUno-counter:hover .MattermostUno-counterIcon {
85+
color: rgb(211, 211, 211);
86+
}

0 commit comments

Comments
 (0)