This repository has been archived by the owner on Dec 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfriends_calendar.user.js
55 lines (49 loc) · 1.85 KB
/
friends_calendar.user.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
// ==UserScript==
// @name Friends calendar
// @version 1.0.3
// @namespace http://gm.lynn.ru/
// @description Календарь для страницы «Что нового»
// @copyright 2009, Alexey Ten (Lynn) (http://lynn.ru)
// @include http://my.ya.ru/
// @include http://my.ya.ru/?*
// @include http://*.ya.ru/friends.xml
// @include http://*.ya.ru/friends.xml?*
// ==/UserScript==
;(function() {
var the_script = function() {
try {
if (g_globals.current_location.page !== 'friends') return
} catch(e) {
return
}
var tb = y5.Url().getParam('tb')
if (tb) {
tb = new Date(parseInt(tb.replace(/...$/,''))-1)
} else {
tb = new Date()
}
tb = tb.getFullYear() + '-' + (tb.getMonth()+1) + '-' + tb.getDate()
var comp = document.createElement('span')
comp.onclick = function() { return { limitDates: { min: null, max: new Date() } } }
jQuery(comp).addClass('y5-c-Components-Calendar-TextInput b-pseudo-link')
.css({position: 'absolute', margin: '0.5em'})
.html('<input class="y5-Calendar-result-date" type="hidden" value="' + tb + '" />' +
'<span class="y5-Calendar-button">календарь</span>')
.prependTo('td.b-page-body .h-posts-decor')
y5.Components.init(comp)
y5.Events.observe('y5:Calendar:selectDate',
function(d){
var a = new Date(d.getFullYear(), d.getMonth(), d.getDate()+1)
y5.Url().replaceParams({tb: (a.getTime()-1) + '999'}).go()
},
comp, true)
}
if (window.opera) {
the_script()
} else {
var script = document.createElement('script')
script.type = 'application/javascript'
script.appendChild(document.createTextNode('(' + the_script.toString() + ')()'))
document.getElementsByTagName('head')[0].appendChild(script)
}
})();