I am currently in the process of converting my AddOn from Manifet'st V2 to V3.
Unfortunately, my context menu entry is missing and I've been searching the net for ages - but I can't find my error.
//Im Fall einer Neuinstallation initiale Optionswerte setzen
chrome.runtime.onInstalled.addListener(function(details) {
//if (details.reason == "install" || details.reason =="update" ) {
if (details.reason == "install") {
chrome.storage.sync.get('SiteBarSyncronisieren', function(val) {
if (val['SiteBarSyncronisieren']=="1") {
chrome.storage.sync.get('SiteBarURL', function(val) {localStorage.SiteBarURL = val['SiteBarURL'];});
chrome.storage.sync.get('SiteBarWidth', function(val) {localStorage.SiteBarWidth = val['SiteBarWidth'];});
chrome.storage.sync.get('SiteBarHeight', function(val) {localStorage.SiteBarHeight = val['SiteBarHeight'];});
chrome.storage.sync.get('SiteBarUser', function(val) {localStorage.SiteBarUser = val['SiteBarUser'];});
chrome.storage.sync.get('SiteBarPassword', function(val) {localStorage.SiteBarPassword = val['SiteBarPassword'];});
chrome.storage.sync.get('SiteBarSyncronisieren', function(val) {localStorage.SiteBarSyncronisieren = "1";});
}
else {
localStorage.SiteBarURL= "
http://my.sitebar.org";
localStorage.SiteBarWidth= "800";
localStorage.SiteBarHeight= "600";
localStorage.SiteBarUser = "";
localStorage.SiteBarPassword= "";
localStorage.SiteBarSyncronisieren = "0";
};
}
);
};
}
);
//Contextmenü Eintrag anlegen
chrome.contextMenus.removeAll();
chrome.contextMenus.create({
"title": chrome.i18n.getMessage("Contextmenu"),
"id": "AddSitebar",
"contexts": ['all']
});
function contextClick(info, tab) {
const { menuItemId } = info
if (menuItemId === 'AddSitebar') {
popup();
}
};
chrome.contextMenus.onClicked.addListener(contextClick);
//Bei Start einmal Login in background.html Iframe laden damit Cookie gesetzt wird
chrome.runtime.onStartup.addListener(function() {
var url=localStorage.SiteBarURL +"/command.php?command=Log%20In";
var ifrm=document.getElementById("SiteBarFrame");
ifrm.setAttribute("src", url);
});
function popup() {
chrome.tabs.getSelected(chrome.windows.WINDOW_ID_CURRENT, function(tab) {
var target=tab.url;
var url=localStorage.SiteBarURL;
url = url + "/command.php?command=Add%20Link&url=" + escape(target);
var w = 400;
var h = 500;
var l = (screen.width/2)-(w/2);
var t= (screen.height/2)-(h/2);
chrome.windows.create({url: url,
type: "popup",
width: w,
height: h,
top: t,
left: l
}
);
});
};