forked from nashby/jose-vs-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjose.js
87 lines (83 loc) · 4.31 KB
/
jose.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Generated by CoffeeScript 1.4.0
(function() {
var button, commentForm, insertButtons, mutationObserver, observer, selectElements,
_this = this;
commentForm = document.querySelector('.js-new-comment-form');
selectElements = function() {
_this.actions = commentForm.querySelector('.form-actions');
_this.bubblesContent = document.querySelectorAll('.discussion-bubble.js-comment-container');
_this.bubble = _this.bubblesContent[_this.bubblesContent.length - 1];
_this.close = _this.actions.querySelector('.js-comment-and-button');
_this.comment = _this.actions.querySelector('.primary');
return _this.textarea = commentForm.querySelector('textarea');
};
if (commentForm) {
selectElements();
mutationObserver = typeof WebKitMutationObserver !== "undefined" && WebKitMutationObserver !== null ? WebKitMutationObserver : MutationObserver;
observer = new mutationObserver(function(mutations) {
return mutations.forEach(function(mutation) {
return selectElements();
});
});
observer.observe(this.actions, {
childList: true
});
button = function(text, innerHtml, closable) {
var btn;
if (closable == null) {
closable = true;
}
btn = document.createElement('button');
btn.innerHTML = text;
btn.className = 'button';
btn.setAttribute('tabindex', '1');
btn.setAttribute('type', 'submit');
btn.setAttribute('title', innerHtml);
btn.addEventListener('click', function(event) {
event.preventDefault();
_this.textarea.value += " " + innerHtml;
if (closable) {
_this.close.click();
} else {
_this.comment.click();
}
return _this.textarea.value = '';
});
return btn;
};
insertButtons = function() {
var btn, closeButtonGroup, closeButtonGroupTitle, openButtonGroup, openButtonGroupTitle;
closeButtonGroupTitle = document.createElement('span');
closeButtonGroupTitle.setAttribute('style', 'float: left; margin: 0px 0px 0px 61px;');
closeButtonGroupTitle.textContent = 'Close this issue';
closeButtonGroup = document.createElement('div');
closeButtonGroup.className = 'button-group';
closeButtonGroup.setAttribute('style', 'float: left; margin: -40px 0px 0px 60px;');
openButtonGroupTitle = document.createElement('span');
openButtonGroupTitle.setAttribute('style', 'float: left; margin: 0px 0px 0px 156px;');
openButtonGroupTitle.textContent = 'Keep it open';
openButtonGroup = document.createElement('div');
openButtonGroup.className = 'button-group';
openButtonGroup.setAttribute('style', 'float: left; margin: -40px 0px 0px 155px;');
btn = button('Sample app', 'Can you please provide a sample application that reproduces the error?', false);
openButtonGroup.appendChild(btn);
btn = button("Wiki", "The wiki is maintained by the community. So if there aren't any up to date instructions, we recommend you to explore the solution yourself and hopefully contribute your findings back!");
closeButtonGroup.appendChild(btn);
btn = button("ML", "Please use the mailing list or StackOverflow for questions/help, where a wider community will be able to help you. We reserve the issues tracker for issues only.");
closeButtonGroup.appendChild(btn);
btn = button("Bad bug report", "You need to give us more information on how to reproduce this issue, otherwise there is nothing we can do. Please read CONTRIBUTING.md file for more information about creating bug reports. Thanks!");
closeButtonGroup.appendChild(btn);
btn = button("<img src='https://a248.e.akamai.net/assets.github.com/images/icons/emoji/shipit.png' width='14' height='14'>", ":shipit:", false);
openButtonGroup.appendChild(btn);
btn = button("<img src='https://a248.e.akamai.net/assets.github.com/images/icons/emoji/heart.png' width='14' height='14'>", ":heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart:", false);
openButtonGroup.appendChild(btn);
_this.bubble.appendChild(closeButtonGroup);
_this.bubble.appendChild(closeButtonGroupTitle);
_this.bubble.appendChild(openButtonGroup);
return _this.bubble.appendChild(openButtonGroupTitle);
};
if (commentForm && this.close) {
insertButtons();
}
}
}).call(this);