From 0eb25e9f050ae44038ab0b081d541e031c8a36b7 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 3 Sep 2010 22:54:40 +0200 Subject: [PATCH] first round of fixes --- build/css/ox.ui.modern.css | 24 +- build/js/ox.ui.js | 3148 ++++++++++++++++++------------------ 2 files changed, 1635 insertions(+), 1537 deletions(-) diff --git a/build/css/ox.ui.modern.css b/build/css/ox.ui.modern.css index 65dda6c..5ddb99e 100644 --- a/build/css/ox.ui.modern.css +++ b/build/css/ox.ui.modern.css @@ -57,28 +57,41 @@ Dialog Forms ================================================================================ */ + +/* .OxThemeModern .OxInput::-selection { background: rgb(80, 80, 80); } +*/ .OxThemeModern .OxButton, +.OxThemeModern input.OxCheckbox, .OxThemeModern input.OxInput, -.OxThemeModern .OxRange, +.OxThemeModern .OxLabel, .OxThemeModern .OxTrack { //border: 1px solid rgb(80, 80, 80); border: 1px solid rgb(48, 48, 48); color: rgb(192, 192, 192); } +.OxThemeModern .OxSelect { + border: 1px solid rgb(48, 48, 48); +} +.OxThemeModern .OxSelect > .OxTitle { + color: rgb(192, 192, 192); +} +.OxThemeModern .OxInputLabel { + color: rgb(192, 192, 192); +} .OxThemeModern .OxButton, -.OxThemeModern .OxRange { +.OxThemeModern div.OxInput, +.OxThemeModern .OxSelect { background: -moz-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64)); background: -webkit-gradient(linear, left top, left bottom, from(rgb(96, 96, 96)), to(rgb(64, 64, 64))); //background: -moz-linear-gradient(left top, left bottom, from(rgb(64, 64, 64)), to(rgb(32, 32, 32))); //background: -webkit-gradient(linear, left top, left bottom, from(rgb(64, 64, 64)), to(rgb(32, 32, 32))); } -.OxThemeModern .OxButton:active, -.OxThemeModern .OxRange.OxActive { +.OxThemeModern .OxButton:active { background: rgb(80, 80, 80); //background: rgb(64, 64, 64); } @@ -86,7 +99,8 @@ Forms background: rgb(80, 80, 80); color: rgb(128, 128, 128); } -.OxThemeModern .OxButton.OxSelected { +.OxThemeModern .OxButton.OxSelected, +.OxThemeModern .OxSelect.OxSelected { //background: -moz-linear-gradient(left top, left bottom, from(rgb(80, 80, 80)), to(rgb(112, 112, 112))); //background: -webkit-gradient(linear, left top, left bottom, from(rgb(80, 80, 80)), to(rgb(112, 112, 112))); background: -moz-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32) 10%, rgb(64, 64, 64)); diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 67109c3..f646e89 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -13,16 +13,16 @@ requires (function() { var oxui = { - defaultTheme: "classic", + defaultTheme: 'classic', elements: {}, getDimensions: function(orientation) { - return orientation == "horizontal" ? - ["width", "height"] : ["height", "width"]; + return orientation == 'horizontal' ? + ['width', 'height'] : ['height', 'width']; }, getEdges: function(orientation) { - return orientation == "horizontal" ? - ["left", "right", "top", "bottom"] : - ["top", "bottom", "left", "right"]; + return orientation == 'horizontal' ? + ['left', 'right', 'top', 'bottom'] : + ['top', 'bottom', 'left', 'right']; }, getBarSize: function(size) { var sizes = { @@ -34,71 +34,71 @@ requires }, jQueryFunctions: function() { var functions = [], - $element = $("
"); + $element = $('
'); //delete $element.length; Ox.each($element, function(k, v) { - if (typeof v == "function") { + if (typeof v == 'function') { functions.push(k); } }); return functions.sort(); }(), - path: $("script[src*=ox.ui.js]").attr("src") - .replace("js/ox.ui.js", ""), + path: $('script[src*=ox.ui.js]').attr('src') + .replace('js/ox.ui.js', ''), scrollbarSize: $.browser.mozilla ? 16 : 12, symbols: { - alt: "\u2325", - apple: "\uF8FF", - arrow_down: "\u2193", - arrow_left: "\u2190", - arrow_right: "\u2192", - arrow_up: "\u2191", - backspace: "\u232B", - backup: "\u2707", - ballot: "\u2717", - black_star: "\u2605", - burn: "\u2622", - caps_lock: "\u21EA", - check: "\u2713", - //clear: "\u2327", - clear: "\u00D7", - click: "\uF803", - close: "\u2715", - command: "\u2318", - control: "\u2303", - cut: "\u2702", - "delete": "\u2326", - diamond: "\u25C6", - edit: "\uF802", - eject: "\u23CF", - escape: "\u238B", - end: "\u2198", - enter: "\u2324", - fly: "\u2708", - gear: "\u2699", - home: "\u2196", - info: "\u24D8", - navigate: "\u2388", - option: "\u2387", - page_up: "\u21DE", - page_down: "\u21DF", - redo: "\u21BA", - "return": "\u21A9", - //select: "\u21D5", - select: "\u25BE", - shift: "\u21E7", - sound: "\u266B", - space: "\u2423", - tab: "\u21E5", - trash: "\u267A", - triangle_down: "\u25BC", - triangle_left: "\u25C0", - triangle_right: "\u25BA", - triangle_up: "\u25B2", - undo: "\u21BB", - voltage: "\u26A1", - warning: "\u26A0", - white_star: "\u2606" + alt: '\u2325', + apple: '\uF8FF', + arrow_down: '\u2193', + arrow_left: '\u2190', + arrow_right: '\u2192', + arrow_up: '\u2191', + backspace: '\u232B', + backup: '\u2707', + ballot: '\u2717', + black_star: '\u2605', + burn: '\u2622', + caps_lock: '\u21EA', + check: '\u2713', + //clear: '\u2327', + clear: '\u00D7', + click: '\uF803', + close: '\u2715', + command: '\u2318', + control: '\u2303', + cut: '\u2702', + 'delete': '\u2326', + diamond: '\u25C6', + edit: '\uF802', + eject: '\u23CF', + escape: '\u238B', + end: '\u2198', + enter: '\u2324', + fly: '\u2708', + gear: '\u2699', + home: '\u2196', + info: '\u24D8', + navigate: '\u2388', + option: '\u2387', + page_up: '\u21DE', + page_down: '\u21DF', + redo: '\u21BA', + 'return': '\u21A9', + //select: '\u21D5', + select: '\u25BE', + shift: '\u21E7', + sound: '\u266B', + space: '\u2423', + tab: '\u21E5', + trash: '\u267A', + triangle_down: '\u25BC', + triangle_left: '\u25C0', + triangle_right: '\u25BA', + triangle_up: '\u25B2', + undo: '\u21BB', + voltage: '\u26A1', + warning: '\u26A0', + white_star: '\u2606' } }, $window, $document, $body; @@ -106,7 +106,7 @@ requires $(function() { $window = $(window), $document = $(document), - $body = $("body"), + $body = $('body'), $elements = {}; Ox.theme(oxui.defaultTheme); }); @@ -186,28 +186,28 @@ requires */ Ox.Event = function() { - var $eventHandler = $("
"), + var $eventHandler = $('
'), events = {}; function addEvent(id, type, event, callback) { events[id] = events[id] || {}; events[id][type] = events[id][type] || {}; events[id][type][event] = events[id][type][event] || []; events[id][type][event].push(callback); - if (type == "normal" || Ox.Focus.focused() == id) { - Ox.print("bind", id, event); - $eventHandler.bind(event + "_" + id, callback); + if (type == 'normal' || Ox.Focus.focused() == id) { + Ox.print('bind', id, event); + $eventHandler.bind(event + (id ? '_' + id : ''), callback); // requestStart/requestStop currently have '' as id } } function removeEvent(id, type, event, callback) { - var focused = type == "normal" || Ox.Focus.focused() == id, - toString = (callback || "").toString(); - Ox.print("removeEvent", id, type, event, callback); + var focused = type == 'normal' || Ox.Focus.focused() == id, + toString = (callback || '').toString(); + Ox.print('removeEvent', id, type, event, callback); if (events[id] && events[id][type] && (!event || events[id][type][event])) { $.each(events[id][type], function(e, fns) { if (!event || event == e) { events[id][type][e] = $.map(events[id][type][e], function(fn, i) { if (!callback || toString == fn.toString()) { - focused && $eventHandler.unbind(e + "_" + id, fn); + focused && $eventHandler.unbind(e + '_' + id, fn); return null; } else { return fn; @@ -228,7 +228,7 @@ requires } } function isKeyboardEvent(event) { // fixme: currently unused - return event.substr(0, 4) == "key_"; + return event.substr(0, 4) == 'key_'; } return { _print: function() { @@ -236,21 +236,21 @@ requires }, add: function(id, event, callback) { // add keyboard event - addEvent(id, "keyboard", event, callback); + addEvent(id, 'keyboard', event, callback); }, bind: function(id, event, callback) { // bind event - addEvent(id, "normal", event, callback); + addEvent(id, 'normal', event, callback); }, bindKeyboard: function(id) { // bind all keyboard events - //Ox.print("binding", "id", id, "events", events[id], Ox.length(events[id]), "keyboardevents", events[id]["keyboard"]) + //Ox.print('binding', 'id', id, 'events', events[id], Ox.length(events[id]), 'keyboardevents', events[id]['keyboard']) $.each(events[id], function(k, v) { - Ox.print("|" + k + "|"); + Ox.print('|' + k + '|'); }) events[id] && events[id].keyboard && $.each(events[id].keyboard, function(event, callbacks) { $.each(callbacks, function(i, callback) { - Ox.print("bind", id, event); + Ox.print('bind', id, event); $eventHandler.bind(event, callback); }); }); @@ -258,10 +258,10 @@ requires changeId: function(oldId, newId) { // fixme: would it be better to pass that.id instead of self.options.id? // then this renaming wouldn't be necessary - Ox.print("changeId", oldId, newId, events[oldId]); + Ox.print('changeId', oldId, newId, events[oldId]); $.each($.extend({}, events[oldId] || {}), function(type, events_) { - var bind = type == "normal" ? "bind" : "add", - unbind = type == "normal" ? "unbind" : "remove"; + var bind = type == 'normal' ? 'bind' : 'add', + unbind = type == 'normal' ? 'unbind' : 'remove'; $.each(events_, function(event, callbacks) { $.each(callbacks, function(i, callback) { Ox.Event[unbind](oldId, event, callback); @@ -273,26 +273,26 @@ requires remove: function(id, event, callback) { // remove keyboard event // event and callback are optional - removeEvent(id, "keyboard", event, callback); + removeEvent(id, 'keyboard', event, callback); }, unbind: function(id, event, callback) { // unbind event // event and callback are optional - removeEvent(id, "normal", event, callback); + removeEvent(id, 'normal', event, callback); }, trigger: function(id, event, data) { // trigger event // data is optional - // keyboard handler will call this with "" as id - Ox.print("trigger", id, event, data || {}); - $eventHandler.trigger(event + (id ? "_" + id : ""), data || {}); + // keyboard handler will call this with '' as id + Ox.print('trigger', id, event, data || {}); + $eventHandler.trigger(event + (id ? '_' + id : ''), data || {}); }, unbindKeyboard: function(id) { // unbind all keyboard events - Ox.print("unbinding", id /*events[id].keyboard*/) + Ox.print('unbinding', id /*events[id].keyboard*/) events[id] && events[id].keyboard && $.each(events[id].keyboard, function(event, callbacks) { $.each(callbacks, function(i, callback) { - Ox.print("unbind", event) + Ox.print('unbind', event) $eventHandler.unbind(event, callback); }); }); @@ -312,24 +312,24 @@ requires blur: function(id) { var index = stack.indexOf(id); if (index == stack.length - 1) { - $elements[id].removeClass("OxFocus"); - //$(".OxFocus").removeClass("OxFocus"); // fixme: the above is better, and should work + $elements[id].removeClass('OxFocus'); + //$('.OxFocus').removeClass('OxFocus'); // fixme: the above is better, and should work stack.length == 1 ? stack.pop() : stack.splice(stack.length - 2, 0, stack.pop()); - Ox.Event.unbindKeyboard($elements[id].options("id")); - stack.length && Ox.Event.bindKeyboard($elements[stack[stack.length - 1]].options("id")); - Ox.print("blur", id, stack); + Ox.Event.unbindKeyboard($elements[id].options('id')); + stack.length && Ox.Event.bindKeyboard($elements[stack[stack.length - 1]].options('id')); + Ox.print('blur', id, stack); } }, focus: function(id) { var index = stack.indexOf(id); if (index == -1 || index < stack.length - 1) { - stack.length && Ox.Event.unbindKeyboard($elements[stack[stack.length - 1]].options("id")); + stack.length && Ox.Event.unbindKeyboard($elements[stack[stack.length - 1]].options('id')); index > -1 && stack.splice(index, 1); stack.push(id); - $elements[id].addClass("OxFocus"); - Ox.Event.bindKeyboard($elements[id].options("id")); - Ox.print("focus", id, stack); + $elements[id].addClass('OxFocus'); + Ox.Event.bindKeyboard($elements[id].options('id')); + Ox.print('focus', id, stack); } }, focused: function() { @@ -352,125 +352,125 @@ requires (function() { - var buffer = "", + var buffer = '', bufferTime = 0, bufferTimeout = 1000, keyNames = function() { return { - 0: "section", - 8: "backspace", - 9: "tab", - 12: "clear", - 13: "enter", - 16: "shift", - 17: "control", - 18: "alt", - 20: "capslock", - 27: "escape", - 32: "space", - 33: "pageup", - 34: "pagedown", - 35: "end", - 36: "home", - 37: "left", - 38: "up", - 39: "right", - 40: "down", - 45: "insert", - 46: "delete", - 47: "help", - 48: "0", - 49: "1", - 50: "2", - 51: "3", - 52: "4", - 53: "5", - 54: "6", - 55: "7", - 56: "8", - 57: "9", - 65: "a", - 66: "b", - 67: "c", - 68: "d", - 69: "e", - 70: "f", - 71: "g", - 72: "h", - 73: "i", - 74: "j", - 75: "k", - 76: "l", - 77: "m", - 78: "n", - 79: "o", - 80: "p", - 81: "q", - 82: "r", - 83: "s", - 84: "t", - 85: "u", - 86: "v", - 87: "w", - 88: "x", - 89: "y", - 90: "z", - 91: "meta.left", - 92: "meta.right", - 93: "select", - 96: "0.numpad", - 97: "1.numpad", - 98: "2.numpad", - 99: "3.numpad", - 100: "4.numpad", - 101: "5.numpad", - 102: "6.numpad", - 103: "7.numpad", - 104: "8.numpad", - 105: "9.numpad", - 106: "asterisk.numpad", - 107: "plus.numpad", - 109: "minus.numpad", - 108: "enter.numpad", - 110: "dot.numpad", - 111: "slash.numpad", - 112: "f1", - 113: "f2", - 114: "f3", - 115: "f4", - 116: "f5", - 117: "f6", - 118: "f7", - 119: "f8", - 120: "f9", - 121: "f10", - 122: "f11", - 123: "f12", - 124: "f13", - 125: "f14", - 126: "f15", - 127: "f16", - 144: "numlock", - 145: "scrolllock", - 186: "semicolon", - 187: "equal", - 188: "comma", - 189: "minus", - 190: "dot", - 191: "slash", - 192: "backtick", - 219: "openbracket", - 220: "backslash", - 221: "closebracket", - 222: "quote" + 0: 'section', + 8: 'backspace', + 9: 'tab', + 12: 'clear', + 13: 'enter', + 16: 'shift', + 17: 'control', + 18: 'alt', + 20: 'capslock', + 27: 'escape', + 32: 'space', + 33: 'pageup', + 34: 'pagedown', + 35: 'end', + 36: 'home', + 37: 'left', + 38: 'up', + 39: 'right', + 40: 'down', + 45: 'insert', + 46: 'delete', + 47: 'help', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 91: 'meta.left', + 92: 'meta.right', + 93: 'select', + 96: '0.numpad', + 97: '1.numpad', + 98: '2.numpad', + 99: '3.numpad', + 100: '4.numpad', + 101: '5.numpad', + 102: '6.numpad', + 103: '7.numpad', + 104: '8.numpad', + 105: '9.numpad', + 106: 'asterisk.numpad', + 107: 'plus.numpad', + 109: 'minus.numpad', + 108: 'enter.numpad', + 110: 'dot.numpad', + 111: 'slash.numpad', + 112: 'f1', + 113: 'f2', + 114: 'f3', + 115: 'f4', + 116: 'f5', + 117: 'f6', + 118: 'f7', + 119: 'f8', + 120: 'f9', + 121: 'f10', + 122: 'f11', + 123: 'f12', + 124: 'f13', + 125: 'f14', + 126: 'f15', + 127: 'f16', + 144: 'numlock', + 145: 'scrolllock', + 186: 'semicolon', + 187: 'equal', + 188: 'comma', + 189: 'minus', + 190: 'dot', + 191: 'slash', + 192: 'backtick', + 219: 'openbracket', + 220: 'backslash', + 221: 'closebracket', + 222: 'quote' // see dojo, for ex. }; }(), modifierNames = { - altKey: "alt", // mac: option - ctrlKey: "control", - // metaKey: "meta", // mac: command - shiftKey: "shift" + altKey: 'alt', // mac: option + ctrlKey: 'control', + // metaKey: 'meta', // mac: command + shiftKey: 'shift' }; $(function() { @@ -481,14 +481,14 @@ requires if ($.browser.mozilla) { $document.keypress(keypress); $document.keydown(function(event) { - var $element = $("input:focus"); + var $element = $('input:focus'); if ($element.length) { if ( ( - keyNames[event.keyCode] == "up" && + keyNames[event.keyCode] == 'up' && $element[0].selectionStart + $element[0].selectionEnd == 0 ) || ( - keyNames[event.keyCode] == "down" && + keyNames[event.keyCode] == 'down' && $element[0].selectionStart == $element.val().length && $element[0].selectionEnd == $element.val().length ) @@ -512,25 +512,25 @@ requires } }); // avoid pushing modifier twice - Ox.print("keys", keys) + Ox.print('keys', keys) if (keyNames[event.keyCode] && keys.indexOf(keyNames[event.keyCode]) == -1) { keys.push(keyNames[event.keyCode]); } - key = keys.join("_"); + key = keys.join('_'); if (key.match(/^[\w\d-]$|SPACE/)) { time = Ox.getTime(); if (time - bufferTime > bufferTimeout) { - buffer = ""; + buffer = ''; } - buffer += key == "SPACE" ? " " : key; + buffer += key == 'SPACE' ? ' ' : key; bufferTime = time; } - Ox.Event.trigger("", "key_" + key); + Ox.Event.trigger('', 'key_' + key); //return false; /* $.each(stack, function(i, v) { // fixme: we dont get the return value! - ret = Ox.event.trigger(keyboard + Ox.toCamelCase(key) + "." + v); + ret = Ox.event.trigger(keyboard + Ox.toCamelCase(key) + '.' + v); return ret; }); */ @@ -558,8 +558,8 @@ requires self = { options: { timeout: 15000, - type: "POST", - url: "api" + type: 'POST', + url: 'api' } }; @@ -607,21 +607,21 @@ requires function callback(data) { delete requests[options.id]; - Ox.length(requests) == 0 && Ox.Event.trigger("requestStop"); + Ox.length(requests) == 0 && Ox.Event.trigger('', 'requestStop'); options.callback(data); } function debug(request) { - var $iframe = $("