Use chrome

This commit is contained in:
Sebastian Sauer 2023-07-31 22:11:50 +02:00
parent ac6dde4919
commit 780a81e374

@ -10,8 +10,6 @@ const stickyNoteIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448
const featherIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M278.5 215.6L23 471c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l57-57h68c49.7 0 97.9-14.4 139-41c11.1-7.2 5.5-23-7.8-23c-5.1 0-9.2-4.1-9.2-9.2c0-4.1 2.7-7.6 6.5-8.8l81-24.3c2.5-.8 4.8-2.1 6.7-4l22.4-22.4c10.1-10.1 2.9-27.3-11.3-27.3l-32.2 0c-5.1 0-9.2-4.1-9.2-9.2c0-4.1 2.7-7.6 6.5-8.8l112-33.6c4-1.2 7.4-3.9 9.3-7.7C506.4 207.6 512 184.1 512 160c0-41-16.3-80.3-45.3-109.3l-5.5-5.5C432.3 16.3 393 0 352 0s-80.3 16.3-109.3 45.3L139 149C91 197 64 262.1 64 330v55.3L253.6 195.8c6.2-6.2 16.4-6.2 22.6 0c5.4 5.4 6.1 13.6 2.2 19.8z"/></svg>`;
/** End of font awesome icons */
const browser = window.browser ?? window.chrome;
const semanticLabels = {
praise: {
icon: trophyIcon,
@ -67,7 +65,7 @@ const fillTextAreaValue = (textarea, value, emptySubject = true) => {
const semanticButtonClickHandler = (e, {textarea, label, blocking}) => {
e.preventDefault();
const semanticComment = semanticCommentStructure
.replace('%text', browser.i18n.getMessage(label))
.replace('%text', chrome.i18n.getMessage(label))
.replace('%decoration', (blocking ? '' : ' (non-blocking)'));
const cleanedValue = textarea.value.replace(
/\*\*.+(\s\(non-blocking\))?:\*\*\s?/,
@ -90,8 +88,8 @@ const semanticButtonClickHandler = (e, {textarea, label, blocking}) => {
const buttonGenerator = (textarea, parent, label, blocking) => {
const button = document.createElement('button');
const semLabel = semanticLabels[label];
const name = browser.i18n.getMessage(label);
const description = browser.i18n.getMessage(label+'Description', name);
const name = chrome.i18n.getMessage(label);
const description = chrome.i18n.getMessage(label+'Description', name);
button.setAttribute('data-tooltip-content', description);
const parser = new DOMParser();
const doc = parser.parseFromString(semLabel.icon, 'image/svg+xml');