mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-14 10:36:19 +02:00
move downloads permission to optionals. Fixes #139
This commit is contained in:
@ -4,12 +4,8 @@
|
|||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Blazing fast & offline playground for your web experiments",
|
"description": "Blazing fast & offline playground for your web experiments",
|
||||||
"homepage_url": "https://webmakerapp.com",
|
"homepage_url": "https://webmakerapp.com",
|
||||||
"permissions": [
|
"permissions": ["storage", "tabs", "<all_urls>"],
|
||||||
"storage",
|
"optional_permissions": ["downloads"],
|
||||||
"tabs",
|
|
||||||
"<all_urls>",
|
|
||||||
"downloads"
|
|
||||||
],
|
|
||||||
"content_security_policy": "script-src 'self' filesystem: http://localhost:* https://localhost:* https://ajax.googleapis.com https://code.jquery.com https://cdnjs.cloudflare.com https://unpkg.com https://maxcdn.com https://cdn77.com https://maxcdn.bootstrapcdn.com https://cdn.jsdelivr.net/ https://*.stripe.com/ https://builds.framerjs.com/ https://rawgit.com https://wzrd.in https://www.google-analytics.com 'unsafe-eval'; object-src 'self'",
|
"content_security_policy": "script-src 'self' filesystem: http://localhost:* https://localhost:* https://ajax.googleapis.com https://code.jquery.com https://cdnjs.cloudflare.com https://unpkg.com https://maxcdn.com https://cdn77.com https://maxcdn.bootstrapcdn.com https://cdn.jsdelivr.net/ https://*.stripe.com/ https://builds.framerjs.com/ https://rawgit.com https://wzrd.in https://www.google-analytics.com 'unsafe-eval'; object-src 'self'",
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options.html",
|
"page": "options.html",
|
||||||
|
@ -1451,7 +1451,37 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadsPermission() {
|
||||||
|
var d = deferred();
|
||||||
|
chrome.permissions.contains(
|
||||||
|
{
|
||||||
|
permissions: ['downloads']
|
||||||
|
},
|
||||||
|
function(result) {
|
||||||
|
if (result) {
|
||||||
|
d.resolve();
|
||||||
|
} else {
|
||||||
|
chrome.permissions.request(
|
||||||
|
{
|
||||||
|
permissions: ['downloads']
|
||||||
|
},
|
||||||
|
function(granted) {
|
||||||
|
if (granted) {
|
||||||
|
trackEvent('fn', 'downloadsPermGiven');
|
||||||
|
d.resolve();
|
||||||
|
} else {
|
||||||
|
d.reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return d.promise;
|
||||||
|
}
|
||||||
|
|
||||||
scope.takeScreenshot = function(e) {
|
scope.takeScreenshot = function(e) {
|
||||||
|
handleDownloadsPermission().then(() => {
|
||||||
// Hide tooltips so that they don't show in the screenshot
|
// Hide tooltips so that they don't show in the screenshot
|
||||||
var s = document.createElement('style');
|
var s = document.createElement('style');
|
||||||
s.textContent =
|
s.textContent =
|
||||||
@ -1495,6 +1525,8 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
trackEvent('ui', 'takeScreenshotBtnClick');
|
trackEvent('ui', 'takeScreenshotBtnClick');
|
||||||
|
});
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user