major refactoring of javascripts
This commit is contained in:
@@ -681,6 +681,15 @@ $(document).ready(function() {
|
||||
$(".comment-section[data-post-id=" + post_id + "] form").show();
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
// Ajax links
|
||||
$("a[data-remote=true]").click(function(e) {
|
||||
Danbooru.ajax_start(e.target);
|
||||
})
|
||||
|
||||
$("a[data-remote=true]").ajaxComplete(function(e) {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
})
|
||||
|
||||
// Image resize sidebar
|
||||
$("#resize-links").hide();
|
||||
@@ -779,12 +788,12 @@ $(document).ready(function() {
|
||||
this.j_alert("Error", msg);
|
||||
}
|
||||
|
||||
Danbooru.ajax_start = function(element) {
|
||||
$(element).after(' <span class="wait">...</span>');
|
||||
Danbooru.ajax_start = function(target) {
|
||||
$(target).after(' <img src="/images/wait.gif" width="15" height="5" class="wait">');
|
||||
}
|
||||
|
||||
Danbooru.ajax_stop = function(element) {
|
||||
$(element).next("span.wait").remove();
|
||||
Danbooru.ajax_stop = function(target) {
|
||||
$(target).next("img.wait").remove();
|
||||
}
|
||||
})();
|
||||
// PostModeMenu = {
|
||||
@@ -1079,8 +1088,6 @@ $(document).ready(function() {
|
||||
Danbooru.Favorite = {};
|
||||
|
||||
Danbooru.Favorite.initialize_all = function() {
|
||||
this.initialize_add_to_favorites();
|
||||
this.initialize_remove_from_favorites();
|
||||
this.hide_or_show_add_to_favorites_link();
|
||||
}
|
||||
|
||||
@@ -1099,51 +1106,6 @@ $(document).ready(function() {
|
||||
$("a#remove-from-favorites").hide();
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.Favorite.initialize_add_to_favorites = function() {
|
||||
$("a#add-to-favorites").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/favorites",
|
||||
data: {
|
||||
id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
success: function() {
|
||||
$("a#add-to-favorites").hide();
|
||||
$("a#remove-from-favorites").show();
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Favorite.initialize_remove_from_favorites = function() {
|
||||
$("a#remove-from-favorites").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/favorites/" + Danbooru.meta("post-id"),
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
success: function() {
|
||||
$("a#add-to-favorites").show();
|
||||
$("a#remove-from-favorites").hide();
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
@@ -1193,12 +1155,8 @@ $(document).ready(function() {
|
||||
Danbooru.PostModeration = {};
|
||||
|
||||
Danbooru.PostModeration.initialize_all = function() {
|
||||
this.initialize_approve_link();
|
||||
this.initialize_disapprove_link();
|
||||
this.hide_or_show_approve_and_disapprove_links();
|
||||
this.hide_or_show_delete_and_undelete_links();
|
||||
this.initialize_delete_link();
|
||||
this.initialize_undelete_link();
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.hide_or_show_approve_and_disapprove_links = function() {
|
||||
@@ -1215,82 +1173,6 @@ $(document).ready(function() {
|
||||
$("a#undelete").hide();
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_delete_link = function() {
|
||||
$("a#delete").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/post_moderation/delete.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_undelete_link = function() {
|
||||
$("a#undelete").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/post_moderation/undelete.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_disapprove_link = function() {
|
||||
$("a#disapprove").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "put",
|
||||
url: "/post_moderation/disapprove.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_approve_link = function() {
|
||||
$("a#approve").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "put",
|
||||
url: "/post_moderation/approve.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -15,6 +15,15 @@ $(document).ready(function() {
|
||||
$(".comment-section[data-post-id=" + post_id + "] form").show();
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
// Ajax links
|
||||
$("a[data-remote=true]").click(function(e) {
|
||||
Danbooru.ajax_start(e.target);
|
||||
})
|
||||
|
||||
$("a[data-remote=true]").ajaxComplete(function(e) {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
})
|
||||
|
||||
// Image resize sidebar
|
||||
$("#resize-links").hide();
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
Danbooru.Favorite = {};
|
||||
|
||||
Danbooru.Favorite.initialize_all = function() {
|
||||
this.initialize_add_to_favorites();
|
||||
this.initialize_remove_from_favorites();
|
||||
this.hide_or_show_add_to_favorites_link();
|
||||
}
|
||||
|
||||
@@ -22,51 +20,6 @@
|
||||
$("a#remove-from-favorites").hide();
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.Favorite.initialize_add_to_favorites = function() {
|
||||
$("a#add-to-favorites").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/favorites",
|
||||
data: {
|
||||
id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
success: function() {
|
||||
$("a#add-to-favorites").hide();
|
||||
$("a#remove-from-favorites").show();
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Favorite.initialize_remove_from_favorites = function() {
|
||||
$("a#remove-from-favorites").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/favorites/" + Danbooru.meta("post-id"),
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
success: function() {
|
||||
$("a#add-to-favorites").show();
|
||||
$("a#remove-from-favorites").hide();
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
Danbooru.PostModeration = {};
|
||||
|
||||
Danbooru.PostModeration.initialize_all = function() {
|
||||
this.initialize_approve_link();
|
||||
this.initialize_disapprove_link();
|
||||
this.hide_or_show_approve_and_disapprove_links();
|
||||
this.hide_or_show_delete_and_undelete_links();
|
||||
this.initialize_delete_link();
|
||||
this.initialize_undelete_link();
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.hide_or_show_approve_and_disapprove_links = function() {
|
||||
@@ -24,82 +20,6 @@
|
||||
$("a#undelete").hide();
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_delete_link = function() {
|
||||
$("a#delete").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/post_moderation/delete.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_undelete_link = function() {
|
||||
$("a#undelete").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/post_moderation/undelete.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_disapprove_link = function() {
|
||||
$("a#disapprove").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "put",
|
||||
url: "/post_moderation/disapprove.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.PostModeration.initialize_approve_link = function() {
|
||||
$("a#approve").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "put",
|
||||
url: "/post_moderation/approve.js",
|
||||
data: {
|
||||
post_id: Danbooru.meta("post-id")
|
||||
},
|
||||
beforeSend: function() {
|
||||
Danbooru.ajax_start(e.target);
|
||||
},
|
||||
complete: function() {
|
||||
Danbooru.ajax_stop(e.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
this.j_alert("Error", msg);
|
||||
}
|
||||
|
||||
Danbooru.ajax_start = function(element) {
|
||||
$(element).after(' <span class="wait">...</span>');
|
||||
Danbooru.ajax_start = function(target) {
|
||||
$(target).after(' <img src="/images/wait.gif" width="15" height="5" class="wait">');
|
||||
}
|
||||
|
||||
Danbooru.ajax_stop = function(element) {
|
||||
$(element).next("span.wait").remove();
|
||||
Danbooru.ajax_stop = function(target) {
|
||||
$(target).next("img.wait").remove();
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -416,3 +416,26 @@ div.users div.new {
|
||||
/*** Uploads ***/
|
||||
div.uploads div.new div#upload-guide-notice {
|
||||
margin-bottom: 2em; }
|
||||
|
||||
/*** notify ***/
|
||||
.notify-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1000; }
|
||||
.notify-container .notify-notification {
|
||||
position: relative; }
|
||||
.notify-container .notify-notification .notify-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #333;
|
||||
z-index: 1; }
|
||||
.notify-container .notify-notification .notify-message {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
color: #FFF; }
|
||||
|
||||
@@ -698,3 +698,35 @@ div.uploads {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** notify ***/
|
||||
.notify-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
|
||||
.notify-notification {
|
||||
position: relative;
|
||||
|
||||
.notify-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #333;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.notify-message {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
color: #FFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user