|
|
Line 75: |
Line 75: |
| $(id).append(tag_box); | | $(id).append(tag_box); |
| } | | } |
- |
| |
- | /*
| |
- | $(document).ready(function() {
| |
- |
| |
- | var last_id = 0, href = "";
| |
- |
| |
- | //Get posts from ajax index
| |
- | $("#aj_index a").each(function() {
| |
- |
| |
- | //Get url
| |
- | href = $(this).attr('href');
| |
- |
| |
- | //Get id
| |
- | var id = href.split("/");
| |
- | id = id[id.length - 1];
| |
- |
| |
- | //Save highest id (last post)
| |
- | if( id > last_id ) {
| |
- | last_id = id;
| |
- | }
| |
- |
| |
- | //Make AJAX request
| |
- | $.getJSON( href+"?action=raw&ctype=text/javascript" , function(data) {
| |
- | var date = data.date;
| |
- | var author = data.author;
| |
- | var title = data.title;
| |
- | var content = data.content;
| |
- | var tags = data.tags;
| |
- |
| |
- | div = $('<div></div>').attr('id' , 'tn-post-'+date+"-"+author).addClass('tn-post').attr('data-user' , author).attr('data-title' , title).attr('data-date' , date).attr('data-tag' , tags).append($("<div></div>").addClass('tn-text').html(content)).prepend($("<a href='" + href + "?action=edit' class='tn-editpost'><img src='https://static.igem.org/mediawiki/2013/0/04/Tn-20130709-edit_button.png' title='Edit' alt='Edit' /></a>"));
| |
- |
| |
- | $("<center></center>").append($(div)).appendTo($("#aj_cont"));
| |
- |
| |
- | setPost('#tn-post-'+date+"-"+author);
| |
- | });
| |
- | });
| |
- |
| |
- | //Add 'add post' button
| |
- | var addpost_url = href.split('/');
| |
- | addpost_url.pop();
| |
- | addpost_url = addpost_url.join('/');
| |
- | addpost_url += "/" + (parseInt(last_id)+1) + "?action=edit\&preload=Team:UNITN-Trento/Help/Labpost_AJAX";
| |
- | addpost_url = "https://2013.igem.org" + addpost_url;
| |
- | $("<a>Add new LabPost_AJ</a>").attr( 'href' , addpost_url.replace('amp;','') ).addClass("tn-addpost").appendTo("#aj_cont");
| |
- |
| |
- | //Wrap #aj_cont into <center>
| |
- | $("#aj_cont").children().wrapAll("<center></center>");
| |
- | });
| |
- | */
| |
| </script> | | </script> |
| | | |
Line 221: |
Line 172: |
| </html>{{Special:PrefixIndex/Team:UNITN-Trento/Notebook/Labposts/}}<html> | | </html>{{Special:PrefixIndex/Team:UNITN-Trento/Notebook/Labposts/}}<html> |
| </div> | | </div> |
| + | <div id="aj_load" style="text-align: center;">Loading the posts...</div> |
| <div id="aj_cont" style="text-align: center;"> | | <div id="aj_cont" style="text-align: center;"> |
| <!--Ajax content--> | | <!--Ajax content--> |