Advertisement
sinkir

NipBot

May 14th, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //javascript:(function(){var d=document,s=d.createElement('script');s.src='http://127.0.0.1/nipBot.js';d.body.appendChild(s);})();
  2.  
  3. /*
  4.         _       ____        _     _    
  5.        (_)     |  _ \      | |   (_)    
  6.   _ __  _ _ __ | |_) | ___ | |_   _ ___
  7.  | '_ \| | '_ \|  _ < / _ \| __| | / __|
  8.  | | | | | |_) | |_) | (_) | |_ _| \__ \
  9.  |_| |_|_| .__/|____/ \___/ \__(_) |___/
  10.          | |                    _/ |    
  11.          |_|                   |__/    
  12.  
  13. javascript:(function(){var d=document,s=d.createElement('script');s.src='http://127.0.0.1/nipBot.js';d.body.appendChild(s);})();
  14. */
  15.  
  16. /*
  17.    _____ _       _           _                      
  18.   / ____| |     | |         | |                      
  19.  | |  __| | ___ | |__   __ _| | __   ____ _ _ __ ___
  20.  | | |_ | |/ _ \| '_ \ / _` | | \ \ / / _` | '__/ __|
  21.  | |__| | | (_) | |_) | (_| | |  \ V / (_| | |  \__ \
  22.   \_____|_|\___/|_.__/ \__,_|_|   \_/ \__,_|_|  |___/
  23.                                                      
  24. */
  25. //Frame count of spiner
  26. var myCount = 0;
  27. //Trigger mySpinner() evry x ticks
  28. var evryTicks = 5;
  29. //Store last trick that triggered mySpinner
  30. var lastTick = 0;
  31. // Array to store craft list, [i][0] = resToCraftName [i][1] = resTriggerName
  32. var craftList = [
  33. ["wood", "catnip"],
  34. ["beam", "wood"],
  35. ["slab", "minerals"],
  36. ["plate", "iron"],
  37. ["steel", "coal"],
  38. ["manuscript", "culture"],
  39. ["kerosene", "oil"],
  40. ["thorium", "uranium"],
  41. ["alloy", "titanium"],
  42. ["eludium", "unobtainium"]
  43. ];
  44. var myConfig = {
  45. speed               :1,
  46. speedTmp            :1,
  47.  
  48. autoObserveBtn      :false,
  49. autoHunt            :false,
  50. autoHuntSec         :10,
  51. autoPraise          :false,
  52. autoPraiseSec       :10,
  53.  
  54. autoFurs            :false,
  55. autoFursSec         :10,
  56. autoCompedium       :false,
  57. autoCompediumSec    :10,
  58. autoCompediumSpend  :10,
  59. autoBlueprint       :false,
  60. autoBlueprintSec    :10,
  61. autoBlueprintSpend  :10,
  62.  
  63.  
  64. wood                :false,
  65. woodSec             :10,
  66. woodSpend           :10,
  67. beam                :false,
  68. beamSec             :10,
  69. beamSpend           :10,
  70. slab                :false,
  71. slabSec             :10,
  72. slabSpend           :10,
  73. plate               :false,
  74. plateSec            :10,
  75. plateSpend          :10,
  76. steel               :false,
  77. steelSec            :10,
  78. steelSpend          :10,
  79. manuscript          :false,
  80. manuscriptSec       :10,
  81. manuscriptSpend     :10,
  82. kerosene            :false,
  83. keroseneSec         :10,
  84. keroseneSpend       :10,
  85. thorium             :false,
  86. thoriumSec          :10,
  87. thoriumSpend        :10,
  88. alloy               :false,
  89. alloySec            :10,
  90. alloySpend          :10,
  91. eludium             :false,
  92. eludiumSec          :10,
  93. eludiumSpend        :10
  94.  
  95. };
  96. if(!!localStorage.getItem("nipBotConfig"))
  97. {
  98.     myConfig = JSON.parse(localStorage.getItem("nipBotConfig"));
  99. }
  100.  
  101.  
  102. /*
  103.   _____       _           _    
  104.  |_   _|     (_)         | |  
  105.    | |  _ __  _  ___  ___| |_  
  106.    | | | '_ \| |/ _ \/ __| __|
  107.   _| |_| | | | |  __/ (__| |_  
  108.  |_____|_| |_| |\___|\___|\__|
  109.             _/ |              
  110.            |__/                
  111. */
  112.  
  113. gamePage.timer.updateScheduledEvents = function()
  114. {
  115.     nipBot();
  116.     for (var i in this.scheduledHandlers)
  117.     {
  118.         this.scheduledHandlers[i]();
  119.     }
  120.     this.scheduledHandlers = [];
  121. };
  122.  
  123. document.getElementById('motd').innerHTML += "&nbsp;<a href='#' class='myAnimStart' id='mySpinner' onclick='toggleMenu();'>?</a>";
  124.  
  125. setTimeout(function (){
  126.     g('mySpinner').className = "myAnimEnd";
  127. }, 1000);
  128. setTimeout(function (){
  129.     g('mySpinner').className = "";
  130. }, 5000);
  131.  
  132. mySpinner();
  133. injectCss();
  134. injectHtmlMenu();
  135.  
  136. if(!gamePage.nipUpdateModel){gamePage.nipUpdateModel = gamePage.updateModel;}
  137. gamePage.updateModel = function()
  138. {
  139.     for(var myi = 0; myi < myConfig.speed; myi++)
  140.     {
  141.         if(myi != 0)
  142.         {
  143.             game.calendar.tick();
  144.         }
  145.         game.nipUpdateModel();
  146.     }
  147. }
  148.  
  149.  
  150. /*
  151.   ______                      _    _ _____
  152.  |  ____|                    | |  | |_   _|
  153.  | |__ _   _ _ __   ___ ___  | |  | | | |  
  154.  |  __| | | | '_ \ / __/ __| | |  | | | |  
  155.  | |  | |_| | | | | (__\__ \ | |__| |_| |_
  156.  |_|   \__,_|_| |_|\___|___/  \____/|_____|
  157.                                            
  158. */
  159. function g(id)
  160. {
  161.     return document.getElementById(id);
  162. }
  163. function gr(id)
  164. {
  165.     return gamePage.resPool.get(id);
  166. }
  167. function myLast(arr)
  168. {
  169.     return arr[arr.length -1];
  170. }
  171.  
  172.  
  173.  
  174. function toggleMenu()
  175. {
  176.    
  177.     if(g('myMenuId').style.display == "none")
  178.     {
  179.         myConfig.speedTmp = myConfig.speed;
  180.         myConfig.speed = 1;
  181.         printHtmlMenu();
  182.         g('myMenuId').style.display = "block";
  183.     }
  184.     else
  185.     {
  186.         myConfig.speed = myConfig.speedTmp;
  187.        
  188.         mySaveConfig();
  189.         g('myMenuId').style.display = "none";
  190.     }
  191. }
  192.  
  193. function mySpinner()
  194. {  
  195.     var frames = ['⠋','⠛','⠙','⠹','⠸','⢸','⢰','⣰','⣠','⣤','⣄','⣆','⡆','⡇','⠇','⠏'];
  196.  
  197.     document.getElementById('mySpinner').innerHTML = ""+frames[myCount];
  198.     myCount++;
  199.     if(myCount >= frames.length)
  200.     {
  201.         myCount = 0;
  202.     }
  203. }
  204.  
  205.  
  206.  
  207. function printCss()
  208. {
  209.     var cssCode = "";
  210.     cssCode += `
  211.    
  212. #mySpinner
  213. {
  214.     text-decoration:none;
  215.     transition: transform ease 4s, background-color ease 4s;
  216.     transform-origin: left top;
  217. }
  218. .myAnimStart
  219. {
  220.     position: fixed;
  221.     transform: scale(30);
  222.     background-color:rgba(30,30,30,0.6);
  223. }
  224. .myAnimEnd
  225. {
  226.     position: fixed;
  227.     transform: scale(1);
  228.     background-color:rgba(200,200,200,0);
  229.  
  230. }
  231.  
  232. .close
  233. {
  234.     transition : background-color ease 0.3s;
  235. }
  236. .close:hover
  237. {
  238.     background-color:rgba(255,0,0,0.3);
  239. }
  240.  
  241. .scheme_grassy #myMenuId
  242. {
  243.     padding: 30px;
  244.     background-color: #C6EBA1; 
  245. }
  246. #myMenuIdTable
  247. {
  248.     text-align:center;
  249.     width:100%;
  250. }
  251. #myMenuIdTable > tbody > tr > td
  252. {
  253.     padding:8px 0 8px 0;
  254. }
  255.  
  256.     `;
  257.     return cssCode;
  258.    
  259. }
  260.  
  261.  
  262. function printHtmlMenu()
  263. {
  264.  
  265.     var myStrHtml = ""
  266.     myStrHtml = `
  267. <a href="#" class="close" onclick="toggleMenu();" style="position: absolute; top: 0px; right: 0px; padding:16px;">close</a>
  268.  
  269. <table id="myMenuIdTable"><tbody>
  270. <tr>
  271. <td style="text-align:right;"><input id="autoObserveBtn" type="checkbox" `+((myConfig.autoObserveBtn) ? "checked" : "")+`>
  272. <label for="autoObserveBtn">Auto Observe </label></td><td style="text-align:left;"> the Sky </td><td> </td><td> </td><td> </td><td> </td>
  273. </tr>
  274.    
  275. <tr style="display:`+((gr("manpower").unlocked) ? "table-row" : "none")+`">
  276. <td><input id="autoHunt" type="checkbox" `+((myConfig.autoHunt) ? "checked" : "")+`>
  277. <label for="autoHunt">Auto send </td><td>hunters</td><td> if </td><td>` +gr('manpower').title+` </td><td> will be full in </label>  </td><td><input type="number" id="autoHuntSec" value="`+(myConfig.autoHuntSec)+`" style="width:8ch" /> seconds</td>
  278. </tr>
  279.    
  280. <tr style="display:`+((gr("faith").unlocked) ? "table-row" : "none")+`">
  281. <td><input id="autoPraise" type="checkbox" `+((myConfig.autoPraise) ? "checked" : "")+`>
  282. <label for="autoPraise">Auto Praise </td><td> the sun</td><td> if </td><td>`+gr('faith').title+` </td><td> will be full in </label> </td><td><input type="number" id="autoPraiseSec" value="`+(myConfig.autoPraiseSec)+`" style="width:8ch" /> seconds</td>
  283. </tr>
  284.  
  285. <tr style="display:`+((gamePage.workshop.getCraft("parchment").unlocked) ? "table-row" : "none")+`">
  286. <td><input id="autoFurs" type="checkbox" `+((myConfig.autoFurs) ? "checked" : "")+`>
  287. <label for="autoFurs">Auto Craft </td><td>`+gr("parchment").title+` </td><td> if </td><td>`+gr('furs').title+` </td><td> is more than </label>  </td><td><input type="number" id="autoFursSec" value="`+(myConfig.autoFursSec)+`" style="width:18ch" /> units&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  288. </tr>
  289. <tr style="display:`+((gamePage.workshop.getCraft("compedium").unlocked) ? "table-row" : "none")+`">
  290. <td><input id="autoCompedium" type="checkbox" `+((myConfig.autoCompedium) ? "checked" : "")+`>
  291. <label for="autoCompedium">Auto Craft </td><td>`+gr("compedium").title+` </td><td> if </td><td> `+gr("science").title+` </td><td> will be full in </label> </td><td><input type="number" id="autoCompediumSec" value="`+(myConfig.autoCompediumSec)+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="autoCompediumSpend" value="`+(myConfig.autoCompediumSpend)+`" style="width:8ch" />&#37;</td>
  292. </tr>
  293. <tr style="display:`+((gamePage.workshop.getCraft("blueprint").unlocked) ? "table-row" : "none")+`">
  294. <td><input id="autoBlueprint" type="checkbox" `+((myConfig.autoBlueprint) ? "checked" : "")+`>
  295. <label for="autoBlueprint">Auto Craft </td><td>`+gr("blueprint").title+` </td><td> if </td><td> `+gr("science").title+` </td><td> will be full in </label> </td><td><input type="number" id="autoBlueprintSec" value="`+(myConfig.autoBlueprintSec)+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="autoBlueprintSpend" value="`+(myConfig.autoBlueprintSpend)+`" style="width:8ch" />&#37;</td>
  296. </tr>
  297.  
  298. <tr>
  299. <td>&nbsp;</td>
  300. <td>&nbsp;</td>
  301. <td>&nbsp;</td>
  302. <td>&nbsp;</td>
  303. <td>&nbsp;</td>
  304. <td>&nbsp;</td>
  305. </tr>
  306.  
  307.     `;
  308.    
  309.     myStrHtml += genCraftList();
  310.     myStrHtml += `</body></table><br><br>&nbsp;&nbsp;&nbsp;!Déja Vus ! speed : <input id="mySpeed" type="number" min="1" max="64" value="`+(myConfig.speedTmp)+`" style="width:5ch"><br><br><br><br>`;
  311.    
  312.    
  313.     g("myMenuId").innerHTML = myStrHtml;
  314.  
  315. }
  316.  
  317. function genCraftList()
  318. {
  319.     var myStr = "";
  320.     var trDisplay = "";
  321.     craftList.forEach(function(truck){ 
  322.     //if(gamePage.workshop.getCraft(truck[0]).unlocked)
  323.     //{
  324.    
  325.     console.log(truck[0]+" et "+truck[0]);
  326.  
  327.     if( (gamePage.workshop.getCraft(truck[0]).unlocked && gr(truck[0]).unlocked && gr(truck[1]).unlocked) )
  328.     {
  329.         trDisplay = "table-row";
  330.     }
  331.     else
  332.     {
  333.         trDisplay = "none";
  334.     }
  335.     console.log(trDisplay);
  336.         myStr += `
  337. <tr style="display:`+trDisplay+`">
  338. <td><input id="auto`+truck[0]+`" type="checkbox"  `+( (eval("myConfig."+truck[0]) ) ? "checked" : "")+`>
  339. <label for="auto`+truck[0]+`">Auto Craft </td><td>`+gr(truck[0]).title+` </td><td> if </td><td> `+gr(truck[1]).title+` </td><td> will be full in </label> </td><td><input type="number" id="auto`+truck[0]+`Sec" value="`+(eval('myConfig.'+truck[0]+'Sec'))+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="auto`+truck[0]+`Spend" value="`+(eval('myConfig.'+truck[0]+'Spend'))+`" style="width:8ch" />&#37;</td>
  340. </tr>
  341.         `;
  342.     //}
  343.     }) 
  344.     return myStr;
  345. }
  346.  
  347. function injectCss()
  348. {
  349.     var cssCode = printCss();
  350.     var styleElement = document.createElement("style");
  351.     styleElement.type = "text/css";
  352.     if (styleElement.styleSheet)
  353.     {
  354.         styleElement.styleSheet.cssText = cssCode;
  355.     }
  356.     else
  357.     {
  358.         styleElement.appendChild(document.createTextNode(cssCode));
  359.     }
  360.     document.getElementsByTagName("head")[0].appendChild(styleElement);
  361.    
  362. }
  363.  
  364. function injectHtmlMenu()
  365. {
  366.     var myDiv = document.createElement("div");
  367.     //myDiv.innerHTML = myStrHtml;
  368.     myDiv.setAttribute("class", "dialog help");
  369.     myDiv.setAttribute("style", "height: 72vh !important;top:225px !important;display:none; overflow:auto;width:720px;margin-left:-30%;");
  370.     myDiv.setAttribute("id", "myMenuId");
  371.     document.body.appendChild(myDiv);
  372. }
  373.  
  374.  
  375. function mySaveConfig()
  376. {
  377.    
  378. myConfig.speed              = g('mySpeed').value;
  379. //console.log(myConfig.speed);
  380. if(myConfig.speed < 1 || myConfig.speed > 64){myConfig.speed = 1}
  381.  
  382. myConfig.autoObserveBtn     = g('autoObserveBtn').checked;
  383. myConfig.autoHunt           = g('autoHunt').checked;
  384. myConfig.autoHuntSec        = g('autoHuntSec').value;
  385. myConfig.autoPraise         = g('autoPraise').checked;
  386. myConfig.autoPraiseSec      = g('autoPraiseSec').value;
  387.  
  388. myConfig.autoFurs           = g('autoFurs').checked;
  389. myConfig.autoFursSec        = g('autoFursSec').value;
  390. myConfig.autoCompedium      = g('autoCompedium').checked;
  391. myConfig.autoCompediumSec   = g('autoCompediumSec').value;
  392. myConfig.autoCompediumSpend = g('autoCompediumSpend').value;
  393. myConfig.autoBlueprint      = g('autoBlueprint').checked;
  394. myConfig.autoBlueprintSec   = g('autoBlueprintSec').value;
  395. myConfig.autoBlueprintSpend = g('autoBlueprintSpend').value;
  396.  
  397.  
  398. myConfig.wood               = g('autowood').checked;
  399. myConfig.woodSec            = g('autowoodSec').value;
  400. myConfig.woodSpend          = g('autowoodSpend').value;
  401. myConfig.beam               = g('autobeam').checked;
  402. myConfig.beamSec            = g('autobeamSec').value;
  403. myConfig.beamSpend          = g('autobeamSpend').value;
  404. myConfig.slab               = g('autoslab').checked;
  405. myConfig.slabSec            = g('autoslabSec').value;
  406. myConfig.slabSpend          = g('autoslabSpend').value;
  407. myConfig.plate              = g('autoplate').checked;
  408. myConfig.plateSec           = g('autoplateSec').value;
  409. myConfig.plateSpend         = g('autoplateSpend').value;
  410. myConfig.steel              = g('autosteel').checked;
  411. myConfig.steelSec           = g('autosteelSec').value;
  412. myConfig.steelSpend         = g('autosteelSpend').value;
  413. myConfig.manuscript         = g('automanuscript').checked;
  414. myConfig.manuscriptSec      = g('automanuscriptSec').value;
  415. myConfig.manuscriptSpend    = g('automanuscriptSpend').value;
  416. myConfig.kerosene           = g('autokerosene').checked;
  417. myConfig.keroseneSec        = g('autokeroseneSec').value;
  418. myConfig.keroseneSpend      = g('autokeroseneSpend').value;
  419. myConfig.thorium            = g('autothorium').checked;
  420. myConfig.thoriumSec         = g('autothoriumSec').value;
  421. myConfig.thoriumSpend       = g('autothoriumSpend').value;
  422. myConfig.alloy              = g('autoalloy').checked;
  423. myConfig.alloySec           = g('autoalloySec').value;
  424. myConfig.alloySpend         = g('autoalloySpend').value;
  425. myConfig.eludium            = g('autoeludium').checked;
  426. myConfig.eludiumSec         = g('autoeludiumSec').value;
  427. myConfig.eludiumSpend       = g('autoeludiumSpend').value;
  428.  
  429. localStorage.setItem("nipBotConfig", JSON.stringify(myConfig));
  430.    
  431. }
  432.  
  433. /*
  434.   ______                 ____        _  
  435.  |  ____|               |  _ \      | |  
  436.  | |__ _   _ _ __  ___  | |_) | ___ | |_
  437.  |  __| | | | '_ \/ __| |  _ < / _ \| __|
  438.  | |  | |_| | | | \__ \ | |_) | (_) | |_
  439.  |_|   \__,_|_| |_|___/ |____/ \___/ \__|
  440.                                          
  441. */
  442.  
  443.  
  444. function nipBot()
  445. {
  446.     if(gamePage.ticks >= lastTick + evryTicks)
  447.     {
  448.         //console.log(gamePage.ticks);
  449.        
  450.        
  451.         mySpinner();
  452.         myJobs();
  453.         lastTick = gamePage.ticks;
  454.     }
  455. }
  456.  
  457.  
  458. function myJobs()
  459. {
  460.     var nbToCraft = 0;
  461.     var objTemp;
  462.     var objTempSec;
  463.     var priceTmp;
  464.    
  465.     myConfig.speedTmp = myConfig.speed;
  466.     myConfig.speed = 1;
  467.     if(myConfig.autoObserveBtn)
  468.     {
  469.         if (g('observeBtn') != null)
  470.         {
  471.             g('observeBtn').click();
  472.         }
  473.     }
  474.     if(myConfig.autoHunt)
  475.     {
  476.         if ((gr("manpower").value + (gr("manpower").perTickCached * 5 * myConfig.autoHuntSec)) > gr("manpower").maxValue)
  477.         {
  478.             gamePage.village.huntAll();
  479.         }
  480.     }  
  481.     if(myConfig.autoPraise)
  482.     {
  483.         if ((gr("faith").value + (gr("faith").perTickCached * 5 * myConfig.autoPraiseSec)) > gr("faith").maxValue)
  484.         {
  485.             gamePage.religion.praise();
  486.         }
  487.     }
  488.    
  489.    
  490.     if(myConfig.autoFurs)
  491.     {
  492.         if (gr("furs").value > myConfig.autoFursSec)
  493.         {
  494.             gamePage.craft("parchment", Math.floor(gr("furs").value / 1000) );
  495.         }
  496.     }  
  497.     if(myConfig.autoCompedium)
  498.     {
  499.         if ((gr("science").value + (gr("science").perTickCached * 5 * myConfig.autoCompediumSec)) > gr("science").maxValue)
  500.         {
  501.             //nbToCraft = Math.floor( (gr("science").perTickCached * 5 * myConfig.autoCompediumSec) / 10000);
  502.             nbToCraft = Math.floor( (gr("science").value * (myConfig.autoCompediumSpend / 100)) / 10000 );
  503.             if(nbToCraft < 1){nbToCraft = 1;}
  504.             gamePage.craft("compedium", nbToCraft);
  505.         }
  506.     }  
  507.     if(myConfig.autoBlueprint)
  508.     {
  509.         if ((gr("science").value + (gr("science").perTickCached * 5 * myConfig.autoBlueprintSec)) > gr("science").maxValue)
  510.         {
  511.             //nbToCraft = Math.floor( (gr("science").perTickCached * 5 * myConfig.autoBlueprintSec) / 25000);
  512.             nbToCraft = Math.floor( (gr("science").value * (myConfig.autoBlueprintSpend / 100)) / 25000 );
  513.             if(nbToCraft < 1){nbToCraft = 1;}
  514.             gamePage.craft("blueprint", nbToCraft);
  515.         }
  516.     }
  517.    
  518.     craftList.forEach(function(truck){ 
  519.     objTemp = eval("myConfig."+truck[0]);
  520.     objTempSec = eval("myConfig."+truck[0]+"Sec");
  521.     priceTmp = myLast(gamePage.workshop.getCraft(truck[0]).prices).val;
  522.    
  523.     if(objTemp)
  524.     {
  525.         if ((gr(truck[1]).value + (gr(truck[1]).perTickCached * 5 * objTempSec)) > gr(truck[1]).maxValue)
  526.         {
  527.             //nbToCraft = Math.floor( (gr(truck[1]).perTickCached * 5 * objTempSec) / priceTmp);
  528.             nbToCraft = Math.floor( (gr(truck[1]).value * ( eval("myConfig."+truck[0]+"Spend") / 100)) / priceTmp );
  529.             if(nbToCraft < 1){nbToCraft = 1;}
  530.             gamePage.craft(truck[0], nbToCraft);
  531.         }
  532.     }
  533.        
  534.     })
  535.     myConfig.speed = myConfig.speedTmp;
  536.    
  537. }
  538.  
  539. /*
  540. function drawMenuCss()
  541. {
  542.     var cssCode = "";
  543.     cssCode += `
  544.     .scheme_grassy #myMenuId
  545.     {
  546.         padding: 30px;
  547.         background-color: #C6EBA1; 
  548.     }
  549.     #myMenuId
  550.     {
  551.         width: 600px;
  552.         height: 80% !important;
  553.         position: absolute;
  554.         margin: auto;
  555.         top: 0px !important;
  556.         right: 0px;
  557.         bottom: 0px;
  558.         left: 0px;
  559.         display: block;
  560.         overflow: auto;
  561.     }
  562.     .btn.myModern {
  563.         font-family: Helvetica;
  564.         font-size: 14px;
  565.         border-radius: 3px;
  566.         border: 1px solid #888;
  567.         width: 264px;
  568.         padding: 10px 0 10px 10px;
  569.         cursor: initial;
  570.     }
  571.  
  572.     #myMenuTabs
  573.     {
  574.         position:absolute;
  575.         top:100px;
  576.         width:600px;
  577.         text-align:center;
  578.        
  579.     }
  580.     #myContener
  581.     {
  582.         position: relative;
  583.         margin: 0 auto;
  584.         width:100%;
  585.         top:128px;
  586.     }
  587.     #myContener > div
  588.     {
  589.         width:600px;
  590.         display:none;
  591.     }
  592.     #myMenuTabInfo
  593.     {
  594.         font-size:11px;
  595.     }
  596.     #myMenuTabInfo > table > tbody > tr > td, #myMenuTabInfo > table > tr > td
  597.     {
  598.         padding: 0px 10px 0px 10px;
  599.     }
  600.    
  601.     .optionLabelText
  602.     {
  603.         display:inline-block;
  604.         width:260px;
  605.         margin: 0 0 0 60px;
  606.     }
  607.     .optionLabel
  608.     {
  609.       position: relative;
  610.       display: block;
  611.       width: 40px;
  612.       height: 20px;
  613.       margin: 0 0 5px 0;
  614.     }
  615.     .slider {
  616.       position: absolute;
  617.       cursor: pointer;
  618.       top: 0;
  619.       left: 0;
  620.       right: 0;
  621.       bottom: 0;
  622.       background-color: #ccc;
  623.       -webkit-transition: .4s;
  624.       transition: .4s;
  625.     }
  626.    
  627.     .slider:before {
  628.       position: absolute;
  629.       content: "";
  630.       height: 14px;
  631.       width: 14px;
  632.       left: 3px;
  633.       bottom: 3px;
  634.       background-color: white;
  635.       -webkit-transition: .4s;
  636.       transition: .4s;
  637.     }
  638.    
  639.     input:checked + .slider {
  640.       background-color: #2196F3;
  641.     }
  642.  
  643.     input:focus + .slider {
  644.       box-shadow: 0 0 1px #2196F3;
  645.     }
  646.  
  647.     input:checked + .slider:before {
  648.       -webkit-transform: translateX(20px);
  649.       -ms-transform: translateX(20px);
  650.       transform: translateX(20px);
  651.     }
  652.  
  653.     // Rounded sliders
  654.     .slider.round {
  655.       border-radius: 34px;
  656.     }
  657.  
  658.     .slider.round:before {
  659.       border-radius: 50%;
  660.     }
  661.            
  662.     `;
  663.     return cssCode;
  664. }
  665. */
  666.  
  667. /*
  668.  
  669. function drawMenu()
  670. {
  671.     var cssCode = drawMenuCss();
  672.     var styleElement = document.createElement("style");
  673.     styleElement.type = "text/css";
  674.     if (styleElement.styleSheet)
  675.     {
  676.         styleElement.styleSheet.cssText = cssCode;
  677.     }
  678.     else
  679.     {
  680.         styleElement.appendChild(document.createTextNode(cssCode));
  681.     }
  682.     document.getElementsByTagName("head")[0].appendChild(styleElement);
  683.    
  684.    
  685.     var mydiv = document.createElement("div");
  686.     mydiv.innerHTML = `
  687.     <div style="display: inline-block;position: relative;top: 0px;left: 86px;font-family: Helvetica;letter-spacing: 0px;">(^u^)&nbsp;&nbsp;&nbsp; ⟵ &nbsp;&nbsp; Hi Humain ! i'm a kitten.., totaly not a robot =]</div>
  688.     <a style="cursor:pointer;position:absolute;top:0px;right:8px;text-decoration: underline;" onclick="toggleMenu();">close</a>
  689.  
  690.     <div id="myMenuTabs" class="">
  691.         <a href="#" onclick="myMenuOpenTab(1);">Infos</a> |
  692.         <a href="#" onclick="myMenuOpenTab(2);">Option</a> |
  693.         <a href="#" onclick="myMenuOpenTab(3);">Default Tasks</a> |
  694.         <a href="#" onclick="myMenuOpenTab(4);">My Tasks</a>
  695.     </div>
  696.    
  697.     <div id="myContener">
  698.         <div id="myMenuTabInfo"></div>
  699.         <div id="myMenuTabOption">
  700.             <label class="optionLabel"><input id="optionShowTrueValues"         type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Show true values</span></label>
  701.             <label class="optionLabel"><input id="optionShowHiddenRessources"   type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Show hidden ressources</span></label>
  702.             <label class="optionLabel"><input id="optionEnableExtraTicks"       type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Enable extra ticks feature (not legit)</span></label>
  703.         </div>
  704.         <div id="myMenuTabDefaultTasks">
  705.             <label class="optionLabel"><input id="optionAutoCraftWood"          type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Auto craft wood</span></label>
  706.  
  707.         </div>
  708.         <div id="myMenuTabMyTasks">
  709.             <br />
  710.         </div>
  711.     </div>
  712.    
  713.  
  714.  
  715.    
  716.     `;
  717.     mydiv.setAttribute("class", "dialog help");
  718.     mydiv.setAttribute("style", "width:600px;height:80%;position:absolute;margin:auto;top:0;right:0;bottom:0;left:0;display:none;overflow:auto;");
  719.     mydiv.setAttribute("id", "myMenuId");
  720.     document.body.appendChild(mydiv);
  721. }
  722.  
  723. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement