Commit f3b287b7 authored by dj3c1t's avatar dj3c1t

init source buttons after load

parent c8e9cf55
......@@ -25,77 +25,85 @@ $(document).ready(
);
}
init_players($("#main"));
function init_sources_buttons(container) {
$(".toggle_composition_sources").click(
function() {
var source_id = $(this).data("source-id");
var contentDiv = $("#source_" + source_id + " .composition_sources .loaded").first();
if(contentDiv.html()) {
contentDiv.slideUp(
400,
function() {
contentDiv.html("");
container.find(".toggle_composition_sources").click(
function() {
var source_id = $(this).data("source-id");
var contentDiv = $("#source_" + source_id + " .composition_sources .loaded").first();
if(contentDiv.html()) {
contentDiv.slideUp(
400,
function() {
contentDiv.html("");
}
);
return;
}
var toggle_button = $(this);
var loading = toggle_button.parents(".composition_sources").first().find(".loading");
loading.show();
var url = "{{ path('source_composition_sources', {source: 1111}) }}";
url = url.replace("1111", source_id);
$.get(
url,
function(response) {
loading.hide();
if(response["error"]) {
app_message("danger", toggle_button.closest(".source"), response["error"]);
return;
}
contentDiv.hide();
contentDiv.html(response["data"]["source_list"]);
contentDiv.slideDown();
init_players(contentDiv);
init_sources_buttons(contentDiv);
}
);
return;
}
var toggle_button = $(this);
var loading = toggle_button.parents(".composition_sources").first().find(".loading");
loading.show();
var url = "{{ path('source_composition_sources', {source: 1111}) }}";
url = url.replace("1111", source_id);
$.get(
url,
function(response) {
loading.hide();
if(response["error"]) {
app_message("danger", toggle_button.closest(".source"), response["error"]);
return;
}
contentDiv.hide();
contentDiv.html(response["data"]["source_list"]);
contentDiv.slideDown();
init_players(contentDiv);
}
);
}
);
);
$(".toggle_source_derivations").click(
function() {
var source_id = $(this).data("source-id");
var contentDiv = $("#source_" + source_id + " .source_derivations .loaded").first();
if(contentDiv.html()) {
contentDiv.slideUp(
400,
function() {
contentDiv.html("");
container.find(".toggle_source_derivations").click(
function() {
var source_id = $(this).data("source-id");
var contentDiv = $("#source_" + source_id + " .source_derivations .loaded").first();
if(contentDiv.html()) {
contentDiv.slideUp(
400,
function() {
contentDiv.html("");
}
);
return;
}
var toggle_button = $(this);
var loading = toggle_button.parents(".source_derivations").first().find(".loading");
loading.show();
var url = "{{ path('source_source_derivations', {source: 1111}) }}";
url = url.replace("1111", source_id);
$.get(
url,
function(response) {
loading.hide();
if(response["error"]) {
app_message("danger", toggle_button.closest(".source"), response["error"]);
return;
}
contentDiv.hide();
contentDiv.html(response["data"]["source_list"]);
contentDiv.slideDown();
init_players(contentDiv);
init_sources_buttons(contentDiv);
}
);
return;
}
var toggle_button = $(this);
var loading = toggle_button.parents(".source_derivations").first().find(".loading");
loading.show();
var url = "{{ path('source_source_derivations', {source: 1111}) }}";
url = url.replace("1111", source_id);
$.get(
url,
function(response) {
loading.hide();
if(response["error"]) {
app_message("danger", toggle_button.closest(".source"), response["error"]);
return;
}
contentDiv.hide();
contentDiv.html(response["data"]["source_list"]);
contentDiv.slideDown();
init_players(contentDiv);
}
);
}
);
);
}
init_players($("#main"));
init_sources_buttons($("#main"));
$(".toggle_source_xml_view").click(
function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment