2014-07-21 16:38:06 +04:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
2014-07-25 18:34:53 +04:00
|
|
|
window.nodejs = (typeof(process) === 'object' && process.features.uv)
|
|
|
|
|
? {
|
|
|
|
|
require: window.require,
|
|
|
|
|
}
|
|
|
|
|
: null
|
2014-07-21 16:38:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
define(function(require){ var module = {}
|
|
|
|
|
console.log('>>> ui')
|
|
|
|
|
|
|
|
|
|
//var DEBUG = DEBUG != null ? DEBUG : true
|
|
|
|
|
|
2014-07-21 18:21:36 +04:00
|
|
|
var keyboard = require('lib/keyboard')
|
|
|
|
|
var doc = keyboard.doc
|
|
|
|
|
|
|
|
|
|
// compatibility...
|
2014-07-21 16:38:06 +04:00
|
|
|
var browser = require('browser')
|
|
|
|
|
var nw = require('nw')
|
|
|
|
|
|
2014-07-21 18:21:36 +04:00
|
|
|
// XXX load only the actualy used here modules...
|
|
|
|
|
var actions = require('actions')
|
|
|
|
|
var data = require('data')
|
2014-07-21 18:33:31 +04:00
|
|
|
var ribbons = require('ribbons')
|
2014-07-21 16:38:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
2014-07-21 18:33:31 +04:00
|
|
|
// XXX add this to the global doc...
|
2014-07-22 17:09:25 +04:00
|
|
|
module.GLOBAL_KEYBOARD = {
|
2014-07-21 16:38:06 +04:00
|
|
|
'Global bindings': {
|
|
|
|
|
doc: 'NOTE: binding priority is the same as the order of sections '+
|
|
|
|
|
'on this page.',
|
|
|
|
|
pattern: '*',
|
|
|
|
|
|
|
|
|
|
F4: {
|
|
|
|
|
alt: doc('Close viewer',
|
|
|
|
|
function(){
|
2014-07-21 18:21:36 +04:00
|
|
|
window.close()
|
2014-07-21 16:38:06 +04:00
|
|
|
return false
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
F5: doc('Full reload viewer',
|
|
|
|
|
function(){
|
|
|
|
|
/*
|
|
|
|
|
killAllWorkers()
|
|
|
|
|
.done(function(){
|
|
|
|
|
reload()
|
|
|
|
|
})
|
|
|
|
|
*/
|
2014-07-21 18:21:36 +04:00
|
|
|
location.reload()
|
2014-07-21 16:38:06 +04:00
|
|
|
return false
|
|
|
|
|
}),
|
|
|
|
|
F12: doc('Show devTools',
|
|
|
|
|
function(){
|
2014-07-21 18:21:36 +04:00
|
|
|
if(window.showDevTools != null){
|
|
|
|
|
showDevTools()
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
// if no showDevTools defined pass the button further...
|
|
|
|
|
} else {
|
|
|
|
|
return true
|
|
|
|
|
}
|
2014-07-21 16:38:06 +04:00
|
|
|
}),
|
|
|
|
|
// NOTE: these are for systems where F** keys are not available
|
|
|
|
|
// or do other stuff...
|
|
|
|
|
R: {
|
|
|
|
|
/*
|
|
|
|
|
'ctrl+alt': doc('Reload viewer',
|
|
|
|
|
function(){
|
|
|
|
|
reloadViewer()
|
|
|
|
|
return false
|
|
|
|
|
}),
|
|
|
|
|
*/
|
|
|
|
|
'ctrl+shift': 'F5',
|
|
|
|
|
},
|
|
|
|
|
P: {
|
|
|
|
|
'ctrl+shift': 'F12',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// NOTE: this is handled by the wrapper at this point, so we do
|
|
|
|
|
// not have to do anything here...
|
|
|
|
|
F11: doc('Toggle full screen view', function(){
|
|
|
|
|
toggleFullscreenMode()
|
|
|
|
|
return false
|
|
|
|
|
}),
|
|
|
|
|
F: {
|
|
|
|
|
ctrl: 'F11',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
$(function(){
|
2014-07-21 18:21:36 +04:00
|
|
|
// setup base keyboard for devel, in case something breaks...
|
2014-07-21 16:38:06 +04:00
|
|
|
$(document)
|
|
|
|
|
.keydown(
|
|
|
|
|
keyboard.makeKeyboardHandler(
|
2014-07-22 17:09:25 +04:00
|
|
|
module.GLOBAL_KEYBOARD,
|
2014-07-21 16:38:06 +04:00
|
|
|
function(k){
|
|
|
|
|
window.DEBUG && console.log(k)
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */
|
|
|
|
|
return module })
|