Shartak Treasure Map Safety

Default action for Non-active Treasure Maps set to identify

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Shartak Treasure Map Safety
// @namespace   http://userscripts.org/users/125692
// @description Default action for Non-active Treasure Maps set to identify
// @include     http://www.shartak.com/game.cgi
// @include     http://shartak.com/game.cgi
// @include     https://shartak.com/game.cgi
// @include     https://www.shartak.com/game.cgi
// @version     1
// @run-at document-start
// @grant       none
// ==/UserScript==
(function() {
  
function addNamedGlobalStyle(css,idname) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.id=idname;
	style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}  
  
//first we make maps unclickable with css injecting style early.
//nodot inventory
//this one is named so can be toggled.
addNamedGlobalStyle("ul.inventory{display:none!important;}","hideinventory");
//then we wait till dom ready then alter then reset css  
  
//set eventlistener for when page has maps ready for altering.  
document.addEventListener ("DOMContentLoaded", DOM_ContentReady);

function DOM_ContentReady () {
   var treasuremaps=document.evaluate( "//input[starts-with(@value,'2Y(')]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
   if(treasuremaps.snapshotLength>0){//we have at least one activated map
      for(var i=0,j=0;j=treasuremaps.snapshotItem(i);i++){
         j.parentNode.firstElementChild.selectedIndex=1;
      }
   }
   document.getElementById('hideinventory').disabled=true;
}
  
  
//EOF
})();