Skip to content

Instantly share code, notes, and snippets.

@rooftopchicken
Last active January 21, 2021 01:48
Show Gist options
  • Select an option

  • Save rooftopchicken/1769462fb0f2b227aa269200cf53ba10 to your computer and use it in GitHub Desktop.

Select an option

Save rooftopchicken/1769462fb0f2b227aa269200cf53ba10 to your computer and use it in GitHub Desktop.
adds button to consume Tiger's Eye Dew at the end of battle
// ==UserScript==
// @name FV ENERGY! It's EXTREME!!!
// @version 1.2
// @description become a Kyle
// @author msjanny
// @match https://www.furvilla.com/career/warrior/*
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
/* globals $:false */
$(document).ready(function(){
let url = window.location.href;
let isBattle = window.location.href.indexOf("battle") !== -1;
let id = isBattle ? url.split('/')[6] : url.split('/')[5];
let dewBtn = $('<a href="#" class="btn"><img src="https://www.furvilla.com/img/items/4/4275-tigers-eye-dew.png" height="30">ENERGY!</a>').click(function() {
//open modal
$('#modal').modal('show');
$.get("https://www.furvilla.com/use/tiger-dew/4275", function(data) {
$('#modal .modal-content').html(data.content);
//select currect warrior from dropdown
$(`option[value="${id}"]`).attr("selected", "selected");
});
});
//only add the wax fangs if the active villager matches the current warrior
if ($(".right-column .villager-avatar a").eq(0).attr("href").split('/')[4] == id) {
let fangsBtn = $('<a href="#" class="btn"><img src="https://www.furvilla.com/img/items/3/3843-wax-fangs.png" height="30">:K</a>').click(function() {
//open modal
$('#modal').modal('show');
$.get("https://www.furvilla.com/use/candy/wax-fangs", function(data) {
$('#modal .modal-content').html(data.content);
});
});
isBattle ? $(".battle-complete > p").prepend(fangsBtn) : $(".registration-well > .row.text-center").append(fangsBtn);
fangsBtn.clone(true).appendTo($(".modal-dialog"));
}
// add to page
isBattle ? $(".battle-complete > p").prepend(dewBtn): $(".registration-well > .row.text-center").append(dewBtn);
dewBtn.clone(true).insertAfter($(".modal-content"));
$("<style type='text/css'>.modal-dialog > .btn { margin-top: 80px; z-index: 2050; position: relative; }</style>").appendTo("head");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment