10 vertical-align: inherit;
21 vertical-align: bottom;
25 font-family: sans-serif;
27 vertical-align: inherit;
40 #title, #page_number {
46 text-overflow: ellipsis;
53 padding-bottom: 0.4cm;
59 function pixels(value) {
63 function setup(options) {
64 var body = document.querySelector('body');
65 var header = document.querySelector('#header');
66 var content = document.querySelector('#content');
67 var footer = document.querySelector('#footer');
69 body.style.width = pixels(options['width']);
70 body.style.height = pixels(options['height']);
71 header.style.height = pixels(options['topMargin']);
72 content.style.height = pixels(options['height'] - options['topMargin'] -
73 options['bottomMargin']);
74 footer.style.height = pixels(options['bottomMargin']);
76 document.querySelector('#date span').innerText =
77 new Date(options['date']).toLocaleDateString();
78 document.querySelector('#title span').innerText = options['title'];
80 document.querySelector('#url span').innerText = options['url'];
81 document.querySelector('#page_number span').innerText = options['pageNumber'];
83 // Reduce date and page number space to give more space to title and url.
84 document.querySelector('#date').style.width =
85 pixels(document.querySelector('#date span').offsetWidth);
86 document.querySelector('#page_number').style.width =
87 pixels(document.querySelector('#page_number span').offsetWidth);
89 // Hide text if it doesn't fit into expected margins.
90 if (header.offsetHeight > options['topMargin'] + 1) {
91 header.style.display = 'none';
92 content.style.height = pixels(options['height'] - options['bottomMargin']);
94 if (footer.offsetHeight > options['bottomMargin'] + 1) {
95 footer.style.display = 'none';
104 <div id="date" class="text"><span/></div>
105 <div id="title" class="text"><span/></div>
112 <div id="url" class="text"><span/></div>
113 <div id="page_number" class="text"><span/></div>