43
43
color : # 666 ;
44
44
}
45
45
46
- .movie-card a {
46
+ a .link {
47
+ text-decoration : none;
48
+ color : # 007bff ;
49
+ transition : background-color 0.3s , color 0.3s ;
50
+ }
51
+
52
+ a .link : hover {
53
+ background-color : # 007bff ;
54
+ color : # ffffff ;
55
+ }
56
+
57
+ a .button {
47
58
display : inline-block;
48
59
margin-top : 10px ;
49
60
text-decoration : none;
54
65
transition : background-color 0.3s , color 0.3s ;
55
66
}
56
67
57
- . movie-card a : hover {
68
+ a . button : hover {
58
69
background-color : # 007bff ;
59
70
color : # ffffff ;
60
71
}
118
129
119
130
< body >
120
131
< div class ="header ">
121
- < h1 style ="display: inline; margin-right: 20px; "> Movie Browser</ h1 >
132
+ < h1 style ="display: inline; margin-right: 20px; "> Wikidata Movie Browser</ h1 >
122
133
< a id ="endpointLink " href ="" target ="_blank "> View JSON on Endpoint</ a >
123
134
</ div >
124
135
< div class ="search-container ">
@@ -144,6 +155,7 @@ <h1 style="display: inline; margin-right: 20px;">Movie Browser</h1>
144
155
})
145
156
{
146
157
Movies(limit: 1000) @pattern(of: "SELECT ?s { ?s wdt:P31 wd:Q11424 . FILTER (exists { ?s rdfs:label ?l . FILTER(langMatches(lang(?l), 'en')) FILTER(CONTAINS(LCASE(STR(?l)), LCASE('SEARCH_TERM'))) }) }") {
158
+ id @bind(of: "?s")
147
159
label @one @pattern(of: "?s rdfs:label ?l. FILTER(LANG(?l) = 'en')")
148
160
description @one @pattern(of: "?s schema:description ?l. FILTER(LANG(?l) = 'en')")
149
161
depiction @one @pattern(of: "SELECT ?s ?o { ?s wdt:P18 ?o } ORDER BY ?o LIMIT 1")
@@ -210,8 +222,14 @@ <h1 style="display: inline; margin-right: 20px;">Movie Browser</h1>
210
222
const movieCard = document . createElement ( 'div' ) ;
211
223
movieCard . className = 'movie-card' ;
212
224
225
+ const wikidataLink = document . createElement ( 'a' ) ;
226
+ wikidataLink . href = movie . id ;
227
+ wikidataLink . target = '_blank' ;
228
+ wikidataLink . className = "link" ;
229
+ wikidataLink . textContent = `${ movie . label } (${ movie . releaseYear } )` ;
230
+
213
231
const movieTitle = document . createElement ( 'h3' ) ;
214
- movieTitle . textContent = ` ${ movie . label } ( ${ movie . releaseYear } )` ;
232
+ movieTitle . appendChild ( wikidataLink ) ;
215
233
216
234
const movieDescription = document . createElement ( 'p' ) ;
217
235
movieDescription . textContent = movie . description ;
@@ -231,11 +249,12 @@ <h1 style="display: inline; margin-right: 20px;">Movie Browser</h1>
231
249
movieCard . appendChild ( movieGenres ) ;
232
250
233
251
if ( movie . netflix ) {
234
- const movieLink = document . createElement ( 'a' ) ;
235
- movieLink . href = movie . netflix ;
236
- movieLink . target = '_blank' ;
237
- movieLink . textContent = 'Watch on Netflix' ;
238
- movieCard . appendChild ( movieLink ) ;
252
+ const netflixLink = document . createElement ( 'a' ) ;
253
+ netflixLink . href = movie . netflix ;
254
+ netflixLink . className = "button" ;
255
+ netflixLink . target = '_blank' ;
256
+ netflixLink . textContent = 'Watch on Netflix' ;
257
+ movieCard . appendChild ( netflixLink ) ;
239
258
}
240
259
241
260
container . appendChild ( movieCard ) ;
0 commit comments