-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_reply-loader.js.tid
62 lines (53 loc) · 1.29 KB
/
_reply-loader.js.tid
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
modifier: bengillies
type: text/javascript
tags: excludeLists excludeSearch excludeMissing
_cache-max-age: 43200
/*
* Create a reply button and add it to the page
*
* Requires jQuery
*
*/
(function($) {
function renderBtn() {
$('<style/>').html(['.reply-btn {',
'border: 0;',
'background: transparent;',
'position: absolute;',
'top: 0px;',
'right: 52px;',
'height: 24px;',
'width: 24px;',
'padding: 0',
'}',
'.reply-btn img {',
'width: 100%',
'}'].join('')).prependTo(document.head);
var replyBtn = $('<button/>', {
'class': 'reply-btn',
html: '<img src="/bags/common/tiddlers/reply.png" alt="reply to this tiddler"/>'
}).appendTo(document.body);
return replyBtn;
}
$(function() {
function initializeReply() {
if (window.tiddlyweb.status.username
&& window.tiddlyweb.status.username !== "GUEST") {
var replyBtn = renderBtn();
if (typeof createReplyButton === 'function') {
createReplyButton(replyBtn[0]);
} else {
$.getScript('/bags/common/tiddlers/_reply-button.js',
function() {
createReplyButton(replyBtn[0]);
});
}
}
}
if (!window.tiddlyweb || !window.tiddlyweb.status) {
$.getScript("/status.js", initializeReply)
} else {
initializeReply();
}
});
}(jQuery));