-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
243 lines (223 loc) · 9.27 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!doctype html>
<!--
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html ng-app="Librarian">
<head>
<meta charset="utf-8">
<title>Librarian: search Google Books</title>
<!-- TODO(mbrukman): fix code to work with Angular 1.3.0 and later. -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script>
<!-- TODO(mbrukman): fix code to work with Angular UI Bootstrap 0.13.0 and later. -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.js"></script>
<link href="https://fonts.googleapis.com/css?family=PT+Sans:400,700|PT+Sans+Caption:400,700"
rel="stylesheet" type="text/css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css"
rel="stylesheet" type="text/css" />
<script src="books.js"></script>
<link href="books.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div style="header" align=center>
<h1>Book search</h1>
</div>
<div ng-controller="SearchCtrl" style="content" align=center>
<form ng-submit="search()">
<div class="form-horizontal">
<input autofocus ng-model="query" size="20" type="text" />
<button class="btn-primary" type="submit">search</button><br />
<table border=0>
<tr>
<td class="tdLabel"><label>Availability:</label></td>
<td class="tdSelect">
<select ng-model="filter" class="search" style="width: 10em">
<option value="full">full view</option>
<option value="free-ebooks">Google ebooks</option>
</select>
</td>
</tr>
<tr>
<td class="tdLabel"><label>Download:</label></td>
<td class="tdSelect">
<select ng-model="download" class="search" style="width: 5em">
<option value="">any</option>
<option value="epub">EPUB</option>
</select>
</td>
</tr>
<tr>
<td class="tdLabel"><label>Language:</label></td>
<td class="tdSelect">
<!--
Important: use 2-letter ISO 639-1 codes here! See
https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the
full list.
Note that these are NOT ALWAYS the same as the related 2-letter
country code TLD (aka ccTLD): e.g., Japan's ccTLD is `jp` but
the Japanese 2-letter language code is `ja`; Korea's ccTLD is
`kr` but the Korean 2-letter language code is `ko`, etc.
However, in some cases the ccTLD and language code are the same,
e.g., France and French (fr), Germany and German (de), Italy and
Italian (it), Turkey and Turkish (tr), etc.
The United Kingdon ccTLD is `uk` but the 2-letter language code
`uk` is for the Ukranian language, while Ukrain's ccTLD is `ua`.
-->
<select ng-model="lang" class="search" style="width: 8em">
<option value="zh">Chinese</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="en" selected>English</option>
<option value="et">Estonian</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="he">Hebrew</option>
<option value="it">Italian</option>
<option value="la">Latin</option>
<option value="lv">Latvian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="no">Norwegian</option>
<option value="pt">Portuguese</option>
<option value="ru">Russian</option>
<option value="sv">Swedish</option>
<option value="tr">Turkish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="uz">Uzbek</option>
<option value="yi">Yiddish</option>
</select>
</td>
</tr>
</table>
</div>
</form>
<table border=0>
<tr ng-repeat="book in data.items"
ng-show="download != 'epub' || (download == 'epub' && book.accessInfo.epub.isAvailable)">
<td>
<img ng-src="{{secureUrl(book.volumeInfo.imageLinks.smallThumbnail)}}">
</td>
<td>
<em>{{truncateTitle(book.volumeInfo.title)}}</em><br>
<em ng-show="book.volumeInfo.subtitle">
{{truncateTitle(book.volumeInfo.subtitle)}}
</em><br ng-show="book.volumeInfo.subtitle">
<span ng-repeat="author in book.volumeInfo.authors">
{{author}}<span ng-show="! $last">, </span>
</span><br>
<a ng-href="https://play.google.com/books/reader?id={{book.id}}">web reader</a> |
<a ng-href="https://google.com/books?id={{book.id}}&&printsec=frontcover#v=onepage">Google Books</a> |
<a ng-href="https://play.google.com/store/books/details?id={{book.id}}">Google Play</a> |
<a ng-href="https://www.googleapis.com/books/v1/volumes/{{book.id}}">JSON</a>
</td>
</tr>
</table>
<table border=0>
<tr ng-class-even="'even'"
ng-class-odd="'odd'"
ng-mouseenter="showLinks = true"
ng-mouseleave="showLinks = false"
ng-repeat="book in data.results">
<td valign="top">
<img class="clickable book"
ng-click="toggleBook(book)"
ng-src="{{book.artworkUrl60}}">
</td>
<td valign="top">
<span class="clickable bookTitle"
ng-click="toggleBook(book)">
{{book.collectionName}}
</span>
<br>
<span class="bookArtist">
{{book.artistName}}
</span>
<br>
<!-- Displayed on mouseover in the row; hidden on mouseout. -->
<span ng-show="showLinks">
<a href="{{book.feedUrl}}">RSS</a> |
<a href="{{book.collectionViewUrl}}">iTunes</a>
</span>
<div modal="book.modal"
close="closeModalBook(book)">
<div class="modal-header">
<table>
<tr>
<td valign="top" class="book">
<img class="clickable book"
ng-click="bookDescription = !bookDescription"
ng-src="{{book.artworkUrl60}}"
style="vertical-align: top">
</td>
<td valign="top" align="left">
<span class="bookTitle" ng-bind="book.collectionName">
</span>
<br>
<span class="bookArtist" ng-bind="book.artistName">
</span>
<br>
</td>
</tr>
<tr>
<td colspan=2>
<span class="bookDesc"
ng-bind="book.rss.channel.description"
ng-show="bookDescription">
</span>
</td>
</tr>
</table>
</div>
<div class="modal-body">
<table>
<tr ng-repeat="item in book.rss.channel.item">
<td valign="top">
<!-- TODO: subtitles, text content, etc. -->
{{$index + 1}}.
</td>
<td valign="top">
<span class="bookTitle clickable"
ng-class="episodeClass(item)"
ng-click="setActiveMedia(item)"
ng-mouseover="item.showSummary = true"
ng-mouseout="item.showSummary = false"
ng-show="hasEnclosedUrl(item) && hasMedia(item)">
{{item.title}}
<span class="episodeSummary"
ng-show="showEpisodeSummary(item)">
<br>{{item['itunes:summary']}}
</span>
</span>
<!-- The URL is not supported media: link to it directly. -->
<span class="bookTitle"
ng-show="hasEnclosedUrl(item) && !hasMedia(item)">
<a href="{{enclosureUrl(item)}}">{{item.title}}</a>
</span>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<!-- TODO: figure out how to display sanitized HTML rather than
escaped HTML. -->
<span ng-bind="activeMedia.description"></span>
</div>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>