-var BlergMedia = {
- audioExtensions: [],
- videoExtensions: []
-};
-
-function media_init() {
- var e = document.createElement('audio');
- if (!!e.canPlayType) {
- BlergMedia.has_audio = true;
- if (e.canPlayType('audio/mpeg; codecs="mp3"')) {
- BlergMedia.has_mp3 = true;
- BlergMedia.audioExtensions.push('mp3');
- }
- if (e.canPlayType('audio/ogg; codecs="vorbis"')) {
- BlergMedia.has_vorbis = true;
- BlergMedia.audioExtensions.push('ogg', 'oga');
- }
- if (e.canPlayType('audio/wav')) {
- BlergMedia.has_wav = true;
- BlergMedia.audioExtensions.push('wav');
- }
- }
-
- var e = document.createElement('video');
- if (!!e.canPlayType) {
- BlergMedia.has_video = true;
- if (e.canPlayType('video/mp4; codecs="avc"')) {
- BlergMedia.has_h264 = true;
- BlergMedia.videoExtensions.push('mp4');
- }
- if (e.canPlayType('video/ogg; codecs="theora, vorbis"')) {
- BlergMedia.has_theora = true;
- BlergMedia.videoExtensions.push('ogv');
- }
- if (e.canPlayType('video/webm; codecs="vp8, vorbis"')) {
- BlergMedia.has_webm = true;
- BlergMedia.videoExtensions.push('webm');
- }
- }
-}
-
-function play_audio() {
- var e = event.target.parentElement;
- var url = event.target.parentElement.href;
- var audio_element = new Element('audio', {src: url, controls: 1, autoplay: 1});
- e.replace(audio_element);
-}
-
-function play_video() {
- var e = event.target.parentElement;
- var url = event.target.parentElement.href;
- var p = new Element('p');
- var video_element = new Element('video', {src: url, controls: 1, autoplay: 1});
- p.insert(video_element);
- e.replace(p);
-}
-
-window.addEventListener('load', media_init, false);
onTryLogin: "tryLogin",
onTryLogout: "tryLogout",
onSetTitle: "setTitle",
- onPostVisibility: "postVisibilityUpdate"
+ onPostVisibility: "postVisibilityUpdate",
+ onReload: "sendReload"
},
components: [
{classes: "blerg-header", components: [
postVisibilityUpdate: function(inSender, inEvent) {
this.$.post.waterfall('onPostVisibility', inEvent);
this.$.controls.waterfall('onPostVisibility', inEvent);
+ },
+ sendReload: function() {
+ this.$.main.waterfall('onReload');
}
});
postSuccessful: function() {
this.setData('');
this.closePost();
- this.href = '#' + blerg.API.username;
+ if (location.hash != '#' + blerg.API.username) {
+ qlink(blerg.API.username);
+ } else {
+ this.bubble('onReload');
+ }
},
postFailed: function() {
alert('Could not post!');
listKind: "blerg.Record",
handlers: {
onLogin: "getStalkStatus",
- onLogout: "getStalkStatus"
+ onLogout: "getStalkStatus",
+ onReload: "usernameChanged"
},
published: {
username: "",
+var BlergMedia = {
+ audioExtensions: [],
+ videoExtensions: []
+};
+
+function media_init() {
+ var e = document.createElement('audio');
+ if (!!e.canPlayType) {
+ BlergMedia.has_audio = true;
+ if (e.canPlayType('audio/mpeg; codecs="mp3"')) {
+ BlergMedia.has_mp3 = true;
+ BlergMedia.audioExtensions.push('mp3');
+ }
+ if (e.canPlayType('audio/ogg; codecs="vorbis"')) {
+ BlergMedia.has_vorbis = true;
+ BlergMedia.audioExtensions.push('ogg', 'oga');
+ }
+ if (e.canPlayType('audio/wav')) {
+ BlergMedia.has_wav = true;
+ BlergMedia.audioExtensions.push('wav');
+ }
+ }
+
+ var e = document.createElement('video');
+ if (!!e.canPlayType) {
+ BlergMedia.has_video = true;
+ if (e.canPlayType('video/mp4; codecs="avc"')) {
+ BlergMedia.has_h264 = true;
+ BlergMedia.videoExtensions.push('mp4');
+ }
+ if (e.canPlayType('video/ogg; codecs="theora, vorbis"')) {
+ BlergMedia.has_theora = true;
+ BlergMedia.videoExtensions.push('ogv');
+ }
+ if (e.canPlayType('video/webm; codecs="vp8, vorbis"')) {
+ BlergMedia.has_webm = true;
+ BlergMedia.videoExtensions.push('webm');
+ }
+ }
+}
+
+function play_audio() {
+ var e = event.target.parentElement;
+ var url = event.target.parentElement.href;
+ var audio_element = new Element('audio', {src: url, controls: 1, autoplay: 1});
+ e.replace(audio_element);
+}
+
+function play_video() {
+ var e = event.target.parentElement;
+ var url = event.target.parentElement.href;
+ var p = new Element('p');
+ var video_element = new Element('video', {src: url, controls: 1, autoplay: 1});
+ p.insert(video_element);
+ e.replace(p);
+}
+
+window.addEventListener('load', media_init, false);