Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import browser from 'webextension-polyfill';
const getText = browser.i18n.getMessage;
async function createTab(
url,
{index = null, active = true, openerTabId = null} = {}
) {
const props = {url, active};
if (index !== null) {
props.index = index;
}
if (
openerTabId !== null &&
openerTabId !== browser.tabs.TAB_ID_NONE &&
!(await isAndroid())
) {
props.openerTabId = openerTabId;
}
function globalToggleForm ({ active, onOptionChange }) {
const toggle = onOptionChange('active')
return html`
<form class="dib mb3">
<label class="dib pa3 flex items-center pointer ${!active ? 'charcoal bg-gray-muted br2' : ''}" for="active">
${switchToggle({ id: 'active', checked: active, onchange: toggle, style: 'mr3' })}
${browser.i18n.getMessage('panel_headerActiveToggleTitle')}
</label>
</form>
`
}
getOpenButtonTitle = () => {
const defaultBehavior = getSettings("openButtonBehavior");
switch (defaultBehavior) {
case "openInNewWindow":
return browser.i18n.getMessage("openInNewWindowLabel");
case "openInCurrentWindow":
return browser.i18n.getMessage("openInCurrentWindowLabel");
case "addToCurrentWindow":
return browser.i18n.getMessage("addToCurrentWindowLabel");
default:
return "";
}
};
import browser from 'webextension-polyfill';
import Bowser from 'bowser';
import {targetEnv} from 'utils/config';
const getText = browser.i18n.getMessage;
function createTab(
url,
{index = null, active = true, openerTabId = null} = {}
) {
const props = {url, active};
if (index !== null) {
props.index = index;
}
if (openerTabId !== null && ['chrome', 'opera'].includes(targetEnv)) {
props.openerTabId = openerTabId;
}
return browser.tabs.create(props);
}
async function isAndroid() {
function returnFileName(sessions) {
log.log(logDir, "returnFileName()", sessions);
const sessionLabel = browser.i18n.getMessage("sessionLabel").toLowerCase();
const sessionsLabel = browser.i18n.getMessage("sessionsLabel").toLowerCase();
let fileName = `${moment().format(getSettings("dateFormat"))} (${sessions.length} ${
sessions.length == 1 ? sessionLabel : sessionsLabel
})`;
const pattern = /\\|\/|\:|\?|\.|"|<|>|\|/g;
fileName = fileName.replace(pattern, "-");
return fileName;
}
const updateAutoName = () => {
for (let i in sessions) {
if (sessions[i].tag.includes("winClose")) {
if (sessions[i].name === "Auto Saved - Window was closed")
sessions[i].name = browser.i18n.getMessage("winCloseSessionName");
} else if (sessions[i].tag.includes("regular")) {
if (sessions[i].name === "Auto Saved - Regularly")
sessions[i].name = browser.i18n.getMessage("regularSaveSessionName");
}
}
};
updateTags();
closeEditor()
},
[closeEditor, createBookmarkAfterId, editBookmark, isCreating, targetId],
)
return (
<>
export default props => {
const { category, elements } = props;
return (
<li>
<fieldset>
<legend>
<p>
{category !== "" ? browser.i18n.getMessage(category) : ""}
</p>
</legend>
<ul>
{elements.map((option, index) => (
<div>
{option.hasOwnProperty("childElements") ? (
<ul>
{option.childElements.map((option, index) => (
))}
</ul>
) : (
""
)}
</div></ul></fieldset></li>
t(key, params) {
const s = browser.i18n.getMessage(key, params)
return s || key;
},
getDomain(url) {
optionValue={optionValue}
updatePartialOptions={props.updatePartialOptions}
/>,
]
}
return acc
},
[],
)}
)