Team:UNITN-Trento/JS/Styles/Labpost

From 2013.igem.org

(Difference between revisions)
Line 5: Line 5:
var tags = $(id).attr("data-tag").split("-");
var tags = $(id).attr("data-tag").split("-");
var uri = "https://2013.igem.org/wiki/index.php?title=Team:UNITN-Trento/Notebook";
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 = ardate[0] + "<br />" + ardate[2] + "/" + ardate[1];
 +
};
 +
}
var wholow = [];
var wholow = [];
Line 13: Line 21:
var who_box = $("<div></div>");
var who_box = $("<div></div>");
var tag_box = $("<div></div>");
var tag_box = $("<div></div>");
-
+
 
-
if (wholow.indexOf("bruno") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/c/c2/Bruno.jpg' />"); }
+
if (wholow.indexOf("bruno") != -1) {
-
if (wholow.indexOf("caterina") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/e/ed/Cate.jpg' />"); }
+
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/c/c2/Bruno.jpg' />");
-
if (wholow.indexOf("emil") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/5/50/Emil.JPG' />"); }
+
}
-
if (wholow.indexOf("fabio") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/9/9f/Fabio.jpg' />"); }
+
if (wholow.indexOf("caterina") != -1) {
-
if (wholow.indexOf("gabriele") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/26/Gire.jpg' />"); }
+
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/e/ed/Cate.jpg' />");
-
if (wholow.indexOf("michele") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/2e/Pedro.jpg' />"); }
+
}
-
if (wholow.indexOf("thomas") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/4/42/Thomas.png' />"); }
+
if (wholow.indexOf("emil") != -1) {
-
if (wholow.indexOf("viola") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/23/Viola.jpg' />"); }
+
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/5/50/Emil.JPG' />");
 +
}
 +
if (wholow.indexOf("fabio") != -1) {
 +
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/9/9f/Fabio.jpg' />");
 +
}
 +
if (wholow.indexOf("gabriele") != -1) {
 +
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/26/Gire.jpg' />");
 +
}
 +
if (wholow.indexOf("michele") != -1) {
 +
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/2e/Pedro.jpg' />");
 +
}
 +
if (wholow.indexOf("thomas") != -1) {
 +
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/4/42/Thomas.png' />");
 +
}
 +
if (wholow.indexOf("viola") != -1) {
 +
$(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/23/Viola.jpg' />");
 +
}
$(who_box).addClass("tn-faces");
$(who_box).addClass("tn-faces");
$(tag_box).addClass("tn-tags");
$(tag_box).addClass("tn-tags");
for (var i = 0; i < tags.length; i++) {
for (var i = 0; i < tags.length; i++) {
-
if (i == 0) { $(tag_box).html("<b>Tags</b><br/>"); }
+
if (i == 0) {
-
+
$(tag_box).html("<b>Tags</b><br/>");
-
$(tag_box).html($(tag_box).html()+"<span class='tag'>"+tags[i]+"</span>");
+
}
 +
 
 +
$(tag_box).html($(tag_box).html() + "<span class='tag'>" + tags[i] + "</span>");
}
}
-
if (title != "") { $(id).prepend("<div class='tn-posttitle'>"+title+"</div>"); }
+
if (title != "") {
-
$(id).prepend("<div class='tn-postdate'><a href='"+uri+id+"'class='tn-anchor'>"+date+"</a></div>");
+
$(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).prepend(who_box);
$(id).append(tag_box);
$(id).append(tag_box);
}
}

Revision as of 08:38, 9 July 2013

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 = ardate[0] + "
" + ardate[2] + "/" + ardate[1]; }; }

var wholow = []; for (var i = 0; i < who.length; i++) { wholow.push(who[i].toLowerCase()); }

var who_box = $("
"); var tag_box = $("
");

if (wholow.indexOf("bruno") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/c/c2/Bruno.jpg' />"); } if (wholow.indexOf("caterina") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/e/ed/Cate.jpg' />"); } if (wholow.indexOf("emil") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/5/50/Emil.JPG' />"); } if (wholow.indexOf("fabio") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/9/9f/Fabio.jpg' />"); } if (wholow.indexOf("gabriele") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/26/Gire.jpg' />"); } if (wholow.indexOf("michele") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/2e/Pedro.jpg' />"); } if (wholow.indexOf("thomas") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/4/42/Thomas.png' />"); } if (wholow.indexOf("viola") != -1) { $(who_box).append("<img src='http://www.filopoe.it/old/mediawiki/images/2/23/Viola.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("Tags
"); }

$(tag_box).html($(tag_box).html() + "" + tags[i] + ""); }

if (title != "") {

$(id).prepend("
" + title + "
");

}

$(id).prepend("");

$(id).prepend(who_box); $(id).append(tag_box); }