Last active
August 29, 2015 14:21
-
-
Save orisano/469145de0b6f9948a4c2 to your computer and use it in GitHub Desktop.
問題ページでソースコードをデベロッパーコンソールに貼り付けると、雑なフォームが出来上がります
This file contains hidden or 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(global){ | |
| var $comment_form, $chat_form, $user_id, $token, $comment, $text, $comment_submit, $chat_submit, $section; | |
| var doc = global["document"]; | |
| function create_input(type, name, value){ | |
| var $dom = doc.createElement("input"); | |
| $dom.type = type; | |
| $dom.name = name; | |
| $dom.value = value; | |
| return $dom; | |
| } | |
| function create_form(method, action){ | |
| var $dom = doc.createElement("form"); | |
| $dom.className = "pure-form pure-form-aligned"; | |
| $dom.method = method; | |
| $dom.action = action; | |
| return $dom; | |
| } | |
| var user_id = doc.querySelector(".content>p:nth-child(1)").innerText.split(":")[1].substr(1); | |
| var token = doc.querySelector(".content>p:nth-child(2)").innerText.split(":")[1].substr(1); | |
| $section = doc.querySelector("section"); | |
| $comment_form = create_form("GET", "./comment"); | |
| $user_id = create_input("hidden", "id", user_id); | |
| $token = create_input("hidden", "token", token); | |
| $comment = create_input("text", "comment", ""); | |
| $comment_submit = create_input("submit", "submit", "comment"); | |
| $comment_form.appendChild($user_id); | |
| $comment_form.appendChild($token); | |
| $comment_form.appendChild($comment); | |
| $comment_form.appendChild($comment_submit); | |
| $section.appendChild($comment_form); | |
| $chat_form = create_form("GET", "./chat"); | |
| $user_id = create_input("hidden", "id", user_id); | |
| $token = create_input("hidden", "token", token); | |
| $text = create_input("text", "text", ""); | |
| $chat_submit = create_input("submit", "submit", "chat"); | |
| $chat_form.appendChild($user_id); | |
| $chat_form.appendChild($token); | |
| $chat_form.appendChild($text); | |
| $chat_form.appendChild($chat_submit); | |
| $section.appendChild($chat_form); | |
| })((this || 0).self || global); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment