From 27bbbdbd8389e0e14f678e75334825d85ae35bdc Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 15 Jul 2013 09:10:08 +0000 Subject: [PATCH] Ox.Clipboard: add events; Ox.Request: cleanup; Ox.MainMenu: use OxHighlight class; Themes: add bar highlight color and gradient --- source/Ox.UI/css/theme.css | 6 ++++++ source/Ox.UI/js/Core/Clipboard.js | 16 +++++++++++++++- source/Ox.UI/js/Core/Request.js | 7 +++---- source/Ox.UI/js/Menu/MainMenu.js | 6 +++--- source/Ox.UI/themes/aqua/json/theme.jsonc | 2 ++ source/Ox.UI/themes/oxdark/json/theme.jsonc | 2 ++ source/Ox.UI/themes/oxlight/json/theme.jsonc | 2 ++ source/Ox.UI/themes/oxmedium/json/theme.jsonc | 2 ++ 8 files changed, 35 insertions(+), 8 deletions(-) diff --git a/source/Ox.UI/css/theme.css b/source/Ox.UI/css/theme.css index 05bb853f..e27e3158 100644 --- a/source/Ox.UI/css/theme.css +++ b/source/Ox.UI/css/theme.css @@ -828,6 +828,12 @@ Menus background-image: -webkit-linear-gradient(top, $barSelectedGradient); color: $barSelectedColor; } +.$themeClass .OxMainMenu > .OxTitle.OxHighlight { + background-image: -moz-linear-gradient(top, $barHighlightGradient); + background-image: -o-linear-gradient(top, $barHighlightGradient); + background-image: -webkit-linear-gradient(top, $barHighlightGradient); + color: $barHighlightColor; +} .$themeClass .OxMenu { box-shadow: 0 2px 4px $menuShadow; diff --git a/source/Ox.UI/js/Core/Clipboard.js b/source/Ox.UI/js/Core/Clipboard.js index 02585f55..f613e694 100644 --- a/source/Ox.UI/js/Core/Clipboard.js +++ b/source/Ox.UI/js/Core/Clipboard.js @@ -14,7 +14,8 @@ Ox.Clipboard Basic clipboard handler () -> 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); } }; }()); diff --git a/source/Ox.UI/js/Core/Request.js b/source/Ox.UI/js/Core/Request.js index 02eced0f..69374641 100644 --- a/source/Ox.UI/js/Core/Request.js +++ b/source/Ox.UI/js/Core/Request.js @@ -12,7 +12,6 @@ Ox.Request 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 Unbind event + bindEvent Bind event @*/ bindEvent: function() { if (!$element) { @@ -207,7 +207,6 @@ Ox.Request = (function() { /*@ unbindEvent Unbind event @*/ - // FIXME: Can this be removed? unbindEvent: function() { $element && $element.unbindEvent.apply(this, arguments); } diff --git a/source/Ox.UI/js/Menu/MainMenu.js b/source/Ox.UI/js/Menu/MainMenu.js index 0280d875..bfbe5092 100644 --- a/source/Ox.UI/js/Menu/MainMenu.js +++ b/source/Ox.UI/js/Menu/MainMenu.js @@ -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() { diff --git a/source/Ox.UI/themes/aqua/json/theme.jsonc b/source/Ox.UI/themes/aqua/json/theme.jsonc index 42b2d85a..153878e8 100644 --- a/source/Ox.UI/themes/aqua/json/theme.jsonc +++ b/source/Ox.UI/themes/aqua/json/theme.jsonc @@ -5,6 +5,8 @@ "themeColorLightness": 0.25, "barGradient": [[224, 224, 224], [192, 192, 192]], + "barHighlightColor": [255, 255, 255], + "barHighlightGradient": [[80, 144, 208], [48, 112, 178]], "barSelectedColor": [255, 255, 255], "barSelectedGradient": [[80, 144, 208], [48, 112, 178]], diff --git a/source/Ox.UI/themes/oxdark/json/theme.jsonc b/source/Ox.UI/themes/oxdark/json/theme.jsonc index 6ba1de3f..f68c5f9f 100644 --- a/source/Ox.UI/themes/oxdark/json/theme.jsonc +++ b/source/Ox.UI/themes/oxdark/json/theme.jsonc @@ -5,6 +5,8 @@ "themeColorLightness": 0.75, "barGradient": [[64, 64, 64], [32, 32, 32]], + "barHighlightColor": [0, 0, 0], + "barHighlightGradient": [[255, 255, 0], [192, 192, 0]], "barSelectedColor": [255, 255, 255], "barSelectedGradient": [[80, 80, 80], [48, 48, 48]], diff --git a/source/Ox.UI/themes/oxlight/json/theme.jsonc b/source/Ox.UI/themes/oxlight/json/theme.jsonc index 4399f6ef..eb6e9286 100644 --- a/source/Ox.UI/themes/oxlight/json/theme.jsonc +++ b/source/Ox.UI/themes/oxlight/json/theme.jsonc @@ -5,6 +5,8 @@ "themeColorLightness": 0.25, "barGradient": [[224, 224, 224], [192, 192, 192]], + "barHighlightColor": [0, 0, 0], + "barHighlightGradient": [[255, 255, 0], [192, 192, 0]], "barSelectedColor": [0, 0, 0], "barSelectedGradient": [[208, 208, 208], [176, 176, 176]], diff --git a/source/Ox.UI/themes/oxmedium/json/theme.jsonc b/source/Ox.UI/themes/oxmedium/json/theme.jsonc index 1a93b39a..cb3cdf79 100644 --- a/source/Ox.UI/themes/oxmedium/json/theme.jsonc +++ b/source/Ox.UI/themes/oxmedium/json/theme.jsonc @@ -5,6 +5,8 @@ "themeColorLightness": 0.25, "barGradient": [[160, 160, 160], [128, 128, 128]], + "barHighlightColor": [0, 0, 0], + "barHighlightGradient": [[255, 255, 0], [192, 192, 0]], "barSelectedColor": [255, 255, 255], "barSelectedGradient": [[128, 128, 128], [96, 96, 96]],