Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name dhsds_mitschreiber_GRABEDIT
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description schwarz auf weiss
- // @author kukgdtug
- // @match https://*.die-staemme.de/game.php*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var url = $(location).attr("href");
- var betreff = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(1) > th:nth-child(2) > span > span > span").html();
- var messageblock = {};
- // Create WebSocket client.
- const socket = new WebSocket('wss://37c1992.online-server.cloud/grabber/ws_post_report');
- socket.onerror = function(event) {
- console.error("WebSocket error observed:", event);
- };
- socket.onopen = function(event) {
- console.log("WebSocket is open now.");
- $(document).ready(function() {
- if(url.includes("screen=report") && url.includes("&view")){
- //check if battle report
- var temp_title = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(3) > td > h3").html();
- if (temp_title == undefined){
- temp_title = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(5) > td > h3").html();
- }
- console.log(temp_title);
- if(temp_title != undefined && (temp_title.includes("gewonnen") || temp_title.includes("ausgekundschaftet"))){
- messageblock = parseReportDataFromHtml();
- socket.send(JSON.stringify(messageblock));
- }
- }
- });
- };
- })();
- function parseReportDataFromHtml(){
- var data = {};
- var temp;
- //bericht_id
- temp = $(location).attr("href");
- if (temp != undefined){
- data.bericht_id = Number(temp.substring((temp.indexOf("view=")+5)));
- console.log("bericht_id: " + data.bericht_id);
- }else{
- console.log("BERICHT ID NOT FOUND");
- }
- //betreff
- temp = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(1) > th:nth-child(2) > span > span > span").html();
- if (temp != undefined){
- temp = temp.trimStart();
- temp = temp.trimEnd();
- data.betreff = temp;
- console.log("betreff: " + data.betreff);
- }else{
- console.log("BETREFF NOT FOUND");
- }
- //uhrzeit
- temp = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(2) > td:nth-child(2)").html();
- if (temp != undefined){
- temp = temp.trimStart().trimEnd().split(' '); //17.02.19 15:12:18
- var temp_datum = temp[0].split(".");
- temp = Date.parse("20"+temp_datum[2]+"-"+temp_datum[1]+"-"+temp_datum[0]+"T"+temp[1]); //"2011-10-10T14:48:00+01:00"
- data.timestamp = temp + 3600000; //TODO +1h offset bc of timezone - probably wrong
- console.log("timestamp: " + data.timestamp);
- }else{
- console.log("UHRZEIT NOT FOUND");
- }
- //titel
- temp = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(3) > td > h3").html();
- if (temp != undefined){
- data.titel = temp;
- console.log("titel: " + data.titel);
- }else{
- temp = $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(5) > td > h3").html();
- if (temp != undefined){
- data.titel = temp;
- console.log("titel: " + data.titel);
- }else{
- console.log("TITEL NOT FOUND");
- }
- }
- //glueck
- temp = $("#attack_luck > tbody > tr > td:nth-child(4) > b").html(); //positive
- if (temp != undefined){
- data.glueck = Number(temp.substring(0,temp.length-1));
- console.log("glueck: " + data.glueck);
- }
- temp = $("#attack_luck > tbody > tr > td:nth-child(1) > b").html(); //negative
- if (temp != undefined){
- data.glueck = Number(temp.substring(0,temp.length-1));
- console.log("glueck: " + data.glueck);
- }
- //angreifer_name
- temp = $("#attack_info_att > tbody > tr:nth-child(1) > th:nth-child(2) > a").html();
- if (temp != undefined){
- temp = temp.split();
- data.angreifer_name = temp[0];
- console.log("angreifer_name: " + data.angreifer_name);
- }else{
- console.log("angreifer_name NOT FOUND");
- }
- //angreifer_id
- temp = $("#attack_info_att > tbody > tr:nth-child(1) > th:nth-child(2) > a").prop("href");
- if (temp != undefined){
- temp = temp.split("=");
- data.angreifer_id = Number(temp[3]);
- console.log("angreifer_id: " + data.angreifer_id);
- }else{
- console.log("angreifer_id NOT FOUND");
- }
- //angreifer_dorf_name
- temp = $("#attack_info_att > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").html();
- if (temp != undefined){
- temp = temp.split('(');
- data.angreifer_dorf_name = temp[0];
- console.log("angreifer_dorf_name: " + data.angreifer_dorf_name);
- }else{
- console.log("angreifer_dorf_name NOT FOUND");
- }
- //angreifer_dorf_coord
- temp = $("#attack_info_att > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").html();
- if (temp != undefined){
- temp = temp.split('(');
- temp = temp[1];
- temp = temp.split(')');
- data.angreifer_dorf_coord = temp[0];
- console.log("angreifer_dorf_coord: " + data.angreifer_dorf_coord);
- }else{
- console.log("angreifer_dorf_coord NOT FOUND");
- }
- //angreifer_dorf_id
- temp = $("#attack_info_att > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").prop("href");
- if (temp != undefined){
- temp = temp.split("=");
- data.angreifer_dorf_id = Number(temp[3]);
- console.log("angreifer_dorf_id: " + data.angreifer_dorf_id);
- }else{
- console.log("angreifer_dorf_id NOT FOUND");
- }
- //angreifer_truppen_anzahl
- temp = $("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spear").html();
- if (temp != undefined){
- data.angreifer_truppen_anzahl = {};
- data.angreifer_truppen_anzahl[0] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spear").html());
- data.angreifer_truppen_anzahl[1] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-sword").html());
- data.angreifer_truppen_anzahl[2] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-axe").html());
- data.angreifer_truppen_anzahl[3] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spy").html());
- data.angreifer_truppen_anzahl[4] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-light").html());
- data.angreifer_truppen_anzahl[5] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-heavy").html());
- data.angreifer_truppen_anzahl[6] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-ram").html());
- data.angreifer_truppen_anzahl[7] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-catapult").html());
- data.angreifer_truppen_anzahl[8] = Number($("#attack_info_att_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-snob").html());
- console.log("angreifer_truppen_anzahl: " + data.angreifer_truppen_anzahl);
- }else{
- console.log("angreifer_truppen_anzahl NOT FOUND");
- }
- //angreifer_truppen_verluste
- temp = $("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spear").html();
- if (temp != undefined){
- data.angreifer_truppen_verluste = {};
- data.angreifer_truppen_verluste[0] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spear").html());
- data.angreifer_truppen_verluste[1] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-sword").html());
- data.angreifer_truppen_verluste[2] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-axe").html());
- data.angreifer_truppen_verluste[3] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spy").html());
- data.angreifer_truppen_verluste[4] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-light").html());
- data.angreifer_truppen_verluste[5] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-heavy").html());
- data.angreifer_truppen_verluste[6] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-ram").html());
- data.angreifer_truppen_verluste[7] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-catapult").html());
- data.angreifer_truppen_verluste[8] = Number($("#attack_info_att_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-snob").html());
- console.log("angreifer_truppen_verluste: " + data.angreifer_truppen_verluste);
- }else{
- console.log("angreifer_truppen_verluste NOT FOUND");
- }
- //verteidiger_name
- temp = $("#attack_info_def > tbody > tr:nth-child(1) > th:nth-child(2) > a").html();
- if (temp != undefined){
- temp = temp.split();
- data.verteidiger_name = temp[0];
- console.log("verteidiger_name: " + data.verteidiger_name);
- }else{
- console.log("verteidiger_name NOT FOUND");
- }
- //verteidiger_id
- temp = $("#attack_info_def > tbody > tr:nth-child(1) > th:nth-child(2) > a").prop("href");
- if (temp != undefined){
- temp = temp.split("=");
- data.verteidiger_id = Number(temp[3]);
- console.log("verteidiger_id: " + data.verteidiger_id);
- }else{
- console.log("verteidiger_id NOT FOUND");
- }
- temp = $("#attack_info_def > tbody > tr:nth-child(1) > th:nth-child(2)").html();
- if (temp == "---"){
- data.verteidiger_id = 0;
- console.log("verteidiger_id: " + data.verteidiger_id);
- }else{
- console.log("verteidiger_id NOT FOUND");
- }
- //verteidiger_dorf_name
- temp = $("#attack_info_def > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").html();
- if (temp != undefined){
- temp = temp.split('(');
- data.verteidiger_dorf_name = temp[0];
- console.log("verteidiger_dorf_name: " + data.verteidiger_dorf_name);
- }else{
- console.log("verteidiger_dorf_name NOT FOUND");
- }
- //verteidiger_dorf_coord
- temp = $("#attack_info_def > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").html();
- if (temp != undefined){
- temp = temp.split('(');
- temp = temp[1];
- temp = temp.split(')');
- data.verteidiger_dorf_coord = temp[0];
- console.log("verteidiger_dorf_coord: " + data.verteidiger_dorf_coord);
- }else{
- console.log("verteidiger_dorf_coord NOT FOUND");
- }
- //verteidiger_dorf_id
- temp = $("#attack_info_def > tbody > tr:nth-child(2) > td:nth-child(2) > span > a:nth-child(1)").prop("href");
- if (temp != undefined){
- temp = temp.split("=");
- data.verteidiger_dorf_id = Number(temp[3]);
- console.log("verteidiger_dorf_id: " + data.verteidiger_dorf_id);
- }else{
- console.log("verteidiger_dorf_id NOT FOUND");
- }
- //verteidiger_truppen_anzahl
- temp = $("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spear").html();
- if (temp != undefined){
- data.verteidiger_truppen_anzahl = {};
- data.verteidiger_truppen_anzahl[0] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spear").html());
- data.verteidiger_truppen_anzahl[1] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-sword").html());
- data.verteidiger_truppen_anzahl[2] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-axe").html());
- data.verteidiger_truppen_anzahl[3] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-spy").html());
- data.verteidiger_truppen_anzahl[4] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-light").html());
- data.verteidiger_truppen_anzahl[5] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-heavy").html());
- data.verteidiger_truppen_anzahl[6] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-ram").html());
- data.verteidiger_truppen_anzahl[7] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-catapult").html());
- data.verteidiger_truppen_anzahl[8] = Number($("#attack_info_def_units > tbody > tr:nth-child(2) > td.unit-item.unit-item-snob").html());
- console.log("verteidiger_truppen_anzahl: " + data.verteidiger_truppen_anzahl);
- }else{
- console.log("verteidiger_truppen_anzahl NOT FOUND");
- }
- //verteidiger_truppen_verluste
- temp = $("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spear").html();
- if (temp != undefined){
- data.verteidiger_truppen_verluste = {};
- data.verteidiger_truppen_verluste[0] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spear").html());
- data.verteidiger_truppen_verluste[1] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-sword").html());
- data.verteidiger_truppen_verluste[2] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-axe").html());
- data.verteidiger_truppen_verluste[3] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-spy").html());
- data.verteidiger_truppen_verluste[4] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-light").html());
- data.verteidiger_truppen_verluste[5] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-heavy").html());
- data.verteidiger_truppen_verluste[6] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-ram").html());
- data.verteidiger_truppen_verluste[7] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-catapult").html());
- data.verteidiger_truppen_verluste[8] = Number($("#attack_info_def_units > tbody > tr:nth-child(3) > td.unit-item.unit-item-snob").html());
- console.log("verteidiger_truppen_verluste: " + data.verteidiger_truppen_verluste);
- }else{
- console.log("verteidiger_truppen_verluste NOT FOUND");
- }
- //spionage
- if($("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(3) > td > h4").html() == "Spionage" ||
- $("#content_value > table > tbody > tr > td:nth-child(2) > table > tbody > tr > td > table:nth-child(2) > tbody > tr:nth-child(5) > td > h4").html() == "Spionage"){
- //spionage_ress_erspaeht
- temp = $("#attack_spy_resources > tbody > tr:nth-child(1) > td").html();
- if (temp == "keine"){
- data.spionage_ress_erspaeht = [0,0,0];
- console.log("spionage_ress_erspaeht: " + data.spionage_ress_erspaeht);
- }else if (temp != undefined){
- data.spionage_ress_erspaeht = [0,0,0];
- var temp_holz = $("#attack_spy_resources > tbody > tr:nth-child(1) > td > span:nth-child(1)").text();
- if(temp_holz != undefined){
- temp_holz = temp_holz.replace(".", "");
- temp_holz = temp_holz.trimStart();
- }else{
- temp_holz = 0;
- }
- var temp_lehm = $("#attack_spy_resources > tbody > tr:nth-child(1) > td > span:nth-child(2)").text();
- if(temp_lehm != undefined){
- temp_lehm = temp_lehm.replace(".", "");
- temp_lehm = temp_lehm.trimStart();
- }
- var temp_eisen = $("#attack_spy_resources > tbody > tr:nth-child(1) > td > span:nth-child(3)").text();
- if(temp_eisen != undefined){
- temp_eisen = temp_eisen.replace(".", "");
- temp_eisen = temp_eisen.trimStart();
- }else{
- temp_eisen = 0;
- }
- data.spionage_ress_erspaeht = [Number(temp_holz),Number(temp_lehm),Number(temp_eisen)];
- console.log("spionage_ress_erspaeht: " + data.spionage_ress_erspaeht);
- }
- //spionage_gebauede
- temp = $("#attack_spy_building_data").attr("value");
- if (temp != undefined){
- temp = JSON.parse(temp);
- data.spionage_gebauede = temp;
- console.log("spionage_gebauede: " + data.spionage_gebauede);
- }
- //spionage_ausserhalb
- temp = $("#attack_spy_away > tbody > tr:nth-child(1) > th").html();
- if (temp == "Einheiten außerhalb:"){
- data.spionage_ausserhalb = {};
- data.spionage_ausserhalb[0] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-spear").html());
- data.spionage_ausserhalb[1] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-sword").html());
- data.spionage_ausserhalb[2] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-axe").html());
- data.spionage_ausserhalb[3] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-spy").html());
- data.spionage_ausserhalb[4] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-light").html());
- data.spionage_ausserhalb[5] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-heavy").html());
- data.spionage_ausserhalb[6] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-ram").html());
- data.spionage_ausserhalb[7] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-catapult").html());
- data.spionage_ausserhalb[8] = Number($("#attack_spy_away > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td.unit-item.unit-item-snob").html());
- console.log("spionage_ausserhalb: " + data.spionage_ausserhalb);
- }
- }else{
- console.log("SPIONAGE NOT FOUND");
- }
- //beute
- temp = $("#attack_results > tbody > tr:nth-child(1) > th").html();
- if (temp == "Beute:"){
- //init
- temp_holz = 0;
- temp_lehm = 0;
- temp_eisen = 0;
- //first
- if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(1) > span.icon.header.wood").html() != undefined){
- temp_holz = $("#attack_results > tbody > tr:nth-child(1) > td > span:nth-child(1)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(1) > span.icon.header.stone").html() != undefined){
- temp_lehm = $("#attack_results > tbody > tr:nth-child(1) > td > span:nth-child(1)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(1) > span.icon.header.iron").html() != undefined){
- temp_eisen = $("#attack_results > tbody > tr:nth-child(1) > td > span:nth-child(1)").text().replace(".", "").trimStart();
- }
- //second
- if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2) > span.icon.header.wood").html() != undefined){
- temp_holz = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2) > span.icon.header.stone").html() != undefined){
- temp_lehm = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2) > span.icon.header.iron").html() != undefined){
- temp_eisen = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(2)").text().replace(".", "").trimStart();
- }
- //third
- if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3) > span.icon.header.wood").html() != undefined){
- temp_holz = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3) > span.icon.header.stone").html() != undefined){
- temp_lehm = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3)").text().replace(".", "").trimStart();
- }else if($("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3) > span.icon.header.iron").html() != undefined){
- temp_eisen = $("#attack_results > tbody > tr > td:nth-child(2) > span:nth-child(3)").text().replace(".", "").trimStart();
- }
- data.beute = [Number(temp_holz),Number(temp_lehm),Number(temp_eisen)];
- console.log("beute: " + data.beute);
- //beute_ausnutzung
- temp = $("#attack_results > tbody > tr:nth-child(1) > td:nth-child(3)").text().split("/");
- if (temp != undefined){
- temp = (Number(temp[0])/Number(temp[1])).toFixed(2);
- if (isNaN(temp)){
- temp = 0;
- }
- data.beute_ausnutzung = temp;
- console.log("beute_ausnutzung: " + data.beute_ausnutzung);
- }
- }else{
- console.log("BEUTE NOT FOUND");
- }
- //zustimmung
- temp = $("#attack_results > tbody > tr:nth-child(2) > th").html();
- if (temp == "Zustimmung:"){
- temp = $("#attack_results > tbody > tr:nth-child(2) > td").text();
- data.zustimmung = temp;
- console.log("zustimmung: " + data.zustimmung);
- }else{
- console.log("zustimmung NOT FOUND");
- }
- //kata rammbock dmg dedection
- //tr nr 1
- temp = $("#attack_results > tbody > tr:nth-child(1) > th").html();
- if (temp == "Schaden durch Rammböcke:"){
- temp = $("#attack_results > tbody > tr:nth-child(1) > td").text();
- data.schaden_rammbock = temp.trimStart().trimEnd();
- }else if(temp == "Schaden durch Katapultbeschuss:"){
- temp = $("#attack_results > tbody > tr:nth-child(1) > td").text();
- data.schaden_katapult = temp.trimStart().trimEnd();
- }
- //tr nr 2
- temp = $("#attack_results > tbody > tr:nth-child(2) > th").html();
- if (temp == "Schaden durch Rammböcke:"){
- temp = $("#attack_results > tbody > tr:nth-child(2) > td").text();
- data.schaden_rammbock = temp.trimStart().trimEnd();
- }else if(temp == "Schaden durch Katapultbeschuss:"){
- temp = $("#attack_results > tbody > tr:nth-child(2) > td").text();
- data.schaden_katapult = temp.trimStart().trimEnd();
- }
- //tr nr 3
- temp = $("#attack_results > tbody > tr:nth-child(3) > th").html();
- if (temp == "Schaden durch Rammböcke:"){
- temp = $("#attack_results > tbody > tr:nth-child(3) > td").text();
- data.schaden_rammbock = temp.trimStart().trimEnd();
- }else if(temp == "Schaden durch Katapultbeschuss:"){
- temp = $("#attack_results > tbody > tr:nth-child(3) > td").text();
- data.schaden_katapult = temp.trimStart().trimEnd();
- }
- if(data.schaden_katapult != undefined){
- console.log("schaden_katapult: " + data.schaden_katapult);
- }else{
- console.log("schaden_katapult NOT FOUND");
- }
- if(data.schaden_rammbock != undefined){
- console.log("schaden_rammbock: " + data.schaden_rammbock);
- }else{
- console.log("schaden_rammbock NOT FOUND");
- }
- //hinweis
- temp = $("#attack_info > tbody > tr:nth-child(1) > th").html();
- if (temp == "Hinweis:"){
- temp = $("#attack_info > tbody > tr:nth-child(2) > td").text();
- data.hinweis = temp.trimStart().trimEnd();
- console.log("hinweis: " + data.hinweis);
- }else{
- console.log("hinweis NOT FOUND");
- }
- return data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement