This commit is contained in:
Franz Schäfer 2016-05-31 13:38:58 +02:00
commit ef96ed0f57
2 changed files with 42 additions and 42 deletions

View File

@ -40,9 +40,7 @@
</div> </div>
<div class="container"> <div class="container">
<ul id="content"> <div id="content"/>
</ul>
</div> </div>
</div><!--/.container--> </div><!--/.container-->

34
main.js
View File

@ -3,17 +3,16 @@ jQuery.fn.extend({
var self = $(this); var self = $(this);
$.ajax({ $.ajax({
url: dataurl, url: dataurl,
async:true, async: true,
contentType:"application/json", contentType: "application/json",
dataType: "json", dataType: "json",
success: function(data){ success: function (data) {
$.each(data, function(key, attributes2){ $.each(data, function (key, attributes2) {
var sitename = attributes2.sitename; var sitename = attributes2.sitename;
var site_div = $("<div>"); var site_div = $("<div>");
var site_title = $("<h1>"); $(site_div).attr('id', sitename);
$(site_title).text = sitename; var site_list = $("<ul>");
$(site_title).appendTo(site_div); $.each(attributes2.sites, function (key, attributes) {
$.each(attributes2.sites, function(key, attributes){
var my_link = (typeof attributes['link'] != 'undefined') ? attributes['link'] : ""; var my_link = (typeof attributes['link'] != 'undefined') ? attributes['link'] : "";
var my_button = (typeof attributes['button'] != 'undefined') ? attributes['button'] : ""; var my_button = (typeof attributes['button'] != 'undefined') ? attributes['button'] : "";
var my_name = (typeof attributes['name'] != 'undefined') ? attributes['name'] : ""; var my_name = (typeof attributes['name'] != 'undefined') ? attributes['name'] : "";
@ -33,7 +32,7 @@ jQuery.fn.extend({
new_content = $("<img>"); new_content = $("<img>");
$(new_content).addClass("img-responsive"); $(new_content).addClass("img-responsive");
$(new_content).attr("src", my_image); $(new_content).attr("src", my_image);
}else{ } else {
var new_br = $("<br>"); var new_br = $("<br>");
$(new_br).appendTo(new_anchor); $(new_br).appendTo(new_anchor);
new_content = $("<div>"); new_content = $("<div>");
@ -44,9 +43,12 @@ jQuery.fn.extend({
} }
$(new_anchor).appendTo(new_div); $(new_anchor).appendTo(new_div);
console.log(new_div); console.log(new_div);
$(new_div).appendTo(site_div); $(new_div).appendTo(site_list);
});$(site_div).appendTo(self); });
});} $(site_list).appendTo(site_div);
$(site_div).appendTo(self);
});
}
}); });
} }
}); });
@ -56,17 +58,17 @@ jQuery.fn.extend({
var self = $(this); var self = $(this);
$.ajax({ $.ajax({
url: "vcf/api.php", url: "vcf/api.php",
async:true, async: true,
contentType:"text/html", contentType: "text/html",
dataType: "html", dataType: "html",
success: function(data){ success: function (data) {
$(self).html(data); $(self).html(data);
} }
}); });
} }
}); });
$(document).ready(function(){ $(document).ready(function () {
$("#content").linklist(); $("#content").linklist();
$("#impressum").impress(); $("#impressum").impress();
}); });