diff options
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/css/bucky.css | 23 | ||||
| -rw-r--r-- | public/assets/img/castro-the-mestizo.jpg | bin | 0 -> 32338 bytes | |||
| -rw-r--r-- | public/assets/js/lib/router.js | 7 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 7 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/settings.js | 43 | ||||
| -rw-r--r-- | public/assets/js/util/color.js | 3 |
6 files changed, 73 insertions, 10 deletions
diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css index 2e00022..5d4a1a6 100644 --- a/public/assets/css/bucky.css +++ b/public/assets/css/bucky.css @@ -13,6 +13,10 @@ body { body.loading { opacity: 0; } +body.black { + background: #211; + color: #eee; +} * { box-sizing: border-box; } @@ -35,6 +39,7 @@ button, input[type=submit] { margin: 3px; background-color: #c8d0dc; text-transform: uppercase; + cursor: pointer; } .desktop button:hover, .desktop input[type=submit] { @@ -370,6 +375,7 @@ tr:nth-child(even) td.black { background-color: #eee; border-bottom-color: position: relative; vertical-align: top; padding-right: 110px; + color: #111111; } .comment .body { font-size: 12px; @@ -627,7 +633,7 @@ pre br { } #search .desc { display: block; - max-width: 500px; + width: 500px; padding-left: 10px; } #search .meta { @@ -677,9 +683,15 @@ pre br { background: transparent; outline: 0; width: 270px; + transition: background 200ms; + background: white; +} +.search_form input[type='text']:invalid { + background: transparent; } .search_form input[type='text']:focus { border-bottom: 1px solid #211; + border-radius: 2px 2px 0 0; color: #211; } @@ -760,6 +772,15 @@ header .search_form { display: inline-block; } +/* 404 */ +#error_404 { + display: none; + margin: 10px 0; +} +#error_404 a { + font-size: 16px; +} + @media (max-width: 700px) { body { padding: 10px 10px; diff --git a/public/assets/img/castro-the-mestizo.jpg b/public/assets/img/castro-the-mestizo.jpg Binary files differnew file mode 100644 index 0000000..dde4b21 --- /dev/null +++ b/public/assets/img/castro-the-mestizo.jpg diff --git a/public/assets/js/lib/router.js b/public/assets/js/lib/router.js index f9850e8..a83437a 100644 --- a/public/assets/js/lib/router.js +++ b/public/assets/js/lib/router.js @@ -82,4 +82,11 @@ var SiteRouter = Router.extend({ app.view.load() }, + error404: function(){ + $("content").hide() + $("#error_404").show() + $("h1").html("error: page not found") + $("body").removeClass("loading") + }, + })
\ No newline at end of file diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js index 5550173..f8e9d50 100644 --- a/public/assets/js/lib/views/details/index.js +++ b/public/assets/js/lib/views/details/index.js @@ -18,7 +18,12 @@ var DetailsView = View.extend({ load: function(id){ id = id.replace(/\D/g, "") - $.get(this.action + id, this.populate.bind(this)) + $.ajax({ + method: "get", + url: this.action + id, + success: this.populate.bind(this), + error: app.router.error404, + }) }, populate: function(data){ diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js index 6e6b0b2..eacbec4 100644 --- a/public/assets/js/lib/views/details/settings.js +++ b/public/assets/js/lib/views/details/settings.js @@ -5,7 +5,9 @@ var ThreadSettingsForm = FormView.extend({ events: { "click": "hide", "click .inner": "stopPropagation", - "click .close_link": "hide" + "click .thread_delete": "deleteThread", + "click .close_link": "hide", + "change [name=color]": "changeColor", }, action: "", @@ -28,7 +30,7 @@ var ThreadSettingsForm = FormView.extend({ var files = data.files var settings = thread.settings var display = thread.display - + this.$(".close_link").attr("href", "/details/" + thread.id) this.$(".metadata").html(metadata(thread)) this.$("[name=title]").val(sanitize(thread.title)) @@ -55,17 +57,19 @@ var ThreadSettingsForm = FormView.extend({ }) $keyword.val(thread.keyword) }.bind(this)) - console.log(thread) }, validate: function(){ var errors = [] - var comment = $("[name=comment]").val() - if (! comment || ! comment.length) { - errors.push("Please enter a comment.") + var title = $("[name=title]").val() + if (! title || ! title.length) { + errors.push("Please enter a title.") } return errors.length ? errors : null }, + + serialize: function(){ + }, success: function(data){ window.location.href = "/details/" + data.comment.thread @@ -91,5 +95,32 @@ var ThreadSettingsForm = FormView.extend({ if (this.visible) this.hide() else this.show() }, + + changeColor: function(){ + var color_name = this.$("[name=color]").val() + set_background_color(color_name) + }, + + deleteThread: function(e){ + var data = this.options.parent.data + var id = data.thread.id + var comment_count = (data.comments || []).length + var file_count = (data.files || []).length + var msg = "Are you sure you want to delete this thread?\n\n#" + id + ' "' + sanitize(data.thread.title) + '"' + msg += " + " + comment_count + " comment" + courtesy_s(comment_count) + if ( file_count) msg += " + " + file_count + " file" + courtesy_s(file_count) + var should_remove = confirm(msg) + if (should_remove) { + $.ajax({ + method: "DELETE", + url: "/api/thread/" + id, + headers: { "csrf-token": $("[name=_csrf]").attr("value") }, + data: { csrf: csrf() }, + success: function(){ + window.location.href = "/" + }, + }) + } + }, })
\ No newline at end of file diff --git a/public/assets/js/util/color.js b/public/assets/js/util/color.js index bcdfe77..6d33a72 100644 --- a/public/assets/js/util/color.js +++ b/public/assets/js/util/color.js @@ -110,12 +110,11 @@ function set_background_color_from_time(){ set_background_color(color_name) } function set_background_color(color_name){ - console.log(color_name) color_name = color_name || "plain" var color = COLORS[color_name] .clone() .mottleRGB(4,4,8) // .add(nighttime_quotient()) -console.log(color.toString()) document.body.style.backgroundColor = color.toString() + $(document.body).toggleClass("black", color_name === "black") } |
