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

Commit 93f4f81

Browse files
committed
1.9.0
1 parent 8ae5bb3 commit 93f4f81

13 files changed

+5815
-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: "Mattermost Uno is disabled on this site."
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: "Mattermost Uno is running on this site."
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 || !/^https:\/\/([^/]+\.mattermost|mattermost\.[^/]+|[^/]+\.mattermost\.[^/]+)/.test(url)) 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

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

0 commit comments

Comments
 (0)