Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Quick Village Notes
- // @version 3.1.1
- // @author Diogo Rocha
- // @include https://*&screen=info_village&id*
- // ==/UserScript==
- //Ainda falta implementar funcionamento para outros mundos
- var world = window.location.href.substring(8, 12);
- var archers = true, religion = true;
- var genView = $('#content_value table tbody:eq(2) tr:eq(4) a')
- var temp = false;
- var event = false;
- var listener= false;
- function injectButton(){
- var html = '';
- html += '<table class="header-border"><tbody><tr><td><table height="20px" width="20px" class="box menu nowrap"><tbody><tr>'
- html += '<td style="white-space:nowrap;" id="state" class="firstcell box-item icon-box nowrap">'
- html += '<span></span>'
- html += '</td></tr></tbody></table></td></tr><tr class="newStyleOnly"><td class="shadow"><div class="leftshadow"></div><div class="rightshadow"></div></td></tr></tbody></table>'
- $('#header_info > tbody > tr > td:nth-child(3)').append(html)
- $('#state').click(function(){toggleListener()})
- }
- if(listener)injectButton();
- function startListener(){
- if(!event){
- document.addEventListener ('keydown', reportKeyEvent);
- $('#state span').attr("style", "color: green");
- $('#state span').text("ON")
- event = true;
- }
- }
- function stopListener(){
- if(event){
- document.removeEventListener('keydown', reportKeyEvent);
- $('#state span').attr("style", "color: red");
- $('#state span').text("OFF")
- event = false;
- //console.log("off")
- }
- }
- function toggleListener(){
- if(event) stopListener();
- else startListener();
- }
- function reportKeyEvent (zEvent) {
- if(zEvent.code === "KeyP" && ($(genView).text().includes("geral da aldeia"))){
- var url = String(location.href).split('/')
- var link = $(genView).attr("href")
- UI.InfoMessage('A abrir aldeia...', 3000);
- location.href = url[0] + "//" + url[2] + "/" + link;
- }
- if(zEvent.code === "F5") location.reload()
- if(zEvent.code === "F1") $('#1atq').click();
- if(zEvent.code === "F2") $('#ataque').click();
- if(zEvent.code === "F10" || zEvent.code === "KeyE") $('#limpa').click();
- if(zEvent.code === "F11") $('#editar').click();
- if(zEvent.code === "F12" || zEvent.code === "KeyQ") $('#limpar').click();
- if(zEvent.code === "KeyC")
- {
- $('#content_value > table > tbody > tr > td:nth-child(1) > table:nth-child(2) > tbody > tr:nth-child(6) > td > a').click();
- setTimeout(function(){$('input[value="220298"]').click();}, 200);
- setTimeout(function(){$('input[value="Inserir grupos"]').click();}, 300);
- }
- zEvent.stopPropagation ();
- zEvent.preventDefault ()
- }
- if(world == 'pt59'){
- archers = false;
- religion = false;
- }
- $('a.float_right').remove();
- var html = '';
- html += '<span class="float_right">'
- html += '<button type="button" id="1atq" class="btn">1</button>';
- html += '<button type="button" id="2atq" class="btn">2</button>';
- html += '<button type="button" id="3atq" class="btn">3</button>';
- html += '<button type="button" id="p3atq" class="btn">3+</button>';
- html += '<button type="button" id="reservar" class="btn">Reservar</button>';
- html += '<button type="button" id="ataque" class="btn">Ataque</button>';
- html += '<button type="button" id="defesa" class="btn">Defesa</button>';
- if(religion)html += '<button type="button" id="igreja" class="btn">Igreja</button>';
- html += '<button type="button" id="torre" class="btn">Torre</button>';
- html += '<button type="button" id="limpa" class="btn">Limpa</button>';
- html += '<button type="button" id="editar" onclick="VillageInfo.Notes.toggleEdit(); return false" class="btn">Editar</button>';
- html += '<button type="button" id="limpar" class="btn">Limpar</button>';
- html +- '</span>'
- setTimeout(function(){
- document.getElementById("1atq").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #ff9631 0%,#ea7404 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("2atq").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #ff9631 0%,#ea7404 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("3atq").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #ff9631 0%,#ea7404 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("p3atq").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #ff9631 0%,#ea7404 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("reservar").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("ataque").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("defesa").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("torre").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- if(religion) document.getElementById("igreja").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("limpa").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0bac00 0%,#0e7a1e 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("editar").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #0080ff 0%,#0052a2 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- document.getElementById("limpar").setAttribute("style","background: no-repeat 3px -49px, linear-gradient(to bottom, #ff0000 0%,#a70000 100%); padding: 3px 3px 3px 3px; font-size: 8px !important")
- }, 5);
- $('table.vis:eq(2) th:eq(0)').append(html)
- if(listener)toggleListener();
- $('#1atq').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " 1Full ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#2atq').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " 2Full ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#3atq').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " 3Full ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#p3atq').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " +3Full ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#reservar').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Reservado ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#ataque').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Ataque ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#defesa').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Defesa ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#torre').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Torre ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#igreja').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Igreja ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#limpa').click(function(){
- $('#editar').click();
- $('#message').val($('#message').val() + " Limpa ");
- $('#note_submit_button').click();
- if(listener)startListener();
- })
- $('#editar').click(function(){
- if(listener)stopListener();
- })
- $('#note_submit_button').click(function(){
- if(listener)startListener();
- });
- $('#limpar').click(function(){
- $('#editar').click();
- $('#message').val('');
- $('#note_submit_button').click();
- if(listener)startListener();
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement