From a70494be4e1767e0cb7ff4218e7f266ece56089c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 4 Jul 2018 14:42:21 -0400 Subject: Made pokemon embeddable --- app/assets/javascripts/pokeviewer/pokemon.js.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/pokeviewer/pokemon.js.coffee b/app/assets/javascripts/pokeviewer/pokemon.js.coffee index a6fd326..e80ae77 100644 --- a/app/assets/javascripts/pokeviewer/pokemon.js.coffee +++ b/app/assets/javascripts/pokeviewer/pokemon.js.coffee @@ -1,3 +1,9 @@ +show_pokemon_tab = (tab) -> + $(".pokemon-tab").hide() + $(".ptabe-button").removeClass("active") + $(".pokemon-" + tab).show() + $(".ptabe-" + tab).addClass("active") + $ -> $(".pkv-has-hover").mouseover -> $(this).children(".pkv-hover").show() @@ -7,3 +13,7 @@ $ -> $(this).children(".pkv-hover").offset({left: event.pageX + 16, top: event.pageY - 16}) $(".in-emerald .pokemon-image img").mouseover -> $(this).attr("src", $(this)[0].src) + $(".ptabe-button a").click -> + show_pokemon_tab($(this).data("tab")) + if $("#pokemon-embed").length > 0 + show_pokemon_tab("details") -- cgit 1.4.1