temporary fix for video skipping bug (#716); add third parameter (index) to forEach callback; add Geo colors

This commit is contained in:
rlx 2012-03-25 21:23:03 +00:00
parent 8c67bf9462
commit 17aca54e7a
5 changed files with 57 additions and 50 deletions

View file

@ -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'
})
),

View file

@ -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,

View file

@ -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);
});

View file

@ -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() {

View file

@ -169,7 +169,7 @@ Ox.forEach <f> 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;
}
}