diff options
| author | pep <yes@peepee.me> | 2020-07-28 21:29:32 +0000 |
|---|---|---|
| committer | pep <yes@peepee.me> | 2020-07-28 21:29:32 +0000 |
| commit | a7aea69687eb268807aa4a86d9188004fe5cb6c7 (patch) | |
| tree | d91ffe93b934f5e61cb6aa02e92030e00a5d13f2 /public/assets | |
| parent | d051c6d71f2d2e24ca113f127ff7e0b143d0042a (diff) | |
fixed minor thing
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/js/lib/views/details/commentform.js | 1 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/files.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/settings.js | 48 | ||||
| -rw-r--r-- | public/assets/js/util/format.js | 4 |
4 files changed, 28 insertions, 27 deletions
diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index 51295cb..f3d79ac 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -54,6 +54,7 @@ var CommentForm = FormView.extend({ // window.location.reload() console.log(this) console.log(this.parent) + console.log("this is data") console.log(data) data.comment && this.parent.comments.load([data.comment]) data.files && this.parent.files.load(data.files) diff --git a/public/assets/js/lib/views/details/files.js b/public/assets/js/lib/views/details/files.js index 98b9350..915f90b 100644 --- a/public/assets/js/lib/views/details/files.js +++ b/public/assets/js/lib/views/details/files.js @@ -21,7 +21,7 @@ var FilesView = FormView.extend({ } var total = 0, has_music = false - this.files = files || this.files + this.files = this.files.concat(files) this.thread = thread || this.thread this.files.forEach(function(file){ if (is_image(file.filename)) { diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js index a027b12..b270f02 100644 --- a/public/assets/js/lib/views/details/settings.js +++ b/public/assets/js/lib/views/details/settings.js @@ -316,32 +316,32 @@ var ThreadSettingsForm = FormView.extend({ file_names.join("\n") var should_remove = confirm(msg) if (should_remove) { - } - var promises = inputs_checked.map(node => { - return new Promise((resolve, reject) => { - $.ajax({ - method: "DELETE", - url: "/api/file/" + node.value, - headers: { "csrf-token": $("[name=_csrf]").attr("value") }, - data: JSON.stringify({ csrf: csrf() }), - dataType: "json", - success: function(data){ - console.log(data) - $(node).closest('.file').remove() - }, - error: function(){ - console.log('error deleting file', node.value) - reject() - } + var promises = inputs_checked.map(node => { + return new Promise((resolve, reject) => { + $.ajax({ + method: "DELETE", + url: "/api/file/" + node.value, + headers: { "csrf-token": $("[name=_csrf]").attr("value") }, + data: JSON.stringify({ csrf: csrf() }), + dataType: "json", + success: function(data){ + console.log(data) + $(node).closest('.file').remove() + }, + error: function(){ + console.log('error deleting file', node.value) + reject() + } + }) }) }) - }) - Promise.all(promises).then( () => { - window.location.href = '/details/' + thread_id - }).catch(() =>{ - console.error('whaaaaa') - alert('there was a problem deleting the files...') - }) + Promise.all(promises).then( () => { + window.location.href = '/details/' + thread_id + }).catch(() =>{ + console.error('whaaaaa') + alert('there was a problem deleting the files...') + }) + } }, deleteThread: function(e){ diff --git a/public/assets/js/util/format.js b/public/assets/js/util/format.js index 441430e..28c659b 100644 --- a/public/assets/js/util/format.js +++ b/public/assets/js/util/format.js @@ -213,7 +213,7 @@ function get_age (t, long) { } function tidy_urls (s, short_urls) { - var ret = s.split("\n").map(function(line){ + var ret = s.split(/(<[bh]r\/?>|\n)/).map(function(line){ if (line.indexOf("<") !== -1) { return line @@ -230,7 +230,7 @@ function tidy_urls (s, short_urls) { } }); }) - .join("\n") + .join("") .replace(/\r/g, "") .replace(/<code>\n/g, "<code>") .replace(/<\/code>\n/g, "</code>") |
