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

Commit

Permalink
Merge pull request #57 from blue0513/feature/fix-css
Browse files Browse the repository at this point in the history
Fix/fix-css
  • Loading branch information
blue0513 authored Aug 6, 2019
2 parents 308567f + 8301908 commit 453c6f7
Showing 1 changed file with 17 additions and 33 deletions.
50 changes: 17 additions & 33 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ function initialize() {
webview.addEventListener('dom-ready', function() {
initializeWebview(webview, contents[index]['channel']);
});
webview.addEventListener('page-title-updated', function() {
const channelName = getChannelName(webview);
updateChannelNameIfNeeded(channelName, index);
});
});
}
function initializeMenu(template) {
Expand Down Expand Up @@ -108,16 +104,6 @@ function getOtherWorkspacesInfo(other_urls) {
});
return nameAndUrls;
}
function getChannelNameFromTitle(webview) {
const pageTitle = webview.getTitle();
const titleElements = pageTitle.split(' ');

if (titleElements.length == 4) return titleElements[0];
return null;
}
function getChannelName(webview) {
return getChannelNameFromTitle(webview);
}
function getWebviews() {
return Array.from(document.getElementsByTagName('webview'));
}
Expand Down Expand Up @@ -152,20 +138,27 @@ function initializeWebviewForAnotherWorkspace(webview, workspaceUrl) {
}
}
function getOnlySidebarCss() {
const disableChannelList = '.client_channels_list_container { display: none !important; }';
const disableBody = '#col_messages { display: none !important; }';
const disableHeader = '.messages_header { display: none !important; }';
return disableChannelList + disableBody + disableHeader;
const disableChannelList = '.p-workspace__sidebar { display: none !important; }';
const widenSidebar = '.p-workspace--context-pane-expanded { grid-template-columns: 0px auto 100% !important; }';
const disableTeamHeader = '.p-classic_nav__team_header { display: none !important; }';
const disableChannelHeader = '.p-classic_nav__channel_header { display: none !important; }';
const disableBody = '.p-workspace__primary_view { display: none !important; }';
return disableChannelList + widenSidebar+ disableTeamHeader + disableChannelHeader + disableBody;
}
function getOnlyChannelCss() {
const disableBody = '.client_main_container { display: none !important; }';
return disableBody;
const disableBody = '.p-workspace__primary_view { display: none !important; }';
const disableChannelHeader = '.p-classic_nav__channel_header { display: none !important; }';
const disableRightHeader = '.p-classic_nav__right_header { display: none !important; }';
const disableSidebar = '.p-workspace__secondary_view { display: none !important; }';
return disableBody + disableChannelHeader + disableRightHeader + disableSidebar;
}
function getOnlyBodyCss() {
const disableChannelList = '.client_channels_list_container { display: none !important; }';
const disableHeader = '#client_header { display: none !important; }';
const widenBody = '#col_messages { width 100% !important; }';
return disableChannelList + disableHeader + widenBody;
const disableChannelList = '.p-workspace__sidebar { display: none !important; }';
const disableTeamHeader = '.p-classic_nav__team_header { display: none !important; }';
const widenBody = '.p-workspace--context-pane-collapsed { grid-template-columns: 0px auto !important; }';
const adjustHeight = '.p-workspace--classic-nav { grid-template-rows: min-content 60px auto !important; }'
const adjustLeftPadding = '.p-workspace--context-pane-expanded { grid-template-columns: 0px auto !important; }';
return disableChannelList + widenBody + adjustHeight + disableTeamHeader + adjustLeftPadding;
}
function addKeyEvents(webview) {
webview.getWebContents().on('before-input-event', (event, input) => {
Expand All @@ -177,7 +170,6 @@ function addKeyEvents(webview) {
function opendev() {
const webviews = getWebviews();
let webview = webviews[1];
webview.goBack();
webview.openDevTools();
}
function reload(index) {
Expand All @@ -203,10 +195,6 @@ function add() {
webview.addEventListener('dom-ready', function() {
initializeWebview(webview, channel);
});
webview.addEventListener('page-title-updated', function() {
const channelName = getChannelName(webview);
updateChannelNameIfNeeded(channelName, index);
});
}
function updateChannelNameIfNeeded(channelName, index) {
if (!channelName) return;
Expand All @@ -229,10 +217,6 @@ function loadWorkspace(workspaceUrl) {
webview.addEventListener('dom-ready', function() {
initializeWebviewForAnotherWorkspace(webview, workspaceUrl);
});
webview.addEventListener('page-title-updated', function() {
const channelName = getChannelName(webview);
updateChannelNameIfNeeded(channelName, index);
});
}
function addButtons(div, index) {
let divForButtons = div.children[0];
Expand Down

0 comments on commit 453c6f7

Please sign in to comment.