comparison app/views/tweets/index.html.erb @ 116:32c8c150cd80

100% less javascripts
author nanaya <me@myconan.net>
date Sun, 12 Feb 2017 16:59:32 +0900
parents 394235fd42d2
children e3067b426b70
comparison
equal deleted inserted replaced
115:c712d307e197 116:32c8c150cd80
60 Doesn't actually output <code>rss</code> but generates <code>atom</code> instead. 60 Doesn't actually output <code>rss</code> but generates <code>atom</code> instead.
61 Not that it matters because either way it works with any RSS readers. 61 Not that it matters because either way it works with any RSS readers.
62 </p> 62 </p>
63 63
64 <form class="js-twitter--form twitter-form"> 64 <form class="js-twitter--form twitter-form">
65 <input type="text" placeholder="Enter Username" class="js-twitter--input twitter-form__input" autofocus> 65 <input
66 name="id"
67 type="text"
68 placeholder="Enter Username"
69 class="js-twitter--input twitter-form__input"
70 autofocus
71 >
66 <button type="submit"> 72 <button type="submit">
67 Go 73 Go
68 </button> 74 </button>
69 </form> 75 </form>
70 </div> 76 </div>
71 <div class="main__footer"> 77 <div class="main__footer">
72 <hr> 78 <hr>
73 <a href="https://bitbucket.org/nanaya1/rsstweet">Source</a> 79 <a href="https://bitbucket.org/nanaya1/rsstweet">Source</a>
74 </div> 80 </div>
75
76 <script>
77 var form = document.getElementsByClassName('js-twitter--form')[0]
78 var input = document.getElementsByClassName('js-twitter--input')[0]
79 var doRedirect = function(e) {
80 e.preventDefault()
81 document.location = "/" + input.value
82 }
83
84 form.addEventListener('submit', doRedirect)
85 </script>
86 </body> 81 </body>