Jquery 插件中Chrome图标中的Twitch数字在线拖缆

Jquery 插件中Chrome图标中的Twitch数字在线拖缆,jquery,google-chrome,google-chrome-extension,twitch,Jquery,Google Chrome,Google Chrome Extension,Twitch,我想在Chrome中创建插件。我几乎做了所有我想做的,除了Chrome插件图标中的在线拖缆数量 我把文本“检查” 但我想在这里看到拖缆的在线数量,或者如果拖缆中有人在线,则会显示文本“On” 有人能帮我吗 将文本放在该位置是代码: 在.js复制行中: chrome.browserAction.setBadgeText({text:'On'}) 我试着这样想: popup.js var clientID = 'API-KEY'; var baseKraken = 'https://api.twi

我想在Chrome中创建插件。我几乎做了所有我想做的,除了Chrome插件图标中的在线拖缆数量

我把文本“检查”

但我想在这里看到拖缆的在线数量,或者如果拖缆中有人在线,则会显示文本“On”

有人能帮我吗

将文本放在该位置是代码: 在.js复制行中:

chrome.browserAction.setBadgeText({text:'On'})

我试着这样想:

popup.js

var clientID = 'API-KEY';
var baseKraken = 'https://api.twitch.tv/kraken/';

function getKrakenAPI(endpoint, data, method) {
    return $.ajax({
            url: baseKraken + endpoint,
            method: method,
            data: data,
            dataType: 'json',
            headers: {
                'Client-ID': clientID,
                Accept: 'application/vnd.twitchtv.v5+json'
            }
        });
}

getKrakenAPI(
        'streams',
        {
            channel: [ 'ivelios_christopher', 'esl_sc2' ]
        }
    )
.done(function(data) {
        if(data._total > 0) {

    chrome.browserAction.setBadgeText( { text: "On" } );

        }
    });
但是由于某些原因,这不起作用,有什么建议/帮助吗

manifest.json

{
  "name": "My Bookmarks",
  "version": "1.1",
  "description": "A browser action with a popup dump of all bookmarks, including search, add, edit and delete.",
  "permissions": [
    "bookmarks",
        "*://*.twitch.tv/*"
  ],
  "browser_action": {
      "default_title": "My Bookmarks",
      "default_icon": "icon.png",
      "default_popup": "popup.html"
  },
  "manifest_version": 2,
  "content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'",
"background":
{
    "scripts":["jquery-3.2.1.min.js"],
  "scripts":["popup.js"]

}
}
popup.html

    <html>
    <head>
<script src="jquery-3.2.1.min.js"></script>
      <script src="popup.js"></script>

    </head>
    <body>
      <iframe src="#" height="550" width="600" frameborder="0"></iframe>
    </body>
    </html>

谢谢

最好的,
Ivelios

I编辑问题。通过调试弹出窗口来检查控制台中是否存在任何错误:右键单击它,然后检查,或者简单地将弹出窗口作为一个普通选项卡打开:
chrome-extension://ID/popup.html
(用扩展ID替换ID)。我有一些错误;我在manifest.json和popup.html中添加了jquery-3.2.1.min.js localhost,同样的错误。我更改了它。新错误:
uncaughttypeerror:getKrakenAPI(…)。成功不是popup.js:23的函数。