質問編集履歴
3
補足情報追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -292,4 +292,6 @@
|
|
292
292
|
|
293
293
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
294
294
|
|
295
|
-
firefox developer edition
|
295
|
+
firefox developer edition 54.0a2
|
296
|
+
|
297
|
+
firefox 64bit 52.0
|
2
コードを編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -142,6 +142,12 @@
|
|
142
142
|
|
143
143
|
});
|
144
144
|
|
145
|
+
/* browser.windows.onCreated.addListener(() => {
|
146
|
+
|
147
|
+
});
|
148
|
+
|
149
|
+
browser.windows.onCreated.removeListener(newWindow); */
|
150
|
+
|
145
151
|
}
|
146
152
|
|
147
153
|
|
@@ -200,6 +206,74 @@
|
|
200
206
|
|
201
207
|
}
|
202
208
|
|
209
|
+
|
210
|
+
|
211
|
+
function getInfoForTab(tabs) {
|
212
|
+
|
213
|
+
if (tabs.length > 0) {
|
214
|
+
|
215
|
+
const gettingInfo = browser.tabs.get(tabs[0].id);
|
216
|
+
|
217
|
+
gettingInfo.then(onGot);
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
browser.pageAction.onClicked.addListener(() => {
|
226
|
+
|
227
|
+
const querying = browser.tabs.query({currentWindow: true, active: true});
|
228
|
+
|
229
|
+
querying.then(getInfoForTab);
|
230
|
+
|
231
|
+
});
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
function updateActiveTab(tabs) {
|
236
|
+
|
237
|
+
function onGot(tabInfo) {
|
238
|
+
|
239
|
+
const YouTubewatchURL = 'https://www.youtube.com/watch';
|
240
|
+
|
241
|
+
if (tabInfo.url.match(YouTubewatchURL)) {
|
242
|
+
|
243
|
+
browser.pageAction.show(tabs);
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
const gettingInfo = browser.tabs.get(tabs);
|
250
|
+
|
251
|
+
gettingInfo.then(onGot);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
// listen to tab URL changes
|
256
|
+
|
257
|
+
browser.tabs.onUpdated.addListener((tabId, changeInfo) => {
|
258
|
+
|
259
|
+
if (changeInfo.status === 'complete') {
|
260
|
+
|
261
|
+
console.log(tabId);
|
262
|
+
|
263
|
+
updateActiveTab(tabId);
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
});
|
268
|
+
|
269
|
+
// listen to tab switching
|
270
|
+
|
271
|
+
browser.tabs.onActivated.addListener((activeInfo) => {
|
272
|
+
|
273
|
+
updateActiveTab(activeInfo.tabId);
|
274
|
+
|
275
|
+
});
|
276
|
+
|
203
277
|
```
|
204
278
|
|
205
279
|
新しいウインドウのhtmlが読み込んでるjs
|
1
manifest\.jsonを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,6 +48,74 @@
|
|
48
48
|
|
49
49
|
###該当のソースコード
|
50
50
|
|
51
|
+
manifest.json
|
52
|
+
|
53
|
+
```json
|
54
|
+
|
55
|
+
{
|
56
|
+
|
57
|
+
"manifest_version": 2,
|
58
|
+
|
59
|
+
"name": "YouTube Popup Panel",
|
60
|
+
|
61
|
+
"version": "1.2",
|
62
|
+
|
63
|
+
"applications": {
|
64
|
+
|
65
|
+
"gecko": {
|
66
|
+
|
67
|
+
"id": "YouTube-Popup-Panel@nekojiro.net"
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
},
|
72
|
+
|
73
|
+
"description": "__MSG_extensionDescription__",
|
74
|
+
|
75
|
+
"default_locale": "en",
|
76
|
+
|
77
|
+
"background": {
|
78
|
+
|
79
|
+
"scripts": ["YouTube-background.js"]
|
80
|
+
|
81
|
+
},
|
82
|
+
|
83
|
+
"page_action": {
|
84
|
+
|
85
|
+
"default_icon": "icons/page-32.png",
|
86
|
+
|
87
|
+
"default_title": "Popup"
|
88
|
+
|
89
|
+
},
|
90
|
+
|
91
|
+
"icons": {
|
92
|
+
|
93
|
+
"48": "icons/page-48.png",
|
94
|
+
|
95
|
+
"64": "icon/page-64.png"
|
96
|
+
|
97
|
+
},
|
98
|
+
|
99
|
+
"permissions": [
|
100
|
+
|
101
|
+
"storage",
|
102
|
+
|
103
|
+
"tabs"
|
104
|
+
|
105
|
+
],
|
106
|
+
|
107
|
+
"options_ui": {
|
108
|
+
|
109
|
+
"page": "options/options.html"
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
|
118
|
+
|
51
119
|
background
|
52
120
|
|
53
121
|
```javascript
|