removing print statements and dead code

This commit is contained in:
rolux 2011-01-13 12:43:02 +00:00
parent a3aba62f29
commit 18ce6852c4

View file

@ -8,7 +8,7 @@ var pandora = new Ox.App({
init: 'hello', init: 'hello',
}).launch(function(data) { }).launch(function(data) {
Ox.print('data', data); //Ox.print('data', data);
var app = { var app = {
$ui: { $ui: {
@ -38,14 +38,15 @@ var pandora = new Ox.App({
function load() { function load() {
$(function() { $(function() {
// fixme: use jquert ajaxStart?
var $body = $('body'); var $body = $('body');
Ox.Request.requests() && app.$ui.loadingIcon.start(); Ox.Request.requests() && app.$ui.loadingIcon.start();
$body.bind('requestStart', function() { $body.bind('requestStart', function() {
Ox.print('requestStart') //Ox.print('requestStart')
app.$ui.loadingIcon.start(); app.$ui.loadingIcon.start();
}); });
$body.bind('requestStop', function() { $body.bind('requestStop', function() {
Ox.print('requestStop') //Ox.print('requestStop')
app.$ui.loadingIcon.stop(); app.$ui.loadingIcon.stop();
}); });
}); });
@ -70,7 +71,7 @@ var pandora = new Ox.App({
app.$ui.map.triggerResize(); app.$ui.map.triggerResize();
} }
} else { } else {
Ox.print('app.$ui.window.resize'); //Ox.print('app.$ui.window.resize');
app.$ui.browser.scrollToSelection(); app.$ui.browser.scrollToSelection();
app.user.ui.itemView == 'timeline' && app.$ui.editor.options({ app.user.ui.itemView == 'timeline' && app.$ui.editor.options({
height: app.$ui.document.height() - height: app.$ui.document.height() -
@ -117,7 +118,7 @@ var pandora = new Ox.App({
return that; return that;
}, },
accountDialogOptions: function(action, value) { accountDialogOptions: function(action, value) {
Ox.print('ACTION', action) //Ox.print('ACTION', action)
app.$ui.accountForm && app.$ui.accountForm.remove(); app.$ui.accountForm && app.$ui.accountForm.remove();
var buttons = { var buttons = {
login: ['register', 'reset'], login: ['register', 'reset'],
@ -164,7 +165,7 @@ var pandora = new Ox.App({
id: type, id: type,
title: buttonTitle[type] + '...' title: buttonTitle[type] + '...'
}).bindEvent('click', function() { }).bindEvent('click', function() {
Ox.print('CLICK EVENT', type) //Ox.print('CLICK EVENT', type)
app.$ui.accountDialog.options(ui.accountDialogOptions(type)); app.$ui.accountDialog.options(ui.accountDialogOptions(type));
}); });
} }
@ -196,12 +197,12 @@ var pandora = new Ox.App({
if (app.$ui.accountForm) { if (app.$ui.accountForm) {
app.$ui.accountForm.items.forEach(function(item) { app.$ui.accountForm.items.forEach(function(item) {
if (item.options('id') == 'usernameOrEmail') { if (item.options('id') == 'usernameOrEmail') {
Ox.print('REMOVING') //Ox.print('REMOVING')
//Ox.Event.unbind('usernameOrEmailSelect') //Ox.Event.unbind('usernameOrEmailSelect')
//Ox.Event.unbind('usernameOrEmailSelectMenu') //Ox.Event.unbind('usernameOrEmailSelectMenu')
//Ox.Event.unbind('usernameOrEmailInput') //Ox.Event.unbind('usernameOrEmailInput')
} }
Ox.print('REMOVING ITEM', item.options('id')); //Ox.print('REMOVING ITEM', item.options('id'));
item.remove(); item.remove();
}); });
} }
@ -265,7 +266,7 @@ var pandora = new Ox.App({
}, },
validate: function(event, data) { validate: function(event, data) {
Ox.print('FORM VALIDATE', data) //Ox.print('FORM VALIDATE', data)
app.$ui.accountDialog[ app.$ui.accountDialog[
(data.valid ? 'enable' : 'disable') + 'Button' (data.valid ? 'enable' : 'disable') + 'Button'
]('submit' + Ox.toTitleCase(action)); ]('submit' + Ox.toTitleCase(action));
@ -580,7 +581,7 @@ var pandora = new Ox.App({
min: 1, min: 1,
orientation: 'horizontal', orientation: 'horizontal',
request: function(data, callback) { request: function(data, callback) {
Ox.print('data, Query.toObject', data, Query.toObject()) //Ox.print('data, Query.toObject', data, Query.toObject())
pandora.api.find($.extend(data, { pandora.api.find($.extend(data, {
query: Query.toObject() query: Query.toObject()
}), callback); }), callback);
@ -671,7 +672,7 @@ var pandora = new Ox.App({
app.$ui.findInput.options({ app.$ui.findInput.options({
autocomplete: autocompleteFunction() autocomplete: autocompleteFunction()
}).focus(); }).focus();
Ox.print(app.$ui.findInput.options('autocomplete').toString()) //Ox.print(app.$ui.findInput.options('autocomplete').toString())
}), }),
app.$ui.findInput = new Ox.Input({ app.$ui.findInput = new Ox.Input({
autocomplete: autocompleteFunction(), autocomplete: autocompleteFunction(),
@ -686,7 +687,7 @@ var pandora = new Ox.App({
var key = app.user.ui.findQuery.conditions.length ? var key = app.user.ui.findQuery.conditions.length ?
app.user.ui.findQuery.conditions[0].key : '', app.user.ui.findQuery.conditions[0].key : '',
query; query;
Ox.print('key', key); //Ox.print('key', key);
app.user.ui.findQuery.conditions = [ app.user.ui.findQuery.conditions = [
{ {
key: key == 'all' ? '' : key, key: key == 'all' ? '' : key,
@ -726,7 +727,7 @@ var pandora = new Ox.App({
return app.user.ui.findQuery.conditions.length ? function(value, callback) { return app.user.ui.findQuery.conditions.length ? function(value, callback) {
var key = app.user.ui.findQuery.conditions[0].key, var key = app.user.ui.findQuery.conditions[0].key,
findKey = Ox.getObjectById(app.config.findKeys, key); findKey = Ox.getObjectById(app.config.findKeys, key);
Ox.print('autocomplete', key, value); //Ox.print('autocomplete', key, value);
value === '' && Ox.print('Warning: autocomplete function should never be called with empty value'); value === '' && Ox.print('Warning: autocomplete function should never be called with empty value');
if ('autocomplete' in findKey && findKey.autocomplete) { if ('autocomplete' in findKey && findKey.autocomplete) {
pandora.api.autocomplete({ pandora.api.autocomplete({
@ -771,7 +772,7 @@ var pandora = new Ox.App({
return that; return that;
}, },
group: function(id, query) { group: function(id, query) {
Ox.print('group', id, query); //Ox.print('group', id, query);
/* /*
query && query.conditions.length && alert($.map(query.conditions, function(v) { query && query.conditions.length && alert($.map(query.conditions, function(v) {
return v.value; return v.value;
@ -805,7 +806,7 @@ var pandora = new Ox.App({
columnsVisible: true, columnsVisible: true,
id: 'group_' + id, id: 'group_' + id,
request: function(data, callback) { request: function(data, callback) {
Ox.print('sending request', data) //Ox.print('sending request', data)
delete data.keys; delete data.keys;
//alert(id + " Query.toObject " + JSON.stringify(Query.toObject(id)) + ' ' + JSON.stringify(data)) //alert(id + " Query.toObject " + JSON.stringify(Query.toObject(id)) + ' ' + JSON.stringify(data))
return pandora.api.find($.extend(data, { return pandora.api.find($.extend(data, {
@ -976,9 +977,9 @@ var pandora = new Ox.App({
function getItem() { function getItem() {
pandora.api.getItem(app.user.ui.item, function(result) { pandora.api.getItem(app.user.ui.item, function(result) {
if (app.user.ui.itemView == 'info') { if (app.user.ui.itemView == 'info') {
Ox.print('result.data.item', result.data.item) //Ox.print('result.data.item', result.data.item)
$.get('/static/html/itemInfo.html', {}, function(template) { $.get('/static/html/itemInfo.html', {}, function(template) {
Ox.print(template); //Ox.print(template);
app.$ui.contentPanel.replace(1, app.$ui.contentPanel.replace(1,
app.$ui.item = new Ox.Element('div') app.$ui.item = new Ox.Element('div')
.append($.tmpl(template, result.data.item)) .append($.tmpl(template, result.data.item))
@ -1018,15 +1019,15 @@ var pandora = new Ox.App({
width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 - width: app.$ui.document.width() - app.$ui.mainPanel.size(0) - 1 -
(app.user.ui.showAnnotations * app.user.ui.annotationsSize) - 1 (app.user.ui.showAnnotations * app.user.ui.annotationsSize) - 1
}).bindEvent('resize', function(event, data) { }).bindEvent('resize', function(event, data) {
Ox.print('resize editor', data) //Ox.print('resize editor', data)
app.$ui.editor.options({ app.$ui.editor.options({
width: data width: data
}); });
Ox.print('resize done') //Ox.print('resize done')
})); }));
that.replace(1, app.$ui.annotations = ui.annotations()); that.replace(1, app.$ui.annotations = ui.annotations());
that.bindEvent('resize', function(event, data) { that.bindEvent('resize', function(event, data) {
Ox.print('resize item', data) //Ox.print('resize item', data)
app.$ui.editor.options({ app.$ui.editor.options({
height: data height: data
}); });
@ -1107,7 +1108,7 @@ var pandora = new Ox.App({
width: (data - 88) + 'px' width: (data - 88) + 'px'
}); });
//*/ //*/
Ox.print('resize', data, data / app.ui.infoRatio + 16); //Ox.print('resize', data, data / app.ui.infoRatio + 16);
app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16); app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16);
}, },
toggle: function(event, data) { toggle: function(event, data) {
@ -1119,7 +1120,7 @@ var pandora = new Ox.App({
list: function(view) { list: function(view) {
var that, $map, var that, $map,
keys = ['director', 'id', 'poster', 'title', 'year']; keys = ['director', 'id', 'poster', 'title', 'year'];
Ox.print('constructList', view); //Ox.print('constructList', view);
if (view == 'list') { if (view == 'list') {
that = new Ox.TextList({ that = new Ox.TextList({
columns: $.map(app.config.sortKeys, function(key, i) { columns: $.map(app.config.sortKeys, function(key, i) {
@ -1136,7 +1137,7 @@ var pandora = new Ox.App({
columnsVisible: true, columnsVisible: true,
id: 'list', id: 'list',
request: function(data, callback) { request: function(data, callback) {
Ox.print('data, Query.toObject', data, Query.toObject()) //Ox.print('data, Query.toObject', data, Query.toObject())
pandora.api.find($.extend(data, { pandora.api.find($.extend(data, {
query: Query.toObject() query: Query.toObject()
}), callback); }), callback);
@ -1165,7 +1166,7 @@ var pandora = new Ox.App({
}, },
keys: keys, keys: keys,
request: function(data, callback) { request: function(data, callback) {
Ox.print('data, Query.toObject', data, Query.toObject()) //Ox.print('data, Query.toObject', data, Query.toObject())
pandora.api.find($.extend(data, { pandora.api.find($.extend(data, {
query: Query.toObject() query: Query.toObject()
}), callback); }), callback);
@ -1346,7 +1347,7 @@ var pandora = new Ox.App({
}); });
}); });
}); });
Ox.print(app.$ui.document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height) //Ox.print(app.$ui.document.height(), dialogWidth, 'x', dialogHeight, dialogWidth / (dialogHeight - 48), item.poster.width, 'x', item.poster.height, item.poster.width / item.poster.height)
} else { } else {
app.$ui.previewImage = $('<img>') app.$ui.previewImage = $('<img>')
.attr({ .attr({
@ -1421,7 +1422,7 @@ var pandora = new Ox.App({
}) })
.one('load', function() { .one('load', function() {
if (data.ids[0] != app.ui.selectedMovies[0]) { if (data.ids[0] != app.ui.selectedMovies[0]) {
Ox.print('cancel after load...') //Ox.print('cancel after load...')
return; return;
} }
var image = $still[0], var image = $still[0],
@ -2058,7 +2059,7 @@ var pandora = new Ox.App({
orientation: 'vertical' orientation: 'vertical'
}) })
.bindEvent('resize', function(event, data) { .bindEvent('resize', function(event, data) {
Ox.print('???? resize rightPanel', event, data) //Ox.print('???? resize rightPanel', event, data)
if (!app.user.ui.item) { if (!app.user.ui.item) {
resizeGroups(data); resizeGroups(data);
app.$ui.list.size(); app.$ui.list.size();
@ -2179,7 +2180,7 @@ var pandora = new Ox.App({
align: 'left', align: 'left',
clickable: function(data) { clickable: function(data) {
//alert(JSON.stringify([data.user, data.type])) //alert(JSON.stringify([data.user, data.type]))
Ox.print('$$$$$$$$', data.user, data.type) //Ox.print('$$$$$$$$', data.user, data.type)
return data.user == app.user.username && data.type == 'smart'; return data.user == app.user.username && data.type == 'smart';
}, },
format: function(value) { format: function(value) {
@ -2249,7 +2250,7 @@ var pandora = new Ox.App({
}) })
.bind({ .bind({
dragenter: function(e) { dragenter: function(e) {
Ox.print('DRAGENTER', e) //Ox.print('DRAGENTER', e)
} }
}) })
.bindEvent({ .bindEvent({
@ -2496,7 +2497,7 @@ var pandora = new Ox.App({
} }
}).join(''); }).join('');
$.each([' ', ' -', '- ', '--', '\\(\\(', '\\)\\(', '\\)\\)'], function(i, v) { $.each([' ', ' -', '- ', '--', '\\(\\(', '\\)\\(', '\\)\\)'], function(i, v) {
Ox.print(v, v[0], v[0] == '\\') //Ox.print(v, v[0], v[0] == '\\')
while (value.indexOf(v) > -1) { while (value.indexOf(v) > -1) {
value = value.replace(new RegExp(v, 'g'), v[0] + (v[0] == '\\' ? v[1] : '')); value = value.replace(new RegExp(v, 'g'), v[0] + (v[0] == '\\' ? v[1] : ''));
} }
@ -2551,7 +2552,7 @@ var pandora = new Ox.App({
}); });
$.each(app.ui.groups, function(i_, group_) { $.each(app.ui.groups, function(i_, group_) {
if (i_ != i) { if (i_ != i) {
Ox.print('setting groups request', i, i_) //Ox.print('setting groups request', i, i_)
app.$ui.groups[i_].options({ app.$ui.groups[i_].options({
request: function(data, callback) { request: function(data, callback) {
delete data.keys; delete data.keys;
@ -2571,7 +2572,7 @@ var pandora = new Ox.App({
var widths = $.map(app.ui.groups, function(v, i) { var widths = $.map(app.ui.groups, function(v, i) {
return getGroupWidth(i, width); return getGroupWidth(i, width);
}); });
Ox.print('widths', widths); //Ox.print('widths', widths);
app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list); app.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list); app.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
$.each(app.$ui.groups, function(i, list) { $.each(app.$ui.groups, function(i, list) {
@ -2590,7 +2591,7 @@ var pandora = new Ox.App({
operator: '=' operator: '='
}, function(result) { }, function(result) {
var valid = existing == !!result.data.users.length; var valid = existing == !!result.data.users.length;
Ox.print(existing, result.data.users) //Ox.print(existing, result.data.users)
callback({ callback({
message: existing ? message: existing ?
'Unknown ' + string : 'Unknown ' + string :
@ -2607,7 +2608,7 @@ var pandora = new Ox.App({
var Query = (function() { var Query = (function() {
function constructFind(query) { function constructFind(query) {
Ox.print('cF', query) //Ox.print('cF', query)
return /*encodeURI(*/$.map(query.conditions, function(v, i) { return /*encodeURI(*/$.map(query.conditions, function(v, i) {
if (!Ox.isUndefined(v.conditions)) { if (!Ox.isUndefined(v.conditions)) {
return '[' + constructFind(v) + ']'; return '[' + constructFind(v) + ']';
@ -2645,12 +2646,12 @@ var pandora = new Ox.App({
} else if (str.indexOf('|') > -1) { } else if (str.indexOf('|') > -1) {
find.operator = '|'; find.operator = '|';
} }
Ox.print('pF', str, find.operator) //Ox.print('pF', str, find.operator)
find.conditions = $.map(find.operator === '' ? [str] : str.split(find.operator == '&' ? ',' : '|'), function(v, i) { find.conditions = $.map(find.operator === '' ? [str] : str.split(find.operator == '&' ? ',' : '|'), function(v, i) {
Ox.print('v', v) //Ox.print('v', v)
var ret, kv; var ret, kv;
if (v[0] == '[') { if (v[0] == '[') {
Ox.print('recursion', subconditions) //Ox.print('recursion', subconditions)
ret = parseFind(subconditions[parseInt(v.substr(1, v.length - 2))]); ret = parseFind(subconditions[parseInt(v.substr(1, v.length - 2))]);
} else { } else {
kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':'); kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':');
@ -2691,7 +2692,7 @@ var pandora = new Ox.App({
sort = []; sort = [];
if ('find' in query) { if ('find' in query) {
app.user.ui.findQuery = parseFind(query.find); app.user.ui.findQuery = parseFind(query.find);
Ox.print('user.ui.findQuery', app.user.ui.findQuery) //Ox.print('user.ui.findQuery', app.user.ui.findQuery)
} }
if ('sort' in query) { if ('sort' in query) {
sort = query.sort.split(',') sort = query.sort.split(',')
@ -2711,7 +2712,7 @@ var pandora = new Ox.App({
}, },
toObject: function(groupId) { toObject: function(groupId) {
Ox.print('tO', app.user.ui.findQuery.conditions) //Ox.print('tO', app.user.ui.findQuery.conditions)
// the inner $.merge() creates a clone // the inner $.merge() creates a clone
var conditions = $.merge( var conditions = $.merge(
$.merge([], app.user.ui.listQuery.conditions), $.merge([], app.user.ui.listQuery.conditions),
@ -2725,7 +2726,7 @@ var pandora = new Ox.App({
} }
}) : []); }) : []);
operator = conditions.length < 2 ? '' : ','; // fixme: should be & operator = conditions.length < 2 ? '' : ','; // fixme: should be &
Ox.print('>>', groupId, app.user.ui.find, conditions); //Ox.print('>>', groupId, app.user.ui.find, conditions);
return { return {
conditions: conditions, conditions: conditions,
operator: operator operator: operator
@ -2733,7 +2734,7 @@ var pandora = new Ox.App({
}, },
toString: function() { toString: function() {
Ox.print('tS', app.user.ui.find) //Ox.print('tS', app.user.ui.find)
return '?' + Ox.serialize({ return '?' + Ox.serialize({
find: constructFind(Query.toObject()), find: constructFind(Query.toObject()),
sort: app.user.ui.lists[app.user.ui.list].sort[0].operator + sort: app.user.ui.lists[app.user.ui.list].sort[0].operator +
@ -2802,7 +2803,7 @@ var pandora = new Ox.App({
url = document.location.pathname.substr(1) + url = document.location.pathname.substr(1) +
document.location.search + document.location.hash; document.location.search + document.location.hash;
$.each(regexps, function(re, fn) { $.each(regexps, function(re, fn) {
Ox.print(url, 're', re) //Ox.print(url, 're', re)
re = new RegExp(re); re = new RegExp(re);
if (re(url)) { if (re(url)) {
fn(url); fn(url);
@ -2858,7 +2859,7 @@ var pandora = new Ox.App({
} else { } else {
//FIXME: this is a workaround since open gets called twice //FIXME: this is a workaround since open gets called twice
// due to a bug with double click // due to a bug with double click
Ox.print('ignore double call of app.url, double click need to be fixed'); //Ox.print('ignore double call of app.url, double click need to be fixed');
return; return;
} }
} }