forum previews working
This commit is contained in:
@@ -3,7 +3,7 @@ $(document).ready(function() {
|
||||
// $("#upgrade-account").hide();
|
||||
// Cookie.put('hide-upgrade-account', '1', 7);
|
||||
// });
|
||||
|
||||
|
||||
// Table striping
|
||||
$("table.striped tbody tr:even").addClass("even");
|
||||
$("table.striped tbody tr:odd").addClass("odd");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Danbooru.Comment = {};
|
||||
|
||||
Danbooru.Comment.initialize_all = function() {
|
||||
$("#c-comments div.dtext-preview").hide();
|
||||
$("div.dtext-preview").hide();
|
||||
this.initialize_response_link();
|
||||
this.initialize_preview_button();
|
||||
}
|
||||
|
||||
35
public/javascripts/src/app/forum_posts.js
Normal file
35
public/javascripts/src/app/forum_posts.js
Normal file
@@ -0,0 +1,35 @@
|
||||
(function() {
|
||||
Danbooru.ForumPost = {};
|
||||
|
||||
Danbooru.ForumPost.initialize_all = function() {
|
||||
$("#c-forum-topics #preview").hide();
|
||||
|
||||
this.initialize_preview_link();
|
||||
}
|
||||
|
||||
Danbooru.ForumPost.initialize_preview_link = function() {
|
||||
$("#c-forum-topics #preview a[name=toggle-preview]").click(function() {
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
$("#c-forum-topics input[value=Preview]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/dtext/preview",
|
||||
data: {
|
||||
body: $("#forum_post_body").val()
|
||||
},
|
||||
success: function(data) {
|
||||
$("#dtext-help").hide();
|
||||
$("#preview").show();
|
||||
$("#preview .content").html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
Danbooru.ForumPost.initialize_all();
|
||||
});
|
||||
Reference in New Issue
Block a user