function initmonsterversions() { let u = new URL(location.href).pathname.split('/'); u.pop(); const current =u.pop(); let result = u.join('/')+"/"; function compareVer(a, b) { function prep(t) { return ("" + t) .replace(/[^0-9\.]+/g, function(c){return "." + ((c = c.replace(/[\W_]+/, "")) ? c.toLowerCase().charCodeAt(0) - 65536 : "") + "."}) .replace(/(?:\.0+)*(\.-[0-9]+)(\.[0-9]+)?\.*$/g, "$1$2") .split('.'); } a = prep(a); b = prep(b); for (var i = 0; i < Math.max(a.length, b.length); i++) { a[i] = ~~a[i]; b[i] = ~~b[i]; if (a[i] > b[i]) return 1; else if (a[i] < b[i]) return -1; } return 0; } const lastVersionContainer = document.createElement('div'); lastVersionContainer.setAttribute('style','margin-bottom:10px;'); const constainer = document.createElement('div'); constainer.setAttribute('style','display: flex;align-items: center;justify-content: flex-start;gap: 10px;align-content: center;'); constainer.appendChild(document.createTextNode('versions')); const selectElement = document.createElement('select'); selectElement.setAttribute('onChange','location="'+result+'"+this.value'); selectElement.setAttribute('id','monster-versions'); selectElement.add(new Option('1.26.1')); selectElement.add(new Option('1.26.0')); selectElement.add(new Option('1.25.0')); selectElement.add(new Option('1.24.0')); selectElement.add(new Option('1.23.0')); selectElement.add(new Option('1.22.0')); selectElement.add(new Option('1.21.1')); selectElement.add(new Option('1.21.0')); selectElement.add(new Option('1.20.2')); selectElement.add(new Option('1.20.1')); selectElement.add(new Option('1.20.0')); selectElement.add(new Option('1.19.0')); selectElement.add(new Option('1.18.0')); selectElement.add(new Option('1.17.2')); selectElement.add(new Option('1.17.1')); selectElement.add(new Option('1.17.0')); selectElement.add(new Option('1.16.1')); selectElement.add(new Option('1.16.0')); selectElement.add(new Option('1.15.5')); selectElement.add(new Option('1.15.4')); selectElement.add(new Option('1.15.3')); selectElement.add(new Option('1.15.2')); selectElement.add(new Option('1.15.0')); selectElement.value=current; constainer.append(selectElement); document.getElementById('sidebar-main-content').prepend(constainer); document.getElementById('sidebar-main-content').prepend(lastVersionContainer); if(compareVer(current,'1.26.1')===-1) {; let infocontainer = document.createElement('div'); let infolink = document.createElement('a'); let lasturl = new URL(location.href) lasturl.pathname=result+"1.26.1"+"/" infolink.setAttribute('href',lasturl); infolink.append(document.createTextNode('Looking for Monster 1.26.1?')); infocontainer.append(infolink); lastVersionContainer.append(infocontainer); };}; document.addEventListener("DOMContentLoaded", initmonsterversions);