Skip to content

Commit

Permalink
Extract JS from show_top_tracks.inc.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchray committed May 3, 2024
1 parent 2a09ed0 commit 8b3f2c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion public/templates/show_similar_songs.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
$hide_drag = in_array('cel_drag', $hide_columns);
$show_license = AmpConfig::get('licensing') && AmpConfig::get('show_license');
?>
<table id="top_tracks_<?php echo $artist->id; ?>" class="tabledata striped-rows">
<table id="similar_tracks" class="tabledata striped-rows">
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>
Expand Down
9 changes: 2 additions & 7 deletions public/templates/show_top_tracks.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
$hide_drag = in_array('cel_drag', $hide_columns);
$show_license = AmpConfig::get('licensing') && AmpConfig::get('show_license');
?>
<table id="top_tracks_<?php echo $artist->id; ?>" class="tabledata striped-rows">
<table id="top_tracks" class="tabledata striped-rows">
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>
Expand Down Expand Up @@ -136,9 +136,4 @@
</tbody>
</table>

<script>
var index = 1;
var indexes = $("#top_tracks_<?php echo $artist->id; ?> .cel_play_content").each(function() {
$(this).html(index++);
});
</script>
<script>topTracksIndexes();</script>
6 changes: 6 additions & 0 deletions src/js/artist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function topTracksIndexes() {
var index = 1;
var indexes = $("#top_tracks .cel_play_content").each(function() {
$(this).html(index++);
});
}
2 changes: 2 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Ajax from './ajax.js';
import * as Artist from './artist.js';
import * as Base from './base.js';
import * as Search from './search.js';
import * as Sidebar from './sidebar.js';
Expand All @@ -10,4 +11,5 @@ Object.assign(window, Base);
Object.assign(window, Tools);
Object.assign(window, Search);
Object.assign(window, Sidebar);
Object.assign(window, Artist);
Object.assign(window, Slideshow);

0 comments on commit 8b3f2c0

Please sign in to comment.