Commit d0d23d8d9e03d38b5f6a89d3ab680cd659544746
Use strings for inline scripts instead of toString
toString seems broken with pkgcel committed on 4/10/2020, 8:12:43 PM
Parent: e095c75a1ef7824b16689d3ef626435a90ca42ca
Files changed
lib/forms.js | changed |
lib/forms.js | ||
---|---|---|
@@ -1,8 +1,35 @@ | ||
1 | 1 … | var h = require('pull-hyperscript') |
2 | 2 … | var u = require('./util') |
3 | 3 … | var forms = exports |
4 | 4 … | |
5 … | +var issueCommentScript = `;(function () { | |
6 … | + var container = [].slice.call(document.querySelectorAll('.post-form')).pop() || document.body | |
7 … | + var $ = container.querySelector.bind(container) | |
8 … | + $('.tab-links').style.display = 'block' | |
9 … | + $('.tab2-link').onclick = function (e) { | |
10 … | + with (new XMLHttpRequest()) { | |
11 … | + open('POST', '', true) | |
12 … | + onload = function() { | |
13 … | + $('.preview-text').innerHTML = responseText | |
14 … | + } | |
15 … | + var repoInput = $('.repo-id') | |
16 … | + send('action=markdown' + | |
17 … | + (repoInput ? '&repo=' + encodeURIComponent(repoInput.value) : '') + | |
18 … | + '&text=' + encodeURIComponent($('.post-text').value)) | |
19 … | + } | |
20 … | + } | |
21 … | +}())` | |
22 … | + | |
23 … | +var issueCommentButtonScript = `;(function () { | |
24 … | + var btn = document.getElementById('comment-close-btn') | |
25 … | + document.getElementById('post-text').onkeyup = function (e) { | |
26 … | + btn.setAttribute('value', this.value | |
27 … | + ? btn.getAttribute('data-value-withcomment') | |
28 … | + : btn.getAttribute('data-value-nocomment')) | |
29 … | + } | |
30 … | +}())` | |
31 … | + | |
5 | 32 … | forms.post = function (req, repo, placeholder, rows) { |
6 | 33 … | return '<div class="post-form">' + |
7 | 34 … | '<input type="radio" class="tab-radio" id="tab1" name="tab" checked="checked"/>' + |
8 | 35 … | '<input type="radio" class="tab-radio" id="tab2" name="tab"/>' + |
@@ -53,35 +80,8 @@ | ||
53 | 80 … | header |
54 | 81 … | ]) |
55 | 82 … | } |
56 | 83 … | |
57 | -var issueCommentScript = '(' + function () { | |
58 | - var container = [].slice.call(document.querySelectorAll('.post-form')).pop() || document.body | |
59 | - var $ = container.querySelector.bind(container) | |
60 | - $('.tab-links').style.display = 'block' | |
61 | - $('.tab2-link').onclick = function (e) { | |
62 | - with (new XMLHttpRequest()) { | |
63 | - open('POST', '', true) | |
64 | - onload = function() { | |
65 | - $('.preview-text').innerHTML = responseText | |
66 | - } | |
67 | - var repoInput = $('.repo-id') | |
68 | - send('action=markdown' + | |
69 | - (repoInput ? '&repo=' + encodeURIComponent(repoInput.value) : '') + | |
70 | - '&text=' + encodeURIComponent($('.post-text').value)) | |
71 | - } | |
72 | - } | |
73 | -}.toString() + ')()' | |
74 | - | |
75 | -var issueCommentButtonScript = '(' + function () { | |
76 | - var btn = document.getElementById('comment-close-btn') | |
77 | - document.getElementById('post-text').onkeyup = function (e) { | |
78 | - btn.setAttribute('value', this.value | |
79 | - ? btn.getAttribute('data-value-withcomment') | |
80 | - : btn.getAttribute('data-value-nocomment')) | |
81 | - } | |
82 | -}.toString() + ')()' | |
83 | - | |
84 | 84 … | forms.issueComment = function (req, issue, repo, branch, type) { |
85 | 85 … | return '<section><form action="" method="post">' + |
86 | 86 … | '<input type="hidden" name="action" value="comment">' + |
87 | 87 … | '<input type="hidden" name="id" value="' + issue.id + '">' + |
Built with git-ssb-web