From 17aca54e7a8f6a1ca9073f892003183eba828914 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 25 Mar 2012 21:23:03 +0000 Subject: [PATCH] temporary fix for video skipping bug (#716); add third parameter (index) to forEach callback; add Geo colors --- demos/fileinput/js/fileinput.js | 29 +++++------------ demos/listmap/js/listmap.js | 28 +--------------- source/Ox.Geo/Ox.Geo.js | 43 +++++++++++++++++++++++++ source/Ox.UI/js/Video/Ox.VideoPlayer.js | 3 ++ source/Ox/js/Collection.js | 4 +-- 5 files changed, 57 insertions(+), 50 deletions(-) diff --git a/demos/fileinput/js/fileinput.js b/demos/fileinput/js/fileinput.js index fff49f0e..1d76b13b 100644 --- a/demos/fileinput/js/fileinput.js +++ b/demos/fileinput/js/fileinput.js @@ -24,9 +24,9 @@ Ox.load('UI', function() { $main = Ox.Element() .append( - Ox.Label({ - textAlign: 'center', - title: 'File Button', + Ox.FileButton({ + maxFiles: 1, + title: 'Select File...', width: 128 }) .css({ @@ -37,20 +37,7 @@ Ox.load('UI', function() { ) .append( Ox.FileButton({ - maxFiles: 1, - title: 'Select File...', - width: 128 - }) - .css({ - position: 'absolute', - left: '160px', - top: '16px' - }) - ) - .append( - Ox.Label({ - textAlign: 'center', - title: 'File Input', + title: 'Select Files...', width: 128 }) .css({ @@ -66,8 +53,8 @@ Ox.load('UI', function() { }) .css({ position: 'absolute', - left: '160px', - top: '48px' + left: '16px', + top: '80px' }) ) .append( @@ -76,8 +63,8 @@ Ox.load('UI', function() { }) .css({ position: 'absolute', - left: '160px', - top: '80px' + left: '16px', + top: '112px' }) ), diff --git a/demos/listmap/js/listmap.js b/demos/listmap/js/listmap.js index 7c31834e..5a05a779 100644 --- a/demos/listmap/js/listmap.js +++ b/demos/listmap/js/listmap.js @@ -1,31 +1,5 @@ Ox.load({UI: {}, Geo: {}}, function() { - var markerColor = { - 'Northern America': [64, 64, 255], - 'Central America': [0, 0, 255], - 'Caribbean': [0, 0, 128], - 'Southern America': [0, 255, 0], - 'Northern Europe': [255, 255, 192], - 'Western Europe': [255, 255, 0], - 'Eastern Europe': [255, 128, 0], - 'Southern Europe': [128, 128, 0], - 'Northern Africa': [128, 128, 128], - 'Western Africa': [64, 64, 128], - 'Middle Africa': [64, 64, 64], - 'Eastern Africa': [128, 64, 64], - 'Southern Africa': [64, 128, 64], - 'Western Asia': [255, 128, 128], - 'Central Asia': [255, 0, 0], - 'Eastern Asia': [128, 0, 0], - 'Southern Asia': [255, 0, 255], - 'South-Eastern Asia': [128, 0, 128], - 'Australia and New Zealand': [0, 128, 128], - 'Micronesia': [192, 255, 255], - 'Melanesia': [0, 255, 255], - 'Polynesia': [128, 128, 255], - 'Antarctica': [192, 192, 192] - }, - $listmap = new Ox.ListMap({ height: window.innerHeight, places: Ox.COUNTRIES.map(function(place) { @@ -37,7 +11,7 @@ Ox.load({UI: {}, Geo: {}}, function() { flag: place.code, geoname: place.name, id: place.code, - markerColor: markerColor[place.region] || [128,128,128], + markerColor: Ox.getGeoColor(place.region), name: place.name, type: 'country', lat: place.lat, diff --git a/source/Ox.Geo/Ox.Geo.js b/source/Ox.Geo/Ox.Geo.js index 12a7e484..61279318 100644 --- a/source/Ox.Geo/Ox.Geo.js +++ b/source/Ox.Geo/Ox.Geo.js @@ -76,6 +76,45 @@ Ox.load.Geo = function(options, callback) { @*/ Ox.COUNTRIES = data; + var colors = { + + 'North America': [0, 0, 255], + 'Northern America': [0, 0, 255], + + 'South America': [0, 255, 0], + 'Southern America': [0, 255, 0], + 'Caribbean': [192, 255, 192], + 'Central America': [0, 128, 0], + + 'Europe': [255, 255, 0], + 'Western Europe': [255, 255, 0], + 'Northern Europe': [255, 255, 192], + 'Southern Europe': [128, 128, 0], + 'Eastern Europe': [255, 192, 0], + + 'Africa': [255, 0, 255], + 'Northern Africa': [255, 0, 255], + 'Southern Africa': [255, 128, 255], + 'Middle Africa': [128, 0, 128], + 'Western Africa': [128, 0, 255], + 'Eastern Africa': [255, 0, 128], + + 'Asia': [255, 0, 0], + 'Eastern Asia': [255, 0, 0], + 'South-Eastern Asia': [255, 128, 128], + 'Southern Asia': [128, 0, 0], + 'Western Asia': [255, 128, 0], + 'Central Asia': [128, 64, 0], + + 'Oceania': [0, 255, 255], + 'Australia and New Zealand': [0, 255, 255], + 'Micronesia': [192, 255, 255], + 'Melanesia': [0, 128, 128], + 'Polynesia': [128, 128, 255], + + 'Antarctica': [128, 128, 128] + + }; //@ Functions ---------------------------------------------------------- @@ -176,6 +215,10 @@ Ox.load.Geo = function(options, callback) { return Ox.PATH + 'Ox.Geo/png/flags/' + size + '/' + code + '.png'; }; + Ox.getGeoColor = function(str) { + return colors[str] || [128, 128, 128]; + }; + callback(true); }); diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index 066023f8..5a77c11d 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -1721,9 +1721,12 @@ Ox.VideoPlayer = function(options, self) { that.triggerEvent('playing', { position: self.options.position }); + /* + temporarily disabled minute != previousMinute && that.triggerEvent('position', { position: minute * 60 }); + */ } function playInToOut() { diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index f69c6283..d5217027 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -169,7 +169,7 @@ Ox.forEach forEach loop "012abcfoo" @*/ Ox.forEach = function(col, fn, includePrototype) { - var isObject = Ox.isObject(col), key; + var ind = 0, isObject = Ox.isObject(col), key; // Safari will not loop through an arguments array col = Ox.isArguments(col) ? Ox.makeArray(col) : col; for (key in col) { @@ -177,7 +177,7 @@ Ox.forEach = function(col, fn, includePrototype) { // fixme: fn.call(context, obj[key], key, obj) may be more standard... if (( includePrototype || Object.hasOwnProperty.call(col, key) - ) && fn(col[key], key) === false) { + ) && fn(col[key], key, ind++) === false) { break; } }