Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
IE redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie0 committed Apr 29, 2017
1 parent f6ee0e3 commit f68c3af
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,33 @@
"@angular/platform-browser-dynamic": "2.4.3",
"@types/core-js": "0.9.35",
"angular2-onsenui": "1.0.0-rc.5",
"core-js": "2.4.1",
"onsenui": "2.0.5",
"rxjs": "5.0.3",
"ts-loader": "^2.0.0",
"typescript": "2.1.5",
"zone.js": "0.7.6",

"autoprefixer": "6.3.7",
"babel-loader": "6.2.4",
"babel-preset-es2015": "6.9.0",
"babel-preset-react": "6.11.1",
"babel-preset-stage-2": "6.11.0",
"copy-webpack-plugin": "3.0.1",
"core-js": "2.4.1",
"css-loader": "0.23.1",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
"html-loader": "0.4.3",
"html-webpack-plugin": "2.22.0",
"null-loader": "0.1.1",
"onsenui": "2.0.5",
"postcss-loader": "0.9.1",
"precss": "1.4.0",
"progress-bar-webpack-plugin": "1.8.0",
"raw-loader": "^0.5.1",
"react-hot-loader": "3.0.0-beta.1",
"rxjs": "5.0.3",
"style-loader": "0.13.1",
"stylus": "0.54.5",
"stylus-loader": "2.1.1",
"style-loader": "0.13.1",
"ts-loader": "1.3.0",
"typescript": "2.0.10",
"webpack": "1.13.1",
"webpack-dev-server": "1.14.1"
"webpack-dev-server": "1.14.1",
"zone.js": "0.7.6"
}
}
2 changes: 1 addition & 1 deletion src/app/history.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="history">
<div class="song-container" *ngFor="let row of history()">
<table *ngIf="!isNaN(row.now)">
<table>
<tr>
<td class="a" rowspan=2>{{ row.now | date:'HH:mm' }}</td>
<td class="b">{{ row.nowPlaying.song }}</td>
Expand Down
17 changes: 13 additions & 4 deletions src/app/radio.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import {HTTP} from './http';

declare var Audio:any;

var NchanSubscriber = require('../NchanSubscriber.js');

function parseDate(date) {
const parsed = Date.parse(date);
if (!isNaN(parsed)) {
return new Date(parsed);
}
return new Date(Date.parse(date.replace(/-/g, '/').replace(/[a-z]+/gi, ' ')));
}

export module Radio {

export abstract class Player {
Expand Down Expand Up @@ -83,7 +92,7 @@ export module Radio {
}

play () {
var path = this.options.path + (this.options.path.indexOf("?") != -1 ? '&' : '?') + new Date().getTime();
var path = this.options.path + (this.options.path.indexOf("?") != -1 ? '&' : '?') + Date.now();
this.played = false;

if(this.audio != null)
Expand Down Expand Up @@ -134,7 +143,7 @@ export module Radio {
}

play () {
var path = this.options.manifest + (this.options.manifest.indexOf("?") != -1 ? '&' : '?') + new Date().getTime();
var path = this.options.manifest + (this.options.manifest.indexOf("?") != -1 ? '&' : '?') + Date.now()
this.played = false;

if(this.audio != null)
Expand Down Expand Up @@ -207,7 +216,7 @@ export module Radio {

update (http:HTTP.Request, callback:(response) => void) {
var data = JSON.parse(http.responseText)
data.now = new Date(data.now).getTime()
data.now = parseDate(data.now).getTime()
callback(data);
}

Expand Down Expand Up @@ -240,7 +249,7 @@ export module Radio {

update (message:any, callback:(response) => void) {
var data = JSON.parse(message)
data.now = new Date(data.now).getTime()
data.now = parseDate(data.now).getTime()
callback(data);
}

Expand Down
10 changes: 10 additions & 0 deletions src/public/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@
<meta property="og:url" content="http://insanityradio.com/listen/" />

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Security-Policy" content="default-src * data:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; media-src *; connect-src ws://webapi.insanityradio.com wss://webapi.insanityradio.com http://localhost:8080 ws://localhost:8080">

<script type="text/javascript">
// Not supported on any version of IE currently. Fall back to classic
if(navigator.userAgent.indexOf("Trident") > -1 || navigator.userAgent.indexOf("MSIE") > -1) {
location.href = '/listen/classic/';
}
</script>

<% for (var dep in htmlWebpackPlugin.options.externalJS) { %>
<script type="text/javascript" src="<%= htmlWebpackPlugin.options.externalJS[dep] %>"></script><% } %>
<% for (var dep in htmlWebpackPlugin.options.externalCSS) { %>
Expand Down
4 changes: 2 additions & 2 deletions www/app.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@
<meta property="og:url" content="http://insanityradio.com/listen/" />

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Security-Policy" content="default-src * data:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; media-src *; connect-src ws://webapi.insanityradio.com wss://webapi.insanityradio.com http://localhost:8080 ws://localhost:8080">

<script type="text/javascript">

// Not supported on any version of IE currently. Fall back to classic
if(navigator.userAgent.indexOf("Trident") > -1 || navigator.userAgent.indexOf("MSIE") > -1) {
location.href = '/listen/classic/';
}

</script>


<script type="text/javascript" src="components/loader.js"></script>

Expand Down

0 comments on commit f68c3af

Please sign in to comment.