Team:EPF-Lausanne/Template/script.js
From 2012.igem.org
Line 1: | Line 1: | ||
//Generate private namespace | //Generate private namespace | ||
var EPFL = (function(){ | var EPFL = (function(){ | ||
+ | var amp = unescape("%26"); | ||
return { | 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(){ | setup: function(){ | ||
EPFL.setupProtocols(); | EPFL.setupProtocols(); | ||
Line 29: | Line 35: | ||
}, | }, | ||
setupCalendar: function(){ | setupCalendar: function(){ | ||
- | var toAdd = | + | var toAdd = amp+"preload=Team:EPF-Lausanne/Notebook/Template/NewEntry"; |
$(".month tr td a") | $(".month tr td a") | ||
.filter( | .filter( |
Revision as of 22:38, 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(){ $(".protocol-title").each(function(){ 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); }); $(".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(); };