Filter menus/palette based on Chrome major version.

This commit is contained in:
Thomas Wilburn 2013-11-01 16:24:57 -07:00
parent bbd1e6528b
commit 9da0f96696
4 changed files with 11 additions and 8 deletions

View file

@ -48,18 +48,14 @@
{ "label": "Go To Reference", "command": "palette:open", "argument": "reference" },
{ "label": "Command Palette", "command": "palette:open", "argument": "command" },
"divider",
/*
Planned here:
plugins
go to line/reference shortcuts
fullscreen
build system via NaCl
"divider",
*/
{ "label": "Toggle Macro Recording", "command": "ace:togglemacro" },
{ "label": "Replay Macro", "command": "ace:command", "argument": "replaymacro" }
]
},
/*{
"label": "Project",
"minVersion": 32
},*/
{
"label": "Settings",
"sub": [

View file

@ -22,6 +22,9 @@ define([
fragment.appendChild(preset);
continue;
}
if (entry.minVersion && entry.minVersion > chrome.version) {
continue;
}
var li = document.createElement("li");
li.innerHTML = entry.label;
if (entry.command) {

View file

@ -106,6 +106,7 @@ define([
var item = menu[i];
//skip dividers and other special cases
if (typeof item == "string") continue;
if (item.minVersion && item.minVersion > window.navigator.version) continue;
if (item.command && fuzzyCommand.test(item.palette || item.label)) {
results.push(item);
}

View file

@ -3,6 +3,9 @@ define(["command"], function(command) {
var defaults = {};
var local = {};
//put this here because Settings is pretty early in load process
chrome.version = window.navigator.appVersion.match(/Chrome\/(\d+)/)[1] || 0;
var SyncFile = function(name, c) {
this.entry = {};
if (name) {