cleanup landing page

This commit is contained in:
pandora 2019-10-23 15:52:02 +00:00
commit f485f76e5b
5 changed files with 127 additions and 182 deletions

View file

@ -6,6 +6,7 @@ pandora.ui.home = function() {
that = $('<div>')
.addClass('OxScreen')
.attr({id: 'home'})
.css({
backgroundColor: 'white',
height: '100%',
@ -52,25 +53,13 @@ pandora.ui.home = function() {
.css(homeMenuCenterCSS)
.appendTo(that),
$counter = $('<div>')
.attr({
id: 'homeCounter'
})
.css({
position: 'absolute',
right: '32px',
top: '32px',
width: '128px'
})
.appendTo(that),
$logo = Ox.Element({
element: '<img>'
})
.addClass('selected')
.attr({
id: 'homeLogo',
src: '/static/png/logo.png'
src: '/static/svg/logo.collectivecinema.svg'
})
.css({
height: 'auto',
@ -115,60 +104,65 @@ pandora.ui.home = function() {
})
.appendTo($box),
$textBox = $('<div>').css({
display: 'none',
position: 'absolute',
top: '220px',
}).appendTo($box),
$textSubtitle = Ox.Element()
.html('Collective Cinema')
.addClass('subtitle')
.appendTo($textBox),
$text = $('<div>').css({
display: 'flex'
}).appendTo($textBox),
$text_es = $('<div>')
.addClass('text')
.addClass('es')
.css({
display: 'none',
fontFamily: 'Home Arabic',
fontSize: '13px',
lineHeight: '18px',
marginRight: '8px',
position: 'absolute',
textAlign: 'right',
top: '360px',
width: '392px'
})
.appendTo($box),
.appendTo($text),
$text_en = $('<div>')
.addClass('text')
.addClass('en')
.css({
display: 'none',
fontFamily: 'Home English',
fontSize: '12px',
left: '400px',
lineHeight: '17px',
marginLeft: '8px',
position: 'absolute',
top: '360px',
width: '392px'
})
.appendTo($box),
.appendTo($text),
$tutorials = $('<div>')
$footer = Ox.Element()
.html('<img src="/static/images/cultura_fonca_negro.png" width="300">')
.css({
textAlign: 'center',
marginBottom: '48px',
display: 'none',
left: '-128px',
marginLeft: '8px',
marginBottom: '32px',
position: 'absolute',
top: '392px',
width: '1024px',
height: '288px'
}).appendTo($box),
})
.appendTo($textBox),
$enterButton = Ox.Element({
element: '<img>'
})
.attr({
src: '/static/png/enter.png'
})
.css({
cursor: 'url(/static/png/cursor.png) 4 12, auto',
height: '32px',
left: 0,
margin: '0 auto',
position: 'absolute',
right: 0,
})
$subtitle = Ox.Element()
.html('Collective Cinema')
.addClass('subtitle')
.appendTo($menu),
$enterButton = Ox.Element()
.addClass('menu')
.html('<div class="en">Enter the archive</div><div class="es">Entra al archivo</div>')
.bind({
click: function() {
var page = pandora.user.ui.page == 'home' ? '' : pandora.user.ui.page;
@ -192,21 +186,9 @@ pandora.ui.home = function() {
})
.appendTo($menu),
$aboutButton = Ox.Element({
element: '<img>'
})
.attr({
src: '/static/png/about.png'
})
.css({
cursor: 'pointer',
height: '32px',
left: 0,
margin: '0 auto',
position: 'absolute',
right: 0,
top: '48px'
})
$aboutButton = Ox.Element()
.addClass('menu')
.html('<div class="en">About</div><div class="es">Acerca de</div>')
.bind({
click: function() {
renderPage('about');
@ -220,49 +202,10 @@ pandora.ui.home = function() {
})
.appendTo($menu),
$tutorialButton = Ox.Element({
element: '<img>'
})
.attr({
src: '/static/png/tutorial.png'
})
.css({
cursor: 'pointer',
height: '32px',
left: 0,
margin: '0 auto',
position: 'absolute',
right: 0,
top: '84px'
})
.bind({
click: function() {
renderPage('tutorial');
},
mouseenter: function() {
$tutorialButton.css({opacity: 0.5});
},
mouseleave: function() {
$tutorialButton.css({opacity: 1});
}
})
.appendTo($menu),
$contactButton = Ox.Element({
element: '<img>'
})
.attr({
src: '/static/png/contact.png'
})
.css({
cursor: 'pointer',
height: '32px',
left: 0,
margin: '0 auto',
position: 'absolute',
right: 0,
top: '120px'
})
$contactButton = Ox.Element()
.addClass('menu')
.html('<div class="en">Contact</div><div class="es">Contacto</div>')
.bind({
click: function() {
renderPage('contact');
@ -276,31 +219,15 @@ pandora.ui.home = function() {
})
.appendTo($menu),
$counterImage = Ox.Element({
element: '<img>'
})
.attr({
src: '/static/png/counter.png'
})
.css({
height: '64px',
position: 'absolute',
right: 0,
top: '40px'
})
.appendTo($counter),
text,
loadedCSS = false;
function getText(callback) {
var text = {};
Ox.getAsync([
'/static/txt/about.ar.txt',
'/static/txt/about.es.txt',
'/static/txt/about.en.txt',
'/static/txt/tutorial.ar.txt',
'/static/txt/tutorial.en.txt',
'/static/txt/contact.ar.txt',
'/static/txt/contact.es.txt',
'/static/txt/contact.en.txt'
], Ox.get, function(data) {
Object.keys(data).forEach(function(key) {
@ -315,28 +242,11 @@ pandora.ui.home = function() {
});
}
function renderCounter() {
Ox.forEach(text.hours, function(value, index) {
Ox.Element()
.css({
border: '2px solid black',
fontFamily: 'Home English',
fontSize: '32px',
fontWeight: 'bold',
height: '43px',
paddingTop: '5px',
position: 'absolute',
right: 24 + (text.hours.length - index) * 22 + 'px',
width: '20px'
})
.html(value)
.appendTo($counter);
});
}
function renderPage(page) {
if (page == 'home') {
$logo.addClass('selected').css({cursor: 'default'});
$textBox.hide()
$title.css({display: 'none'});
$text_es.css({display: 'none'});
$text_en.css({display: 'none'});
@ -345,12 +255,7 @@ pandora.ui.home = function() {
} else {
$menu.css(homeMenuLeftCSS);
$logo.removeClass('selected').css({cursor: 'pointer'});
$title.attr({
src: '/static/png/' + page + '.png'
})
.css({
display: 'block'
});
$textBox.show()
$text_es.css({
display: 'block'
}).html(
@ -361,6 +266,11 @@ pandora.ui.home = function() {
}).html(
text[page + '.en']
);
if (page == 'about') {
$footer.show()
} else {
$footer.hide()
}
if (page == 'contact') {
Ox.forEach(
document.querySelectorAll('a[href="/contact"]'),
@ -393,7 +303,6 @@ pandora.ui.home = function() {
that.appendTo(Ox.$body).animate({opacity: 1}, 500, function() {
getText(function(data) {
text = data;
renderCounter();
that.find('*').animate({opacity: 1}, 250, function() {
// ...
});
@ -417,10 +326,8 @@ pandora.ui.home = function() {
var $elements = that.find('*'), count = 0;
$box.css({top: '80px'});
$menu.css({top: '80px'});
$counter.css({top: '80px'});
getText(function(data) {
text = data;
renderCounter();
loadCSS(function() {
that.css({opacity: 1}).appendTo(Ox.$body);
$box.animate({top: '32px'}, 500, function() {
@ -433,7 +340,6 @@ pandora.ui.home = function() {
});
//$menu.animate({top: '32px'}, 500);
$menu.animate({top: homeMenuCenterCSS.top}, 500);
$counter.animate({top: '32px'}, 500);
callback && callback();
});
});