Skip to content

Commit

Permalink
Escape most data printed out from AJAX requests
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Oct 19, 2015
1 parent a0ead12 commit 7e6e9c0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions gmusicprocurator/templates/js/album.mtpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div>[% /* For flexbox */ %]
<h3>[[ album.name ]] - [% if (!!album.artistId) { %]<a href="#/artists/[[ album.artistId[0] ]]">[% } %][[ album.artist ]][% if (!!album.artistId) { %]</a>[% } %]</h3>
<h3>[%- album.name %] - [% if (!!album.artistId) { %]<a href="#/artists/[[ album.artistId[0] ]]">[% } %][%- album.artist %][% if (!!album.artistId) { %]</a>[% } %]</h3>

<section id="album-metadata">
<figure>
<img src="[[ album.albumArtRef ]]" alt="">
<figcaption>
<p>[[ album.tracks.length ]] song[% if (album.tracks.length != 1) { %]s[% } %]</p>
<p>[[ AlpacAudio.human_readable_milliseconds(album.duration) ]]</p>
<p>[[ album.year ]]</p>
<p>[[ album.genres.join(', ') ]]</p>
<p>[%- album.tracks.length %] song[% if (album.tracks.length != 1) { %]s[% } %]</p>
<p>[%- AlpacAudio.human_readable_milliseconds(album.duration) %]</p>
<p>[%- album.year %]</p>
<p>[%- album.genres.join(', ') %]</p>
</figcaption>
</figure>
<ul class="actions">
Expand Down
14 changes: 7 additions & 7 deletions gmusicprocurator/templates/js/artist.mtpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div>[% /* For flexbox */ %]
<h3>[[ artist.name ]]</h3>
<h3>[%- artist.name %]</h3>

<section id="artist-metadata">
<figure>
<img src="[[ artist.artistArtRef ]]" alt="">
<figcaption>
<p>[[ artist.artistBio ]]</p>
<p>[%- artist.artistBio %]</p>
</figcaption>
</figure>
</section>
Expand All @@ -16,10 +16,10 @@
<ul>
[% artist.albums.forEach(function (album) { %]
<li><figure class="secondary-album-art">
<a href="#/albums/[[ album.albumId ]]"><img src="[[ album.albumArtRef ]]" alt="" title="[[ album.name ]]" class="secondary-album-art"></a>
<a href="#/albums/[[ album.albumId ]]"><img src="[[ album.albumArtRef ]]" alt="" title="[%- album.name %]" class="secondary-album-art"></a>
<figcaption>
<p><a href="#/albums/[[ album.albumId ]]" title="[[ album.name ]]">[[ album.name ]]</a></p>
<p>[% if (!!album.artistId[0]) { %]<a href="#/artists/[[ album.artistId[0] ]]" title="[[ album.artist ]]">[% } %][[ album.artist ]][% if (!!album.artistId[0]) { %]</a>[% } %]</p>
<p><a href="#/albums/[[ album.albumId ]]" title="[%- album.name %]">[%- album.name %]</a></p>
<p>[% if (!!album.artistId[0]) { %]<a href="#/artists/[[ album.artistId[0] ]]" title="[%- album.artist %]">[% } %][%- album.artist %][% if (!!album.artistId[0]) { %]</a>[% } %]</p>
</figcaption>
</figure></li>
[% }); /* artist.albums.forEach */ %]
Expand All @@ -32,8 +32,8 @@
<ul>
[% artist.related_artists.forEach(function (related) { %]
<li><a href="#/artists/[[ related.artistId ]]"><figure class="secondary-artist-art">
<img src="[[ related.artistArtRef ]]" alt="" title="[[ related.name ]]" class="secondary-artist-art">
<figcaption title="[[ related.name ]]">[[ related.name ]]</figcaption>
<img src="[[ related.artistArtRef ]]" alt="" title="[%- related.name %]" class="secondary-artist-art">
<figcaption title="[%- related.name %]">[%- related.name %]</figcaption>
</figure></a></li>
[% }); /* artist.related_artists.forEach */ %]
</ul>
Expand Down
4 changes: 2 additions & 2 deletions gmusicprocurator/templates/js/now-playing.mtpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[% } /* albumArtRef */ %]
<span class="details">
<span class="primary">
<b>[[ track.title ]]</b>
<b>[%- track.title %]</b>
</span>
<span class="secondary">
<span>[[ track.artist ]]</span>: <i>[[ track.album ]]</i>
<span>[%- track.artist %]</span>: <i>[%- track.album %]</i>
</span>
</span>
2 changes: 1 addition & 1 deletion gmusicprocurator/templates/js/playlist-entry.mtpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a href="#playlist/[[ entry.id ]]"[% if (entry.id == gmp.QUEUE_ID) { %] class="queue"[% } /* queue */ %]>[[ entry.name ]]</a>
<a href="#playlist/[[ entry.id ]]"[% if (entry.id == gmp.QUEUE_ID) { %] class="queue"[% } /* queue */ %]>[%- entry.name %]</a>
10 changes: 5 additions & 5 deletions gmusicprocurator/templates/js/playlist-track.mtpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var aa = track.get('albumArtRef');
%]
<tr data-entry-id="[[ pt.id ]]">
<td class="albumart">[% if (!!aa) { %]<span data-idx="[[ pt.idx ]]" data-art-url="[[ aa[0].url ]]" style="background-image:url([[ aa[0].url ]])"><span class="fa"></span></span>[% } %]</td>
<td>[[ track.get('title') ]]</td>
<td>[[ AlpacAudio.human_readable_milliseconds(track.get('durationMillis')) ]]</td>
<td><a href="#/artists/[[ track.get('artistId')[0] ]]">[[ track.get('artist') ]]</a></td>
<td><a href="#/albums/[[ track.get('albumId') ]]">[[ track.get('album') ]]</a></td>
<td>[[ track.get('trackNumber') ]]</td>
<td>[%- track.get('title') %]</td>
<td>[%- AlpacAudio.human_readable_milliseconds(track.get('durationMillis')) %]</td>
<td><a href="#/artists/[[ track.get('artistId')[0] ]]">[%- track.get('artist') %]</a></td>
<td><a href="#/albums/[[ track.get('albumId') ]]">[%- track.get('album') %]</a></td>
<td>[%- track.get('trackNumber') %]</td>
</tr>
2 changes: 1 addition & 1 deletion gmusicprocurator/templates/js/playlist.mtpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[% if (typeof(playlist.ownerName) !== 'undefined' || playlist.id == AlpacAudio.QUEUE_ID) { %]
<section id="playlist-info">
[% if (!!playlist.name) { %]
<h3 class="name">[[ playlist.name ]]</h3>
<h3 class="name">[%- playlist.name %]</h3>
[% } /* playlist.name */ %]
[% if (playlist.id != AlpacAudio.QUEUE_ID) { %]
<ul class="actions">
Expand Down
2 changes: 1 addition & 1 deletion gmusicprocurator/templates/js/search-form.mtpl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<input type="search" name="query" placeholder="Search…" required="required" value="[% if (typeof query != 'undefined' && !!query) { %][[ query ]][% } %]">[% /* eliminate padding
<input type="search" name="query" placeholder="Search…" required="required" value="[% if (typeof query != 'undefined' && !!query) { %][%- query %][% } %]">[% /* eliminate padding
*/ %]<button type="submit" class="pure-button" title="Search"><span class="fa fa-search"></span></button>
10 changes: 5 additions & 5 deletions gmusicprocurator/templates/js/search-results.mtpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ul>
[% model.artist_hits.forEach(function (hit) { %]
<li><a href="#/artists/[[ hit.artist.artistId ]]"><figure>
<img src="[[ hit.artist.artistArtRef ]]" alt="" title="[[ hit.artist.name ]]" class="secondary-artist-art">
<figcaption title="[[ hit.artist.name ]]">[[ hit.artist.name ]]</figcaption>
<img src="[[ hit.artist.artistArtRef ]]" alt="" title="[%- hit.artist.name %]" class="secondary-artist-art">
<figcaption title="[%- hit.artist.name %]">[%- hit.artist.name %]</figcaption>
</figure></a></li>
[% }); /* artist_hits.forEach */ %]
</ul>
Expand All @@ -22,10 +22,10 @@
<ul>
[% model.album_hits.forEach(function (hit) { %]
<li><figure>
<a href="#/albums/[[ hit.album.albumId ]]"><img src="[[ hit.album.albumArtRef ]]" alt="" title="[[ hit.album.name ]]" class="secondary-album-art"></a>
<a href="#/albums/[[ hit.album.albumId ]]"><img src="[[ hit.album.albumArtRef ]]" alt="" title="[%- hit.album.name %]" class="secondary-album-art"></a>
<figcaption>
<p><a href="#/albums/[[ hit.album.albumId ]]" title="[[ hit.album.name ]]">[[ hit.album.name ]]</a></p>
<p>[% if (!!hit.album.artistId[0]) { %]<a href="#/artists/[[ hit.album.artistId[0] ]]" title="[[ hit.album.artist ]]">[% } %][[ hit.album.artist ]][% if (!!hit.album.artistId[0]) { %]</a>[% } %]</p>
<p><a href="#/albums/[[ hit.album.albumId ]]" title="[%- hit.album.name %]">[%- hit.album.name %]</a></p>
<p>[% if (!!hit.album.artistId[0]) { %]<a href="#/artists/[[ hit.album.artistId[0] ]]" title="[%- hit.album.artist %]">[% } %][% hit.album.artist %][% if (!!hit.album.artistId[0]) { %]</a>[% } %]</p>
</figcaption>
</figure></li>
[% }); /* album_hits.forEach */ %]
Expand Down

0 comments on commit 7e6e9c0

Please sign in to comment.