2011-11-05 17:04:10 +00:00
|
|
|
'use strict';
|
|
|
|
|
2011-08-24 21:04:13 +00:00
|
|
|
pandora.ui.home = function() {
|
|
|
|
|
|
|
|
var that = $('<div>')
|
2011-09-18 02:22:50 +00:00
|
|
|
.addClass('OxScreen')
|
2011-08-24 21:04:13 +00:00
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
opacity: 0,
|
2012-02-19 12:58:49 +00:00
|
|
|
zIndex: 1001
|
2011-08-24 21:04:13 +00:00
|
|
|
}),
|
|
|
|
$reflectionImage = $('<img>')
|
2013-07-09 09:14:18 +00:00
|
|
|
.addClass('logo')
|
2012-04-20 10:22:32 +00:00
|
|
|
.attr({src: '/static/png/logo.png'})
|
2011-08-24 21:04:13 +00:00
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '160px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
width: '320px',
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0,
|
|
|
|
MozTransform: 'scaleY(-1)',
|
2011-10-23 14:25:23 +00:00
|
|
|
OTransform: 'scaleY(-1)',
|
2011-08-24 21:04:13 +00:00
|
|
|
WebkitTransform: 'scaleY(-1)'
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
|
|
|
$reflectionGradient = $('<div>')
|
2013-07-09 09:14:18 +00:00
|
|
|
.addClass('OxReflection logo')
|
2011-08-24 21:04:13 +00:00
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '160px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
2012-12-22 01:31:40 +00:00
|
|
|
// FIXME: should be 320 and 160 - the values below are temporary fixes for Chrome 26
|
|
|
|
width: '322px',
|
|
|
|
height: '162px',
|
2011-08-24 21:04:13 +00:00
|
|
|
margin: 'auto',
|
2011-08-25 19:24:02 +00:00
|
|
|
})
|
2011-08-24 21:04:13 +00:00
|
|
|
.appendTo(that),
|
|
|
|
$logo = $('<img>')
|
2013-07-09 09:14:18 +00:00
|
|
|
.addClass('logo')
|
2011-08-24 21:04:13 +00:00
|
|
|
.attr({
|
|
|
|
id: 'logo',
|
2012-04-20 10:22:32 +00:00
|
|
|
src: '/static/png/logo.png'
|
2011-08-24 21:04:13 +00:00
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
bottom: '160px',
|
|
|
|
width: window.innerWidth + 'px',
|
|
|
|
margin: 'auto',
|
|
|
|
cursor: 'pointer'
|
|
|
|
})
|
2012-05-28 14:10:11 +00:00
|
|
|
.on({
|
2011-08-24 21:04:13 +00:00
|
|
|
click: function() {
|
2011-10-08 13:09:16 +00:00
|
|
|
$browseButton.triggerEvent('click');
|
2011-08-24 21:04:13 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
|
|
|
$findInput = Ox.Input({
|
|
|
|
width: 156
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '48px',
|
|
|
|
right: '164px',
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
2014-09-19 17:30:39 +00:00
|
|
|
.on({
|
|
|
|
click: function(e) {
|
|
|
|
// fixme: why?
|
|
|
|
e.stopPropagation();
|
|
|
|
}
|
2011-08-24 21:04:13 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
submit: function(data) {
|
2011-09-17 13:04:10 +00:00
|
|
|
if (data.value) {
|
|
|
|
$findButton.triggerEvent('click');
|
|
|
|
} else {
|
|
|
|
$browseButton.triggerEvent('click');
|
|
|
|
}
|
2011-08-24 21:04:13 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
|
|
|
$findButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Find'),
|
2011-08-24 21:04:13 +00:00
|
|
|
width: 74
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: '82px',
|
|
|
|
top: '48px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2011-10-08 13:09:16 +00:00
|
|
|
var folder = pandora.getListData().folder,
|
|
|
|
value = $findInput.value();
|
2011-09-17 13:30:46 +00:00
|
|
|
folder && pandora.$ui.folderList[folder].options({selected: []});
|
2011-10-08 13:09:16 +00:00
|
|
|
that.fadeOutScreen();
|
2011-12-21 16:12:27 +00:00
|
|
|
pandora.UI.set({
|
|
|
|
page: '',
|
|
|
|
find: {
|
|
|
|
conditions: value === ''
|
|
|
|
? []
|
|
|
|
: [{key: '*', value: value, operator: '='}],
|
|
|
|
operator: '&'
|
2013-10-07 19:41:20 +00:00
|
|
|
},
|
|
|
|
section: 'items'
|
2011-10-08 11:24:09 +00:00
|
|
|
});
|
2017-02-15 17:44:59 +00:00
|
|
|
pandora.$ui.findSelect && pandora.$ui.findSelect.value('*');
|
|
|
|
pandora.$ui.findInput && pandora.$ui.findInput.value(value);
|
2011-08-24 21:04:13 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
|
|
|
$browseButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Browse'),
|
2011-08-24 21:04:13 +00:00
|
|
|
width: 74
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: '246px',
|
|
|
|
top: '48px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2012-02-19 11:39:39 +00:00
|
|
|
pandora.UI.set({
|
2013-10-07 19:41:20 +00:00
|
|
|
page: pandora.user.ui.page == 'home' ? '' : pandora.user.ui.page,
|
|
|
|
section: 'items'
|
2012-02-19 11:39:39 +00:00
|
|
|
});
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeOutScreen();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
2017-02-15 17:44:59 +00:00
|
|
|
|
2011-08-24 21:04:13 +00:00
|
|
|
$signupButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Sign Up'),
|
2011-08-24 21:04:13 +00:00
|
|
|
width: 74
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '112px',
|
|
|
|
right: '246px',
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page: 'signup'});
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeOutScreen();
|
|
|
|
}
|
2011-10-29 17:46:46 +00:00
|
|
|
}),
|
2011-08-24 21:04:13 +00:00
|
|
|
$signinButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Sign In'),
|
2024-11-08 12:29:15 +00:00
|
|
|
width: pandora.site.site.oidc ? 156 : 74
|
2011-08-24 21:04:13 +00:00
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '112px',
|
2024-11-08 12:29:15 +00:00
|
|
|
right: pandora.site.site.oidc ? '164px' : '82px',
|
2011-08-24 21:04:13 +00:00
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page :'signin'});
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeOutScreen();
|
|
|
|
}
|
2011-10-29 17:46:46 +00:00
|
|
|
}),
|
2011-08-24 21:04:13 +00:00
|
|
|
$preferencesButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Preferences'),
|
2011-08-24 21:04:13 +00:00
|
|
|
width: 156
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '112px',
|
|
|
|
right: '164px',
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page: 'preferences'});
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeOutScreen();
|
|
|
|
}
|
2011-10-29 17:46:46 +00:00
|
|
|
}),
|
2011-08-24 21:04:13 +00:00
|
|
|
$aboutButton = Ox.Button({
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('About {0}', [pandora.site.site.name]),
|
2011-08-24 21:04:13 +00:00
|
|
|
width: 156
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: '164px',
|
|
|
|
top: '112px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page: 'about'});
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeOutScreen();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(that),
|
|
|
|
$text = $('<div>')
|
2013-05-09 10:13:58 +00:00
|
|
|
.html(Ox._(
|
|
|
|
'pan.do/ra. \u2620 2007-{0} 0x2620. All Open Source.',
|
|
|
|
[Ox.formatDate(new Date(), '%Y')]
|
|
|
|
)).css({
|
2011-08-24 21:04:13 +00:00
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: '176px',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
width: '360px',
|
|
|
|
height: '16px',
|
|
|
|
margin: 'auto',
|
|
|
|
opacity: 0,
|
2011-10-29 17:46:46 +00:00
|
|
|
textAlign: 'center'
|
2011-08-24 21:04:13 +00:00
|
|
|
})
|
|
|
|
.appendTo(that);
|
|
|
|
|
2018-05-09 09:48:35 +00:00
|
|
|
adjustRatio();
|
|
|
|
|
2011-08-24 21:04:13 +00:00
|
|
|
if (pandora.user.level == 'guest') {
|
2024-11-08 12:29:15 +00:00
|
|
|
if (pandora.site.site.oidc) {
|
|
|
|
$signinButton.options({
|
|
|
|
width: 156
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
$signupButton.appendTo(that);
|
|
|
|
}
|
2011-08-24 21:04:13 +00:00
|
|
|
$signinButton.appendTo(that);
|
|
|
|
} else {
|
|
|
|
$preferencesButton.appendTo(that);
|
|
|
|
}
|
|
|
|
|
2018-05-09 09:48:35 +00:00
|
|
|
function adjustRatio() {
|
|
|
|
var width = $logo.width();
|
|
|
|
var height = $logo.height();
|
|
|
|
if (width == 0 || height == 0) {
|
|
|
|
setTimeout(adjustRatio, 50);
|
2018-05-09 16:27:52 +00:00
|
|
|
} else {
|
|
|
|
var aspect = width / height;
|
|
|
|
if (aspect != 2) {
|
|
|
|
var top = 320 / aspect;
|
|
|
|
$reflectionImage.css({
|
|
|
|
top: top + 'px',
|
|
|
|
})
|
|
|
|
$reflectionGradient.css({
|
|
|
|
top: top + 'px',
|
|
|
|
height: (top + 2) + 'px',
|
|
|
|
})
|
|
|
|
$logo.css({
|
|
|
|
bottom: top + 'px',
|
|
|
|
})
|
|
|
|
}
|
2018-05-09 09:48:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-24 21:04:13 +00:00
|
|
|
that.fadeInScreen = function() {
|
2014-09-25 16:53:35 +00:00
|
|
|
that.appendTo(Ox.$body).animate({opacity: 1}, 500, function() {
|
2011-08-24 21:04:13 +00:00
|
|
|
that.find(':not(#logo)').animate({opacity: 1}, 250, function() {
|
2011-12-18 09:44:31 +00:00
|
|
|
$findInput.focusInput(true);
|
2011-08-24 21:04:13 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
$logo.animate({width: '320px'}, 500);
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.fadeOutScreen = function() {
|
|
|
|
that.find(':not(#logo)').hide();
|
|
|
|
$logo.animate({width: window.innerWidth + 'px'}, 500);
|
|
|
|
that.animate({opacity: 0}, 500, function() {
|
|
|
|
that.remove();
|
|
|
|
});
|
2013-08-10 08:58:22 +00:00
|
|
|
pandora.$ui.tv && pandora.$ui.tv.unmute().find('.OxControls.OxVolume').hide();
|
2011-08-24 21:04:13 +00:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.hideScreen = function() {
|
|
|
|
that.hide().remove();
|
|
|
|
that.find(':not(#logo)').css({opacity: 0});
|
|
|
|
$logo.css({width: window.innerWidth + 'px'});
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2013-07-09 09:14:18 +00:00
|
|
|
that.showScreen = function(callback) {
|
2013-07-09 11:14:00 +00:00
|
|
|
var $elements = that.find(':not(.logo)'), count = 0;
|
2011-08-24 21:04:13 +00:00
|
|
|
$logo.css({width: '320px'});
|
2014-09-25 16:53:35 +00:00
|
|
|
that.css({opacity: 1}).appendTo(Ox.$body);
|
2013-07-09 09:14:18 +00:00
|
|
|
that.find(':not(#logo)').css({opacity: 1});
|
|
|
|
$elements.animate({opacity: 1}, 500, function() {
|
|
|
|
if (callback && ++count == $elements.length) {
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
});
|
2011-12-18 09:44:31 +00:00
|
|
|
$findInput.focusInput(true);
|
2011-08-24 21:04:13 +00:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-10-29 17:46:46 +00:00
|
|
|
|
2011-09-23 10:44:54 +00:00
|
|
|
};
|