Skip to content

Instantly share code, notes, and snippets.

@Dewep
Last active August 25, 2015 22:31
Show Gist options
  • Save Dewep/0427dca45983ec365ba2 to your computer and use it in GitHub Desktop.
Save Dewep/0427dca45983ec365ba2 to your computer and use it in GitHub Desktop.
Epitech defense to Doodle

EpitechDoodle

Presentation

Convert a list of Epitech defenses (like this one) to a Doodle.

Installation

Add a bookmark with this url:

javascript:var%20s=document.getElementById('EpitechDoodle');if(s){s.parentNode.removeChild(s);}%20s=document.createElement('script');s.setAttribute('src','https://cdn.rawgit.com/Dewep/0427dca45983ec365ba2/raw/5fdaac493ed23bf559fa9e3f312b5d7a03840e05/epitechDefense-to-Doodle.js');%20s.setAttribute('type','text/javascript');s.setAttribute('id','EpitechDoodle');document.body.appendChild(s);void(0);

You can also custom the email and name of the Doodle directly on the link with that (edit the values email and name):

javascript:EpitechDoodle={'email':'custom-eip@yopmail.fr','name':'Custom%20EIP'};var%20s=document.getElementById('EpitechDoodle');if(s){s.parentNode.removeChild(s);}%20s=document.createElement('script');s.setAttribute('src','https://cdn.rawgit.com/Dewep/0427dca45983ec365ba2/raw/5fdaac493ed23bf559fa9e3f312b5d7a03840e05/epitechDefense-to-Doodle.js');%20s.setAttribute('type','text/javascript');s.setAttribute('id','EpitechDoodle');document.body.appendChild(s);void(0);
(function(){
EpitechDoodle = EpitechDoodle || {};
$.ajax({
"url": window.location.origin + window.location.pathname + "?format=json",
dataType: "json"
}).success(function(data){
var fields = {
"type": "date",
"levels": 3,
"title": data.title,
"description": data.description,
"eMailAddress": EpitechDoodle.email || "comeon@yopmail.fr",
"name": EpitechDoodle.name || "ComeOn",
"hidden": "false",
"columnConstraint": "",
"rowConstraint": "",
"askEmail": "",
"askPhone": "",
"askAddress": "",
"byInvitation": "false",
"invitees": "",
"createdOnCalendarView": "true",
"multiDay": "false",
"timeZone": "Europe/Paris"
};
for (var i = 0; i < data.events.length; i++){
var date = data.events[i].begin.substr(0,4)+data.events[i].begin.substr(5,2)+data.events[i].begin.substr(8,2);
var time = data.events[i].begin.substr(11,2)+data.events[i].begin.substr(14,2)+"-"+data.events[i].end.substr(11,2)+data.events[i].end.substr(14,2);
if (fields[date] === undefined){
fields[date] = time;
}else{
fields[date] += "||" + time;
}
}
var form = $('<form method="POST" action="http://doodle.com/create">');
$.each(fields, function(k,v){
form.append('<input type="hidden" name="' + k + '" value="' + v + '">');
});
form.appendTo("body").submit();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment