var h = require('pull-hyperscript') var u = require('./util') var forms = exports forms.post = function (req, repo, placeholder, rows) { return '
' + '' + '' + '' + (repo ? '' : '') + '
' + '' + '
' + '
' + '' } forms.name = function (req, enabled, id, name, action, inputId, title, header) { if (!inputId) inputId = action if (!enabled) { return h('form', {class: 'petname', action: '', method: 'post'}, [ header, h('br', {clear: 'all'}) ]) } return h('form', {class: 'petname', action: '', method: 'post'}, [ h('input', { type: 'checkbox', class: 'name-checkbox', id: inputId, onfocus: 'this.form.name.focus()' }), h('input', { class: 'name', name: 'name', value: u.escape(name), onkeyup: 'if (event.keyCode == 27) this.form.reset()' }), h('input', {type: 'hidden', name: 'action', value: action}), h('input', {type: 'hidden', name: 'id', value: u.escape(id)}), h('label', {class: 'name-toggle', for: inputId, title: title}, [ h('i', '✍') ]), h('input', {class: 'btn name-btn', type: 'submit', value: req._t('Rename')}), header ]) } var issueCommentScript = '(' + function () { var container = [].slice.call(document.querySelectorAll('.post-form')).pop() || document.body var $ = container.querySelector.bind(container) $('.tab-links').style.display = 'block' $('.tab2-link').onclick = function (e) { with (new XMLHttpRequest()) { open('POST', '', true) onload = function() { $('.preview-text').innerHTML = responseText } var repoInput = $('.repo-id') send('action=markdown' + (repoInput ? '&repo=' + encodeURIComponent(repoInput.value) : '') + '&text=' + encodeURIComponent($('.post-text').value)) } } }.toString() + ')()' var issueCommentButtonScript = '(' + function () { var btn = document.getElementById('comment-close-btn') document.getElementById('post-text').onkeyup = function (e) { btn.setAttribute('value', this.value ? btn.getAttribute('data-value-withcomment') : btn.getAttribute('data-value-nocomment')) } }.toString() + ')()' forms.issueComment = function (req, issue, repo, branch, type) { return '
' + '' + '' + '' + '' + '' + forms.post(req, repo) + '' + '' + '' + '
' } forms.lineComment = function (req, repo, updateId, commitId, filePath, line) { return '
' + '' + '' + '' + '' + '' + '' + forms.post(req, repo) + '' + '
' } forms.lineCommentReply = function (req, root, branch) { return '
' + '' + '' + '' + forms.post(req) + '' + '
' }