This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.

32 lines
1.1 KiB
JavaScript
Raw Normal View History

chrome.storage.sync.get(['show_mode','simple_mode','true_mode','auto_mode'], function(items) {
var choise=items['show_mode'];
if(choise == undefined) choise = true;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
else chrome.browserAction.setBadgeText({text: "off"});
choise=items['simple_mode'];
if(choise == undefined) choise = false;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
choise=items['true_mode'];
if(choise == undefined) choise = false;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
choise=items['auto_mode'];
if(choise == undefined) choise = false;
if(choise) chrome.browserAction.setBadgeText({text: "on"});
});
//Создать контекстное меню
chrome.contextMenus.create({"title": "Показать ответы","onclick" : show});
//Показать ответы
function show(info) {
var url = info.pageUrl;
var url_ = "www.cambridgelms.org";
if(JSON.stringify(url).includes(url_))
{
var query = { active: true, currentWindow: true };
chrome.tabs.query(query, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {command: "show"});
});
}
}