javascript - chrome extension right context menus -
below code google chrome extension. beginner it. trying append result div of pop html. nothing appended. , if click context menu multiple times, right context menu created multiple times. when open extension pop console, pop appear, otherwise, won's. confused. can me out?
chrome.contextmenus.create({ "title": "my extension", "contexts": [ "page" ,"selection"], }) function parser(article, key, threadshold){ console.log(article); var ret = "<div>" + key + ": "; var res = json.parse(article)["results"]; var keywords = res[key]["results"][0]; console.log(keywords); var sortable = []; (var keyword in keywords){ sortable.push([keyword, keywords[keyword]]) } sortable.sort(function(a,b) {return b[1] - a[1]}) (var item in sortable){ console.log(sortable[item][1]); $("#keywords").append("<tr> <td>" + sortable[item][0]); window.show("popup.html"); } }
Comments
Post a Comment