-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall_by_date.js
73 lines (68 loc) · 2.79 KB
/
wall_by_date.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
WALL BY DATE
Bookmarklet to jump to a particular date on a Facebook Wall.
by Ryan Tate http://ryantate.com/facebook
MIT license http://creativecommons.org/licenses/MIT/
*/
function FBMOD_updateMaxTime(){
var date = new Date();
date.setFullYear(
parseInt(document.getElementById('FBMOD_year').value, 10),
parseInt(document.getElementById('FBMOD_month').value, 10),
parseInt(document.getElementById('FBMOD_day').value, 10)
);
ProfileStream.instance.max_time = parseInt(date.getTime()/1000, 10);
return true;
}
(function (){
var il8ns = {
en: {
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
intro: 'from before'
},
fr: {
months: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
intro: 'à partir du'
}
};
function il8n(){
var bodyClass = document.getElementsByTagName('body')[0].getAttribute('class');
if (/\bLocale_fr_/.test(bodyClass)){
return il8ns.fr;
}
else {
return il8ns.en;
}
}
var form = document.getElementById('FBMOD_form');
if (! form){
var element = document.getElementById('profile_pager_container');
var a = element.getElementsByTagName('a')[0];
var a2 = a.cloneNode(true);
a.removeChild(a.childNodes[1]);
a.removeChild(a.childNodes[1]);
a2.removeChild(a2.firstChild);
var span = document.createElement('span');
span.style.float = 'left';
var html = '<span> ' + il8n().intro + '</span>';
html += '<form action="#" style="display: inline-block; vertical-align: text-top; margin-top: -6px; " id="FBMOD_form" onsubmit="' + a.getAttribute('onclick') + '">';
html += '<input id="FBMOD_day" name="FBMOD_day" size="2" value="1" onchange="FBMOD_updateMaxTime()" />';
html += '<select id="FBMOD_month" name="FBMOD_month" onchange="FBMOD_updateMaxTime()">';
for (var i = 0; i < il8n().months.length; i++){
html += '<option value="' + i + '">' + il8n().months[i] + '</option>';
}
html += '</select> ';
html += '<input id="FBMOD_year" name="FBMOD_year" value="2010" size="4" onchange="FBMOD_updateMaxTime()" />';
html += '</form>';
span.innerHTML = html;
element.firstChild.appendChild(span);
form = span.getElementsByTagName('form')[0];
var oldDate = new Date();
oldDate.setTime(ProfileStream.instance.max_time * 1000);
form.FBMOD_year.value = oldDate.getFullYear();
form.FBMOD_month.value = oldDate.getMonth();
form.FBMOD_day.value = oldDate.getDate();
element.firstChild.appendChild(a2);
}
form.scrollIntoView();
})();