From 6da40d325ce9f037c985c5bce24b5062374039bc Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 1 Sep 2011 04:46:14 +0000 Subject: [PATCH] adding symbols --- demos/form2/js/form.js | 9 +++++-- source/Ox.UI/js/List/Ox.List.js | 13 +++++---- source/Ox.UI/js/List/Ox.TextList.js | 2 +- source/Ox.UI/js/Panel/Ox.CollapsePanel.js | 7 +++++ source/Ox.UI/png/icon16.png | Bin 2880 -> 0 bytes source/Ox.UI/themes/classic/_index.html | 5 ++-- .../Ox.UI/themes/classic/svg/symbolIcon.svg | 3 +++ .../Ox.UI/themes/classic/svg/symbolVolume.svg | 6 +++++ source/Ox.js | 25 +++++++++++++----- 9 files changed, 54 insertions(+), 16 deletions(-) delete mode 100644 source/Ox.UI/png/icon16.png create mode 100644 source/Ox.UI/themes/classic/svg/symbolIcon.svg create mode 100644 source/Ox.UI/themes/classic/svg/symbolVolume.svg diff --git a/demos/form2/js/form.js b/demos/form2/js/form.js index e4afca30..e8667197 100644 --- a/demos/form2/js/form.js +++ b/demos/form2/js/form.js @@ -104,6 +104,7 @@ Ox.load('Geo', function() { { id: "", title: "redo" }, { id: "", title: "unlock" }, { id: "", title: "lock" }, + { id: "", title: "volume" }, { id: "", title: "mount" }, { id: "", title: "unmount" }, { id: "", title: "sync" }, @@ -113,17 +114,21 @@ Ox.load('Geo', function() { { id: "", title: "check" }, { id: "", title: "embed" }, { id: "", title: "bracket" }, - { id: "", title: "delete" }, + { id: "", title: "upload" }, { id: "", title: "download" }, + { id: "", title: "click" }, + { id: "", title: "delete" }, { id: "", title: "edit" }, { id: "", title: "find" }, { id: "", title: "flag" }, + { id: "", title: "icon" }, { id: "", title: "like" }, { id: "", title: "publish" }, { id: "", title: "set" }, { id: "", title: "star" }, { id: "", title: "user" }, - { id: "", title: "view" } + { id: "", title: "view" }, + { id: "", title: "loading" } ], id: "buttonGroupImage", type: "image" diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 888f26fb..835fc3c5 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -554,6 +554,11 @@ Ox.List = function(options, self) { return Math.ceil(self.pageLength * (self.options.itemHeight + self.itemMargin) / self.rowLength); } + function getPageLength(page) { + var mod = self.listLength % self.pageLength; + return page < self.pages - 1 || mod == 0 ? self.pageLength : mod; + } + function getPositionById(id) { // fixme: is this really needed? var pos = -1; @@ -679,11 +684,9 @@ Ox.List = function(options, self) { self.$items[pos].appendTo(that.$content); }); self.selected.length && scrollToPosition(self.selected[0]); - } - - function getPageLength(page) { - var mod = self.listLength % self.pageLength; - return page < self.pages - 1 || mod == 0 ? self.pageLength : mod; + // that.triggerEvent('init', {items: self.options.items.length}); + // fixme: do async lists need to trigger init? + // will this only be reached in async lists? } function loadPage(page, callback) { diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index 1c07de7f..bc30df5b 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -422,7 +422,7 @@ Ox.TextList = function(options, self) { } else if (format) { value = Ox.isObject(format) ? Ox['format' + Ox.toTitleCase(format.type)] - .apply(this, $.merge([value], format.args)) : + .apply(this, Ox.merge([value], format.args || [])) : format(value, data); } else if (Ox.isArray(value)) { value = value.join(', '); diff --git a/source/Ox.UI/js/Panel/Ox.CollapsePanel.js b/source/Ox.UI/js/Panel/Ox.CollapsePanel.js index 69676170..ef8b2915 100644 --- a/source/Ox.UI/js/Panel/Ox.CollapsePanel.js +++ b/source/Ox.UI/js/Panel/Ox.CollapsePanel.js @@ -47,6 +47,7 @@ Ox.CollapsePanel = function(options, self) { .html(self.options.title/*.toUpperCase()*/) .appendTo($titlebar), $extras; + if (self.options.extras.length) { $extras = Ox.Element() .addClass('OxExtras') @@ -55,6 +56,7 @@ Ox.CollapsePanel = function(options, self) { $extra.appendTo($extras); }); } + that.$content = Ox.Element() .addClass('OxContent') .appendTo(that); @@ -65,11 +67,13 @@ Ox.CollapsePanel = function(options, self) { marginTop: -that.$content.height() + 'px' }); } + function dblclickTitlebar(e) { if (!$(e.target).hasClass('OxButton')) { $switch.trigger('click'); } } + function toggleCollapsed() { var marginTop; self.options.collapsed = !self.options.collapsed; @@ -81,6 +85,7 @@ Ox.CollapsePanel = function(options, self) { collapsed: self.options.collapsed }); } + /*@ setOption setOption (key, value) -> set key to value @@ -101,5 +106,7 @@ Ox.CollapsePanel = function(options, self) { marginTop: -that.$content.height() }); }; + return that; + }; diff --git a/source/Ox.UI/png/icon16.png b/source/Ox.UI/png/icon16.png deleted file mode 100644 index 445a720779c831196eb1d42dccc508c330d3c467..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2880 zcmV-G3%~SKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_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Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000LP)t-sfPjGi|Nnr1fPjF2fPjF2fPjF2fB_-MjsO4v26R$RQvd)!natq8HKyqR z001~iL_t&tTVoJ}0|sO!lW7_d1S + + \ No newline at end of file diff --git a/source/Ox.UI/themes/classic/svg/symbolVolume.svg b/source/Ox.UI/themes/classic/svg/symbolVolume.svg new file mode 100644 index 00000000..51489201 --- /dev/null +++ b/source/Ox.UI/themes/classic/svg/symbolVolume.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/source/Ox.js b/source/Ox.js index d2da0840..82e5dc85 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -171,13 +171,13 @@ Ox.compact = function(arr) { Ox.flatten = function(arr) { // fixme: can this work for objects too? var ret = []; - arr.forEach(function(v) { - if (Ox.isArray(v)) { - Ox.flatten(v).forEach(function(v) { - ret.push(v); + arr.forEach(function(val) { + if (Ox.isArray(val)) { + Ox.flatten(val).forEach(function(val) { + ret.push(val); }); } else { - ret.push(v); + ret.push(val); } }); return ret; @@ -468,6 +468,9 @@ Ox.forEach = function(obj, fn) { } for (key in obj) { key = isObject ? key : parseInt(key); + // fixme: some code somewhere (jQuery wrapper?) relies on looping over the prototype + // ... but the hasOwnProperty call should be uncommented! + // +fixme: fn.call(context, obj[key], key, obj) may be more standard... if (/*hasOwnProperty.call(obj, key) && */fn(obj[key], key) === false) { break; } @@ -1640,6 +1643,7 @@ Ox.element = function(str) { return { //@ 0 The DOM element itself 0: str[0] == '<' ? document.createElement(str.substr(1, str.length - 2)) : + // fixme: why only take the first match? str[0] == '.' ? document.getElementsByClassName(str.substr(1))[0] : str[0] == '#' ? document.getElementById(str.substr(1)) : document.getElementsByTagName(str)[0], @@ -1651,7 +1655,7 @@ Ox.element = function(str) { addClass: function(str) { this[0].className = this[0].className ? Ox.unique( (this[0].className + ' ' + str).split(' ') - ) : str; + ).join(' ') : str; return this; }, /*@ @@ -1713,6 +1717,14 @@ Ox.element = function(str) { return ret; }, /*@ + hasClass Returns true if the element has a given class + (className) -> True if the element has the class + className Class name + @*/ + hasClass: function(str) { + return this[0].className.split(' ').indexOf(str) > -1; + }, + /*@ html Gets or sets the inner HTML () -> The inner HTML (html) -> This element @@ -1734,6 +1746,7 @@ Ox.element = function(str) { callback Callback function event The DOM event @*/ + // fixme: why not a generic bind? mousedown: function(callback) { this[0].onmousedown = callback; return this;