forked from paulrouget/firefox.html
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
246 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/require.js"] | ||
path = lib/require.js | ||
url = https://github.com/jrburke/requirejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require.config({ | ||
scriptType: "text/javascript;version=1.8", | ||
enforceDefine: true, | ||
}); | ||
|
||
define([ | ||
'js/browser', | ||
'js/commands', | ||
'js/curvedTabs', | ||
'js/keybindings', | ||
'js/navbar', | ||
'js/os', | ||
'js/tab', | ||
'js/url_helper', | ||
], function( | ||
Browser, | ||
Commands, | ||
CurvedTabs, | ||
Keybindings, | ||
Navbar, | ||
OS, | ||
Tab, | ||
Url_helper) { | ||
"use strict"; | ||
|
||
Commands.createNewTab("http://medium.com"); | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,90 @@ | ||
// Keybindings | ||
define([ | ||
'js/commands' | ||
], function( | ||
Commands | ||
) { | ||
"use strict"; | ||
|
||
(function() { | ||
let allKeyBindings = []; | ||
|
||
let allKeyBindings = []; | ||
RegisterKeyBindings( | ||
["", "Esc", "stop"], | ||
["Ctrl", "Tab", "selectNextTab"], | ||
["Ctrl Shift", "code:9", "selectPreviousTab"] | ||
); | ||
|
||
if (window.OS == "linux" || window.OS == "windows") { | ||
RegisterKeyBindings( | ||
["", "Esc", "stop"], | ||
["Ctrl", "Tab", "selectNextTab"], | ||
["Ctrl Shift", "code:9", "selectPreviousTab"] | ||
["Ctrl", "t", "createNewTab"], | ||
["Ctrl", "r", "reload"], | ||
["Alt", "Left", "goBack"], | ||
["Alt", "Right", "goForward"], | ||
["Ctrl", "l", "focusURLBar"], | ||
["Ctrl", "k", "focusSearchBar"], | ||
["Ctrl", "w", "closeTab"], | ||
["Ctrl Shift", "+", "zoomIn"], | ||
["Ctrl", "=", "zoomIn"], | ||
["Ctrl", "-", "zoomOut"], | ||
["Ctrl", "0", "resetZoom"] | ||
); | ||
} | ||
|
||
if (window.OS == "linux" || window.OS == "windows") { | ||
RegisterKeyBindings( | ||
["Ctrl", "t", "createNewTab"], | ||
["Ctrl", "r", "reload"], | ||
["Alt", "Left", "goBack"], | ||
["Alt", "Right", "goForward"], | ||
["Ctrl", "l", "focusURLBar"], | ||
["Ctrl", "k", "focusSearchBar"], | ||
["Ctrl", "w", "closeTab"], | ||
["Ctrl Shift", "+", "zoomIn"], | ||
["Ctrl", "=", "zoomIn"], | ||
["Ctrl", "-", "zoomOut"], | ||
["Ctrl", "0", "resetZoom"] | ||
); | ||
} | ||
|
||
if (window.OS == "osx") { | ||
RegisterKeyBindings( | ||
["Cmd", "t", "createNewTab"], | ||
["Cmd", "r", "reload"], | ||
["Cmd", "Left", "goBack"], | ||
["Cmd", "Right", "goForward"], | ||
["Cmd", "l", "focusURLBar"], | ||
["Cmd", "k", "focusSearchBar"], | ||
["Cmd", "w", "closeTab"], | ||
["Cmd Shift", "+", "zoomIn"], | ||
["Cmd", "=", "zoomIn"], | ||
["Cmd", "-", "zoomOut"], | ||
["Cmd", "0", "resetZoom"] | ||
); | ||
} | ||
if (window.OS == "osx") { | ||
RegisterKeyBindings( | ||
["Cmd", "t", "createNewTab"], | ||
["Cmd", "r", "reload"], | ||
["Cmd", "Left", "goBack"], | ||
["Cmd", "Right", "goForward"], | ||
["Cmd", "l", "focusURLBar"], | ||
["Cmd", "k", "focusSearchBar"], | ||
["Cmd", "w", "closeTab"], | ||
["Cmd Shift", "+", "zoomIn"], | ||
["Cmd", "=", "zoomIn"], | ||
["Cmd", "-", "zoomOut"], | ||
["Cmd", "0", "resetZoom"] | ||
); | ||
} | ||
|
||
function RegisterKeyBindings(...bindings) { | ||
for (let b of bindings) { | ||
let mods = b[0]; | ||
let key = b[1]; | ||
let func = b[2]; | ||
function RegisterKeyBindings(...bindings) { | ||
for (let b of bindings) { | ||
let mods = b[0]; | ||
let key = b[1]; | ||
let func = b[2]; | ||
|
||
let e = { | ||
ctrlKey: false, | ||
shiftKey: false, | ||
metaKey: false, | ||
altKey: false | ||
} | ||
let e = { | ||
ctrlKey: false, | ||
shiftKey: false, | ||
metaKey: false, | ||
altKey: false | ||
} | ||
|
||
if (mods.indexOf("Ctrl") > -1) e.ctrlKey = true; | ||
if (mods.indexOf("Shift") > -1) e.shiftKey = true; | ||
if (mods.indexOf("Alt") > -1) e.altKey = true; | ||
if (mods.indexOf("Cmd") > -1) e.metaKey = true; | ||
if (mods.indexOf("Ctrl") > -1) e.ctrlKey = true; | ||
if (mods.indexOf("Shift") > -1) e.shiftKey = true; | ||
if (mods.indexOf("Alt") > -1) e.altKey = true; | ||
if (mods.indexOf("Cmd") > -1) e.metaKey = true; | ||
|
||
if (key.indexOf("code:") > -1) { | ||
e.keyCode = key.split(":")[1]; | ||
} else { | ||
e.key = key; | ||
} | ||
allKeyBindings.push({event:e,func:func}); | ||
if (key.indexOf("code:") > -1) { | ||
e.keyCode = key.split(":")[1]; | ||
} else { | ||
e.key = key; | ||
} | ||
allKeyBindings.push({event:e,func:func}); | ||
} | ||
} | ||
|
||
window.addEventListener("keypress", e => { | ||
for (let oneKeyBinding of allKeyBindings) { | ||
let matches = true; | ||
for (let prop in oneKeyBinding.event) { | ||
if (e[prop] != oneKeyBinding.event[prop]) { | ||
matches = false; | ||
break; | ||
} | ||
} | ||
if (matches) { | ||
Cmds[oneKeyBinding.func](); | ||
window.addEventListener("keypress", e => { | ||
for (let oneKeyBinding of allKeyBindings) { | ||
let matches = true; | ||
for (let prop in oneKeyBinding.event) { | ||
if (e[prop] != oneKeyBinding.event[prop]) { | ||
matches = false; | ||
break; | ||
} | ||
} | ||
}); | ||
})(); | ||
if (matches) { | ||
Commands[oneKeyBinding.func](); | ||
} | ||
} | ||
}); | ||
|
||
}); |
Oops, something went wrong.