This repository has been archived by the owner on Oct 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2634fcf
commit 23d9dd7
Showing
13 changed files
with
5,820 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
}); | ||
} | ||
}); | ||
|
||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
.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; | ||
margin: 0.5rem 0 0.6rem; | ||
max-width: 600px; | ||
padding: 0.4rem 0.75rem 0.35rem; | ||
} | ||
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); | ||
} |
Oops, something went wrong.