vanilla JS >>> jQuery

This commit is contained in:
Lorin Werthen 2018-06-26 10:55:36 +02:00
parent 86fe029f0c
commit 0c6307971a
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
6 changed files with 20 additions and 12 deletions

View file

@ -1,4 +1,3 @@
$ ->
$.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) -> $.getJSON 'https://zeus.ugent.be/game/top4/show.json', (data) ->
str = "<table>" str = "<table>"
for x in data for x in data

View file

@ -1,9 +1,16 @@
$('#tipue_search_input_field').on 'focusin', -> input_field = document.getElementById('tipue_search_input_field')
$('#tipue_search_input').addClass("focused") input = document.getElementById('tipue_search_input')
$('#tipue_search_input_field').on 'focusout', -> input_field.addEventListener 'focusin', ->
$('#tipue_search_input').removeClass("focused") input.classList.add('focused')
$('.navbar-burger').on 'click', -> input_field.addEventListener 'focusout', ->
$('.navbar-menu').toggleClass('is-active') input.classList.remove('focused')
$('.navbar-burger').toggleClass('is-active')
burger = document.getElementsByClassName('navbar-burger')[0]
menu = document.getElementsByClassName('navbar-menu')[0]
burger.addEventListener 'click', ->
s = 'is-active'
if menu.classList.contains(s) then menu.classList.remove(s) else menu.classList.add(s)
if burger.classList.contains(s) then burger.classList.remove(s) else burger.classList.add(s)

View file

@ -130,6 +130,8 @@ Hier kunnen we verschillende statistieken van Haldis en Tap met elkaar vergelijk
</div> </div>
<% content_for :scripts do %> <% content_for :scripts do %>
<script src="https://code.jquery.com/jquery-3.0.0.min.js" charset="utf-8"></script>
<!-- CDNS --> <!-- CDNS -->
<script src="https://d3js.org/d3.v5.min.js"></script> <script src="https://d3js.org/d3.v5.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" integrity="sha256-iYUgmrapfDGvBrePJPrMWQZDcObdAcStKBpjP3Az+3s=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" integrity="sha256-iYUgmrapfDGvBrePJPrMWQZDcObdAcStKBpjP3Az+3s=" crossorigin="anonymous" />

View file

@ -5,6 +5,7 @@
<% end %> <% end %>
<% content_for :scripts do %> <% content_for :scripts do %>
<script src="https://code.jquery.com/jquery-3.0.0.min.js" charset="utf-8"></script>
<%= asset :js, :gamification %> <%= asset :js, :gamification %>
<% end %> <% end %>

View file

@ -18,6 +18,8 @@ title: Search
</div> </div>
<% content_for :scripts do %> <% content_for :scripts do %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch_set.js"></script>
<%= asset :js, :tipuesearch %>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#tipue_search_input_field').tipuesearch({ $('#tipue_search_input_field').tipuesearch({

View file

@ -52,10 +52,7 @@
</div> </div>
<%= render '/partials/_footer.*' %> <%= render '/partials/_footer.*' %>
<script src="https://code.jquery.com/jquery-3.0.0.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch_set.js"></script>
<%= asset :js, :tipuesearch %>
<%= asset :js, :search %>
<%= content_for(@item, :scripts) %> <%= content_for(@item, :scripts) %>
<%= asset :js, :search %>
</body> </body>
</html> </html>