Team:UNITN-Trento/Templates/Notebook
From 2013.igem.org
(Difference between revisions)
Line 8: | Line 8: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
alert("Notebook under maintenance, please DO NOT add any post. Thank you."); | alert("Notebook under maintenance, please DO NOT add any post. Thank you."); | ||
+ | |||
+ | function setPost(id) { | ||
+ | var title = $(id).attr("data-title"); | ||
+ | var date = $(id).attr("data-date"); | ||
+ | who = $(id).attr("data-user").split("-"); | ||
+ | var tags = $(id).attr("data-tag").split("-"); | ||
+ | var uri = "https://2013.igem.org/wiki/index.php?title=Team:UNITN-Trento/Notebook"; | ||
+ | |||
+ | |||
+ | if (date.indexOf("-") != -1) { | ||
+ | ardate = date.split("-") | ||
+ | if (ardate.length == 3) { | ||
+ | date = "<span class='yy'>" + ardate[0] + "</span><br />\n<span class='ddmm'>" + ardate[2] + "/" + ardate[1] + "</span>"; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | var wholow = []; | ||
+ | for (var i = 0; i < who.length; i++) { | ||
+ | wholow.push(who[i].toLowerCase()); | ||
+ | } | ||
+ | |||
+ | var who_box = $("<div></div>"); | ||
+ | var tag_box = $("<div></div>"); | ||
+ | |||
+ | if (wholow.indexOf("bruno") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/2/26/Tn-2013-Ba_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("caterina") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/5/59/Tn-2013-Cm_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("emil") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/5/50/Tn-2013-Et_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("fabio") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/5/50/Tn-2013-Fd_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("gabriele") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/e/e0/Tn-2013-Gg_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("michele") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/b/b0/Tn-2013-Mp_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("thomas") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/6/66/Tn-2013-Tp_face.jpg' />"); | ||
+ | } | ||
+ | if (wholow.indexOf("viola") != -1) { | ||
+ | $(who_box).append("<img src='https://static.igem.org/mediawiki/2013/1/1d/Tn-2013-Vv_face.jpg' />"); | ||
+ | } | ||
+ | $(who_box).addClass("tn-faces"); | ||
+ | |||
+ | $(tag_box).addClass("tn-tags"); | ||
+ | for (var i = 0; i < tags.length; i++) { | ||
+ | if (i == 0) { | ||
+ | $(tag_box).html("<b>Tags</b><br/>"); | ||
+ | } | ||
+ | |||
+ | $(tag_box).html($(tag_box).html() + "<span class='tag'>" + tags[i] + "</span>"); | ||
+ | } | ||
+ | |||
+ | if (title != "") { | ||
+ | $(id).prepend("<div class='tn-posttitle'>" + title + "</div>"); | ||
+ | } | ||
+ | $(id).prepend("<div class='tn-postdate'><a href='" + uri + id + "'class='tn-anchor'>" + date + "</a></div>"); | ||
+ | $(id).prepend(who_box); | ||
+ | $(id).append(tag_box); | ||
+ | } | ||
+ | |||
$(document).ready(function() { | $(document).ready(function() { | ||
Line 38: | Line 105: | ||
$('<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)).appendTo($("#aj_cont")); | $('<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)).appendTo($("#aj_cont")); | ||
+ | |||
+ | setPost('tn-post-'+date+"-"+author); | ||
}); | }); | ||
}); | }); |
Revision as of 07:43, 19 August 2013
[http://2013.igem.org/wiki/index.php?title=Team:UNITN-Trento/Templates/Notebook&action=edit Edit this page] | Main Page