Resize map

Resize map by clicking a button and typing in how big it should be

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name     Resize map
// @description Resize map by clicking a button and typing in how big it should be
// @version 2.1.3
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @include https://*/game.php?village=*&screen=map*
// @namespace https://greasyfork.org/users/151096
// ==/UserScript==
var parentThingie = document.getElementById("inner-border"); // Set parent

var input = document.createElement("input");
input.setAttribute("id", "inputSetSize");
input.setAttribute("type", "text");
input.setAttribute("value", "");
input.setAttribute("style", "margin-top:10px");
parentThingie.parentNode.insertBefore(input, parentThingie);

var buttonSetMapSize = document.createElement("button"); // Create button
buttonSetMapSize.innerHTML = "Set Map Size"; // Text of button
buttonSetMapSize.setAttribute("id", "setMapSize"); // Set ID
buttonSetMapSize.setAttribute("style","float:left;margin:10px;"); // Set CSS
buttonSetMapSize.setAttribute("class","btn"); // Set class

parentThingie.insertAdjacentElement('afterbegin', input); // Add input field to the site
parentThingie.insertAdjacentElement('afterbegin', buttonSetMapSize); // Add button to the site

document.getElementById("inputSetSize").addEventListener("keyup", function(event) {
    "use strict";
    event.preventDefault();
    if (event.keyCode === 13) {
        document.getElementById("setMapSize").click();
    }
});

document.getElementById("setMapSize").onclick = function largeMap(){ // Call this function when the button is clicked
    "use strict";
    var size = parseInt(document.getElementById("inputSetSize").value); // Prompts the user to type in map size
    TWMap.resize(size, true);
};