Skip to content

Commit

Permalink
Insert tracklist into the correct container
Browse files Browse the repository at this point in the history
  • Loading branch information
adlawson committed Nov 13, 2016
1 parent 912c4e3 commit 7400937
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tracklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ main();
browser.onChange(browser.querySelector('[m-contents="maincontent"]'), main);

function main() {
const container = browser.querySelector('[ng-controller="CloudcastHeaderCtrl"]');
if (container !== null) {
const parent = browser.querySelector('[ng-controller="CloudcastHeaderCtrl"]');
const empty = parent.querySelector('[ng-init]');
if (parent !== null) {
fetchData(window.location, (data) => {
const tracklistTemplate = require('./templates/tracklist')(dust); // Required by both new and legacy
if (isLegacy()) {
render(require('./templates/legacy')(dust), data.cloudcast, html => {
const empty = container.querySelector('[ng-init]');
browser.replace(container, empty, html);
toggleEvents(container, container);
browser.replace(parent, empty, html);
toggleEvents(parent, parent);
});
} else {
const toggleContainer = browser.querySelector('footer.mz-actions');
const moreButton = toggleContainer.querySelector('[ng-controller="DropdownCtrl"]');
render(tracklistTemplate, data.cloudcast, tracklistHtml => {
browser.insert(container, tracklistHtml);
browser.insert(empty, tracklistHtml);
render(require('./templates/toggle')(dust), {}, toggleHtml => {
browser.insertBefore(toggleContainer, moreButton, toggleHtml);
toggleEvents(container, toggleContainer);
toggleEvents(empty, toggleContainer);
});
});
}
Expand Down

0 comments on commit 7400937

Please sign in to comment.