1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

Merge branch 'master' into patrickhlauke-a11y-patch2

This commit is contained in:
Patrick H. Lauke
2021-09-18 17:47:59 +01:00
committed by GitHub
92 changed files with 4464 additions and 1533 deletions

View File

@@ -17,7 +17,6 @@ document.addEventListener('DOMContentLoaded', () => {
// delay 50ms so that we get proper body dimensions
setTimeout(load, 50);
function load() {
var closeButton = document.getElementById('close-button'),
@@ -34,10 +33,12 @@ document.addEventListener('DOMContentLoaded', () => {
if (bodyRect.width < 768) {
document.querySelector('#template-add .add-save').textContent = i18n.yes;
document.querySelector('#template-add .never-save').textContent = i18n.never;
document.querySelector('#template-add .select-folder').style.display = 'none';
document.querySelector('#template-change .change-save').textContent = i18n.yes;
} else {
document.querySelector('#template-add .add-save').textContent = i18n.notificationAddSave;
document.querySelector('#template-add .never-save').textContent = i18n.notificationNeverSave;
document.querySelector('#template-add .select-folder').style.display = 'initial';
document.querySelector('#template-change .change-save').textContent = i18n.notificationChangeSave;
}
@@ -52,8 +53,10 @@ document.addEventListener('DOMContentLoaded', () => {
addButton.addEventListener('click', (e) => {
e.preventDefault();
const folderId = document.querySelector('#template-add-clone .select-folder').value;
sendPlatformMessage({
command: 'bgAddSave'
command: 'bgAddSave',
folder: folderId,
});
});
@@ -63,6 +66,17 @@ document.addEventListener('DOMContentLoaded', () => {
command: 'bgNeverSave'
});
});
const responseFoldersCommand = 'notificationBarGetFoldersList';
chrome.runtime.onMessage.addListener((msg) => {
if (msg.command === responseFoldersCommand && msg.data) {
fillSelectorWithFolders(msg.data.folders);
}
});
sendPlatformMessage({
command: 'bgGetDataForTab',
responseCommand: responseFoldersCommand
});
} else if (getQueryVariable('change')) {
setContent(document.getElementById('template-change'));
var changeButton = document.querySelector('#template-change-clone .change-save');
@@ -120,4 +134,13 @@ document.addEventListener('DOMContentLoaded', () => {
function sendPlatformMessage(msg) {
chrome.runtime.sendMessage(msg);
}
function fillSelectorWithFolders(folders) {
const select = document.querySelector('#template-add-clone .select-folder');
select.appendChild(new Option(chrome.i18n.getMessage('selectFolder'), null, true));
folders.forEach((folder) => {
//Select "No Folder" (id=null) folder by default
select.appendChild(new Option(folder.name, folder.id || '', false));
});
}
});

View File

@@ -84,7 +84,7 @@ button.neutral {
}
body[class*='lang-en'] .add-buttons {
width: 175px;
width: 50px;
}
@media (min-width: 768px) {
@@ -98,3 +98,4 @@ body[class*='lang-en'] .add-buttons {
display: none;
}
}