work on design

This commit is contained in:
bkfox 2016-08-01 23:30:54 +02:00
parent 3367cab64b
commit d62a47ffe5
31 changed files with 577 additions and 112 deletions

View File

@ -10,8 +10,33 @@ h1, h2, h3, h4, h5 {
margin: 0.4em 0em; margin: 0.4em 0em;
} }
ul {
margin: 0em;
}
/** classes **/
.float_right {
float: right;
}
.float_left {
float: left;
}
.icon {
max-width: 2em;
max-height: 2em;
vertical-align: middle;
}
.small_icon {
max-height: 1.5em;
vertical-align: middle;
}
/** classes: flex **/
.flex_row { .flex_row {
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
@ -33,14 +58,40 @@ h1, h2, h3, h4, h5 {
} }
/** content: menus **/
nav.menu {
padding: 0.4em;
}
.menu.top {
padding: 0.2em;
height: 2.5em;
margin-bottom: 1em;
}
.menu.top * {
vertical-align: middle;
}
.menu.top > section {
display: inline-block;
}
.page_left > section,
.page_right > section {
margin-bottom: 1em;
}
/** content: list & items **/ /** content: list & items **/
.list { .list {
width: 100%; width: 100%;
}
ul.list {
padding: 0.4em; padding: 0.4em;
} }
.list_item { .list_item {
width: inherit;
margin: 0.4em 0; margin: 0.4em 0;
} }
@ -59,6 +110,11 @@ h1, h2, h3, h4, h5 {
min-height: 64px; min-height: 64px;
} }
.list_item > * {
margin: 0em 0.2em;
vertical-align: middle;
}
/** content: date list **/ /** content: date list **/
.date_list nav { .date_list nav {
@ -94,11 +150,182 @@ h1, h2, h3, h4, h5 {
.date_list_item h3 { .date_list_item h3 {
width: 100%; width: 100%;
margin-top: 0em;
} }
/** content: publication **/ /** content: comments **/
.comments form input:not([type=checkbox]),
.comments form textarea {
display: inline-block;
width: 100%;
max-height: 6em;
margin: 0.2em 0em;
padding: 0.2em;
}
.comments form input[type=checkbox],
.comments form button[type=submit] {
vertical-align:bottom;
margin: 0.2em 0em;
text-align: center;
}
.comments form button[type=submit] {
float: right;
}
.comments form #show_more:not(:checked) ~ .extra {
display: none;
}
.comments label[for="show_more"] {
font-size: 0.8em;
}
.comments ul {
margin-top: 2.5em;
}
.comment {
list-style: none;
border: 1px #818181 dotted;
margin: 0.4em 0em;
}
.comment .metadata {
font-size: 0.9em;
}
.comment time {
float: right;
}
/** content: player **/
.player {
width: 20em;
}
.player:not([seekable]) > .controls {
display: none;
}
.player .controls > * {
margin: 0em 0.2em;
}
.player .controls .single {
display: none;
}
.player .controls .single + label {
display: inline-block;
font-size: 1em;
padding: 0.1em;
width: 1.5em;
height: 1.0em;
text-align: center;
box-shadow: inset 0em 0em 0.1em #818181;
}
.player .controls .single:not(:checked) + label {
border-left: 2px #818181 solid;
color: black;
}
.player .controls .single:checked + label {
border-right: 2px #818181 solid;
}
.player .on_air a:not([href]), .on_air a[href=""] {
display: none;
}
.player .playlist .item {
margin: 0em;
padding: 0.2em 0.4em;
height: 1em;
cursor: pointer;
}
.player .playlist .item:hover {
color: #007EDF;
}
.player .item > * {
vertical-align: middle;
}
.player .playlist .item .actions {
display: none;
}
.player .playlist .item:hover .actions {
display: inline-block;
}
.player .playlist .item .info {
float: right;
width: 2em;
display: inline-block;
}
.player .item:not([selected]) .button {
display: none;
}
.player .item[selected] {
height: auto;
font-size: 1.1em;
}
.player .button {
display: inline-block;
cursor: pointer;
height: 2.0em;
background: none;
border: none;
font-size: 1.4em;
}
.player .button > img {
max-height: 2.0em;
}
.player:not([state]) .button > img:not(.play),
.player[state="paused"] .button > img:not(.play),
.player[state="playing"] .button > img:not(.pause),
.player[state="loading"] .button > img:not(.loading)
{
display: none;
}
.player[state="loading"] .box .button > img.loading {
animation-duration: 2s;
animation-iteration-count: infinite;
animation-name: rotate;
animation-timing-function: linear;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/** content: page **/
main .body ~ section:not(.comments) {
width: calc(50% - 1em);
float: left;
}

View File

@ -35,7 +35,11 @@ h1:first-letter, h2:first-letter, h3:first-letter {
h1 { font-size: 1.4em; } h1 { font-size: 1.4em; }
h2 { font-size: 1.2em; } h2 { font-size: 1.2em; }
h3 { font-size: 1.0em; } h3 { font-size: 0.9em; }
h2 * { vertical-align: middle; }
/** info **/ /** info **/
@ -67,8 +71,23 @@ a:hover {
/** page **/ /** page **/
.page > nav { .page > nav {
width: 20em; width: 16em;
overflow: hidden; overflow: hidden;
} }
main {
background-color: rgba(255,255,255,0.9);
padding: 1em;
box-shadow: 0em 0em 0.2em black;
}
main h1 {
margin: 0em;
margin: 0em 0em 0.4em 0em;
}
main .content img.cover {
width: 100%;
}

View File

@ -0,0 +1,130 @@
This is a human-readable summary of (and not a substitute for) the license.
http://creativecommons.org/licenses/by-sa/4.0/
------
Disclaimer
This license is acceptable for Free Cultural Works.
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
------
Creative Commons Attribution-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part; and
produce, reproduce, and Share Adapted Material.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.

View File

@ -0,0 +1,14 @@
# Android Developer Icons
Android Developer Icons is a custom icon set, created by [Opoloo](http://www.opoloo.com/). Included are:
* 250 hand-crafted, pixel-perfect icons in 5 sizes and 14 colors
* an icon font, made from the set
* all sources: .svg, .ai, .eps, .eot, .ttf, .woff
## License
[Attribution-ShareAlike 4.0 International CC BY-SA 4.0]
(http://creativecommons.org/licenses/by-sa/4.0/)
## More
Were always happy to hear from you, whether its a question about the icon set or giving us a heads-up where you used our beautiful little icons in a project. If you like, follow us at [Google+](https://plus.google.com/u/0/b/104776915031333350956/+Opoloo/posts), on [Twitter](https://twitter.com/Opoloo), or [shoot us an email](mailto: info@opoloo.com).

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,5 +1,4 @@
// TODO // TODO
// - multiple sources for an item
// - live streams as item; // - live streams as item;
// - add to playlist button // - add to playlist button
// //
@ -8,9 +7,9 @@
function duration_str(seconds) { function duration_str(seconds) {
seconds = Math.floor(seconds); seconds = Math.floor(seconds);
var hours = Math.floor(seconds / 3600); var hours = Math.floor(seconds / 3600);
seconds -= hours; seconds -= hours * 3600;
var minutes = Math.floor(seconds / 60); var minutes = Math.floor(seconds / 60);
seconds -= minutes; seconds -= minutes * 60;
var str = hours ? (hours < 10 ? '0' + hours : hours) + ':' : ''; var str = hours ? (hours < 10 ? '0' + hours : hours) + ':' : '';
str += (minutes < 10 ? '0' + minutes : minutes) + ':'; str += (minutes < 10 ? '0' + minutes : minutes) + ':';
@ -19,18 +18,19 @@ function duration_str(seconds) {
} }
function Sound(title, detail, stream, duration) { function Sound(title, detail, duration, streams) {
this.title = title; this.title = title;
this.detail = detail; this.detail = detail;
this.stream = stream;
this.duration = duration; this.duration = duration;
this.streams = streams.splice ? streams.sort() : [streams];
} }
Sound.prototype = { Sound.prototype = {
title: '', title: '',
detail: '', detail: '',
stream: '', streams: undefined,
duration: undefined, duration: undefined,
on_air_url: undefined,
item: undefined, item: undefined,
@ -44,26 +44,36 @@ function PlayerPlaylist(player) {
this.player = player; this.player = player;
this.playlist = player.player.querySelector('.playlist'); this.playlist = player.player.querySelector('.playlist');
this.item_ = player.player.querySelector('.playlist .item'); this.item_ = player.player.querySelector('.playlist .item');
this.items = [] this.sounds = []
} }
PlayerPlaylist.prototype = { PlayerPlaylist.prototype = {
items: undefined, sounds: undefined,
find: function(stream) { /// Find a sound by its streams, and return it if found
return this.items.find(function(stream_) { find: function(streams) {
return stream_ == stream; streams = streams.splice ? streams.sort() : streams;
return this.sounds.find(function(sound) {
// comparing array
if(!sound.streams || sound.streams.length != streams.length)
return false;
for(var i = 0; i < streams.length; i++)
if(sound.streams[i] != streams[i])
return false;
return true
}); });
}, },
add: function(sound, container) { add: function(sound, container) {
if(this.find(sound.stream)) var sound_ = this.find(sound.streams);
return; if(sound_)
return sound_;
var item = this.item_.cloneNode(true); var item = this.item_.cloneNode(true);
item.removeAttribute('style'); item.removeAttribute('style');
console.log(sound)
item.querySelector('.title').innerHTML = sound.title; item.querySelector('.title').innerHTML = sound.title;
if(sound.seekable) if(sound.seekable)
item.querySelector('.duration').innerHTML = item.querySelector('.duration').innerHTML =
@ -79,26 +89,29 @@ PlayerPlaylist.prototype = {
'click', function(event) { self.remove(sound); }, false 'click', function(event) { self.remove(sound); }, false
); );
item.addEventListener('click', function(event) { item.addEventListener('click', function(event) {
if(event.target.className.indexOf('action') != -1)
return;
self.player.select(sound, true) self.player.select(sound, true)
}, false); }, false);
(container || this.playlist).appendChild(item); (container || this.playlist).appendChild(item);
this.items.push(sound); this.sounds.push(sound);
this.save(); this.save();
return sound;
}, },
remove: function(sound) { remove: function(sound) {
var index = this.items.indexOf(sound); var index = this.sounds.indexOf(sound);
if(index != -1) if(index != -1)
this.items.splice(index,1); this.sounds.splice(index,1);
this.playlist.removeChild(sound.item); this.playlist.removeChild(sound.item);
this.save(); this.save();
}, },
save: function() { save: function() {
var list = []; var list = [];
for(var i in this.items) { for(var i in this.sounds) {
var sound = Object.assign({}, this.items[i]) var sound = Object.assign({}, this.sounds[i])
delete sound.item; delete sound.item;
list.push(sound); list.push(sound);
} }
@ -106,10 +119,14 @@ PlayerPlaylist.prototype = {
}, },
load: function() { load: function() {
var list = []; var list = this.player.store.get('playlist');
var container = document.createDocumentFragment(); var container = document.createDocumentFragment();
for(var i in list) for(var i in list) {
this.add(list[i], container) var sound = list[i];
sound = new Sound(sound.title, sound.detail, sound.duration,
sound.streams)
this.add(sound, container)
}
this.playlist.appendChild(container); this.playlist.appendChild(container);
}, },
} }
@ -118,12 +135,12 @@ PlayerPlaylist.prototype = {
function Player(id) { function Player(id) {
this.store = new Store('player'); this.store = new Store('player');
// html items // html sounds
this.player = document.getElementById(id); this.player = document.getElementById(id);
this.box = this.player.querySelector('.box');
this.audio = this.player.querySelector('audio'); this.audio = this.player.querySelector('audio');
this.on_air = this.player.querySelector('.on_air');
this.controls = { this.controls = {
duration: this.box.querySelector('.duration'), duration: this.player.querySelector('.controls .duration'),
progress: this.player.querySelector('progress'), progress: this.player.querySelector('progress'),
single: this.player.querySelector('input.single'), single: this.player.querySelector('input.single'),
} }
@ -151,7 +168,7 @@ Player.prototype = {
function update_info() { function update_info() {
var controls = self.controls; var controls = self.controls;
// progress // progress
if( !self.sound.seekable || if(!self.sound || !self.sound.seekable ||
self.audio.duration == Infinity) { self.audio.duration == Infinity) {
controls.duration.innerHTML = ''; controls.duration.innerHTML = '';
controls.progress.value = 0; controls.progress.value = 0;
@ -161,7 +178,7 @@ Player.prototype = {
var pos = self.audio.currentTime; var pos = self.audio.currentTime;
controls.progress.value = pos; controls.progress.value = pos;
controls.progress.max = self.audio.duration; controls.progress.max = self.audio.duration;
controls.duration.innerHTML = duration_str(sound.duration); controls.duration.innerHTML = duration_str(pos);
} }
// audio // audio
@ -174,7 +191,7 @@ Player.prototype = {
}, false); }, false);
this.audio.addEventListener('loadstart', function() { this.audio.addEventListener('loadstart', function() {
self.player.setAttribute('state', 'stalled'); self.player.setAttribute('state', 'loading');
}, false); }, false);
this.audio.addEventListener('loadeddata', function() { this.audio.addEventListener('loadeddata', function() {
@ -184,15 +201,11 @@ Player.prototype = {
this.audio.addEventListener('timeupdate', update_info, false); this.audio.addEventListener('timeupdate', update_info, false);
this.audio.addEventListener('ended', function() { this.audio.addEventListener('ended', function() {
self.player.removeAttribute('state');
if(!self.controls.single.checked) if(!self.controls.single.checked)
self.next(true); self.next(true);
}, false); }, false);
// buttons
this.box.querySelector('button.play').onclick = function() {
self.play();
};
// progress // progress
progress = this.controls.progress; progress = this.controls.progress;
progress.addEventListener('click', function(event) { progress.addEventListener('click', function(event) {
@ -210,6 +223,39 @@ Player.prototype = {
}, false); }, false);
}, },
update_on_air: function(url) {
if(!url) {
// TODO HERE
}
var self = this;
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.onreadystatechange = function() {
if(req.readyState != 4 || (req.status != 200 && req.status != 0))
return;
var data = JSON.parse(req.responseText)
if(data.type == 'track') {
self.on_air.querySelector('.info').innerHTML = '♫';
self.on_air.querySelector('.title') =
(data.artist || '') + ' — ' + (data.title);
self.on_air.querySelector('.url').removeAttribute('href');
}
else {
self.on_air.querySelector('.info').innerHTML = '';
self.on_air.querySelector('.title').innerHTML = data.title;
self.on_air.querySelector('.url').setAttribute('href', data.url);
}
if(timeout)
window.setTimeout(function() {
self.update_on_air(url);
}, 60*1000);
};
req.send();
},
play: function() { play: function() {
if(this.audio.paused) if(this.audio.paused)
this.audio.play(); this.audio.play();
@ -227,58 +273,68 @@ Player.prototype = {
}, },
select: function(sound, play = true) { select: function(sound, play = true) {
if(this.sound == sound) {
if(play)
this.play();
return;
}
if(this.sound) if(this.sound)
this.unselect(this.sound); this.unselect(this.sound);
this.audio.pause(); this.audio.pause();
// if stream is a list, use <source> // streams as <source>
var sources = this.audio.querySelectorAll('source'); var sources = this.audio.querySelectorAll('source');
for(var i = 0; i < sources.length; i++) { for(var i = 0; i < sources.length; i++) {
this.audio.removeChild(sources[i]); this.audio.removeChild(sources[i]);
} }
sources = sound.stream.splice ? sound.stream : [ sound.stream ]; streams = sound.streams;
for(var i = 0; i < sources.length; i++) { for(var i = 0; i < streams.length; i++) {
var source = document.createElement('source'); var source = document.createElement('source');
source.src = sources[i]; source.src = streams[i];
source.type = this.__mime_type(source.src);
this.audio.appendChild(source); this.audio.appendChild(source);
} }
this.audio.load(); this.audio.load();
// attributes
this.sound = sound; this.sound = sound;
sound.item.setAttribute('selected', 'true'); sound.item.setAttribute('selected', 'true');
this.box.querySelector('.title').innerHTML = sound.title; if(sound.seekable)
this.player.setAttribute('seekable', 'true');
else
this.player.removeAttribute('seekable');
// play
if(play) if(play)
this.play(); this.play();
}, },
next: function() { next: function() {
var index = this.playlist.items.indexOf(this.sound); var index = this.playlist.sounds.indexOf(this.sound);
if(index < 0) if(index < 0)
return; return;
index++; index++;
if(index < this.playlist.items.length) if(index < this.playlist.sounds.length)
this.select(this.playlist.items[index], true); this.select(this.playlist.sounds[index], true);
}, },
save: function() { save: function() {
this.store.set('player', { this.store.set('player', {
single: this.controls.single.checked, single: this.controls.single.checked,
sound: this.sound && this.sound.stream, sound: this.sound && this.sound.streams,
}); });
}, },
load: function() { load: function() {
var data = this.store.get('player'); var data = this.store.get('player');
this.controls.single.checked = data.single; this.controls.single.checked = data.single;
this.sound = this.playlist.find(data.stream); if(data.sound)
}, this.sound = this.playlist.find(data.sound);
update_on_air: function() {
}, },
} }

View File

@ -31,7 +31,7 @@ Store.prototype = {
set: function(key, data) { set: function(key, data) {
key = this.prefix + '.' + key; key = this.prefix + '.' + key;
if(data == undefined) { if(data == undefined) {
localStorage.removeItem(prefix); localStorage.removeItem(this.prefix);
return; return;
} }
localStorage.setItem(key, JSON.stringify(data)) localStorage.setItem(key, JSON.stringify(data))

View File

@ -31,7 +31,7 @@
<title>{{ page.title }}</title> <title>{{ page.title }}</title>
</head> </head>
<body> <body>
<div class="top"> <div class="menu top">
{% render_sections position="top" %} {% render_sections position="top" %}
</div> </div>
@ -40,7 +40,7 @@
</header> </header>
<div class="page flex_row"> <div class="page flex_row">
<nav class="page_left flex_item"> <nav class="menu page_left flex_item">
{% render_sections position="page_left" %} {% render_sections position="page_left" %}
</nav> </nav>
@ -62,7 +62,7 @@
{% endblock %} {% endblock %}
</main> </main>
<nav class="page_right flex_item"> <nav class="menu page_right flex_item">
{% render_sections position="page_right" %} {% render_sections position="page_right" %}
</nav> </nav>
</div> </div>

View File

@ -4,7 +4,7 @@
{% block content_extras %} {% block content_extras %}
{% with tracks=page.tracks.all %} {% with tracks=page.tracks.all %}
{% if tracks %} {% if tracks %}
<div class="playlist"> <section class="playlist">
<h2>{% trans "Playlist" %}</h2> <h2>{% trans "Playlist" %}</h2>
<ul> <ul>
{% for track in tracks %} {% for track in tracks %}
@ -14,11 +14,11 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </section>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<div class="dates"> <section class="dates">
<h2>{% trans "Dates of diffusion" %}</h2> <h2>{% trans "Dates of diffusion" %}</h2>
<ul> <ul>
{% with diffusion=page.diffusion %} {% with diffusion=page.diffusion %}
@ -28,16 +28,16 @@
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
</ul> </ul>
</div> </section>
{% with podcasts=self.get_podcasts %} {% with podcasts=self.get_podcasts %}
{% if podcasts %} {% if podcasts %}
<div class="podcasts list"> <section class="podcasts list">
<h2>{% trans "Podcasts" %}</h2> <h2>{% trans "Podcasts" %}</h2>
{% for item in podcasts %} {% for item in podcasts %}
{% include 'cms/snippets/sound_list_item.html' %} {% include 'cms/snippets/sound_list_item.html' %}
{% endfor %} {% endfor %}
</div> </section>
{% endif %} {% endif %}
{% endwith %} {% endwith %}

View File

@ -25,9 +25,10 @@
{% endif %} {% endif %}
<section class="body"> <section class="body">
{{ page.body|richtext}} {{ page.body|richtext}}
{% block content_extras %}{% endblock %}
</section> </section>
{% block content_extras %}{% endblock %}
<div class="post_content"> <div class="post_content">
{% render_sections position="post_content" %} {% render_sections position="post_content" %}
</div> </div>

View File

@ -1,8 +1,10 @@
{% extends "cms/sections/section_item.html" %} {% extends "cms/sections/section_item.html" %}
{% block content %} {% block content %}
{% with item_date_format="H:i" list_css_class="date_list" %} {% with item_date_format="H:i" list_css_class="date_list" list_no_cover=True %}
{% include "cms/snippets/list.html" %} {% for item in object_list %}
{% include "cms/snippets/date_list_item.html" %}
{% endfor %}
{% endwith %} {% endwith %}
{% endblock %} {% endblock %}

View File

@ -10,49 +10,50 @@
</style> </style>
<div id="player"> <div id="player" class="player">
<div class="box"> <audio preload="metadata">
<audio preload="metadata"> {% trans "Your browser does not support the <code>audio</code> element." %}
{% trans "Your browser does not support the <code>audio</code> element." %} {% for stream in streams %}
{% for stream in streams %} <source src="{{ stream }}" />
<source src="{{ stream }}" /> {% endfor %}
{% endfor %} </audio>
</audio>
<button class="play" onclick="Player.play()" <div class="controls flex_row">
title="{% trans "play/pause" %}"></button> <progress class="flex_item" value="0" max="1"></progress>
<span class="info duration"></span>
<h3 class="title">{{ self.live_title }}</h3> <input type="checkbox" class="single" id="player_single_mode">
<label for="player_single_mode" class="info" title="{% trans "single mode" %}"></label>
<div>
<div class="info duration"></div>
<progress value="0" max="1"></progress>
<input type="checkbox" class="single" id="player_single_mode">
<label for="player_single_mode"></label>
</div>
</div> </div>
<div class="playlist"> <div class="playlist">
<li class='item' style="display: none;"> <li class='item list_item flex_row' style="display: none;">
<h2 class="title">{{ self.live_title }}</h2> <div class="button">
<div class="info duration"></div> <img src="{% static "cms/images/play.png" %}" class="play"
title="{% trans "play" %}" />
<img src="{% static "cms/images/pause.png" %}" class="pause"
title="{% trans "pause" %}" />
<img src="{% static "cms/images/loading.png" %}" class="loading"
title="{% trans "loading..." %}" />
</div>
<h3 class="title flex_item">{{ self.live_title }}</h3>
<div class="actions"> <div class="actions">
<a class="action detail" title="{% trans "more informations" %}"></a> <a class="action detail" title="{% trans "more informations" %}"></a>
<a class="action remove" title="{% trans "remove this sound" %}"></a> <a class="action remove" title="{% trans "remove this sound" %}"></a>
</div> </div>
<span class="info duration"></span>
</li> </li>
</div> </div>
<div class='item on_air'>
<h2 class="title"></h2>
<a class="url"></a>
</div>
</div> </div>
<script> <script>
var player = new Player('player'); var player = new Player('player');
player.playlist.add(new Sound('{{ self.live_title }}', '', [ var sound = player.playlist.add(new Sound('{{ self.live_title }}', '', undefined,
{% for stream in streams %}'{{ stream }}',{% endfor %} streams=[
])); {% for stream in streams %}'{{ stream }}',{% endfor %}
]), on_air_url = '{% url 'controllers.on_air' %}');
player.select(sound, false);
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,11 @@
{% extends "cms/sections/section_item.html" %} {% extends "cms/sections/section_item.html" %}
{% load i18n %} {% load i18n %}
{% load static %}
{% block content %} {% block content %}
<form action="{{ list_page.url }}" method="GET"> <form action="{{ list_page.url }}" method="GET">
<input type="text" name="search" placeholder="{{ self.text }}"> <img src="{% static "cms/images/search.png" %}" class="icon"/>
<input type="text" name="search" placeholder="{{ self.default_text }}">
<input type="submit" style="display: none;"> <input type="submit" style="display: none;">
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,11 @@
{% load i18n %} {% load i18n %}
{% load static %}
{% load honeypot %} {% load honeypot %}
{% if comment_form or page.comments %}
<h2><img src="{% static "cms/images/comments.png" %}" class="icon">{% trans "Comments" %}</h2>
{% endif %}
{% if comment_form %} {% if comment_form %}
{% with comment_form as form %} {% with comment_form as form %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
@ -30,7 +35,10 @@
</div> </div>
</form> </form>
<ul> {% endwith %}
{% endif %}
<ul class="list">
{% for comment in page.comments %} {% for comment in page.comments %}
<li class="comment"> <li class="comment">
<div class="metadata"> <div class="metadata">
@ -45,8 +53,3 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endwith %}
{% endif %}

View File

@ -16,6 +16,7 @@ is just a bit different.
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{% if not list_no_cover %}
{% if item_big_cover %} {% if item_big_cover %}
{% image item.cover max-640x480 class="cover big" height="" width="" %} {% image item.cover max-640x480 class="cover big" height="" width="" %}
{% elif item.cover %} {% elif item.cover %}
@ -23,6 +24,7 @@ is just a bit different.
{% else %} {% else %}
<div class="cover small"></div> <div class="cover small"></div>
{% endif %} {% endif %}
{% endif %}
<div class="flex_item"> <div class="flex_item">
<h3>{{ item.title }}</h3> <h3>{{ item.title }}</h3>

View File

@ -1,13 +1,22 @@
{% load static %} {% load static %}
{# TODO: complete archive podcast -> info #} {# TODO: complete archive podcast -> info #}
<a class="list_item sound" onclick="player.playlist.add(new Sound( <div class="list_item sound">
<a onclick="player.select(player.playlist.add(new Sound(
title='{{ item.name|escape }}', title='{{ item.name|escape }}',
detail='{{ item.detail_url }}', detail='{{ item.detail_url }}',
stream='{{ item.url }}'));"> duration={{ item.duration|date:"H*3600+i*60+s" }},
<h3>{{ item.name }}</h3> streams='{{ item.url }}')));" class="flex_row">
<img src="{% static "cms/images/listen.png" %}" class="icon"/>
<h3 class="flex_item">{{ item.name }}</h3>
<span class="info"> <span class="info">
{{ duration.date|date:'H:i:s' }} {% if item.duration.hour > 0 %}
{{ item.duration|date:'H:i:s' }}
{% else %}
{{ item.duration|date:'i:s' }}
{% endif %}
</span> </span>
</a> </a>
</div>

View File

@ -49,17 +49,14 @@ section.station {
</style> </style>
<script> <script>
// HERE
var Monitor = { var Monitor = {
get_token: function () { get_token: function () {
return document.cookie.replace(/.*csrftoken=([^;]+)(;.*|$)/, '$1'); return document.cookie.replace(/.*csrftoken=([^;]+)(;.*|$)/, '$1');
}, },
post: function(station, action) { post: function(station, action) {
params = 'station=' + station + '&&action=' + action; var params = 'station=' + station + '&&action=' + action;
var req = new XMLHttpRequest()
req = new XMLHttpRequest()
req.open('POST', '{% url 'controllers.monitor' %}', false); req.open('POST', '{% url 'controllers.monitor' %}', false);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length); req.setRequestHeader("Content-length", params.length);
@ -74,7 +71,7 @@ var Monitor = {
}, },
update: function(timeout) { update: function(timeout) {
req = new XMLHttpRequest() var req = new XMLHttpRequest()
req.open('GET', '{% url 'controllers.monitor' %}', true); req.open('GET', '{% url 'controllers.monitor' %}', true);
req.onreadystatechange = function() { req.onreadystatechange = function() {
if(req.readyState != 4 || (req.status != 200 && req.status != 0)) if(req.readyState != 4 || (req.status != 200 && req.status != 0))
@ -88,7 +85,9 @@ var Monitor = {
doc.querySelector('#stations').innerHTML; doc.querySelector('#stations').innerHTML;
if(timeout) if(timeout)
window.setTimeout(function() { Monitor.update(timeout);}, 5000); window.setTimeout(
function() { Monitor.update(timeout);}, timeout
);
}; };
req.send(); req.send();
}, },