From 1d00e6dc2e7299c6d8190484dcd4b6af790831fa Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 11 Sep 2010 10:59:40 +0200 Subject: [PATCH] better icon loading for firefox --- build/css/ox.ui.classic.css | 2 +- build/css/ox.ui.css | 2 +- build/css/ox.ui.modern.css | 2 +- build/js/ox.js | 2 +- build/js/ox.ui.js | 38 +++++++++++++++++++++----------- build/png/ox.ui/transparent.png | Bin 0 -> 2792 bytes 6 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 build/png/ox.ui/transparent.png diff --git a/build/css/ox.ui.classic.css b/build/css/ox.ui.classic.css index ce75b363..c6bd7bad 100644 --- a/build/css/ox.ui.classic.css +++ b/build/css/ox.ui.classic.css @@ -165,7 +165,7 @@ Lists ================================================================================ */ -.OxThemeClassic .OxIconList .OxItem > .OxIcon img.OxLoading { +.OxThemeClassic .OxIconList .OxItem img.OxLoading { border-color: rgb(208, 208, 208); background: -moz-linear-gradient(top, rgb(255, 255, 255), rgb(224, 224, 224)); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(255, 255, 255)), color-stop(1, rgb(224, 224, 224))); diff --git a/build/css/ox.ui.css b/build/css/ox.ui.css index 9b4a580c..69477f7e 100644 --- a/build/css/ox.ui.css +++ b/build/css/ox.ui.css @@ -692,7 +692,7 @@ Lists .OxIconList .OxItem > .OxIcon, .OxIconList .OxItem > .OxText { - left: -2px; + //left: -2px; } .OxIconList .OxItem > .OxIcon img { diff --git a/build/css/ox.ui.modern.css b/build/css/ox.ui.modern.css index 0858afb2..8060d876 100644 --- a/build/css/ox.ui.modern.css +++ b/build/css/ox.ui.modern.css @@ -146,7 +146,7 @@ Lists ================================================================================ */ -.OxThemeModern .OxIconList .OxItem > .OxIcon img.OxLoading { +.OxThemeModern .OxIconList .OxItem img.OxLoading { border-color: rgb(48, 48, 48); background: -moz-linear-gradient(top, rgb(32, 32, 32), rgb(0, 0, 0)); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(32, 32, 32)), color-stop(1, rgb(0, 0, 0))); diff --git a/build/js/ox.js b/build/js/ox.js index 3f8f627f..26ca2919 100644 --- a/build/js/ox.js +++ b/build/js/ox.js @@ -1731,7 +1731,7 @@ Ox.wordwrap = function(str, len, sep, bal, spa) { >>> Ox.wordwrap("These are short words", 16, "
", true) These are
short words */ - var str = str.toString(), + var str = str === null ? '' : str.toString(), len = len || 80, sep = sep || "
", bal = bal || false, diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 5a171c71..f2db5906 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -5719,7 +5719,7 @@ requires height: self.options.size * 1.5, lineLength: self.options.size == 64 ? 17 : 23, lines: self.options.size == 64 ? 4 : 5, - url: oxui.path + '/png/ox.ui.' + Ox.theme() + '/icon.png', + url: oxui.path + '/png/ox.ui/transparent.png', width: self.options.size }); self.title = formatText(self.options.title, self.lines - 1, self.lineLength); @@ -5732,14 +5732,14 @@ requires that.$icon = $('
') .addClass('OxIcon') .css({ - top: self.options.size == 64 ? -68 : -120, + top: self.options.size == 64 ? -72 : -124, width: (self.options.size + 4) + 'px', - height: self.options.size + 'px' + height: (self.options.size + 4) + 'px' }); that.$iconImage = $('') .addClass('OxLoading OxTarget') .attr({ - src: self.options.url + src: self.url }) .css({ width: self.options.width + 'px', @@ -5748,7 +5748,7 @@ requires .mousedown(mousedown) .mouseenter(mouseenter) .mouseleave(mouseleave) - .load(load); + .one('load', load); that.$textBox = $('
') .addClass('OxText') .css({ @@ -5770,17 +5770,19 @@ requires .addClass('OxReflection') .css({ top: self.options.size + 'px', - width: self.options.size + 'px', + width: (self.options.size + 4) + 'px', height: (self.options.size / 2) + 'px' }); that.$reflectionImage = $('') .addClass('OxLoading') .attr({ - src: self.options.url + src: self.url }) .css({ width: self.options.width + 'px', - height: self.options.height + 'px' + height: self.options.height + 'px', + // firefox is 1px off when centering images with odd width and scaleY(-1) + paddingLeft: ($.browser.mozilla && self.options.width % 2 ? 1 : 0) + 'px' }); that.$gradient = $('
') .css({ @@ -5821,8 +5823,16 @@ requires } function load() { - that.$iconImage.removeClass('OxLoading'); - that.$reflectionImage.removeClass('OxLoading'); + that.$iconImage.attr({ + src: self.options.url + }) + .one('load', function() { + that.$iconImage.removeClass('OxLoading'); + that.$reflectionImage.removeClass('OxLoading'); + }); + that.$reflectionImage.attr({ + src: self.options.url + }); } function mousedown(e) { @@ -6071,9 +6081,11 @@ requires } function getPage() { - return self.options.orientation == 'horizontal' - ? Math.floor((that.scrollLeft() - self.listMargin / 2) / self.pageWidth) - : Math.floor((that.scrollTop() - self.listMargin / 2) / self.pageHeight); + return Math.max( + Math.floor(self.options.orientation == 'horizontal' ? + (that.scrollLeft() - self.listMargin / 2) / self.pageWidth : + (that.scrollTop() - self.listMargin / 2) / self.pageHeight + ), 0); } function getPositions() { diff --git a/build/png/ox.ui/transparent.png b/build/png/ox.ui/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..95007b9b3c3482e697ef5e9ab38940514d0cacd0 GIT binary patch literal 2792 zcmVP)KLZ*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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