forked from 0x2620/oxjs
Ox.Clipboard: add events; Ox.Request: cleanup; Ox.MainMenu: use OxHighlight class; Themes: add bar highlight color and gradient
This commit is contained in:
parent
b1b2785a15
commit
27bbbdbd83
8 changed files with 35 additions and 8 deletions
|
|
@ -14,7 +14,8 @@ Ox.Clipboard <o> Basic clipboard handler
|
|||
() -> <s|undefined> Item type
|
||||
@*/
|
||||
Ox.Clipboard = (function() {
|
||||
var clipboard = {items: [], type: void 0};
|
||||
var clipboard = {items: [], type: void 0},
|
||||
$element;
|
||||
return {
|
||||
_print: function() {
|
||||
Ox.print(JSON.stringify(clipboard));
|
||||
|
|
@ -24,21 +25,34 @@ Ox.Clipboard = (function() {
|
|||
Ox.Clipboard.clear();
|
||||
}
|
||||
clipboard = {items: clipboard.items.concat(items), type: type};
|
||||
$element && $element.triggerEvent('add', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
bindEvent: function() {
|
||||
if (!$element) {
|
||||
$element = Ox.Element();
|
||||
}
|
||||
$element.bindEvent.apply(this, arguments);
|
||||
},
|
||||
clear: function() {
|
||||
clipboard = {items: [], type: void 0};
|
||||
$element && $element.triggerEvent('clear', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
copy: function(items, type) {
|
||||
clipboard = {items: items, type: type};
|
||||
$element && $element.triggerEvent('copy', clipboard);
|
||||
return clipboard.items.length;
|
||||
},
|
||||
paste: function(type) {
|
||||
return !type || type == clipboard.type ? clipboard.items : [];
|
||||
$element && $element.triggerEvent('paste', clipboard);
|
||||
},
|
||||
type: function() {
|
||||
return clipboard.type;
|
||||
},
|
||||
unbindEvent: function() {
|
||||
$element && $element.bindEvent.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ Ox.Request <o> Basic request controller
|
|||
Ox.Request = (function() {
|
||||
|
||||
var cache = {},
|
||||
$element,
|
||||
pending = {},
|
||||
requests = {},
|
||||
self = {
|
||||
|
|
@ -21,7 +20,8 @@ Ox.Request = (function() {
|
|||
type: 'POST',
|
||||
url: '/api/'
|
||||
}
|
||||
};
|
||||
},
|
||||
$element;
|
||||
|
||||
return {
|
||||
/*@
|
||||
|
|
@ -64,7 +64,7 @@ Ox.Request = (function() {
|
|||
},
|
||||
|
||||
/*@
|
||||
bindEvent <f> Unbind event
|
||||
bindEvent <f> Bind event
|
||||
@*/
|
||||
bindEvent: function() {
|
||||
if (!$element) {
|
||||
|
|
@ -207,7 +207,6 @@ Ox.Request = (function() {
|
|||
/*@
|
||||
unbindEvent <f> Unbind event
|
||||
@*/
|
||||
// FIXME: Can this be removed?
|
||||
unbindEvent: function() {
|
||||
$element && $element.unbindEvent.apply(this, arguments);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,11 +204,11 @@ Ox.MainMenu = function(options, self) {
|
|||
that.highlightMenu = function(id) {
|
||||
var position = Ox.getIndexById(self.options.menus, id);
|
||||
self.highlightTimeout && clearTimeout(self.highlightTimeout);
|
||||
that.titles[position].addClass('OxSelected');
|
||||
that.titles[position].addClass('OxHighlight');
|
||||
self.highlightTimeout = setTimeout(function() {
|
||||
that.titles[position].removeClass('OxSelected');
|
||||
that.titles[position].removeClass('OxHighlight');
|
||||
delete self.highlightTimeout;
|
||||
}, 250);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
that.removeMenu = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue