-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
166 lines (140 loc) · 6.88 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE HTML>
<html>
<head>
<title>中文电视大全</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="stylesheet" href="/static/styles.css"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div id="videoListPage" data-role="page" data-add-back-btn="true">
<div data-role="header" data-position="fixed">
<h1>中文电视大全</h1>
</div>
<div data-inline="true">
<form action="http://www.allchinesetv.com/index.html" method="get" data-ajax="false">
<input type="search" name="q" data-inline="true" placeholder="拼音或汉字搜索"> <input type="submit" value="Search"
data-inline="true">
</form>
</div>
<div data-role="content">
<ul id="videoList" data-role="listview" data-filter="true">
</ul>
</div>
</div>
<script type="text/javascript">
var serviceURL = 'http://www.allchinesetv.com';
var videos;
//$('#videoListPage').on('pageshow', function (event) {
$(document).on("pageinit", '#videoListPage',function (event) {
getvideoList();
});
$(document).on("click", '.load-more',function (event) {
var allstr = decodeURIComponent($('.load-more').attr('id'));
var str = allstr.substring(3, allstr.length);
url = serviceURL + '/' + str;
$.getJSON(url, function (data) {
var $loadMore = $('#videoList').children('.load-more');
$loadMore.remove()
videos = data;
$.each(videos, function (index, video) {
if (video.type == 1) {
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?id=' + video.id + '">' +
'<img src="' + video.image + '"/>' +
'<h4>' + video.title + '</h4>' +
'<p>' + video.age + '</p>' + ' </a></li> ');
}
if (video.type == 2) {
if (video.valid == 1) {
$('#videoList').append('<li class="load-more" id="' + video.link + '"><a href="#">Load More</a></li>');
}
}
});
$('#videoList').listview('refresh');
});
});
function getvideoList() {
var id = getUrlVars()["id"];
var cat = getUrlVars()["cat"];
var q = getUrlVars()["q"];
//alert(cat)
var url = ''
if (typeof cat != 'undefined') {
url = serviceURL + '/' + cat + '/?alt=json';
$.getJSON(url, function (data) {
var $loadMore = $('#videoList').children('.load-more');
$loadMore.remove()
videos = data;
$.each(videos, function (index, video) {
if (video.type == 1) {
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?id=' + video.id + '">' +
'<img src="' + video.image + '"/>' +
'<h4>' + video.title + '</h4>' +
'<p>' + video.age + '</p>' + ' </a></li> ');
}
if (video.type == 2) {
if (video.valid == 1) {
$('#videoList').append('<li class="load-more" id="' + video.link + '"><a href="#">Load More</a></li>');
}
}
});
$('#videoList').listview('refresh');
});
}
else if (typeof id != 'undefined') {
url = serviceURL + '/play/' + id + '/?alt=json';
$.getJSON(url, function (data) {
$('#videoList li').remove();
videos = data;
$.each(videos, function (index, video) {
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/mobileplay.html?video=' + video.ytlink + '">' +
'<img src="' + video.image + '"/>' +
'<h4>' + video.title + '</h4>' +
'<p>' + video.title + '</p>' + ' </a></li> ');
});
$('#videoList').listview('refresh');
});
}
else if (typeof q != 'undefined') {
url = serviceURL + '/search/?q=' + q + '&alt=json';
$.getJSON(url, function (data) {
$('#videoList li').remove();
videos = data;
$.each(videos, function (index, video) {
if (video.type == 1) {
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?id=' + video.id + '">' +
'<img src="' + video.image + '"/>' +
'<h4>' + video.title + '</h4>' +
'<p>' + video.title + '</p>' + ' </a></li> ');
}
});
$('#videoList').listview('refresh');
});
}
else {
$('#videoList li').remove();
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=tv' + '">' + '<h4>电视剧</h4>' + ' </a></li> ');
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=movie' + '">' + '<h4>电影</h4>' + ' </a></li> ');
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=zongyi' + '">' + '<h4>综艺</h4>' + ' </a></li> ');
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=tiyu' + '">' + '<h4>体育</h4>' + ' </a></li> ');
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=xinwen' + '">' + '<h4>新闻</h4>' + ' </a></li> ');
$('#videoList').append('<li><a data-ajax="false" href="http://www.allchinesetv.com/index.html?cat=katong' + '">' + '<h4>卡通</h4>' + ' </a></li> ');
$('#videoList').listview('refresh');
}
}
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
</script>
</body>
</html>