-
-
Save KOBA789/1447435 to your computer and use it in GitHub Desktop.
showbox.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("span#search_box").click( | |
function(){ | |
if ($("span#search").css("display") == "none"){ | |
$("span#search").slideDown("nomal"); | |
} | |
else { | |
$("span#search").slideUp("nomal"); | |
} | |
}); | |
function smaplefunc(selector, tag_html){ | |
selector.parent().remove(); | |
} | |
$("span.input").click(function(){ | |
var query = $("<input>").attr("type","text").attr("class","input-tag") | |
var s_val = $("<input>").attr("type","hidden").attr("value",$(this).parent().parent().parent().next().next().attr("status_id")); | |
var put = $("<input>").attr("type","submit").attr("class","add-tag").attr("value","タグを追加"); | |
var caution = $("<span>").attr("class","caution").text("タグは半角スペースで区切ってください。大文字は小文字になります"); | |
$(this).parent().prepend(query).append(s_val).append(put).append(caution); | |
$(this).remove(); | |
$("input.add-tag").click(function(){ | |
var that = this; | |
var query = $(this).prev().prev().val(); | |
var status_id = $(this).parent().parent().parent().next().next().attr("status_id"); | |
$.ajax({ | |
type:"GET", | |
url :"/api/tag", | |
data:"query="+query+"&status="+status_id, | |
success:function(tag_html){ | |
$(that).prev().prev().remove(); | |
$(that).prev().remove(); | |
$(that).next().remove(); | |
$(that).append(tag_html); | |
} | |
}); | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment