use Ox.break

This commit is contained in:
rolux 2012-05-22 09:11:26 +02:00
parent 3d4a79b6a2
commit 04784630d3
42 changed files with 117 additions and 118 deletions

View file

@ -154,7 +154,7 @@ Ox.load.Geo = function(options, callback) {
Ox.forEach(Ox.COUNTRIES, function(c) { Ox.forEach(Ox.COUNTRIES, function(c) {
if (c.code == code) { if (c.code == code) {
country = c; country = c;
return false; Ox.break();
} }
}); });
return country; return country;
@ -193,7 +193,7 @@ Ox.load.Geo = function(options, callback) {
Ox.forEach(Ox.COUNTRIES, function(c) { Ox.forEach(Ox.COUNTRIES, function(c) {
if (name == c.name || name == c.googleName || name == c.imdbName) { if (name == c.name || name == c.googleName || name == c.imdbName) {
country = c; country = c;
return false; Ox.break();
} }
}); });
return country; return country;

View file

@ -447,14 +447,14 @@ Ox.load.Image = function(options, callback) {
str = ''; str = '';
} else { } else {
// After length more bytes, break // After length more bytes, break
return false; Ox.break();
} }
} }
} }
}); });
return done != 2; done == 2 && Ox.break();
}); });
return done != 2; done == 2 && Ox.break();
} }
}, function() { }, function() {
try { try {

View file

@ -329,7 +329,7 @@ Ox.load.UI = function(options, callback) {
&& !/chrome/.test(userAgent) && !/linux/.test(userAgent) && !/chrome/.test(userAgent) && !/linux/.test(userAgent)
)) { )) {
format = f; format = f;
return false; Ox.break();
} }
} }
}); });

View file

@ -84,7 +84,7 @@ Ox.Resizebar = function(options, self) {
Ox.forEach(self.options.resize, function(v) { Ox.forEach(self.options.resize, function(v) {
if (self.options.size >= v - 8 && self.options.size <= v + 8) { if (self.options.size >= v - 8 && self.options.size <= v + 8) {
self.options.size = v; self.options.size = v;
return false; Ox.break();
} }
}); });
if (self.options.size != size) { if (self.options.size != size) {

View file

@ -702,7 +702,7 @@ Ox.Calendar = function(options, self) {
Ox.forEach(self.options.events, function(v) { Ox.forEach(self.options.events, function(v) {
if (v.id == id) { if (v.id == id) {
event = v; event = v;
return false; Ox.break();
} }
}); });
return event; return event;
@ -777,7 +777,7 @@ Ox.Calendar = function(options, self) {
Ox.forEach(self.lineEvents, function(events, line_) { Ox.forEach(self.lineEvents, function(events, line_) {
if (Ox.getIndexById(events, id) > -1) { if (Ox.getIndexById(events, id) > -1) {
line = line_; line = line_;
return false; Ox.break();
} }
}); });
return line; return line;
@ -817,12 +817,12 @@ Ox.Calendar = function(options, self) {
// if overlaps, check next line // if overlaps, check next line
if (overlaps(event, event_)) { if (overlaps(event, event_)) {
fits = false; fits = false;
return false; Ox.break();
} }
}); });
if (fits) { if (fits) {
line = line_; line = line_;
return false; Ox.break();
} }
}); });
if (line == self.lineEvents.length) { if (line == self.lineEvents.length) {
@ -920,7 +920,7 @@ Ox.Calendar = function(options, self) {
var width = Math.round(v.seconds * pixelsPerSecond); var width = Math.round(v.seconds * pixelsPerSecond);
if (width >= self.minLabelWidth) { if (width >= self.minLabelWidth) {
units = [self.units[i], self.units[i - 1]]; units = [self.units[i], self.units[i - 1]];
return false; Ox.break();
} }
}); });
self.units.reverse(); self.units.reverse();
@ -1296,7 +1296,6 @@ Ox.Calendar = function(options, self) {
} }
event[key] = value; event[key] = value;
event = getEventData(event); event = getEventData(event);
Ox.Log('Calendar', key, value, 'EVENT:', event)
if ($element) { if ($element) {
getLines(); getLines();
renderCalendar(); renderCalendar();

View file

@ -48,7 +48,7 @@ Ox.ListCalendar = function(options, self) {
if (eventDuration > duration) { if (eventDuration > duration) {
iconSize = size; iconSize = size;
} else { } else {
return false; Ox.break();
} }
}); });
return data.type return data.type
@ -377,7 +377,6 @@ Ox.ListCalendar = function(options, self) {
.hide() .hide()
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
Ox.Log('Calendar', 'CHANGE', data);
var exists = false, values; var exists = false, values;
if (['name', 'alternativeNames'].indexOf(data.id) > -1) { if (['name', 'alternativeNames'].indexOf(data.id) > -1) {
exists = ''; exists = '';
@ -392,10 +391,10 @@ Ox.ListCalendar = function(options, self) {
) )
) { ) {
exists = value; exists = value;
return false; Ox.break();
} }
}); });
return !exists; exists && Ox.break();
}); });
} }
if (data.id == 'name') { if (data.id == 'name') {
@ -690,7 +689,7 @@ Ox.ListCalendar = function(options, self) {
|| event.alternativeNames.indexOf(name) > -1 || event.alternativeNames.indexOf(name) > -1
) { ) {
exists = true; exists = true;
return false; Ox.break();
} }
}); });
return exists; return exists;

View file

@ -141,7 +141,7 @@ Ox.DocPage = function(options, self) {
Ox.forEach(this.className.split(' '), function(v) { Ox.forEach(this.className.split(' '), function(v) {
if (/Hidden$/.test(v)) { if (/Hidden$/.test(v)) {
hidden = true; hidden = true;
return false; Ox.break();
} }
}); });
if (!hidden) { if (!hidden) {

View file

@ -156,7 +156,7 @@ Ox.DocPanel = function(options, self) {
Ox.forEach(self.options.items, function(v) { Ox.forEach(self.options.items, function(v) {
if (v.name == name) { if (v.name == name) {
item = v; item = v;
return false; Ox.break();
} }
}); });
return item; return item;

View file

@ -18,7 +18,7 @@ Ox.Theme = (function() {
Ox.forEach(Ox.UI.$body.attr('class').split(' '), function(className) { Ox.forEach(Ox.UI.$body.attr('class').split(' '), function(className) {
if (Ox.startsWith(className, 'OxTheme')) { if (Ox.startsWith(className, 'OxTheme')) {
theme = className.replace('OxTheme', '').toLowerCase(); theme = className.replace('OxTheme', '').toLowerCase();
return false; Ox.break();
} }
}); });
return theme; return theme;
@ -105,7 +105,7 @@ Ox.Theme = (function() {
background: $element_.css('background'), background: $element_.css('background'),
color: $element_.css('color') color: $element_.css('color')
}); });
return false; Ox.break();
} }
}); });
}); });

View file

@ -326,7 +326,7 @@ Ox.URL = function(options) {
value: split.join(operator), value: split.join(operator),
operator: operator operator: operator
}; };
return false; Ox.break();
} }
}); });
if ( if (
@ -523,7 +523,7 @@ Ox.URL = function(options) {
state.view = view; state.view = view;
state.span = span; state.span = span;
parts.shift(); parts.shift();
return false; Ox.break();
} }
}); });
} }
@ -583,7 +583,7 @@ Ox.URL = function(options) {
// sort // sort
state.sort = parseSort(parts[0], state); state.sort = parseSort(parts[0], state);
parts.shift(); parts.shift();
return false; Ox.break();
} }
} }
); );

View file

@ -396,7 +396,7 @@ Ox.Filter = function(options, self) {
Ox.forEach(self.options.query.conditions, function(condition) { Ox.forEach(self.options.query.conditions, function(condition) {
if (condition.conditions) { if (condition.conditions) {
hasGroups = true; hasGroups = true;
return false; Ox.break();
} }
}); });
hasGroups && renderConditions(); hasGroups && renderConditions();
@ -426,7 +426,9 @@ Ox.Filter = function(options, self) {
self.options.query.operator == '&' ? ['', '^', '$'] : ['!', '!^', '!$'] self.options.query.operator == '&' ? ['', '^', '$'] : ['!', '!^', '!$']
).indexOf(condition.operator) > -1 ).indexOf(condition.operator) > -1
&& condition.value === '' && condition.value === ''
return isUseless; // FIXME: this used to be `return isUseless` - but was it intended
// to be the other way around, i.e. `isUseless && Ox.break`?
!isUseless && Ox.break();
}); });
Ox.Log('Form', 'isUseless', isUseless); Ox.Log('Form', 'isUseless', isUseless);
return isUseless; return isUseless;

View file

@ -100,7 +100,7 @@ Ox.Form = function(options, self) {
} }
function submitCallback(data) { function submitCallback(data) {
Ox.forEach(data, function(v, i) { Ox.forEach(data, function(v) {
self.$items[getItemIndexById(v.id)].setMessage(v.message); self.$items[getItemIndexById(v.id)].setMessage(v.message);
}); });
} }
@ -188,7 +188,6 @@ Ox.Form = function(options, self) {
Ox.Log('Form', 'SET FORM VALUES', arguments[0]) Ox.Log('Form', 'SET FORM VALUES', arguments[0])
Ox.forEach(arguments[0], function(value, key) { Ox.forEach(arguments[0], function(value, key) {
var index = getItemIndexById(key); var index = getItemIndexById(key);
index > -1 && Ox.Log('Form', ':::::::', key, value)
index > -1 && self.options.items[index].value(value); index > -1 && self.options.items[index].value(value);
}); });
return that; return that;

View file

@ -65,7 +65,7 @@ Ox.FormPanel = function(options, self) {
Ox.forEach(self.options.form, function(section, i) { Ox.forEach(self.options.form, function(section, i) {
if (section.title == data.ids[0]) { if (section.title == data.ids[0]) {
self.section = i; self.section = i;
return false; Ox.break();
} }
}); });
self.$sections[self.section].show(); self.$sections[self.section].show();
@ -147,7 +147,7 @@ Ox.FormPanel = function(options, self) {
Ox.forEach(self.options.form, function(section, i) { Ox.forEach(self.options.form, function(section, i) {
if (section.title == title) { if (section.title == title) {
index = i; index = i;
return false; Ox.break();
} }
}); });
return index; return index;

View file

@ -90,7 +90,7 @@ Ox.InputGroup = function(options, self) {
Ox.forEach(self.options.inputs, function($input) { Ox.forEach(self.options.inputs, function($input) {
if ($input.focusInput) { if ($input.focusInput) {
$input.focusInput(true); $input.focusInput(true);
return false; Ox.break();
} }
}); });
} }
@ -135,7 +135,6 @@ Ox.InputGroup = function(options, self) {
} }
function validate(data) { function validate(data) {
//Ox.Log('Form', 'INPUTGROUP TRIGGER VALIDATE')
that.triggerEvent('validate', data); that.triggerEvent('validate', data);
} }
@ -152,7 +151,7 @@ Ox.InputGroup = function(options, self) {
//Ox.Log('Form', v, v.options('id'), id) //Ox.Log('Form', v, v.options('id'), id)
if (v.options('id') == self.options.id + Ox.toTitleCase(id)) { if (v.options('id') == self.options.id + Ox.toTitleCase(id)) {
input = v; input = v;
return false; Ox.break();
} }
}); });
return input; return input;

View file

@ -26,7 +26,7 @@ Ox.OptionGroup = function(items, min, max, property) {
), function(v) { ), function(v) {
if (items[v][property]) { if (items[v][property]) {
last = v; last = v;
return false; Ox.break();
} }
}); });
return last; return last;

View file

@ -607,10 +607,9 @@ Ox.List = function(options, self) {
// fixme: is this really needed? // fixme: is this really needed?
var pos = -1; var pos = -1;
Ox.forEach(self.$items, function($item, i) { Ox.forEach(self.$items, function($item, i) {
//Ox.Log('List', '$item', i, self.options.unique, $item.options('data')[self.options.unique])
if ($item.options('data')[self.options.unique] == id) { if ($item.options('data')[self.options.unique] == id) {
pos = i; pos = i;
return false; Ox.break();
} }
}); });
return pos; return pos;
@ -698,7 +697,7 @@ Ox.List = function(options, self) {
ids.push(self.$items[pos].options('data')[self.options.unique]); ids.push(self.$items[pos].options('data')[self.options.unique]);
} else { } else {
notFound = true; notFound = true;
return false; Ox.break();
} }
}); });
if (notFound) { if (notFound) {
@ -1156,7 +1155,7 @@ Ox.List = function(options, self) {
if (Ox.toLatin(v.title).toUpperCase().indexOf(str) == 0) { if (Ox.toLatin(v.title).toUpperCase().indexOf(str) == 0) {
select(i); select(i);
scrollToPosition(i); scrollToPosition(i);
return false; Ox.break();
} }
}); });
} }
@ -1343,7 +1342,7 @@ Ox.List = function(options, self) {
if (oldIds.indexOf(item.id) > -1) { if (oldIds.indexOf(item.id) > -1) {
newIds.push(item.id); newIds.push(item.id);
} }
return newIds.length < oldIds.length; newIds.length == oldIds.length && Ox.break();
}); });
setSelected(newIds); setSelected(newIds);
}); });

View file

@ -259,7 +259,7 @@ Ox.TextList = function(options, self) {
index++; index++;
} else if (v.id == id) { } else if (v.id == id) {
column = v; column = v;
return false; Ox.break();
} }
}); });
column.visible = true; column.visible = true;
@ -283,7 +283,7 @@ Ox.TextList = function(options, self) {
if (!self.options.columns[index].visible) { if (!self.options.columns[index].visible) {
addColumn(id); addColumn(id);
add = true; add = true;
return false; Ox.break();
} }
ids.push(id); ids.push(id);
}); });
@ -291,7 +291,7 @@ Ox.TextList = function(options, self) {
Ox.forEach(self.visibleColumns, function(column) { Ox.forEach(self.visibleColumns, function(column) {
if (ids.indexOf(column.id) == -1) { if (ids.indexOf(column.id) == -1) {
removeColumn(column.id); removeColumn(column.id);
return false; Ox.break();
} }
}); });
} }
@ -484,7 +484,7 @@ Ox.TextList = function(options, self) {
var x = self.drag.listOffset + offset + self.columnWidths[i] / 2; var x = self.drag.listOffset + offset + self.columnWidths[i] / 2;
if (i < self.drag.startPos && e.clientX < x) { if (i < self.drag.startPos && e.clientX < x) {
self.drag.stopPos = i; self.drag.stopPos = i;
return false; Ox.break();
} else if (i > self.drag.startPos && e.clientX > x) { } else if (i > self.drag.startPos && e.clientX > x) {
self.drag.stopPos = i; self.drag.stopPos = i;
} }
@ -574,7 +574,7 @@ Ox.TextList = function(options, self) {
if (Ox.startsWith(value, query)) { if (Ox.startsWith(value, query)) {
that.$body.options({selected: [item[self.unique]]}); that.$body.options({selected: [item[self.unique]]});
Ox.Log('List', 'QUERY', query, 'VALUE', value) Ox.Log('List', 'QUERY', query, 'VALUE', value)
return false; Ox.break();
} }
}); });
} }

View file

@ -33,7 +33,7 @@ Ox.TreeList = function(options, self) {
if (self.options.data) { if (self.options.data) {
self.options.items = []; self.options.items = [];
Ox.forEach(Ox.sort(Ox.keys(self.options.data)), function(key) { Ox.sort(Object.keys(self.options.data)).forEach(function(key) {
self.options.items.push(parseData(key, self.options.data[key])); self.options.items.push(parseData(key, self.options.data[key]));
}); });
} }
@ -123,12 +123,12 @@ Ox.TreeList = function(options, self) {
ret = Ox.extend(item, { ret = Ox.extend(item, {
level: level level: level
}); });
return false; Ox.break();
} }
if (item.items) { if (item.items) {
ret = getItemById(id, item.items, level + 1); ret = getItemById(id, item.items, level + 1);
if (ret) { if (ret) {
return false; Ox.break();
} }
} }
}); });
@ -145,7 +145,7 @@ Ox.TreeList = function(options, self) {
ret = getParent(id, item.items); ret = getParent(id, item.items);
} }
if (ret) { if (ret) {
return false; Ox.break();
} }
} }
}); });

View file

@ -113,7 +113,7 @@ Ox.ListMap = function(options, self) {
if (data.area >= area) { if (data.area >= area) {
iconSize = size; iconSize = size;
} else { } else {
return false; Ox.break();
} }
}); });
return data.type return data.type

View file

@ -543,7 +543,7 @@ Ox.Map = function(options, self) {
if (place.bounds.equals(p.bounds)) { if (place.bounds.equals(p.bounds)) {
place = p; place = p;
exists = true; exists = true;
return false; Ox.break();
} }
}); });
if (!exists) { if (!exists) {
@ -737,7 +737,7 @@ Ox.Map = function(options, self) {
canContain(bounds, result.geometry.bounds || result.geometry.viewport) canContain(bounds, result.geometry.bounds || result.geometry.viewport)
) { ) {
callback(new Ox.MapPlace(parseGeodata(results[i]))); callback(new Ox.MapPlace(parseGeodata(results[i])));
return false; Ox.break();
} }
}); });
} else { } else {
@ -786,7 +786,7 @@ Ox.Map = function(options, self) {
Ox.forEach(self.options.places, function(place, i) { Ox.forEach(self.options.places, function(place, i) {
if (place.name == name) { if (place.name == name) {
position = i; position = i;
return false; Ox.break();
} }
}); });
return position; return position;
@ -802,7 +802,7 @@ Ox.Map = function(options, self) {
Ox.forEach(self.places, function(place) { Ox.forEach(self.places, function(place) {
if (place.selected) { if (place.selected) {
id = place.id; id = place.id;
return false; Ox.break();
} }
}); });
} }
@ -1037,7 +1037,7 @@ Ox.Map = function(options, self) {
Ox.forEach(components, function(component) { Ox.forEach(components, function(component) {
if (component.types.indexOf('country') > -1) { if (component.types.indexOf('country') > -1) {
countryCode = component.short_name; countryCode = component.short_name;
return false; Ox.break();
} }
}); });
return countryCode; return countryCode;
@ -1076,7 +1076,7 @@ Ox.Map = function(options, self) {
var ret; var ret;
Ox.forEach(types, function(v) { Ox.forEach(types, function(v) {
ret = Ox.startsWith(v, type); ret = Ox.startsWith(v, type);
return !ret; ret && Ox.break();
}); });
return ret; return ret;
} }
@ -1084,10 +1084,10 @@ Ox.Map = function(options, self) {
Ox.forEach(values, function(value) { Ox.forEach(values, function(value) {
if (find(value)) { if (find(value)) {
type = key; type = key;
return false; Ox.break();
} }
}); });
return type == 'feature'; type != 'feature' && Ox.break();
}); });
return type; return type;
} }
@ -1243,7 +1243,7 @@ Ox.Map = function(options, self) {
.css({ .css({
width: (scaleWidth - 16) + 'px' width: (scaleWidth - 16) + 'px'
}) })
return false; Ox.break();
} }
}); });
} }

View file

@ -218,7 +218,7 @@ Ox.MapMarker = function(options) {
if (that.place.area >= area) { if (that.place.area >= area) {
that.size = size; that.size = size;
} else { } else {
return false; Ox.break();
} }
}); });
} else if (Ox.isNumber(size)) { } else if (Ox.isNumber(size)) {

View file

@ -151,7 +151,6 @@ Ox.MapPlace = function(options) {
options = Ox.makeObject(arguments); options = Ox.makeObject(arguments);
Ox.forEach(options, function(value, key) { Ox.forEach(options, function(value, key) {
that[key] = value; that[key] = value;
Ox.Log('Map', 'that.' + key, '=', value, '......')
}); });
update(true); update(true);
}; };

View file

@ -177,7 +177,7 @@ Ox.MainMenu = function(options, self) {
if (ids.length == 1) { if (ids.length == 1) {
Ox.forEach(that.menus, function(menu) { Ox.forEach(that.menus, function(menu) {
item = menu.getItem(id); item = menu.getItem(id);
return !item; item && Ox.break();
}); });
} else { } else {
item = that.getMenu(ids.shift()).getItem(ids.join('_')); item = that.getMenu(ids.shift()).getItem(ids.join('_'));
@ -196,7 +196,7 @@ Ox.MainMenu = function(options, self) {
Ox.forEach(that.menus, function(v) { Ox.forEach(that.menus, function(v) {
if (v.options('id') == id) { if (v.options('id') == id) {
menu = v; menu = v;
return false; Ox.break();
} }
}); });
} else { } else {

View file

@ -191,7 +191,7 @@ Ox.Menu = function(options, self) {
Ox.forEach(that.items, function(item, i) { Ox.forEach(that.items, function(item, i) {
if (item.options('id') == id) { if (item.options('id') == id) {
position = i; position = i;
return false; Ox.break();
} }
}); });
return position; return position;
@ -206,7 +206,8 @@ Ox.Menu = function(options, self) {
var ret = true; var ret = true;
Ox.forEach(that.items, function(item, i) { Ox.forEach(that.items, function(item, i) {
if (i < self.options.selected && !item.options('disabled')) { if (i < self.options.selected && !item.options('disabled')) {
return ret = false; ret = false;
Ox.break();
} }
}); });
return ret; return ret;
@ -216,7 +217,8 @@ Ox.Menu = function(options, self) {
var ret = true; var ret = true;
Ox.forEach(that.items, function(item, i) { Ox.forEach(that.items, function(item, i) {
if (i > self.options.selected && !item.options('disabled')) { if (i > self.options.selected && !item.options('disabled')) {
return ret = false; ret = false;
Ox.break();
} }
}); });
return ret; return ret;
@ -459,7 +461,7 @@ Ox.Menu = function(options, self) {
Ox.forEach(that.submenus, function(submenu, id) { Ox.forEach(that.submenus, function(submenu, id) {
if (!submenu.is(':hidden')) { if (!submenu.is(':hidden')) {
submenu.hideMenu(); submenu.hideMenu();
return false; Ox.break();
} }
}); });
item.options('items').length && that.submenus[item.options('id')].showMenu(); item.options('items').length && that.submenus[item.options('id')].showMenu();
@ -650,13 +652,13 @@ Ox.Menu = function(options, self) {
Ox.forEach(that.items, function(v) { Ox.forEach(that.items, function(v) {
if (v.options('id') == id) { if (v.options('id') == id) {
item = v; item = v;
return false; Ox.break();
} }
}); });
if (!item) { if (!item) {
Ox.forEach(that.submenus, function(submenu) { Ox.forEach(that.submenus, function(submenu) {
item = submenu.getItem(id); item = submenu.getItem(id);
return !item; item && Ox.break();
}); });
} }
} else { } else {
@ -689,7 +691,8 @@ Ox.Menu = function(options, self) {
var ret = false; var ret = false;
Ox.forEach(that.items, function(item) { Ox.forEach(that.items, function(item) {
if (!item.options('disabled')) { if (!item.options('disabled')) {
return ret = true; ret = true;
Ox.break();
} }
}); });
return ret; return ret;
@ -706,7 +709,7 @@ Ox.Menu = function(options, self) {
Ox.forEach(that.submenus, function(submenu) { Ox.forEach(that.submenus, function(submenu) {
if (submenu.is(':visible')) { if (submenu.is(':visible')) {
submenu.hideMenu(); submenu.hideMenu();
return false; Ox.break();
} }
}); });
selectItem(-1); selectItem(-1);

View file

@ -103,7 +103,7 @@ Ox.SplitPanel = function(options, self) {
Ox.forEach(self.options.elements, function(element, i) { Ox.forEach(self.options.elements, function(element, i) {
if (element.element.options('id') == id) { if (element.element.options('id') == id) {
position = i; position = i;
return false; Ox.break();
} }
}); });
return position; return position;

View file

@ -188,10 +188,10 @@ Ox.AnnotationPanel = function(options, self) {
if (item.id == annotationId) { if (item.id == annotationId) {
annotation = item; annotation = item;
found = true; found = true;
return false; Ox.break();
} }
}); });
return !found; found && Ox.break();
}); });
return annotation; return annotation;
} }
@ -203,10 +203,10 @@ Ox.AnnotationPanel = function(options, self) {
if (item.id == annotationId) { if (item.id == annotationId) {
folder = self.$folder[i]; folder = self.$folder[i];
found = true; found = true;
return false; Ox.break();
} }
}); });
return !found; found && Ox.break();
}); });
return folder; return folder;
} }
@ -427,7 +427,7 @@ Ox.AnnotationPanel = function(options, self) {
self.deselecting = true; self.deselecting = true;
$folder.options({selected: ''}); $folder.options({selected: ''});
self.deselecting = false; self.deselecting = false;
return false; Ox.break();
} }
}); });
scrollToSelected(self.options.layers[index].type); scrollToSelected(self.options.layers[index].type);

View file

@ -157,7 +157,7 @@ Ox.BlockVideoTimeline = function(options, self) {
Ox.forEach(self.options.subtitles, function(v) { Ox.forEach(self.options.subtitles, function(v) {
if (v['in'] <= position && v.out > position) { if (v['in'] <= position && v.out > position) {
subtitle = v; subtitle = v;
return false; Ox.break();
} }
}); });
return subtitle; return subtitle;

View file

@ -118,7 +118,7 @@ Ox.SmallVideoTimeline = function(options, self) {
Ox.forEach(self.options.subtitles, function(v) { Ox.forEach(self.options.subtitles, function(v) {
if (v['in'] <= position && v.out > position) { if (v['in'] <= position && v.out > position) {
subtitle = v; subtitle = v;
return false; Ox.break();
} }
}); });
return subtitle; return subtitle;

View file

@ -863,10 +863,10 @@ Ox.VideoEditor = function(options, self) {
if (item.id == annotationId) { if (item.id == annotationId) {
value = item.value; value = item.value;
found = true; found = true;
return false; Ox.break();
} }
}); });
return !found; found && Ox.break();
}); });
return value; return value;
} }
@ -917,7 +917,7 @@ Ox.VideoEditor = function(options, self) {
) { ) {
position = v; position = v;
found = true; found = true;
return false; Ox.break();
} }
}); });
direction == -1 && positions.reverse(); direction == -1 && positions.reverse();
@ -1104,7 +1104,7 @@ Ox.VideoEditor = function(options, self) {
'in': i ? self.options.cuts[i - 1] : 0, 'in': i ? self.options.cuts[i - 1] : 0,
out: cut - 1 / self.options.fps out: cut - 1 / self.options.fps
}; };
return false; Ox.break();
} }
}); });
self.options.selected = ''; self.options.selected = '';

View file

@ -231,7 +231,7 @@ Ox.VideoEditorPlayer = function(options, self) {
Ox.forEach(self.options.subtitles, function(v) { Ox.forEach(self.options.subtitles, function(v) {
if (v['in'] <= self.options.position && v['out'] > self.options.position) { if (v['in'] <= self.options.position && v['out'] > self.options.position) {
subtitle = v.value; subtitle = v.value;
return false; Ox.break();
} }
}); });
return subtitle; return subtitle;
@ -273,8 +273,8 @@ Ox.VideoEditorPlayer = function(options, self) {
self.$markerFrame.show() : self.$markerFrame.hide(); self.$markerFrame.show() : self.$markerFrame.hide();
Ox.forEach(self.$markerPoint, function(markers, point) { Ox.forEach(self.$markerPoint, function(markers, point) {
Ox.forEach(markers, function(marker) { Ox.forEach(markers, function(marker) {
self.options.position == self.options.points[point == 'in' ? 0 : 1] ? self.options.position == self.options.points[point == 'in' ? 0 : 1]
marker.show() : marker.hide(); ? marker.show() : marker.hide();
}); });
}) })
} }

View file

@ -441,9 +441,9 @@ Ox.VideoElement = function(options, self) {
} }
}); });
} else { } else {
Ox.forEach(self.items[0].$videos, function($video, i) { self.items[0].$videos.forEach(function($video, i) {
var src = self.options.src[i]; var src = self.options.src[i];
if(Ox.parseURL(src).protocol.substr(0, 4) == 'http') { if (Ox.parseURL(src).protocol.substr(0, 4) == 'http') {
src += '?' + Ox.uid(); src += '?' + Ox.uid();
} }
$video[0].src = src; $video[0].src = src;

View file

@ -1214,7 +1214,7 @@ Ox.VideoPlayer = function(options, self) {
&& v.out > self.options.position && v.out > self.options.position
) { ) {
censored = true; censored = true;
return false; Ox.break();
} }
}); });
return censored; return censored;
@ -1392,7 +1392,7 @@ Ox.VideoPlayer = function(options, self) {
&& v.out >= self.options.position && v.out >= self.options.position
) { ) {
subtitle = v.text; subtitle = v.text;
return false; Ox.break();
} }
}); });
return subtitle; return subtitle;
@ -1441,7 +1441,7 @@ Ox.VideoPlayer = function(options, self) {
var left = 0; var left = 0;
Ox.forEach(self.options.controlsBottom, function(control) { Ox.forEach(self.options.controlsBottom, function(control) {
if (control == 'timeline') { if (control == 'timeline') {
return false; Ox.break();
} }
left += control == 'position' ? self.positionWidth : 16 left += control == 'position' ? self.positionWidth : 16
}); });
@ -1525,7 +1525,7 @@ Ox.VideoPlayer = function(options, self) {
) { ) {
result = v result = v
found = true; found = true;
return false; Ox.break();
} }
}); });
direction == -1 && self.results.reverse(); direction == -1 && self.results.reverse();
@ -1882,16 +1882,16 @@ Ox.VideoPlayer = function(options, self) {
function setMarkers() { function setMarkers() {
//Ox.Log('Video', 'SET MARKERS', self.options.position, self.options['in'], self.options.out, self.$pointMarker); //Ox.Log('Video', 'SET MARKERS', self.options.position, self.options['in'], self.options.out, self.$pointMarker);
Ox.forEach(self.$posterMarker, function(marker) { Ox.forEach(self.$posterMarker, function(marker) {
isEqual(self.options.position, self.options.posterFrame) ? isEqual(self.options.position, self.options.posterFrame)
marker.show() : marker.hide(); ? marker.show() : marker.hide();
}); });
Ox.forEach(self.$pointMarker, function(markers, point) { Ox.forEach(self.$pointMarker, function(markers, point) {
Ox.forEach(markers, function(marker) { Ox.forEach(markers, function(marker) {
//Ox.Log('Video', self.options.position, self.options[point], isEqual(self.options.position, self.options[point])) //Ox.Log('Video', self.options.position, self.options[point], isEqual(self.options.position, self.options[point]))
// fixme: there's a bug in jquery and/or webkit // fixme: there's a bug in jquery and/or webkit
// on load, show() doesn't work // on load, show() doesn't work
isEqual(self.options.position, self.options[point]) ? isEqual(self.options.position, self.options[point])
marker.css({display: 'block'}) : marker.hide(); ? marker.css({display: 'block'}) : marker.hide();
}); });
}); });
} }

View file

@ -485,7 +485,7 @@ Ox.VideoTimelinePlayer = function(options, self) {
Ox.forEach(self.options.subtitles, function(v) { Ox.forEach(self.options.subtitles, function(v) {
if (v['in'] <= position && v.out > position) { if (v['in'] <= position && v.out > position) {
subtitle = v; subtitle = v;
return false; Ox.break();
} }
}); });
return subtitle; return subtitle;

View file

@ -255,10 +255,9 @@ Ox.Dialog = function(options, self) {
function getButtonById(id) { function getButtonById(id) {
var ret = null; var ret = null;
Ox.forEach(self.options.buttons, function(button) { Ox.forEach(self.options.buttons, function(button) {
//Ox.Log('Window', button.options(), button.options('id'))
if (button.options && button.options('id') == id) { if (button.options && button.options('id') == id) {
ret = button; ret = button;
return false; Ox.break();
} }
}); });
return ret; return ret;

View file

@ -317,7 +317,7 @@ Ox.api = function(items, options) {
(query.operator == '&' && !match) (query.operator == '&' && !match)
|| (query.operator == '|' && match) || (query.operator == '|' && match)
) { ) {
return false; Ox.break();
} }
}); });
return match; return match;
@ -459,7 +459,7 @@ Ox.range = function() {
len = article.length; len = article.length;
sort[val] = sort[val].substr(len + 1) + ', ' sort[val] = sort[val].substr(len + 1) + ', '
+ sort[val].substr(0, len); + sort[val].substr(0, len);
return false; Ox.break();
} }
}); });
} else { } else {

View file

@ -332,7 +332,7 @@
img <e> Any JavaScript PNG image object img <e> Any JavaScript PNG image object
str <s> The string to be encoded str <s> The string to be encoded
@*/ @*/
// fixme: remove, exists in image module
Ox.encodePNG = function(img, str) { Ox.encodePNG = function(img, str) {
var c = Ox.canvas(img), i = 0; var c = Ox.canvas(img), i = 0;
// Compress the string // Compress the string

View file

@ -337,7 +337,7 @@ Ox.formatDateRangeDuration = function(start, end, utc) {
keys = ['year', 'month', 'day', 'hour', 'minute', 'second'], keys = ['year', 'month', 'day', 'hour', 'minute', 'second'],
parts = ['FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'], parts = ['FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'],
values = []; values = [];
Ox.forEach(keys, function(key, i) { keys.forEach(function(key, i) {
while (true) { while (true) {
if (key == 'month') { if (key == 'month') {
// set the day to the same day in the next month, // set the day to the same day in the next month,
@ -574,7 +574,7 @@ Ox.formatValue = function(num, str, bin) {
if (num < Math.pow(base, i + 1) || i == len - 1) { if (num < Math.pow(base, i + 1) || i == len - 1) {
val = Ox.formatNumber(num / Math.pow(base, i), i ? i - 1 : 0) + val = Ox.formatNumber(num / Math.pow(base, i), i ? i - 1 : 0) +
' ' + chr + (chr && bin ? 'i' : '') + str; ' ' + chr + (chr && bin ? 'i' : '') + str;
return false; Ox.break();
} }
}); });
return val; return val;

View file

@ -266,10 +266,10 @@
Ox.forEach(areas[0], function(area0) { Ox.forEach(areas[0], function(area0) {
ret = contains(area0, area1); ret = contains(area0, area1);
// Break if the outer part contains the inner part // Break if the outer part contains the inner part
return !ret; ret && Ox.break();
}); });
// Break if no outer part contains the inner part // Break if no outer part contains the inner part
return ret; !ret && Ox.break();
}); });
return ret; return ret;
}; };
@ -327,7 +327,7 @@
: Ox.joinAreas(intersections); : Ox.joinAreas(intersections);
} }
if (ret === null) { if (ret === null) {
return false; Ox.break();
} else { } else {
ret = splitArea(ret); ret = splitArea(ret);
} }
@ -378,7 +378,7 @@
Ox.forEach(gaps, function(gap, i) { Ox.forEach(gaps, function(gap, i) {
if (Ox.containsArea(gap, area)) { if (Ox.containsArea(gap, area)) {
ret = i; ret = i;
return false; Ox.break();
} }
}); });
return ret; return ret;

View file

@ -643,7 +643,7 @@ Ox.tokenize = (function() {
Ox.forEach(word, function(value, key) { Ox.forEach(word, function(value, key) {
if (value.indexOf(str) > -1) { if (value.indexOf(str) > -1) {
type = key; type = key;
return false; Ox.break();
} }
}); });
}, },

View file

@ -28,7 +28,7 @@ Ox.keyOf = function(obj, val) {
Ox.forEach(obj, function(v, k) { Ox.forEach(obj, function(v, k) {
if (v === val) { if (v === val) {
key = k; key = k;
return false; Ox.break();
} }
}); });
return key; return key;
@ -84,7 +84,7 @@ Ox.unserialize <f> Parses query parameters into an object
@*/ @*/
Ox.unserialize = function(str, toNumber) { Ox.unserialize = function(str, toNumber) {
var obj = {}; var obj = {};
Ox.forEach(str.split('&'), function(val) { str.split('&').forEach(function(val) {
if (val) { if (val) {
var arr = val.split('='); var arr = val.split('=');
if (arr[1]) { if (arr[1]) {

View file

@ -109,7 +109,7 @@ Ox.highlightHTML = function(html, str, classname, tags) {
Ox.forEach(tags, function(tag) { Ox.forEach(tags, function(tag) {
if (html.substr(i + 1).match(new RegExp('^/?' + tag + '\\W'))) { if (html.substr(i + 1).match(new RegExp('^/?' + tag + '\\W'))) {
isTag = true; isTag = true;
return false; Ox.break();
} }
}); });
} }
@ -378,7 +378,7 @@ Ox.parseUserAgent = function(userAgent) {
string: string, string: string,
version: versions[version] || version version: versions[version] || version
}; };
return false; Ox.break();
} }
}); });
}); });
@ -616,7 +616,8 @@ Ox.wordwrap = function(str, len, sep, bal, spa) {
} }
} }
lines = ['']; lines = [''];
Ox.forEach(words, function(word) { words.forEach(function(word) {
var chr;
if ((lines[lines.length - 1] + word + ' ').length <= len + 1) { if ((lines[lines.length - 1] + word + ' ').length <= len + 1) {
// word fits in current line // word fits in current line
lines[lines.length - 1] += word + ' '; lines[lines.length - 1] += word + ' ';
@ -626,11 +627,11 @@ Ox.wordwrap = function(str, len, sep, bal, spa) {
lines.push(word + ' '); lines.push(word + ' ');
} else { } else {
// word is longer than line // word is longer than line
var chr = len - lines[lines.length - 1].length; chr = len - lines[lines.length - 1].length;
lines[lines.length - 1] += word.substr(0, chr); lines[lines.length - 1] += word.substr(0, chr);
for (var pos = chr; pos < word.length; pos += len) { Ox.loop(chr, word.length, len, function(pos) {
lines.push(word.substr(pos, len)); lines.push(word.substr(pos, len));
} });
lines[lines.length - 1] += ' '; lines[lines.length - 1] += ' ';
} }
} }

View file

@ -140,7 +140,7 @@ Ox.isEqual = function(a, b) {
isEqual = true; isEqual = true;
Ox.forEach(a, function(v, k) { Ox.forEach(a, function(v, k) {
isEqual = Ox.isEqual(v, b[k]); isEqual = Ox.isEqual(v, b[k]);
return isEqual; !isEqual && Ox.break();
}); });
} }
} }