Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AM Assistent
- // @author Tjeerdo (skype: tjeerdov, AF-naam: .Arrogant)
- // @version 1.0
- // @namespace www.tribalwars.nl
- // @description Met dit script worden verschillende handelingen bij de AM makkelijker gemaakt
- // @include https://*.tribalwars.nl/game.php*
- // ==/UserScript==
- $( document ).ready( function() {
- // AM import / export test
- $('#template_queue').parent().before( '<div id="AR_AMExportArea" style="background-color:#FFF;padding:10px;height:auto; width:100%;display:none;"></div><div><button id="exportAM">Export</button><button id="importAM">Import</button></div>' );
- $( '#exportAM' ).on( "click", function() {
- var exportList = [];
- $( '#template_queue' ).children( '.sortable_row' ).each( function() {
- exportList.push( {
- "building": $( this ).data( "building" ),
- "levelsUp": $( this ).find( '.level_relative' ).text().match(/\d+/)[0]
- } );
- } )
- $( "#AR_AMExportArea" ).text( JSON.stringify( exportList ) ).show();
- } )
- $( '#importAM' ).on( "click", function() {
- var importedList = JSON.parse( prompt( "Voer hier de export van de AM in" ) );
- var buildingsList = [];
- $.each( importedList, function() {
- buildingsList.push( this.building + ':' + this.levelsUp );
- } )
- $('#queue_data').val( buildingsList.join(';') ).closest( 'form' ).removeAttr('onsubmit').find(':submit').click();
- } )
- } )
Add Comment
Please, Sign In to add comment