pandora/static/js/homePage.js

82 lines
2.2 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-06-04 04:37:05 +00:00
2011-11-05 17:04:10 +00:00
'use strict';
2012-06-25 14:37:45 +00:00
// FIXME: remove
2011-06-04 04:37:05 +00:00
pandora.ui.homePage = function() {
var that = Ox.Element()
.css({padding: '8px'});
var $left = $('<div>')
.css({
float: 'left',
margin: '8px',
background: 'black'
})
.html('left')
.appendTo(that.$element),
$center = $('<div>')
.css({
float: 'left',
margin: '8px'
})
.appendTo(that.$element),
$right = $('<div>')
.css({
float: 'left',
margin: '8px',
background: 'black'
})
.html('right')
.appendTo(that.$element),
$logo = $('<img>')
.attr({src: '/static/png/logo.png'})
2011-06-04 04:37:05 +00:00
.appendTo($center);
// fixme: duplicated
$select = Ox.Select({
id: 'select',
2012-05-24 08:22:56 +00:00
items: [].concat(pandora.site.findKeys.map(function(key) {
2011-06-04 04:37:05 +00:00
return {
id: key.id,
2013-05-09 10:13:58 +00:00
title: Ox._('Find: {0}', [Ox._(key.title)])
2011-06-04 04:37:05 +00:00
};
}), [{}, {
id: 'advanced',
2013-05-09 10:13:58 +00:00
title: Ox._('Find: Advanced')
2011-06-04 04:37:05 +00:00
}]),
overlap: 'right',
width: 112
})
$input = Ox.Input({})
.bindEvent({
change: function() {
}
});
$findElement = Ox.FormElementGroup({
2012-05-26 15:46:24 +00:00
elements: [$select, $input]
2011-06-04 04:37:05 +00:00
})
.css({marginTop: '16px'})
.appendTo($center);
$center = $('<div>')
.css({marginTop: '16px'})
.html('center')
.appendTo($center);
that.resize = function() {
2012-06-25 14:37:45 +00:00
var size = Ox.splitInt(window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1 - 64, 3);
2011-06-04 04:37:05 +00:00
$left.css({width: size[0] + 'px'});
$center.css({width: size[1] + 'px'});
$logo.css({width: size[1] + 'px'});
$input.options({width: size[1] - 112});
$right.css({width: size[2] + 'px'});
};
that.resize();
return that;
2011-06-06 15:55:37 +00:00
}