view changes

This commit is contained in:
albert
2011-08-22 16:28:31 -04:00
parent 24bf21540a
commit 2b7a8f2d67
10 changed files with 47 additions and 8 deletions

View File

@@ -35,7 +35,7 @@
} else if (command === "[reset]") {
return [];
} else if (command[0] === "-") {
return tags.reject(function(x) {return x == command.substr(1, 100)})
return Danbooru.reject(tags, function(x) {return x === command.substr(1, 100)});
} else {
tags.push(command)
return tags;
@@ -44,13 +44,13 @@
Danbooru.TagScript.run = function(post_id, tag_script) {
var commands = this.parse(tag_script);
var post = Post.posts.get(post_id);
var old_tags = post.tags.join(" ");
var post = $("#p_" + post_id);
var old_tags = post.data("tags");
$.each(commands, function(i, x) {
post.tags = Danbooru.TagScript.process(post.tags, x);
post.data("tags", Danbooru.TagScript.process(post.data("tags"), x));
})
Danbooru.Post.update(post_id, {"post[old_tags]": old_tags, "post[tags]": post.tags.join(" ")});
Danbooru.Post.update(post_id, {"post[old_tags]": old_tags, "post[tags]": post.data("tags")});
}
})();

View File

@@ -1,4 +1,4 @@
$(document).ready(function() {
$(function() {
var img = $("#image-preview img");
if (img) {
var height = img.attr("height");
@@ -7,7 +7,7 @@ $(document).ready(function() {
var ratio = 400.0 / height;
img.attr("height", height * ratio);
img.attr("width", width * ratio);
$("#scale").val("Scaled " + parseInt(100 * ratio) + "%");
$("#scale").html("Scaled " + parseInt(100 * ratio) + "%");
}
}
});

View File

@@ -34,4 +34,14 @@
return all;
}
Danbooru.reject = function(array, f) {
var filtered = [];
$.each(array, function(i, x) {
if (!f(x)) {
filtered.push(x);
}
});
return filtered;
}
})();