Team:EPF-Lausanne/Template/script.js

From 2012.igem.org

(Difference between revisions)
Line 18: Line 18:
},
},
setupProtocols: function(){
setupProtocols: function(){
-
$(".protocol-title").filter(function(){ return $.trim($(this).parent().parent().attr("class")) != "protocol-remove-style"; }).each(function(){console.log($.trim($(this).parent().parent().attr("class")), "protocol-remove-style", $(this).parent().parent());}).each(function(){
+
var hide = false;
-
var link = $("<a>")
+
$(".protocol-title").each(function(){
-
.attr("href", "#")
+
if($.trim($(this).parent().parent().attr("class")) != "protocol-remove-style"){
-
.click(
+
hide = true;
-
function(){
+
var link = $("<a>")
-
$(this).parent().parent().children().last().toggle()
+
.attr("href", "#")
-
return false;
+
.click(
-
});
+
function(){
-
+
$(this).parent().parent().children().last().toggle()
-
var children = $(this).children().children();
+
return false;
-
$(this).empty();
+
});
-
link.append(children);
+
-
$(this).append(link);
+
var children = $(this).children().children();
 +
$(this).empty();
 +
link.append(children);
 +
$(this).append(link);
 +
}
});
});
-
$(".protocol-inner-box").hide();
+
if(hide)
 +
$(".protocol-inner-box").hide();
},
},
setupCalendar: function(){
setupCalendar: function(){

Revision as of 23:08, 4 June 2012

//Generate private namespace var EPFL = (function(){ var amp = unescape("%26"); return { registerNewPageButton: function(titleID, buttonID, base, preload){ $(buttonID).click(function(){ window.location.href = "/wiki/index.php?title="+base+"/"+$(titleID).val()+amp+"action=edit"+amp+"preload="+preload; }); }, setup: function(){ EPFL.setupProtocols(); EPFL.setupCalendar(); $('p') .filter(function(){ return $.trim($(this).text()) === && $.trim($(this).html()).length < 10; }) .remove(); }, setupProtocols: function(){ var hide = false; $(".protocol-title").each(function(){ if($.trim($(this).parent().parent().attr("class")) != "protocol-remove-style"){ hide = true; var link = $("<a>") .attr("href", "#") .click( function(){ $(this).parent().parent().children().last().toggle() return false; });

var children = $(this).children().children(); $(this).empty(); link.append(children); $(this).append(link); } }); if(hide) $(".protocol-inner-box").hide(); }, setupCalendar: function(){ var toAdd = amp+"preload=Team:EPF-Lausanne/Notebook/Template/NewEntry"; $(".month tr td a") .filter( function(){ return $(this).attr("href").length > 80; }) .each( function(){ $(this).attr("href", $(this).attr("href")+toAdd); } ); } }; }());

window.onload = function(){ EPFL.setup(); };