// ==UserScript==
// @name FR - Dragon - Dragon Equip
// @namespace https://github.com/flamyfox/FrFun
// @version 0.1
// @description Unequip all, save equip code, equip it again
// @author flamyfox
// @match http://flightrising.com/main.php?p=lair&tab=equip*
// @match http://flightrising.com/main.php?p=lair&id=*&tab=equip&did=*
// @grant none
// ==/UserScript==
var dID = window.location.href;
dID = dID.split("=");
$(document).ready(function() {
//creat style sheet
$("head").append("");
//add ctrl board
var cBoard = "
"
+ " "
+ ""
+ " "
+ " "
+ "
";
$("body").append(cBoard);
//listener
$("#bUnequip").bind("click",function() {
unEquip();
});
$("#bBackUp").bind("click",function() {
backup();
});
$("#bEquip").bind("click",function() {
var equipList = $("#equipList").val().split(",");
var count = equipList.length;
console.log(equipList);
for(var i = 0 ;i<=count;i++){
setTimeout(myApparelOp({ op: 'equip', itemid: equipList[i], did: dID[4] }),500);
if (i==count){
location.reload();
}
}
});
});
function unEquip(){
var count = $('img.remclass').length -1;
//console.log(count);
for(var i = count ;i>=0;i--){
//console.log("op: 'unequip', did: " + dID[4] +" , slot:" + i);
setTimeout(myApparelOp({ op: 'unequip', did: dID[4] , slot:i }),500);
if (i==0){
location.reload();
}
}
}
function backup(){
var tempList = "";
$("#copyit").remove();
$("#itemlist li.itemlist").each(function(){
tempList = tempList + $(this).find("img").attr("src").replace(/\D/g,'') + ",";
});
tempList = tempList.substr(0,tempList.length-1);
//console.log(tempList);
$("form").after("copy and save this code: " + tempList + "
");
}
function myApparelOp(args) {
$.ajax({
type: "POST",
data: args,
url: "includes/equip_op.php",
async:false,
cache:false
});
}