123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- "use strict";
- (function PageActionClosure() {
-
- function showPageAction(tabId, displayUrl) {
-
-
- var url = /^chrome-extension:\/\/[a-p]{32}\/([^#]+)/.exec(displayUrl);
- if (url) {
- url = url[1];
- chrome.pageAction.setPopup({
- tabId,
- popup: "/pageAction/popup.html?file=" + encodeURIComponent(url),
- });
- chrome.pageAction.show(tabId);
- } else {
- console.log("Unable to get PDF url from " + displayUrl);
- }
- }
- chrome.runtime.onMessage.addListener(function (message, sender) {
- if (message === "showPageAction" && sender.tab) {
- showPageAction(sender.tab.id, sender.tab.url);
- }
- });
- })();
|