您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Easy way to view var_ values in DH3
当前为
// ==UserScript== // @name DH3 VarViewer // @namespace com.anwinity.dh3 // @version 1.0.0 // @description Easy way to view var_ values in DH3 // @author Anwinity // @match dh3.diamondhunt.co // @grant none // ==/UserScript== (function() { 'use strict'; const VarViewer = { init: function() { // overwrite navigate to handle new tab const oldNavigate = window.navigate; window.navigate = function(a,b,c,d,e,f,g,h,i,j,k,l,m) { oldNavigate(a,b,c,d,e,f,g,h,i,j,k,l,m); if(a=="right-vars") { VarViewer.refresh(); } else { $("#navigation-right-vars").hide(); } }; // add some styling (cause we fancy) const styles = document.createElement("style"); styles.textContent = ` table#vars-table { border-collapse: collapse; } table#vars-table tr, table#vars-table th, table#vars-table td { border: 1px solid grey; } table#vars-table th, table#vars-table td { padding: 0.25em; } `; $("head").append(styles); // add the button $("#navigation-area-buttons").append(` <div onclick="navigate('right-vars')" id="navigation-right-vars-button" class="navigate-button" style="color: white;"> <img src="images/fireIcon.png" class="img-50" /> <br /> <div style="font-size: 10pt; text-align: center;">Vars</div> </div>`); // add the content $("#right-panel").append(` <div id="navigation-right-vars" style="display: none; padding: 1em;"> <div> <button type="button" onclick="refreshVarsTab()">Refresh</button><br /> <table id="vars-table"> <thead> <tr> <th style="text-align: left">Var Name</th> <th style="text-align: left">Var Value</th> </tr> </thead> <tbody></tbody> </table> </div> </div> `); }, refresh: function() { const tbody = $("#navigation-right-vars tbody"); tbody.empty(); tbody.append('<tr><td id="vars-table-one-sec" colspan="2">One Sec...</td></tr>'); setTimeout(() => { Object.keys(window) .filter(v=>v.startsWith("var_")) .sort() .forEach(function(v) { tbody.append(` <tr> <td>${v}</td> <td>${window[v]}</td> </tr> `); }); $("#vars-table-one-sec").remove(); }, 1); } }; window.refreshVarsTab = VarViewer.refresh; VarViewer.init(); })();