support MSIE 8 until after app load, and MSIE 8 with Chrome Frame beyond that

This commit is contained in:
rolux 2011-09-03 13:19:00 +00:00
parent 545d5c4dc8
commit 921a116a57
2 changed files with 147 additions and 145 deletions

View file

@ -14,163 +14,166 @@ Ox.load('UI', {
loadImages: true, loadImages: true,
showScreen: true, showScreen: true,
theme: 'modern' theme: 'modern'
}, function() { }, function(browserSupported) {
// fixme: use Ox.extend() // fixme: use Ox.extend()
Ox.load('Geo', function() { Ox.load('Geo', function() {
window.pandora = new Ox.App({url: '/api/'}).bindEvent({ window.pandora = new Ox.App({url: '/api/'}).bindEvent({
load: function(event, data) { load: function(data) {
Ox.extend(pandora, {
requests: {},
ui: {}
});
loadResources('/static/json/pandora.json', function() {
Ox.print('Ox.App load', data);
// Ox.UI.hideLoadingScreen(); if (!browserSupported) {
Ox.extend(pandora, {
$ui: {
body: $('body'),
document: $(document),
window: $(window)
.resize(resizeWindow)
.unload(unloadWindow)
},
site: data.site,
user: data.user.level == 'guest' ? Ox.extend({}, data.site.user) : data.user
});
Ox.extend(pandora.site, {
findKeys: $.map(data.site.itemKeys, function(key, i) {
return key.find ? key : null;
}),
sectionFolders: {
items: [
{id: 'personal', title: 'Personal Lists'},
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
{id: 'featured', title: 'Featured Lists', showBrowser: false},
{id: 'volumes', title: 'Local Volumes'}
],
edits: [
{id: 'personal', title: 'Personal Edits'},
{id: 'favorite', title: 'Favorite Edits', showBrowser: false},
{id: 'featured', title: 'Featured Edits', showBrowser: false}
],
texts: [
{id: 'personal', title: 'Personal Texts'},
{id: 'favorite', title: 'Favorite Texts', showBrowser: false},
{id: 'featured', title: 'Featured Texts', showBrowser: false}
]
},
sortKeys: $.map(data.site.itemKeys, function(key, i) {
return key.columnWidth ? key : null;
})
});
Ox.extend(pandora.user, {
infoRatio: 16 / 9,
sectionElement: 'buttons',
selectedMovies: [],
videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats)
});
// fixme: this should not happen
if (!pandora.user.ui.lists[pandora.user.ui.list]) {
pandora.user.ui.lists[pandora.user.ui.list] = pandora.user.ui.lists[''];
}
if (data.user.level == 'guest' && $.browser.mozilla) {
pandora.user.ui.theme = 'classic';
}
pandora.URL.parse();
window.onpopstate = function(event) {
pandora.URL.update();
};
Ox.UI.hideLoadingScreen();
Ox.Theme(pandora.user.ui.theme);
pandora.$ui.appPanel = pandora.ui.appPanel().display();
Ox.Request.requests() && pandora.$ui.loadingIcon.start();
pandora.$ui.body.ajaxStart(pandora.$ui.loadingIcon.start);
pandora.$ui.body.ajaxStop(pandora.$ui.loadingIcon.stop);
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
}, '/static/');
}
});
function loadResources(json, callback, prefix) {
prefix = prefix || '';
$.getJSON(json, function(files) {
var promises = [];
files.forEach(function(file) {
// fixme: opera doesnt fire onload for svg
if ($.browser.opera && Ox.endsWith(file, '.svg')) {
return; return;
} }
//Ox.print('load', file)
var dfd = new $.Deferred(); Ox.extend(pandora, {
Ox.loadFile(prefix + file, function() { requests: {},
dfd.resolve(); ui: {}
}); });
promises.push(dfd.promise()); loadResources('/static/json/pandora.json', function() {
});
//Ox.print('promises.length', promises.length) Ox.print('Ox.App load', data);
$.when.apply(null, promises)
.done(function() { // Ox.UI.hideLoadingScreen();
//Ox.print('promises done')
$(function() { Ox.extend(pandora, {
callback(); $ui: {
body: $('body'),
document: $(document),
window: $(window)
.resize(resizeWindow)
.unload(unloadWindow)
},
site: data.site,
user: data.user.level == 'guest' ? Ox.extend({}, data.site.user) : data.user
}); });
}) Ox.extend(pandora.site, {
.fail(function() { findKeys: $.map(data.site.itemKeys, function(key, i) {
throw new Error('File not found.') return key.find ? key : null;
}); }),
}); sectionFolders: {
} items: [
{id: 'personal', title: 'Personal Lists'},
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
{id: 'featured', title: 'Featured Lists', showBrowser: false},
{id: 'volumes', title: 'Local Volumes'}
],
edits: [
{id: 'personal', title: 'Personal Edits'},
{id: 'favorite', title: 'Favorite Edits', showBrowser: false},
{id: 'featured', title: 'Featured Edits', showBrowser: false}
],
texts: [
{id: 'personal', title: 'Personal Texts'},
{id: 'favorite', title: 'Favorite Texts', showBrowser: false},
{id: 'featured', title: 'Featured Texts', showBrowser: false}
]
},
sortKeys: $.map(data.site.itemKeys, function(key, i) {
return key.columnWidth ? key : null;
})
});
Ox.extend(pandora.user, {
infoRatio: 16 / 9,
sectionElement: 'buttons',
selectedMovies: [],
videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats)
});
// fixme: this should not happen
if (!pandora.user.ui.lists[pandora.user.ui.list]) {
pandora.user.ui.lists[pandora.user.ui.list] = pandora.user.ui.lists[''];
}
function resizeWindow() { if (data.user.level == 'guest' && $.browser.mozilla) {
pandora.resizeFolders(); pandora.user.ui.theme = 'classic';
if (!pandora.user.ui.item) { }
pandora.$ui.list.size();
pandora.resizeGroups(pandora.$ui.rightPanel.width()); pandora.URL.parse();
if (pandora.user.ui.listView == 'map') { window.onpopstate = function(event) {
pandora.$ui.map.resize(); pandora.URL.update();
};
Ox.UI.hideLoadingScreen();
Ox.Theme(pandora.user.ui.theme);
pandora.$ui.appPanel = pandora.ui.appPanel().display();
Ox.Request.requests() && pandora.$ui.loadingIcon.start();
pandora.$ui.body.ajaxStart(pandora.$ui.loadingIcon.start);
pandora.$ui.body.ajaxStop(pandora.$ui.loadingIcon.stop);
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
}, '/static/');
} }
} else { });
//Ox.print('pandora.$ui.window.resize');
pandora.$ui.browser.scrollToSelection(); function loadResources(json, callback, prefix) {
pandora.user.ui.itemView == 'info' && pandora.$ui.item.resize(); prefix = prefix || '';
pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({ $.getJSON(json, function(files) {
// fixme: duplicated var promises = [];
height: pandora.$ui.contentPanel.size(1), files.forEach(function(file) {
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 // fixme: opera doesnt fire onload for svg
}); // fixme: we don't have any svgs, right?
pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({ if ($.browser.opera && Ox.endsWith(file, '.svg')) {
// fixme: duplicated return;
height: pandora.$ui.contentPanel.size(1), }
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 var dfd = new $.Deferred();
}); Ox.loadFile(prefix + file, function() {
dfd.resolve();
});
promises.push(dfd.promise());
});
$.when.apply(null, promises)
.done(function() {
callback();
})
.fail(function() {
throw new Error('File not found.')
});
});
} }
}
function unloadWindow() { function resizeWindow() {
// fixme: ajax request has to have async set to false for this to work pandora.resizeFolders();
pandora.user.ui.section == 'items' && if (!pandora.user.ui.item) {
['player', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 && pandora.$ui.list.size();
pandora.user.ui.item && pandora.resizeGroups(pandora.$ui.rightPanel.width());
pandora.UI.set( if (pandora.user.ui.listView == 'map') {
'videoPosition|' + pandora.user.ui.item, pandora.$ui.map.resize();
pandora.$ui[ }
pandora.user.ui.itemView == 'player' ? 'player' : 'editor' } else {
].options('position') //Ox.print('pandora.$ui.window.resize');
); pandora.$ui.browser.scrollToSelection();
} pandora.user.ui.itemView == 'info' && pandora.$ui.item.resize();
pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
// fixme: duplicated
height: pandora.$ui.contentPanel.size(1),
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
});
pandora.user.ui.itemView == 'timeline' && pandora.$ui.editor.options({
// fixme: duplicated
height: pandora.$ui.contentPanel.size(1),
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
});
}
}
function unloadWindow() {
// fixme: ajax request has to have async set to false for this to work
pandora.user.ui.section == 'items' &&
['player', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 &&
pandora.user.ui.item &&
pandora.UI.set(
'videoPosition|' + pandora.user.ui.item,
pandora.$ui[
pandora.user.ui.itemView == 'player' ? 'player' : 'editor'
].options('position')
);
}
});
}); });
});

View file

@ -27,7 +27,6 @@ pandora.ui.placesDialog = function() {
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
callback(result); callback(result);
}); });
}, },
editPlace: function(place, callback) { editPlace: function(place, callback) {
Ox.print('EDITPLACE', place); Ox.print('EDITPLACE', place);