From 56f5841d4b9c12296cdfcaeff174b2627d59afc8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 11:49:49 -0500 Subject: Migrate to full rails app --- app/assets/javascripts/pokemon.js.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/assets/javascripts/pokemon.js.coffee (limited to 'app/assets/javascripts/pokemon.js.coffee') diff --git a/app/assets/javascripts/pokemon.js.coffee b/app/assets/javascripts/pokemon.js.coffee new file mode 100644 index 0000000..e80ae77 --- /dev/null +++ b/app/assets/javascripts/pokemon.js.coffee @@ -0,0 +1,19 @@ +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() + $(".pkv-has-hover").mouseout -> + $(this).children(".pkv-hover").hide() + $(".pkv-has-hover").mousemove (event) -> + $(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