forked from ogerly/airtime-sendeplan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
126 lines (121 loc) · 5.72 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="description" content="Sendeplan und Sendeungen des online Radios sender.fm">
<meta name="keywords" content="Sendeplan, Sendungen, Onlineradio, radio, Wien, Österreich, online, Internetradio">
<meta name="author" content="Alexander Friedland, sender.fm">
<base href="https://sender.fm" target="_blank">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.css"/>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://momentjs.com/downloads/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/locale/de.js"></script>
<style>
.redrow {
background-color:#ffc107;
}
</style>
</head>
<title>Sendeplan - Sender.fm</title>
<body>
<div id="app" >
<br />
<br />
<label>Sendeplan durchsuchen</label>
<b-input v-model="filters" placeholder="suche"></b-input>
<br />
<b-table
:items="tableItemSendungen"
:fields="fields"
:filter="filters"
striped
hover
responsive
stacked="sm"
>
<template #cell(zeit)="data">
<span :id="this.moment(data.item.start_timestamp).format('DDMMYYYYHHmmss')">{{ this.moment(data.item.start_timestamp).locale('de').format('ll')}}</span>
</template>
</b-table>
</div>
</body>
<script>
var app = new Vue({
el: '#app',
props: {
airtimechannel: {
type: String,
default: ''
}
},
data() {
return {
url: this.airtimechannel === '' ? 'https://senderfm.airtime.pro/api/week-info' : this.airtimechannel,
json: null,
tableItemDays: [],
tableItemSendungen: [],
fields: [
{ key: 'zeit', label: 'Datum', thStyle: { width: "10%" }, formatter: (value, key, item) => {
const date = moment(item.start_timestamp).locale('de').format('ll')
return date;
}},
{ key:'start_timestamp', label: 'Zeit', thStyle: { width: "10%" }, formatter: (value, key, item) => {
const time = moment(item.start_timestamp).locale('de').format('LT')
return time + ' Uhr';
}},
{ key:'name', label: 'Sendung', thStyle: { width: "20%" }},
{ key:'description', label: 'Beschreibung', thStyle: { width: "60%" }, formatter: (cell, row, item)=> {
// return item.description = item.description.replace(/(https?:\/\/[^\s]+)/g, '<a href="sasda">asdasd</a>');
return item.description
}}
],
filters: '',
innerHtml: '',
}
},
mounted () {
this.airtimebot()
if(this.airtimechannel !== '') { alert("channel ist übergeben => " + this.airtimechannel) }
},
methods: {
async airtimebot() {
axios.get(this.url).then(response => {
this.json = response.data;
const l = Object.keys(this.json).length
for (var i = 0; i < l; i++) {
var day = Object.keys(this.json)[i]
var array =this.json[day]
var ll = array.length
if (Object.keys(this.json)[i] != 'AIRTIME_API_VERSION') {
for (var ii = 0; ii < ll; ii++) {
if ( moment() < moment(array[ii].end_timestamp) ) {
this.tableItemSendungen.push(array[ii])
}
}
}
if (i == l-1 ) {
$( "tr" ).removeClass('redrow');
setTimeout(function(){
if ( !$('#'+moment().format('DDMMYYYYHH0000')).text() ) {
$('#'+moment().subtract(1, "hour").format('DDMMYYYYHH0000')+'').parent().parent().parent().addClass('redrow')
} else {
$('#'+moment().format('DDMMYYYYHH0000')+'').parent().parent().parent().addClass('redrow')
}
}, 1000);
}
}
})
}
},
})
</script>
</html>