Advertisement
Tw100

main.min.js

Aug 14th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*! main.min.js 2015-09-01 */
  2. function run(){checkVersion(),checkWorking(),setVersion(),makeItPretty(),showSettings(),turnOnHotkeys(),hotkeysOnOff(),0!=userset[s.enable_auto_run]&&applySettings()}function checkVersion(){if(getVersion()!=version)if(buttons=[{text:"OK",callback:null,confirm:!0}],clearProfiles){var a=$.jStorage.get("profileList");$.each(a,function(a,b){$.jStorage.deleteKey("profile:"+b)}),$.jStorage.set("keyPressSettings",keyPressSettings),Dialog.show("update_dialog","This script has recently been updated to version <span style='font-weight:bold;'>"+version+"</span> and in order for the new version to work, all profiles and settings must be reset. Sorry for any inconvenience.<br /><br/><a href='"+updateNotesURL+"' target='_blank'>See what's new</a>")}else Dialog.show("update_dialog","This script has recently been updated to version <span style='font-weight:bold;'>"+version+"</span><br /><br/><a href='"+updateNotesURL+"' target='_blank'>See what's new</a>")}function checkWorking(){var a=$.jStorage.get("working");null==a&&$.jStorage.set("working",!1),getVersion()!=version&&$.jStorage.set("working",!1),0==working&&0==a&&(buttons=[{text:"OK",callback:null,confirm:!0}],UI.ConfirmationBox("An error has been discovered in this version. You may continue testing the script if you haven't noticed the error.",buttons,!1,[]),$.jStorage.set("working",!0))}function setVersion(){$.jStorage.set("version",version)}function getVersion(){var a=$.jStorage.get("version");return void 0==a?(setVersion(),version):a}function showAllRows(){var a=$.trim($("#plunder_list_nav tr:first td:last").children().last().html().replace(/\D+/g,""));"max"==$("#end_page").val()&&$("#end_page").text(a),$("#am_widget_Farm tr:last").remove(),a>parseInt($("#end_page").val(),10)&&(a=parseInt($("#end_page").val(),10)),setTimeout(function(){getPage(parseInt($("#start_page").val(),10)-1,a)},1)}function getPage(a,b){if(b>a){changeHeader(filter_41+" "+(a+1)+"/"+b+" <img src='graphic/throbber.gif' height='24' width='24'></img>");var c=link[0]+window.game_data.village.id+"&order="+userset[s.order_by]+"&dir="+userset[s.direction]+"&Farm_page="+a+"&screen=am_farm";$.ajax({type:"GET",url:c,dataType:"html",error:function(a,b,c){console.log("Get page failed with error: "+c)},success:function(c){console.log($(c)),$("#plunder_list tr",c).slice(1).each(function(){$("#plunder_list tr:last").after("<tr>"+$(this).html()+"</tr>")}),setTimeout(function(){getPage(a+1,b)},1)}})}else setTimeout(function(){addTableInfo(),applyFilters(),changeHeader(filter_40),highlightRows()},1),$("#plunder_list").show(),Accountmanager.initTooltips(),pagesLoaded=!0,cansend=!0}function changeHeader(a){$("h3:first").html(a)}function highlightRows(){$("#am_widget_Farm table").each(function(){$("tr:even:gt(0) td",this).not("table:first").css("backgroundColor","#FFF5DA"),$("tr:odd:gt(0) td",this).not("table:first").css("backgroundColor","#F0E2BE")})}function getNewVillage(a){"n"==a?UI.InfoMessage("Switching to next village...",500):UI.InfoMessage("Switching to previous village...",500),window.onkeydown=function(){},cansend=!1,filtersApplied=!1,Timing.pause(),fadeThanksToCheese(),openLoader();var b=link[0]+a+window.game_data.village.id+link[1];$.ajax({type:"GET",url:b,dataType:"html",error:function(a,b){alert("Error: "+b),$("#fader").remove(),$("#loaders").remove()},success:function(a){var b=$(a),c=a.split("<title>")[1].split("</title>")[0];window.game_data=$.parseJSON(a.split("var game_data = ")[1].split("};")[0]+"}"),$("#header_info").html($("#header_info",b).html()),$("#topContainer").html($("#topContainer",b).html()),$("#contentContainer").html($("#contentContainer",b).html()),$("#quickbar_inner").html($("#quickbar_inner",b).html()),$("head").find("title").html(c),$("#fader").remove(),$("#loaders").remove(),Timing.resetTickHandlers(),Timing.pause(),pagesLoaded=!1,cansend=!1,run()}})}function showSettings(){$("head").append("<link type='text/css' rel='stylesheet' href='"+scriptURL+"css/style.css' />"),$("#contentContainer h3").eq(0).after($("<div class='vis'id='settingsDiv'><table class='settingsTable'><thead><tr><th colspan='5'class='vis'style='padding:0px;'><h4>"+filter_01+" "+version+" - <a href='http://forum.tribalwars.net/showthread.php?266604-ntoombs19-s-FA-Filter'target='_blank'>"+filter_02+"</a> - "+filter_42+": <select id='language'style='margin:0px;'onchange='loadLanguage($(&quot;#language&quot;).val())'></select><span style='font-size:10px;float:right;font-weight:normal;font-style:normal'>"+filter_03+" <a href='http://forum.tribalwars.net/member.php?22739-ntoombs19'target='_blank'>ntoombs19</a>&nbsp;<div class='vis'style='float:right;text-align:center;line-height:100%;width:12px;height:12px;margin:0px 0px 0px 0px;position:relative;background-color:tan;opacity:.7'><a href='#'num='2'onclick='uglyHider($(this));return false;'>-</a></div></span></h4></th></tr></thead><tbody id='settingsBody'><tr><td class='col1'style='min-width:200px'><span>"+filter_04+"</span>&nbsp;<input type='text'value=''size='2'maxlength='3'id='start_page'>&nbsp;<span>"+filter_05+"</span>&nbsp;<input type='text'value=''size='2'maxlength='3'id='end_page'></td><td colspan='3'><span style='font-weight:bold'>"+filter_06+"</span>&nbsp;<img src='graphic/questionmark.png'width='13'height='13'id='enable_help'></td><td rowspan='5'valign='top'><form><input type='checkbox'id='all_none'>&nbsp;<label for='all_none'style='font-weight:bold'>"+filter_07+"</label>&nbsp;<img src='graphic/questionmark.png'width='13'height='13'id='report_help'><br><input type='checkbox'id='blue'><label for='blue'><img src='graphic/dots/blue.png'>&nbsp;"+filter_08+"</label><br><input type='checkbox'id='green'><label for='green'><img src='graphic/dots/green.png'>&nbsp;"+filter_09+"</label><br><input type='checkbox'id='yellow'><label for='yellow'><img src='graphic/dots/yellow.png'>&nbsp;"+filter_10+"</label><br><input type='checkbox'id='red_yellow'><label for='red_yellow'><img src='graphic/dots/red_yellow.png'>&nbsp;"+filter_11+"</label><br><input type='checkbox'id='red_blue'><label for='red_blue'><img src='graphic/dots/red_blue.png'>&nbsp;"+filter_12+"</label><br><input type='checkbox'id='red'><label for='red'><img src='graphic/dots/red.png'>&nbsp;"+filter_13+"</label></form></td></tr><tr><td rowspan='2'><label for='order_by'>"+filter_14+":</label>&nbsp;<select id='order_by'val='distance'><option value='distance'>"+filter_15+"</option><option value='date'>"+filter_16+"</option></select><br><label for='direction'>"+filter_17+":</label>&nbsp;<select id='direction'val='desc'><option value='asc'>"+filter_18+"</option><option value='desc'>"+filter_19+"</option></select></td><td style='width:26px'><input type='checkbox'id='enable_hauls'></td><td style='width:110px'><label for='enable_hauls'>"+filter_20+"</label></td><td><input type='radio'name='hauls'id='full'><label for='full'><img src='graphic/max_loot/1.png'>"+filter_21+"</label>&nbsp;<input type='radio'name='hauls'id='partial'><label for='partial'><img src='graphic/max_loot/0.png'>"+filter_22+"</label></td></tr><tr><td><input type='checkbox'id='enable_attacks'></td><td><label for='enable_attacks'>"+filter_23+"</label></td><td><select id='attack_operator'><option value='greater_than'>"+filter_24+"</option><option value='less_than'>"+filter_25+"</option><option value='equal_to'>"+filter_26+"</option></select>&nbsp;<input type='text'id='attack_value'size='2'maxlength='2'value=''></td></tr><tr><td rowspan='1'><span style='font-weight:bold;'>"+filter_43+"</span></td><td><input type='checkbox'id='enable_walls'></td><td><label for='enable_walls'>"+filter_30+"</label></td><td><select id='wall_operator'><option value='greater_than'>"+filter_24+"</option><option value='less_than'>"+filter_25+"</option><option value='equal_to'>"+filter_26+"</option></select>&nbsp;<input type='text'id='wall_value'size='2'maxlength='2'value=''></td></tr><tr><td><input type='checkbox'id='next_village_no_farms'><label for='next_village_no_farms'>"+filter_39+"</label></td><td><input type='checkbox'id='enable_distances'></td><td><label for='enable_distances'>"+filter_31+"</label></td><td><select id='distance_operator'val='greater_than'><option value='greater_than'>"+filter_24+"</option><option value='less_than'>"+filter_25+"</option><option value='equal_to'>"+filter_26+"</option></select>&nbsp;<input type='text'id='distance_value'size='2'maxlength='2'value=''></td></tr><tr><td><input type='checkbox' id='next_village_units' />"+filter_44+"</td><td><input type='checkbox' id='enable_continents' /><td colspan='3'><select id='continent_display'><option value='hide'>"+filter_32+"</option><option value='show'>"+filter_33+"</option></select>&nbsp;<label for='continents_list'>"+filter_34+"</label>&nbsp;<input type='text'size='2'maxlength='150'id='continents_list'value=''>&nbsp;<img src='graphic/questionmark.png'height='13'id='continent_help'></td></tr><tr><td><input type='checkbox' id='next_village_scouts' /><input type='text' size='2' id='scouts_left' /> "+filter_45+"</td><td><input type='checkbox'id='enable_scout'></td><td colspan='3'><label for='enable_scout'>"+filter_35+"</label>&nbsp;<select id='scout_report_operator'val='greater_than'><option value='greater_than'>"+filter_24+"</option><option value='less_than'>"+filter_25+"</option><option value='equal_to'>"+filter_26+"</option></select>&nbsp;<input type='text'id='haul_value'size='9'maxlength='7'value=''></td></tr><tr><td><input type='checkbox' id='next_village_farming_troops' /><input type='text' size='2' id='farming_troops_left' /> "+filter_46+"</td><td><input type='checkbox'id='enable_time'></td><td colspan='3'><select id='attack_time_filter'val='hide'><option value='hide'>"+filter_32+"</option><option value='show'>"+filter_33+"</option></select>&nbsp;<label for='enable_time'>"+filter_36+"</label>&nbsp;<input type='text'id='time_value'size='2'maxlength='4'value=''><span>"+filter_37+"</span></td></tr><tr><td><input type='checkbox'id='enable_auto_run'><label for='enable_autoRun'>"+filter_38+"</label></td><td><input type='checkbox' id='hide_recent_farms' /></td><td colspan='3'><select id='sent_time_filter'val='hide'><option value='hide'>"+filter_32+"</option><option value='show'>"+filter_33+"</option></select>&nbsp;"+filter_47+" <input type='text' size='2' id='hide_recent_time' /> "+filter_48+"</td></tr><tr><th>"+filter_49+"</th><th colspan='4'>"+filter_50+"</th></tr><tr><td rowspan='4'><table><tr class='hotkey_values'><td><a href='#'onclick='return setKeyEditMode(\"A\")'id='button_a'class='farm_icon farm_icon_a'></a></td><td><a href='#'onclick='return setKeyEditMode(\"B\")'id='button_b'class='farm_icon farm_icon_b'></a></td><td><a href='#'onclick='return setKeyEditMode(\"C\")'id='button_c'class='farm_icon farm_icon_c'></a></td><td><a href='#'onclick='return setKeyEditMode(\"Master\")'id='button_master'class='farm_icon farm_icon_m'></a></td></tr><tr class='hotkey_values'><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_a'value='A'></td><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_b'value='B'></td><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_c'value='C'></td><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_master'value='M'></td></tr><tr class='hotkey_values'><td colspan='2'><input class='btn tooltip'onclick='return setKeyEditMode(\"Skip\")'type='button'value='Skip'style='margin:0px 0px 0px 0px'title='"+filter_51+"'></td><td><input class='btn tooltip'onclick='return setKeyEditMode(\"Left\")'type='button'value='⇚'style='margin:0px 0px 0px 0px'title='"+filter_52+"'></td><td><input class='btn tooltip'type='button'onclick='return setKeyEditMode(\"Right\")'value='⇛'style='margin:0px 0px 0px 0px'title='"+filter_53+"'></td></tr><tr class='hotkey_values'><td colspan='2'><input type='text'class='hotkey_value' READONLY id='hotkey_value_skip'value='S'></td><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_left'value='&#8592;'></td><td><input type='text'class='hotkey_value' READONLY id='hotkey_value_right'value='&#8594;'></td></tr></table></td><td><input type='checkbox' onchange='return updateKeypressSettings();' id='priorityOneEnabled'/></td><td colspan='3'>"+filter_54+" <select id='priorityOneProfile' onchange='return updateKeypressSettings();'></select> "+filter_55+" <select id='priorityOneButton' onchange='return updateKeypressSettings();'><option val='"+filter_56+"'>"+filter_56+"</option><option val='"+filter_57+"'>"+filter_57+"</option><option val='"+filter_58+"'>"+filter_58+"</option><option val='"+filter_59+"'>"+filter_59+"</option></select></td></tr><tr><td><input type='checkbox' onchange='return updateKeypressSettings();' id='priorityTwoEnabled'/></td><td colspan='3'>"+filter_54+" <select id='priorityTwoProfile' onchange='return updateKeypressSettings();'></select> "+filter_55+" <select id='priorityTwoButton' onchange='return updateKeypressSettings();'><option val='"+filter_56+"'>"+filter_56+"</option><option val='"+filter_57+"'>"+filter_57+"</option><option val='"+filter_58+"'>"+filter_58+"</option><option val='"+filter_59+"'>"+filter_59+"</option></select></td></tr><tr><td><input type='checkbox' onchange='return updateKeypressSettings();' id='priorityThreeEnabled'/></td><td colspan='3'>"+filter_54+" <select id='priorityThreeProfile' onchange='return updateKeypressSettings();'></select> "+filter_55+" <select id='priorityThreeButton' onchange='return updateKeypressSettings();'><option val='"+filter_56+"'>"+filter_56+"</option><option val='"+filter_57+"'>"+filter_57+"</option><option val='"+filter_58+"'>"+filter_58+"</option><option val='"+filter_59+"'>"+filter_59+"</option></select></td></tr><tr><td colspan='4'>"+filter_60+" <select id='defaultButton' onchange='return updateKeypressSettings();'><option val='"+filter_56+"'>"+filter_56+"</option><option val='"+filter_57+"'>"+filter_57+"</option><option val='"+filter_58+"'>"+filter_58+"</option><option val='"+filter_59+"'>"+filter_59+"</option></select></td></tr><tr><td colspan='5'><div style='float:left'><input type='submit'value='"+profile_02+"'onclick='applySettings()'>&nbsp;<input type='submit'value='"+profile_03+"'onclick='resetTable()'></div><div style='float:right'><img src='graphic/questionmark.png'width='13'height='13'id='profile_help'>&nbsp;<label for='settingsProfile'>"+profile_01+":</label>&nbsp;<select id='settingsProfile'onchange='changeProfile($(&quot;#settingsProfile&quot;).val())'></select>&nbsp;<input type='submit'value='"+profile_04+"'onclick='createProfile()'>&nbsp;<input type='submit'value='"+profile_05+"'onclick='setDefaultProfile()'>&nbsp;<input type='submit'value='"+profile_06+"'onclick='deleteProfile()'>&nbsp;<input type='submit'value='"+profile_07+"'onclick='updateProfile()'>&nbsp;<input type='submit'value='"+profile_08+"'onclick='exportProfile()'>&nbsp;<input type='submit'value='"+profile_09+"'onclick='importProfile()'></div></td></tr></tbody></table></div>")),formatSettings(),addLanguages(),$("#language option[value='"+$.jStorage.get("language")+"']").attr("selected","selected")}function formatSettings(){$("#all_none").bind("click",function(){$(this).closest("form").find(":checkbox").prop("checked",this.checked)});var a=$("#report_help");a.attr("title",instructions_01),UI.ToolTip(a);var b=$("#enable_help");b.attr("title",instructions_02),UI.ToolTip(b);var c=$("#continent_help");c.attr("title",instructions_03),UI.ToolTip(c);var d=$("#recent_help");d.attr("title",instructions_04),UI.ToolTip(d);var e=$("#profile_help");e.attr("title",instructions_05),UI.ToolTip(e),loadDefaultProfile(),fillProfileList(),fillMasterSettings(),fillKeypressSettings()}function removeFirstPage(){$("#plunder_list tr:gt(0)").remove(),$("#plunder_list_nav").hide()}function customSendUnits(a,b,c,d){if(!checkIfNextVillage()){if(d.closest("tr").hide(),a=$(a),a.hasClass("farm_icon_disabled"))return!1;var e={target:b,template_id:c,source:game_data.village.id};return $.post(Accountmanager.send_units_link,e,function(a){if(a.error){if(userset[s.next_village_units]&&"Not enough units available"===a.error)return cansend&&filtersApplied&&getNewVillage("n"),!1;UI.ErrorMessage(a.error),d.closest("tr").show()}else{if(setLocalStorageRow(b),"undefined"!=typeof $(d).prop("tooltipText"))var c=$(d).prop("tooltipText");var e=$("<div></div>").append($(c)),f=($(e).find('img[src*="res.png"]').eq(0).attr("src"),c.split("<br />"));f.splice(f.length-2,1),UI.SuccessMessage(f.join(" "),100),Accountmanager.farm.updateOwnUnitsAvailable(a.current_units)}},"json"),!1}}function customSendUnitsFromReport(a,b,c,d){if(!checkIfNextVillage()){if(d.closest("tr").hide(),a=$(a),a.hasClass("farm_icon_disabled"))return!1;var e={report_id:c};return $.post(Accountmanager.send_units_link_from_report,e,function(a){if(a.error){if(userset[s.next_village_units]&&"Not enough units available"===a.error)return cansend&&filtersApplied&&getNewVillage("n"),!1;UI.ErrorMessage(a.error),d.closest("tr").show()}else if(setLocalStorageRow(b),"string"==typeof a.success){if("undefined"!=typeof $(d).prop("tooltipText"))var c=$(d).prop("tooltipText");var e=$("<div></div>").append($(c)),f=($(e).find('img[src*="res.png"]').eq(0).attr("src"),c.split("<br />"));f.splice(f.length-2,1),UI.SuccessMessage(f.join(" "),100),Accountmanager.farm.updateOwnUnitsAvailable(a.current_units)}},"json"),!1}}function setOnclick(a){var b=a.find("a").attr("onclick");if("undefined"!=typeof b){var c=b.slice(b.indexOf("(")+1,b.indexOf(")")),d=c.split(",");-1==b.indexOf("FromReport")?a.find("a").attr("onclick","return customSendUnits("+c+", $(this))"):a.find("a").attr("onclick","return customSendUnitsFromReport("+c+"))"),a.closest("tr").attr("name",$.trim(d[1]))}}function addTableInfo(){$("#am_widget_Farm tr th").slice(0,1).after("<th></th>"),$("#am_widget_Farm tr:not(:first-child)").each(function(a){$(this).children("td").each(function(b){switch(b){case 1:$(this).filter(":first").before("<td style='width:10px;font-weight:bold;' id='rowNum'>"+(a+1)+"</td>");break;case 3:var c=$(this).find("img"),d=$(this).find("img").prop("tooltipText");if("undefined"!=typeof d){var e=d.replace(/\D/g,"");c.after("<span style='font-weight:bold;'> ("+e+")</span>")}break;case 8:setOnclick($(this));break;case 9:setOnclick($(this));break;case 10:setOnclick($(this))}})})}function checkIfNextVillage(){if(current_units=Accountmanager.farm.current_units,userset[s.next_village_scouts]){var a=current_units.spy;if(a<=parseInt(userset[s.scouts_left]))return getNewVillage("n"),!0}if(userset[s.next_village_farming_troops]){var b=0;if($(".fm_unit input:checked").each(function(a){var c=$(this).attr("name");b+=parseInt(current_units[c])}),b<=parseInt(userset[s.farming_troops_left]))return getNewVillage("n"),!0}return userset[s.next_village_no_farms]&&0==$("#plunder_list tr:not(:first-child):visible").length?(getNewVillage("n"),!0):void 0}function applySettings(){pagesLoaded?applyFilters():(setTimeout(showAllRows(),1),removeFirstPage())}function applyFilters(){$("#am_widget_Farm tr:gt(0)").each(function(a){hideRow=checkRowToHide($(this),userset),hideRow&&$(this).hide()}),changeHeader(filter_40);var a=0;"fixed"==$("#topContainer").css("position")&&(a=$("#topContainer").height()),$('*:contains("Bot Protection")').length?($("html, body").animate({scrollTop:$('*:contains("Bot Protection")').offset().top-a},500),cansend=!1):$("html, body").animate({scrollTop:$("#farm_units").offset().top-a},500),filtersApplied=!0}function checkRowToHide(a,b){return hideRow=!1,a.children("td").each(function(a){switch(a){case 2:reportSettings($(this),b);break;case 3:haulSettings($(this),b);break;case 4:hideRecentlyFarmed($(this),b),attackSettings($(this),b),continentSettings($(this),b);break;case 5:hideTime($(this),b);break;case 6:scoutReportSettings($(this),b);break;case 7:wallSettings($(this),b);break;case 8:distanceSettings($(this),b)}}),hideRow?(troubleshoot&&console.log(a.find("#rowNum").html()+": ("+reason.join(",")+")"),reason=[],!0):!1}function resetTable(){$("#plunder_list tr").each(function(a){$(this).show()})}function setLocalStorageRow(a){var b="sitter:"+sitter+", village:"+a+", world:"+getURL()[0];$.jStorage.set(b,getCurrentGameTime())}function reportSettings(a,b){return a.html().indexOf("blue")>=0&&b[s.blue]?(reason.push("Report is blue"),void(hideRow=!0)):a.html().indexOf("green")>=0&&b[s.green]?(reason.push("Report is green"),void(hideRow=!0)):a.html().indexOf("yellow")>=0&&b[s.yellow]?(reason.push("Report is yellow"),void(hideRow=!0)):a.html().indexOf("red_yellow")>=0&&b[s.red_yellow]?(reason.push("Report is red_yellow"),void(hideRow=!0)):a.html().indexOf("red_blue")>=0&&b[s.red_blue]?(reason.push("Report is red_blue"),void(hideRow=!0)):a.html().indexOf("red")>=0&&b[s.red]?(reason.push("Report is red"),void(hideRow=!0)):void 0}function haulSettings(a,b){if(b[s.enable_hauls]){if(a.html().indexOf("max_loot/1")>=0&&b[s.full])return reason.push("Haul is full"),void(hideRow=!0);if(a.html().indexOf("max_loot/0")>=0&&b[s.partial])return reason.push("Haul is partial"),void(hideRow=!0);if(-1==a.html().indexOf("max_loot")&&b[s.full])return reason.push("No haul graphic"),void(hideRow=!0)}}function hideRecentlyFarmed(a,b){if(b[s.hide_recent_farms]){var c=a.closest("tr").attr("name");localTitle="sitter:"+sitter+", village:"+c+", world:"+getURL()[0];var d=new Date($.jStorage.get(localTitle)),e=currentGameTime,f=d,g=e.getTime()-f.getTime(),h=Math.abs(parseInt(g/1e3/60));switch(b[s.sent_time_filter]){case"hide":if(h<parseInt(b[s.hide_recent_time]))return reason.push("Village was recently sent to "+h+" minutes ago"),void(hideRow=!0);break;case"show":if(h>parseInt(b[s.hide_recent_time]))return reason.push("Village was not recently sent to"),void(hideRow=!0)}}}function attackSettings(a,b){var c,d=a.find("img");if(c="undefined"!=typeof d.prop("tooltipText")?parseInt(d.prop("tooltipText").replace(/\D/g,"")):0,b[s.enable_attacks])switch(b[s.attack_operator]){case"greater_than":if(c>parseInt(b[s.attack_value]))return reason.push("Outgoing attacks is too many"),void(hideRow=!0);break;case"less_than":if(c<parseInt(b[s.attack_value]))return reason.push("Outgoing attacks is too few"),void(hideRow=!0);break;case"equal_to":if(c==parseInt(b[s.attack_value]))return reason.push("Outgoing attacks is equal"),void(hideRow=!0)}}function continentSettings(a,b){var c=a.find("a").html();if("undefined"!=typeof c){c=c.substr(c.length-2);var d=b[s.continents_list].split(".");if($.inArray(c,d)>=0&&"hide"==b[s.continent_display])return reason.push("Continent is set to hide"),void(hideRow=!0);if(-1==$.inArray(c,d)&&"show"==b[s.continent_display])return reason.push("Continent is not set to show"),void(hideRow=!0)}}function hideTime(a,b){if(b[s.enable_time]){var c=currentGameTime,d=getVillageAttackedTime(a),e=c.getTime()-d.getTime(),f=Math.abs(parseInt(e/1e3/60));switch(b[s.attack_time_filter]){case"hide":if(f<parseInt(b[s.time_value]))return reason.push("Village attacked "+f+" minutes ago."),void(hideRow=!0);break;case"show":if(f>parseInt(b[s.time_value]))return reason.push("Village attacked "+f+" minutes ago."),void(hideRow=!0)}}}function scoutReportSettings(a,b){var c;if(b[s.enable_scout]){if("?"==$.trim(a.find("span").html()))c=0;else{var d=parseInt(a.children("span").eq(0).html().replace(/\D+/g,"")),e=parseInt(a.children("span").eq(1).html().replace(/\D+/g,"")),f=parseInt(a.children("span").eq(2).html().replace(/\D+/g,""));c=d+e+f}switch(b[s.scout_report_operator]){case"greater_than":if(c>parseInt(b[s.haul_value]))return reason.push("Too many resources"),void(hideRow=!0);break;case"less_than":if(c<parseInt(b[s.haul_value]))return reason.push("Not enough resources"),void(hideRow=!0);break;case"equal_to":if(c==parseInt(b[s.haul_value]))return reason.push("Exact resources"),void(hideRow=!0)}}}function wallSettings(a,b){if(b[s.enable_walls]){var c=parseInt(a.html());switch("?"==c&&(c=0),$.trim(b[s.wall_operator])){case"greater_than":if(c>parseInt(b[s.wall_value]))return reason.push("Wall too high"),void(hideRow=!0);break;case"less_than":if(c<parseInt(b[s.wall_value]))return reason.push("Wall too low"),void(hideRow=!0);break;case"equal_to":if(c==parseInt(b[s.wall_value]))return reason.push("Wall is exact"),void(hideRow=!0)}}}function distanceSettings(a,b){if(b[s.enable_distances]){var c=a.html();switch($.trim(b[s.distance_operator])){case"greater_than":if(parseFloat(c)>parseFloat(b[s.distance_value]))return reason.push("Village too far"),void(hideRow=!0);break;case"less_than":if(parseFloat(c)<parseFloat(b[s.distance_value]))return reason.push("Village too close"),void(hideRow=!0);break;case"equal_to":if(parseFloat(c)==parseFloat(b[s.distance_value]))return reason.push("Village exact distance"),void(hideRow=!0)}}}function deleteRecentlyFarmed(){$("#am_widget_Farm tr:gt(0)").each(function(a){$(this).children("td").each(function(a){4==a&&(reportLinkText=$.trim($(this).children("a").html()),localTitle="sitter:"+sitter+", village:"+reportLinkText+", world:"+getURL()[0],null!=$.jStorage.get(localTitle)&&$.jStorage.deleteKey(localTitle))})})}function getCurrentGameTime(){var a=$("#serverTime").html().split(":"),b=$("#serverDate").html().split("/");return new Date(b[2],b[1]-1,b[0],a[0],a[1],a[2],0)}function getVillageAttackedTime(a){for(var b,c,a,d=a.html(),e=d.split(" "),f=0;f<e.length;f++)a=$.trim(e[f]),a.indexOf(".")>-1?b=a:a==filter_61?b=filter_61:a==filter_62&&(b=filter_62),a.indexOf(":")>-1&&(c=a);if(b==filter_61||b==filter_62){var g=currentGameTime.getDate();b==filter_62&&g--;var h=currentGameTime.getMonth(),i=currentGameTime.getFullYear(),d=c.split(":"),j=d[0],k=d[1],l=d[2];return new Date(i,h,g,j,k,l,0)}var m=b.split("."),g=m[0],h=m[1]-1;if(0==currentGameTime.getMonth()&&11==h)var i=currentGameTime.getFullYear()-1;else var i=currentGameTime.getFullYear();var d=c.split(":"),j=d[0],k=d[1],l=d[2];return new Date(i,h,g,j,k,l,0)}function loadDefaultProfile(){null==$.jStorage.get("profile:"+profile_10)&&($.jStorage.set("profile:"+profile_10,["1","1","distance","asc",!1,!1,!1,!1,!1,!1,!1,!1,"hide","",!1,!1,!1,!1,"greater_than","",!1,"greater_than","",!1,"greater_than","",!1,"greater_than","","hide","",!1,"hide","",!1,!1,!1,"",!1,"",!1]),$.jStorage.deleteKey("profileList"),$.jStorage.set("profileList",[profile_10])),userset=$.jStorage.get("profile:"+profile_10),loadProfile(profile_10),$("#settingsProfile").val(profile_10)}function setDefaultProfile(){if($("#settingsProfile").val()==profile_10){var a=confirm(dialog_02);if(!a)return!1;createProfile(),setDefaultProfile()}else{var b=$.jStorage.get("profile:"+$("#settingsProfile").val());$.jStorage.set("profile:"+profile_10,b)}}function fillProfileList(){var a=$.jStorage.get("profileList");$.each(a,function(a,b){$("#settingsProfile").append("<option value='"+b+"'>"+b+"</option>")}),$("#settingsProfile").val($.jStorage.get("DefaultProfile"))}function createProfile(){var a=prompt(dialog_03+":");if(-1!=$.inArray(a,$.jStorage.get("profileList")))return alert(dialog_04),createProfile(),!1;if(""==a)return alert(dialog_05),createProfile(),!1;if(null!=a&&""!=a){var b=[];b.push($("#start_page").val()),b.push($("#end_page").val()),b.push($("#order_by").val()),b.push($("#direction").val()),b.push($("#all_none").prop("checked")),b.push($("#blue").prop("checked")),b.push($("#green").prop("checked")),b.push($("#yellow").prop("checked")),b.push($("#red_yellow").prop("checked")),b.push($("#red_blue").prop("checked")),b.push($("#red").prop("checked")),b.push($("#hide_recent_farms").prop("checked")),b.push($("#sent_time_filter").val()),b.push($("#hide_recent_time").val()),b.push($("#enable_hauls").prop("checked")),b.push($("#full").prop("checked")),b.push($("#partial").prop("checked")),b.push($("#enable_attacks").prop("checked")),b.push($("#attack_operator").val()),b.push($("#attack_value").val()),b.push($("#enable_walls").prop("checked")),b.push($("#wall_operator").val()),b.push($("#wall_value").val()),b.push($("#enable_distances").prop("checked")),b.push($("#distance_operator").val()),b.push($("#distance_value").val()),b.push($("#enable_scout").prop("checked")),b.push($("#scout_report_operator").val()),b.push($("#haul_value").val()),b.push($("#continent_display").val()),b.push($("#continents_list").val()),b.push($("#enable_time").prop("checked")),b.push($("#attack_time_filter").val()),b.push($("#time_value").val()),b.push($("#enable_auto_run").prop("checked")),b.push($("#next_village_no_farms").prop("checked")),b.push($("#next_village_scouts").prop("checked")),b.push($("#scouts_left").val()),b.push($("#next_village_farming_troops").prop("checked")),b.push($("#farming_troops_left").val()),b.push($("#next_village_units").prop("checked")),$.jStorage.set("profile:"+a,b);var c=$.jStorage.get("profileList");c.push(a),$.jStorage.set("profileList",c),$("#settingsProfile").append("<option value='"+a+"'>"+a+"</option>"),$("#priorityOneProfile").append("<option value='"+a+"'>"+a+"</option>"),$("#priorityTwoProfile").append("<option value='"+a+"'>"+a+"</option>"),$("#priorityThreeProfile").append("<option value='"+a+"'>"+a+"</option>"),$("#settingsProfile").val(a)}}function loadProfile(a){var b=$.jStorage.get("profile:"+a);userset=b,$("#start_page").val(b[0]),$("#end_page").val(b[1]),$("#order_by").val(b[2]),$("#direction").val(b[3]),$("#all_none").prop("checked",b[4]),$("#blue").prop("checked",b[5]),$("#green").prop("checked",b[6]),$("#yellow").prop("checked",b[7]),$("#red_yellow").prop("checked",b[8]),$("#red_blue").prop("checked",b[9]),$("#red").prop("checked",b[10]),$("#hide_recent_farms").prop("checked",b[11]),$("#sent_time_filter").val(b[12]),$("#hide_recent_time").val(b[13]),$("#enable_hauls").prop("checked",b[14]),$("#full").prop("checked",b[15]),$("#partial").prop("checked",b[16]),$("#enable_attacks").prop("checked",b[17]),$("#attack_operator").val(b[18]),$("#attack_value").val(b[19]),$("#enable_walls").prop("checked",b[20]),$("#wall_operator").val(b[21]),$("#wall_value").val(b[22]),$("#enable_distances").prop("checked",b[23]),$("#distance_operator").val(b[24]),$("#distance_value").val(b[25]),$("#enable_scout").prop("checked",b[26]),$("#scout_report_operator").val(b[27]),$("#haul_value").val(b[28]),$("#continent_display").val(b[29]),$("#continents_list").val(b[30]),$("#enable_time").prop("checked",b[31]),$("#attack_time_filter").val(b[32]),$("#time_value").val(b[33]),$("#enable_auto_run").prop("checked",b[34]),$("#next_village_no_farms").prop("checked",b[35]),$("#next_village_scouts").prop("checked",b[36]),$("#scouts_left").val(b[37]),$("#next_village_farming_troops").prop("checked",b[38]),$("#farming_troops_left").val(b[39]),$("#next_village_units").prop("checked",b[40])}function changeProfile(a){loadProfile(a),resetTable(),applyFilters()}function deleteProfile(){var a=$("#settingsProfile").val();if(a==profile_10)alert(dialog_06);else{var b=$.jStorage.get("profileList");b.splice(b.indexOf(a),1),$.jStorage.set("profileList",b),$.jStorage.deleteKey("profile:"+a),$("#settingsProfile option[value='"+a+"']").remove(),$("#priorityOneProfile option[value='"+a+"']").remove(),$("#priorityTwoProfile option[value='"+a+"']").remove(),$("#priorityThreeProfile option[value='"+a+"']").remove(),loadDefaultProfile(profile_10)}}function updateProfile(){var a=$("#settingsProfile").val(),b=[];b.push($("#start_page").val()),b.push($("#end_page").val()),b.push($("#order_by").val()),b.push($("#direction").val()),b.push($("#all_none").prop("checked")),b.push($("#blue").prop("checked")),b.push($("#green").prop("checked")),b.push($("#yellow").prop("checked")),b.push($("#red_yellow").prop("checked")),b.push($("#red_blue").prop("checked")),b.push($("#red").prop("checked")),b.push($("#hide_recent_farms").prop("checked")),b.push($("#sent_time_filter").val()),b.push($("#hide_recent_time").val()),b.push($("#enable_hauls").prop("checked")),b.push($("#full").prop("checked")),b.push($("#partial").prop("checked")),b.push($("#enable_attacks").prop("checked")),b.push($("#attack_operator").val()),b.push($("#attack_value").val()),b.push($("#enable_walls").prop("checked")),b.push($("#wall_operator").val()),b.push($("#wall_value").val()),
  3. b.push($("#enable_distances").prop("checked")),b.push($("#distance_operator").val()),b.push($("#distance_value").val()),b.push($("#enable_scout").prop("checked")),b.push($("#scout_report_operator").val()),b.push($("#haul_value").val()),b.push($("#continent_display").val()),b.push($("#continents_list").val()),b.push($("#enable_time").prop("checked")),b.push($("#attack_time_filter").val()),b.push($("#time_value").val()),b.push($("#enable_auto_run").prop("checked")),b.push($("#next_village_no_farms").prop("checked")),b.push($("#next_village_scouts").prop("checked")),b.push($("#scouts_left").val()),b.push($("#next_village_farming_troops").prop("checked")),b.push($("#farming_troops_left").val()),b.push($("#next_village_units").prop("checked")),$.jStorage.set("profile:"+a,b),userset=b}function exportProfile(){var a=$("#settingsProfile").val(),b=$.jStorage.get("profile:"+a);if(a==profile_10)alert(dialog_07);else{prompt(dialog_08,dialog_09A+""+a+dialog_09B+a+","+b+dialog_09C)}}function importProfile(){var a=prompt(dialog_10+":",dialog_11);a=a.split(",");var b=a[0];a.shift();var c=$.jStorage.get("profileList");if(-1!=$.inArray(b,c))return alert(dialog_12),!1;for(i=0;i<=a.length;i++)("false"===a[i]||"true"===a[i])&&(a[i]=parseBool(a[i]));$.jStorage.set("profile:"+b,a),c.push(b),$.jStorage.set("profileList",c),$("#settingsProfile").append("<option value='"+b+"'>"+b+"</option>"),$("#settingsProfile").val(b),loadProfile(b)}function hotkeysOnOff(){$("#settingsBody tr:lt(9) input,#settingsBody tr:lt(9) select").focusin(function(){window.onkeydown=function(){}}),$("#settingsBody tr:lt(9) input,#settingsBody tr:lt(9) select").focusout(function(){turnOnHotkeys()})}function turnOnHotkeys(){window.onkeydown=function(a){if(editingKey)editKey(a);else{var b=$("#plunder_list tr").filter(":visible").eq(1),c=b.children("td").eq(9).children("a"),d=b.children("td").eq(10).children("a"),e=b.children("td").eq(11).children("a");switch(a.which){case keycodes.a:tryClick(c);break;case keycodes.b:tryClick(d);break;case keycodes.c:tryClick(e);break;case keycodes.skip:b.hide();break;case keycodes.master:cansend&&filtersApplied&&selectMasterButton(b);break;case keycodes.left:getNewVillage("p");break;case keycodes.right:getNewVillage("n");break;default:return}}a.preventDefault()}}function tryClick(a){cansend&&filtersApplied&&(checkIfNextVillage()||(a.hasClass("farm_icon_disabled")||void 0==a.html()?(UI.ErrorMessage("That button is not selectable. Skipping row...",500),a.closest("tr").hide()):(a.click(),doTime(userset[s.next_village_scouts]||userset[s.next_village_farming_troops]?400:250))))}function doTime(a){cansend=!1,setTimeout(function(){cansend=!0},a)}function editKey(a){if(a.keyCode<=37&&a.keyCode>=40||a.keyCode<=48&&a.keyCode>=90)UI.ErrorMessage("You can only enter letters, numbers, or arrows. Plese try another key.",1500);else{var b=String.fromCharCode(a.keyCode);switch(37==a.keyCode&&(b="←"),38==a.keyCode&&(b="↑"),39==a.keyCode&&(b="→"),40==a.keyCode&&(b="↓"),keyToEdit){case"A":keycodes.a=a.keyCode,$("#hotkey_value_a").val(b);break;case"B":keycodes.b=a.keyCode,$("#hotkey_value_b").val(b);break;case"C":keycodes.c=a.keyCode,$("#hotkey_value_c").val(b);break;case"Master":keycodes.master=a.keyCode,$("#hotkey_value_master").val(b);break;case"Skip":keycodes.skip=a.keyCode,$("#hotkey_value_skip").val(b);break;case"Left":keycodes.left=a.keyCode,$("#hotkey_value_left").val(b);break;case"Right":keycodes.right=a.keyCode,$("#hotkey_value_right").val(b);break;default:return}UI.SuccessMessage(b+" is now mapped to the "+keyToEdit+" button."),updateKeypressSettings(),editingKey=!1}}function updateKeypressSettings(){keyPressSettings.a_code=keycodes.a,keyPressSettings.a_char=$("#hotkey_value_a").val(),keyPressSettings.b_code=keycodes.b,keyPressSettings.b_char=$("#hotkey_value_b").val(),keyPressSettings.c_code=keycodes.c,keyPressSettings.c_char=$("#hotkey_value_c").val(),keyPressSettings.master_code=keycodes.master,keyPressSettings.master_char=$("#hotkey_value_master").val(),keyPressSettings.skip_code=keycodes.skip,keyPressSettings.skip_char=$("#hotkey_value_skip").val(),keyPressSettings.left_code=keycodes.left,keyPressSettings.left_char=$("#hotkey_value_left").val(),keyPressSettings.right_code=keycodes.right,keyPressSettings.right_char=$("#hotkey_value_right").val(),keyPressSettings.priorityOneEnabled=$("#priorityOneEnabled").prop("checked"),keyPressSettings.priorityOneProfile=$("#priorityOneProfile").val(),keyPressSettings.priorityOneButton=$("#priorityOneButton").val(),keyPressSettings.priorityTwoEnabled=$("#priorityTwoEnabled").prop("checked"),keyPressSettings.priorityTwoProfile=$("#priorityTwoProfile").val(),keyPressSettings.priorityTwoButton=$("#priorityTwoButton").val(),keyPressSettings.priorityThreeEnabled=$("#priorityThreeEnabled").prop("checked"),keyPressSettings.priorityThreeProfile=$("#priorityThreeProfile").val(),keyPressSettings.priorityThreeButton=$("#priorityThreeButton").val(),keyPressSettings.defaultButton=$("#defaultButton").val(),$.jStorage.set("keyPressSettings",keyPressSettings)}function fillKeypressSettings(){null==$.jStorage.get("keyPressSettings")&&$.jStorage.set("keyPressSettings",keyPressSettings),keyPressSettings=$.jStorage.get("keyPressSettings"),keycodes.a=keyPressSettings.a_code,$("#hotkey_value_a").val(keyPressSettings.a_char),keycodes.b=keyPressSettings.b_code,$("#hotkey_value_b").val(keyPressSettings.b_char),keycodes.c=keyPressSettings.c_code,$("#hotkey_value_c").val(keyPressSettings.c_char),keycodes.master=keyPressSettings.master_code,$("#hotkey_value_master").val(keyPressSettings.master_char),keycodes.skip=keyPressSettings.skip_code,$("#hotkey_value_skip").val(keyPressSettings.skip_char),keycodes.left=keyPressSettings.left_code,$("#hotkey_value_left").val(keyPressSettings.left_char),keycodes.right=keyPressSettings.right_code,$("#hotkey_value_right").val(keyPressSettings.right_char),$("#priorityOneEnabled").prop("checked",keyPressSettings.priorityOneEnabled),$("#priorityOneProfile").val(keyPressSettings.priorityOneProfile),$("#priorityOneButton").val(keyPressSettings.priorityOneButton),$("#priorityTwoEnabled").prop("checked",keyPressSettings.priorityTwoEnabled),$("#priorityTwoProfile").val(keyPressSettings.priorityTwoProfile),$("#priorityTwoButton").val(keyPressSettings.priorityTwoButton),$("#priorityThreeEnabled").prop("checked",keyPressSettings.priorityThreeEnabled),$("#priorityThreeProfile").val(keyPressSettings.priorityThreeProfile),$("#priorityThreeButton").val(keyPressSettings.priorityThreeButton),$("#defaultButton").val(keyPressSettings.defaultButton)}function setKeyEditMode(a){return editingKey=!0,keyToEdit=a,UI.InfoMessage("Press any number, letter, or arrow key to set the hotkey for the <span style='font-weight:bold;'>"+a+"</span> button",1500),!1}function fillMasterSettings(){var a=$.jStorage.get("profileList");$.each(a,function(a,b){$("#priorityOneProfile").append("<option value='"+b+"'>"+b+"</option>"),$("#priorityTwoProfile").append("<option value='"+b+"'>"+b+"</option>"),$("#priorityThreeProfile").append("<option value='"+b+"'>"+b+"</option>")})}function selectMasterButton(a){var b,c=$.jStorage.get("profile:"+keyPressSettings.priorityOneProfile),d=$.jStorage.get("profile:"+keyPressSettings.priorityTwoProfile),e=$.jStorage.get("profile:"+keyPressSettings.priorityThreeProfile),f=a.children("td").eq(9).children("a"),g=a.children("td").eq(10).children("a"),h=a.children("td").eq(11).children("a");switch(b=keyPressSettings.defaultButton,keyPressSettings.priorityThreeEnabled&&!checkRowToHide(a,e)&&(b=keyPressSettings.priorityThreeButton),keyPressSettings.priorityTwoEnabled&&!checkRowToHide(a,d)&&(b=keyPressSettings.priorityTwoButton),keyPressSettings.priorityOneEnabled&&!checkRowToHide(a,c)&&(b=keyPressSettings.priorityOneButton),b){case"A":tryClick(f);break;case"B":tryClick(g);break;case"C":tryClick(h);break;default:a.hide()}}function setDefaultLanguage(){var a=getURL();3==a.length&&a.shift();var b=a.join(".");switch(b){case"fyletikesmaxes.gr":$.jStorage.set("language","el");break;case"guerrastribales.es":$.jStorage.set("language","es");break;case"tribalwars.ae":$.jStorage.set("language","ar");break;default:$.jStorage.set("language","en")}}function loadLanguage(a){$.jStorage.set("language",a);var b=$.jStorage.get("profileList"),c=$.jStorage.get("profile:"+profile_10);$.inArray(a,availableLangs)<0&&(a="en");var d=scriptURL+"lang/"+a+".js";$.getScript(d,function(){$("#settingsDiv").remove(),b[0]=profile_10,$.jStorage.set("profileList",b),$.jStorage.set("profile:"+profile_10,c),changeHeader(filter_40),showSettings()})}function addLanguages(){$("#language").append("<option value='en'>English</option>"),$("#language").append("<option value='el'>Ελληνικά</option>"),$("#language").append("<option value='es'>Español</option>"),$("#language").append("<option value='pt'>Português</option>"),$("#language").append("<option value='ar'>اللغة العربية</option>")}function parseBool(a){return"undefined"==typeof a?!1:"true"===a.replace(/^\s+|\s+$/g,"").toLowerCase()}function getURL(){var a=window.location.hostname;return a=a.split(".")}function checkPage(){"am_farm"!==window.game_data.screen?getFA():run()}function getFA(){fadeThanksToCheese(),openLoader();var a=link[0]+window.game_data.village.id+link[1];$.getScript("https://"+window.location.host+"/js/game/Accountmanager.js",function(){$.ajax({type:"GET",url:a,dataType:"html",error:function(a,b,c){alert("Get LA error: "+c),$("#fader").remove(),$("#loaders").remove()},success:function(a){var b=$(a),c=a.split("<title>")[1].split("</title>")[0];window.game_data=$.parseJSON(a.split("var game_data = ")[1].split("};")[0]+"}"),$("#header_info").html($("#header_info",b).html()),$("#topContainer").html($("#topContainer",b).html()),$("#contentContainer").html($("#contentContainer",b).html()),$("head").find("title").html(c),$("#fader").remove(),$("#loaders").remove(),run()}})})}function fadeThanksToCheese(){var a=document.createElement("div");a.id="fader",a.style.position="fixed",a.style.height="100%",a.style.width="100%",a.style.backgroundColor="black",a.style.top="0px",a.style.left="0px",a.style.opacity="0.6",a.style.zIndex="12000",document.body.appendChild(a)}function openLoader(){var a=document.createElement("div");a.id="loaders",a.style.position="fixed",a.style.width="24px",a.style.height="24px",a.style.top="50%",a.style.left="50%",$(a).css("margin-left","-12px"),$(a).css("margin-top","-12px"),a.style.zIndex=13e3,$(a).append($("<img src='graphic/throbber.gif' height='24' width='24'></img>")),$("#contentContainer").append($(a))}function makeItPretty(){$(".row_a").css("background-color","rgb(216, 255, 216)"),$("#plunder_list").find("tr:gt(0)").each(function(a){$(this).removeClass("row_a"),$(this).removeClass("row_b"),a%2==0?$(this).addClass("row_a"):$(this).addClass("row_b")}),hideStuffs()}function hideStuffs(){$("#plunder_list").hide(),$("#plunder_list_nav").hide(),$("#contentContainer").find('div[class="vis"]').eq(0).children().eq(0).append($("<div class='vis' style='float:right;text-align:center;line-height:100%;width:12px;height:12px;margin:0px 0px 0px 0px;position:relative;background-color:tan;opacity:.7'><a href='#' num='0' onclick='uglyHider($(this));return false;'>+</a></div>")),$("#contentContainer").find('div[class="vis"]').eq(0).children().eq(1).hide(),$("#am_widget_Farm").find("h4").eq(0).append($("<div class='vis' style='float:right;text-align:center;line-height:100%;width:12px;height:12px;margin:0px 0px 0px 0px;position:relative;background-color:tan;opacity:.7'><a href='#' num='1' onclick='uglyHider($(this));return false;'>+</a></div>")),$("#plunder_list_filters").hide()}function uglyHider(a){var b;b=$("#settingsBody").length>0?2:1,"+"===$(a).text()?$(a).text("-"):$(a).text("+"),0==parseInt($(a).attr("num"))?$("#contentContainer").find('div[class="vis"]').eq(b).children().eq(1).toggle():1==parseInt($(a).attr("num"))?$("#plunder_list_filters").toggle():2==parseInt($(a).attr("num"))&&$("#settingsBody").toggle()}!function(){"use strict";function a(){var a=!1;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","tmpval"),a=!0,window.localStorage.removeItem("_tmptest")}catch(b){}if(a)try{window.localStorage&&(v=window.localStorage,y="localStorage",B=v.jStorage_update)}catch(e){}else if("globalStorage"in window)try{window.globalStorage&&(v="localhost"==window.location.hostname?window.globalStorage["localhost.localdomain"]:window.globalStorage[window.location.hostname],y="globalStorage",B=v.jStorage_update)}catch(f){}else{if(w=document.createElement("link"),!w.addBehavior)return void(w=null);w.style.behavior="url(#default#userData)",document.getElementsByTagName("head")[0].appendChild(w);try{w.load("jStorage")}catch(g){w.setAttribute("jStorage","{}"),w.save("jStorage"),w.load("jStorage")}var i="{}";try{i=w.getAttribute("jStorage")}catch(j){}try{B=w.getAttribute("jStorage_update")}catch(m){}v.jStorage=i,y="userDataBehavior"}h(),k(),c(),l(),"addEventListener"in window&&window.addEventListener("pageshow",function(a){a.persisted&&d()},!1)}function b(){var a="{}";if("userDataBehavior"==y){w.load("jStorage");try{a=w.getAttribute("jStorage")}catch(b){}try{B=w.getAttribute("jStorage_update")}catch(c){}v.jStorage=a}h(),k(),l()}function c(){"localStorage"==y||"globalStorage"==y?"addEventListener"in window?window.addEventListener("storage",d,!1):document.attachEvent("onstorage",d):"userDataBehavior"==y&&setInterval(d,1e3)}function d(){var a;clearTimeout(A),A=setTimeout(function(){if("localStorage"==y||"globalStorage"==y)a=v.jStorage_update;else if("userDataBehavior"==y){w.load("jStorage");try{a=w.getAttribute("jStorage_update")}catch(b){}}a&&a!=B&&(B=a,e())},25)}function e(){var a,c=s.parse(s.stringify(u.__jstorage_meta.CRC32));b(),a=s.parse(s.stringify(u.__jstorage_meta.CRC32));var d,e=[],g=[];for(d in c)if(c.hasOwnProperty(d)){if(!a[d]){g.push(d);continue}c[d]!=a[d]&&"2."==String(c[d]).substr(0,2)&&e.push(d)}for(d in a)a.hasOwnProperty(d)&&(c[d]||e.push(d));f(e,"updated"),f(g,"deleted")}function f(a,b){a=[].concat(a||[]);var c,d,e,f;if("flushed"==b){a=[];for(var g in z)z.hasOwnProperty(g)&&a.push(g);b="deleted"}for(c=0,e=a.length;e>c;c++){if(z[a[c]])for(d=0,f=z[a[c]].length;f>d;d++)z[a[c]][d](a[c],b);if(z["*"])for(d=0,f=z["*"].length;f>d;d++)z["*"][d](a[c],b)}}function g(){var a=(+new Date).toString();if("localStorage"==y||"globalStorage"==y)try{v.jStorage_update=a}catch(b){y=!1}else"userDataBehavior"==y&&(w.setAttribute("jStorage_update",a),w.save("jStorage"));d()}function h(){if(v.jStorage)try{u=s.parse(String(v.jStorage))}catch(a){v.jStorage="{}"}else v.jStorage="{}";x=v.jStorage?String(v.jStorage).length:0,u.__jstorage_meta||(u.__jstorage_meta={}),u.__jstorage_meta.CRC32||(u.__jstorage_meta.CRC32={})}function i(){n();try{v.jStorage=s.stringify(u),w&&(w.setAttribute("jStorage",v.jStorage),w.save("jStorage")),x=v.jStorage?String(v.jStorage).length:0}catch(a){}}function j(a){if("string"!=typeof a&&"number"!=typeof a)throw new TypeError("Key name must be string or numeric");if("__jstorage_meta"==a)throw new TypeError("Reserved key name");return!0}function k(){var a,b,c,d,e=1/0,h=!1,j=[];if(clearTimeout(t),u.__jstorage_meta&&"object"==typeof u.__jstorage_meta.TTL){a=+new Date,c=u.__jstorage_meta.TTL,d=u.__jstorage_meta.CRC32;for(b in c)c.hasOwnProperty(b)&&(c[b]<=a?(delete c[b],delete d[b],delete u[b],h=!0,j.push(b)):c[b]<e&&(e=c[b]));e!=1/0&&(t=setTimeout(k,Math.min(e-a,2147483647))),h&&(i(),g(),f(j,"deleted"))}}function l(){var a,b;if(u.__jstorage_meta.PubSub){var c,d=D,e=[];for(a=b=u.__jstorage_meta.PubSub.length-1;a>=0;a--)c=u.__jstorage_meta.PubSub[a],c[0]>D&&(d=c[0],e.unshift(c));for(a=e.length-1;a>=0;a--)m(e[a][1],e[a][2]);D=d}}function m(a,b){if(C[a])for(var c=0,d=C[a].length;d>c;c++)try{C[a][c](a,s.parse(s.stringify(b)))}catch(e){}}function n(){if(u.__jstorage_meta.PubSub){for(var a=+new Date-2e3,b=0,c=u.__jstorage_meta.PubSub.length;c>b;b++)if(u.__jstorage_meta.PubSub[b][0]<=a){u.__jstorage_meta.PubSub.splice(b,u.__jstorage_meta.PubSub.length-b);break}u.__jstorage_meta.PubSub.length||delete u.__jstorage_meta.PubSub}}function o(a,b){u.__jstorage_meta||(u.__jstorage_meta={}),u.__jstorage_meta.PubSub||(u.__jstorage_meta.PubSub=[]),u.__jstorage_meta.PubSub.unshift([+new Date,a,b]),i(),g()}function p(a,b){for(var c,d=a.length,e=b^d,f=0;d>=4;)c=255&a.charCodeAt(f)|(255&a.charCodeAt(++f))<<8|(255&a.charCodeAt(++f))<<16|(255&a.charCodeAt(++f))<<24,c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16),c^=c>>>24,c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16),e=1540483477*(65535&e)+((1540483477*(e>>>16)&65535)<<16)^c,d-=4,++f;switch(d){case 3:e^=(255&a.charCodeAt(f+2))<<16;case 2:e^=(255&a.charCodeAt(f+1))<<8;case 1:e^=255&a.charCodeAt(f),e=1540483477*(65535&e)+((1540483477*(e>>>16)&65535)<<16)}return e^=e>>>13,e=1540483477*(65535&e)+((1540483477*(e>>>16)&65535)<<16),e^=e>>>15,e>>>0}var q="0.4.12",r=window.jQuery||window.$||(window.$={}),s={parse:window.JSON&&(window.JSON.parse||window.JSON.decode)||String.prototype.evalJSON&&function(a){return String(a).evalJSON()}||r.parseJSON||r.evalJSON,stringify:Object.toJSON||window.JSON&&(window.JSON.stringify||window.JSON.encode)||r.toJSON};if("function"!=typeof s.parse||"function"!=typeof s.stringify)throw new Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");var t,u={__jstorage_meta:{CRC32:{}}},v={jStorage:"{}"},w=null,x=0,y=!1,z={},A=!1,B=0,C={},D=+new Date,E={isXML:function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?"HTML"!==b.nodeName:!1},encode:function(a){if(!this.isXML(a))return!1;try{return(new XMLSerializer).serializeToString(a)}catch(b){try{return a.xml}catch(c){}}return!1},decode:function(a){var b,c="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(a){var b=new ActiveXObject("Microsoft.XMLDOM");return b.async="false",b.loadXML(a),b};return c?(b=c.call("DOMParser"in window&&new DOMParser||window,a,"text/xml"),this.isXML(b)?b:!1):!1}};r.jStorage={version:q,set:function(a,b,c){if(j(a),c=c||{},"undefined"==typeof b)return this.deleteKey(a),b;if(E.isXML(b))b={_is_xml:!0,xml:E.encode(b)};else{if("function"==typeof b)return void 0;b&&"object"==typeof b&&(b=s.parse(s.stringify(b)))}return u[a]=b,u.__jstorage_meta.CRC32[a]="2."+p(s.stringify(b),2538058380),this.setTTL(a,c.TTL||0),f(a,"updated"),b},get:function(a,b){return j(a),a in u?u[a]&&"object"==typeof u[a]&&u[a]._is_xml?E.decode(u[a].xml):u[a]:"undefined"==typeof b?null:b},deleteKey:function(a){return j(a),a in u?(delete u[a],"object"==typeof u.__jstorage_meta.TTL&&a in u.__jstorage_meta.TTL&&delete u.__jstorage_meta.TTL[a],delete u.__jstorage_meta.CRC32[a],i(),g(),f(a,"deleted"),!0):!1},setTTL:function(a,b){var c=+new Date;return j(a),b=Number(b)||0,a in u?(u.__jstorage_meta.TTL||(u.__jstorage_meta.TTL={}),b>0?u.__jstorage_meta.TTL[a]=c+b:delete u.__jstorage_meta.TTL[a],i(),k(),g(),!0):!1},getTTL:function(a){var b,c=+new Date;return j(a),a in u&&u.__jstorage_meta.TTL&&u.__jstorage_meta.TTL[a]?(b=u.__jstorage_meta.TTL[a]-c,b||0):0},flush:function(){return u={__jstorage_meta:{CRC32:{}}},i(),g(),f(null,"flushed"),!0},storageObj:function(){function a(){}return a.prototype=u,new a},index:function(){var a,b=[];for(a in u)u.hasOwnProperty(a)&&"__jstorage_meta"!=a&&b.push(a);return b},storageSize:function(){return x},currentBackend:function(){return y},storageAvailable:function(){return!!y},listenKeyChange:function(a,b){j(a),z[a]||(z[a]=[]),z[a].push(b)},stopListening:function(a,b){if(j(a),z[a]){if(!b)return void delete z[a];for(var c=z[a].length-1;c>=0;c--)z[a][c]==b&&z[a].splice(c,1)}},subscribe:function(a,b){if(a=(a||"").toString(),!a)throw new TypeError("Channel not defined");C[a]||(C[a]=[]),C[a].push(b)},publish:function(a,b){if(a=(a||"").toString(),!a)throw new TypeError("Channel not defined");o(a,b)},reInit:function(){b()},noConflict:function(a){return delete window.$.jStorage,a&&(window.jStorage=this),this}},a()}();var version="1.10",scriptName="LA Enhancer",scriptURL="https://github.com/tribalwarsbr100/LA-Enhancer/blob/master/",updateNotesURL="http://forum.tribalwars.net/showthread.php?266604-ntoombs19-s-FA-Filter&p=6785655&viewfull=1#post6785655",working=!0,resourcesLoaded=!1,scriptLoaded=!1,pagesLoaded=!1,filtersApplied=!1,cansend=!0,keySetMode=!1,hideRow=!1,editingKey=!1,troubleshoot=!1,clearProfiles=!1,reason=[],keyToEdit,current_units,currentGameTime=getCurrentGameTime(),sitter="";"0"!=window.game_data.player.sitter&&(sitter="t="+window.game_data.player.id+"&");var link=["https://"+window.location.host+"/game.php?"+sitter+"village=","&screen=am_farm"],userset,s={start_page:0,end_page:1,order_by:2,direction:3,all_none:4,blue:5,green:6,yellow:7,red_yellow:8,red_blue:9,red:10,hide_recent_farms:11,sent_time_filter:12,hide_recent_time:13,enable_hauls:14,full:15,partial:16,enable_attacks:17,attack_operator:18,attack_value:19,enable_walls:20,wall_operator:21,wall_value:22,enable_distances:23,distance_operator:24,distance_value:25,enable_scout:26,scout_report_operator:27,haul_value:28,continent_display:29,continents_list:30,enable_time:31,attack_time_filter:32,time_value:33,enable_auto_run:34,next_village_no_farms:35,next_village_scouts:36,scouts_left:37,next_village_farming_troops:38,farming_troops_left:39,next_village_units:40},keycodes={a:65,b:66,c:67,skip:83,right:39,left:37,master:77},keyPressSettings={a_code:65,a_char:"A",b_code:66,b_char:"B",c_code:67,c_char:"C",master_code:77,master_char:"M",skip_code:83,skip_char:"S",left_code:37,left_char:"←",right_code:39,right_char:"→",priorityOneEnabled:!0,priorityOneProfile:"Default",priorityOneButton:"Skip",priorityTwoEnabled:!0,priorityTwoProfile:"Default",priorityTwoButton:"Skip",priorityThreeEnabled:!0,priorityThreeProfile:"Default",priorityThreeButton:"Skip",defaultButton:"Skip"},availableLangs=["en","es","el","pt","ar"];null==$.jStorage.get("language")&&setDefaultLanguage(),$.getScript(scriptURL+"lang/"+$.jStorage.get("language")+".js",function(){checkPage()}),$(document).off();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement