Path for configureCommands is chosen based on user's browser (Opera incomatibility)
This commit is contained in:
parent
1d30b19132
commit
0e6c5e35ac
13
messaging.js
13
messaging.js
|
@ -131,3 +131,16 @@ function stringAsRegExp(s, flags) {
|
|||
function wildcardAsRegExp(s, flags) {
|
||||
return new RegExp(s.replace(/[{}()\[\]\/\\.+?^$:=!|]/g, "\\$&").replace(/\*/g, '.*?'), flags);
|
||||
}
|
||||
|
||||
var configureCommands = {
|
||||
get url () {
|
||||
return navigator.userAgent.indexOf('OPR') > -1 ?
|
||||
'opera://settings/configureCommands' :
|
||||
'chrome://extensions/configureCommands'
|
||||
},
|
||||
open: () => {
|
||||
chrome.tabs.create({
|
||||
'url': configureCommands.url
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/* globals configureCommands */
|
||||
'use strict';
|
||||
|
||||
document.querySelector('#manage-options-button').addEventListener("click", function() {
|
||||
if (chrome.runtime.openOptionsPage) {
|
||||
// Supported (Chrome 42+)
|
||||
|
@ -8,11 +11,7 @@ document.querySelector('#manage-options-button').addEventListener("click", funct
|
|||
}
|
||||
});
|
||||
|
||||
document.querySelector('#manage-shortcuts-button').addEventListener("click", function() {
|
||||
chrome.tabs.create({
|
||||
'url': 'chrome://extensions/configureCommands'
|
||||
});
|
||||
});
|
||||
document.querySelector('#manage-shortcuts-button').addEventListener("click", configureCommands.open);
|
||||
|
||||
document.querySelector('#editor-styles-button').addEventListener("click", function() {
|
||||
chrome.tabs.create({
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
2: <span i18n-text="optionsOpenManagerNote"></span>, <a href="#" data-cmd="open-keyboard">chrome://extensions/configureCommands</a>
|
||||
</div>
|
||||
|
||||
<script src="/messaging.js"></script>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* globals configureCommands */
|
||||
'use strict';
|
||||
|
||||
function restore () {
|
||||
|
@ -88,8 +89,9 @@ document.addEventListener('click', e => {
|
|||
});
|
||||
}
|
||||
else if (cmd === 'open-keyboard') {
|
||||
chrome.tabs.create({
|
||||
url: 'chrome://extensions/configureCommands'
|
||||
});
|
||||
configureCommands.open();
|
||||
}
|
||||
});
|
||||
// overwrite the default URL if browser is Opera
|
||||
document.querySelector('[data-cmd="open-keyboard"]').textContent =
|
||||
configureCommands.url;
|
||||
|
|
8
popup.js
8
popup.js
|
@ -1,3 +1,5 @@
|
|||
/* globals configureCommands */
|
||||
|
||||
var writeStyleTemplate = document.createElement("a");
|
||||
writeStyleTemplate.className = "write-style-link";
|
||||
|
||||
|
@ -238,11 +240,7 @@ document.querySelector('#popup-options-button').addEventListener("click", functi
|
|||
}
|
||||
});
|
||||
|
||||
document.querySelector('#popup-shortcuts-button').addEventListener("click", function() {
|
||||
chrome.tabs.create({
|
||||
'url': 'chrome://extensions/configureCommands'
|
||||
});
|
||||
});
|
||||
document.querySelector('#popup-shortcuts-button').addEventListener("click", configureCommands.open);
|
||||
|
||||
// popup width
|
||||
document.body.style.width = (localStorage.getItem('popupWidth') || '246') + 'px';
|
||||
|
|
Loading…
Reference in New Issue
Block a user