Team:EPF-Lausanne/Template/script.js

From 2012.igem.org

(Difference between revisions)
Line 4: Line 4:
setup: function(){
setup: function(){
EPFL.setupProtocols();
EPFL.setupProtocols();
 +
EPFL.setupCalendar();
},
},
setupProtocols: function(){
setupProtocols: function(){
$(".protocol-title").each(function(){
$(".protocol-title").each(function(){
-
var link = $("<a>").attr("href", "#").click(function(){
+
var link = $("<a>")
-
$(this).parent().parent().children().last().toggle()
+
.attr("href", "#")
-
return false;
+
.click(
-
});
+
function(){
 +
$(this).parent().parent().children().last().toggle()
 +
return false;
 +
});
 +
var children = $(this).children();
var children = $(this).children();
$(this).empty();
$(this).empty();
Line 17: Line 22:
});
});
$(".protocol-inner-box").hide();
$(".protocol-inner-box").hide();
 +
},
 +
setupCalendar: function(){
 +
var toAdd = unescape("%26")+"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);
 +
}
 +
);
 +
}
}
}
};
};
}());
}());
-
runOnloadHook = function(){
+
window.onload = function(){
EPFL.setup();
EPFL.setup();
};
};

Revision as of 21:30, 4 June 2012

//Generate private namespace var EPFL = (function(){ return { setup: function(){ EPFL.setupProtocols(); EPFL.setupCalendar(); }, setupProtocols: function(){ $(".protocol-title").each(function(){ var link = $("<a>") .attr("href", "#") .click( function(){ $(this).parent().parent().children().last().toggle() return false; });

var children = $(this).children(); $(this).empty(); link.append(children); $(this).append(link); }); $(".protocol-inner-box").hide(); }, setupCalendar: function(){ var toAdd = unescape("%26")+"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(); };