Auto Steam Age Verification

Steam with amnesia always asking your age? Tell Steam once and for all how old you are and say goodbye to age verification.

  1. // ==UserScript==
  2. // @name Auto Steam Age Verification
  3. // @description Steam with amnesia always asking your age? Tell Steam once and for all how old you are and say goodbye to age verification.
  4. // @version 1.0
  5. // @namespace Roxas_Alt
  6. // @license CC-BY-NC-SA
  7. // @include http://store.steampowered.com/*
  8. // @include https://store.steampowered.com/*
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant GM_registerMenuCommand
  12. // @icon https://store.steampowered.com/favicon.ico
  13. // ==/UserScript==
  14.  
  15. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. // //
  17. // Don't trust my script? I'll explain how it works. //
  18. // //
  19. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  20. // //
  21. // 1. It checks if you have already saved your age in local storage. If so, it uses this data, if //
  22. // not, it uses standard data and saves it in local storage. //
  23. // //
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  25. // //
  26. // 2. Each time a store.stempoWered.com finishes loading, the script performs the Timestamp () //
  27. // function. This function uses the data obtained in the first step to create a Timestamp Unix and //
  28. // then create/override the Birthtime cookie. //
  29. // //
  30. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  31. // //
  32. // Cookie Birthtime is used by Steam to determine your age, if this cookie does not exist Steam //
  33. // asks your age and creates this cookie, if the created cookie is invalid or inform you that you //
  34. // are under 18, then Steam does not let you Access the page. Cookie is stored locally and only //
  35. // lasts one session. //
  36. // //
  37. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  38. // //
  39. // The idea of this script is always to keep this cookie in your browser so that Steam no longer //
  40. // asks what your age is. If Steam kept this saved cookie, you would only need to inform your age //
  41. // once, but as Steam does not save (and there are reasons), this script "simulates" that. //
  42. // //
  43. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  44. // //
  45. // - That's just it, but also has the settings. //
  46. // //
  47. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  48. // //
  49. // 3. The configuration creates an extra element within the page. Settings use the data obtained //
  50. // from step 1 to inform what the current settings are. You can save by saving the inserted values //
  51. // in local storage. You can reset values to the default or simply close the settings. //
  52. // //
  53. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  54. // //
  55. // In the end, all the script does is to save locally the date you inform and always create the //
  56. // cookie needed for Steam never to ask your age again. //
  57. // //
  58. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  59.  
  60. const defaultConfig = {
  61. year: 2000,
  62. month: 1,
  63. day: 1,
  64. hours: 1,
  65. minute: 0,
  66. seconds: 1,
  67. };
  68.  
  69. const storedConfig = localStorage.getItem('config');
  70. if (storedConfig !== null) {
  71. const parsedConfig = JSON.parse(storedConfig);
  72. config = parsedConfig;
  73. } else {
  74. localStorage.setItem('config', JSON.stringify(defaultConfig));
  75. config = defaultConfig;
  76. }
  77.  
  78. GM_registerMenuCommand('Settings', createConfigForm);
  79.  
  80. function createConfigForm() {
  81. var overlay = document.createElement('div');
  82. overlay.setAttribute('id', 'overlay-config-form');
  83. overlay.style.position = 'fixed';
  84. overlay.style.top = '0';
  85. overlay.style.left = '0';
  86. overlay.style.width = '100%';
  87. overlay.style.height = '100%';
  88. overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  89. overlay.style.zIndex = '9999';
  90. document.body.appendChild(overlay);
  91.  
  92. var form = document.createElement('form');
  93. form.setAttribute('id', 'config-form');
  94. form.style.position = 'fixed';
  95. form.style.top = '50%';
  96. form.style.left = '50%';
  97. form.style.transform = 'translate(-50%, -50%)';
  98. form.style.padding = '16px';
  99. form.style.border = '1px solid #171a27';
  100. form.style.borderRadius = '8px';
  101. form.style.backgroundColor = '#fff';
  102. form.style.display = 'flex';
  103. form.style.flexDirection = 'column';
  104. form.style.backgroundColor = '#171a21';
  105. form.style.zIndex = '99999';
  106.  
  107. var heading = document.createElement('h1');
  108. heading.textContent = '⚙ Steam Age Settings';
  109.  
  110. var text = document.createElement('p');
  111. text.textContent = "Please enter valid values. (You don't want an error, do you?)";
  112.  
  113. var yearDiv = document.createElement('div');
  114.  
  115. var yearLabel = document.createElement('label');
  116. yearLabel.textContent = 'Year:';
  117. var yearInput = document.createElement('input');
  118. yearInput.setAttribute('type', 'number');
  119. yearInput.setAttribute('name', 'year');
  120. yearInput.setAttribute('value', config.year);
  121.  
  122. var monthDiv = document.createElement('div');
  123.  
  124. var monthLabel = document.createElement('label');
  125. monthLabel.textContent = 'Month:';
  126. var monthInput = document.createElement('input');
  127. monthInput.setAttribute('type', 'number');
  128. monthInput.setAttribute('name', 'month');
  129. monthInput.setAttribute('value', config.month);
  130.  
  131. var dayDiv = document.createElement('div');
  132.  
  133. var dayLabel = document.createElement('label');
  134. dayLabel.textContent = 'Day:';
  135. var dayInput = document.createElement('input');
  136. dayInput.setAttribute('type', 'number');
  137. dayInput.setAttribute('name', 'day');
  138. dayInput.setAttribute('value', config.day);
  139.  
  140. var textHour = document.createElement('p');
  141. textHour.textContent = "I don't recommend changing the values below.";
  142.  
  143. var hoursDiv = document.createElement('div');
  144.  
  145. var hoursLabel = document.createElement('label');
  146. hoursLabel.textContent = 'Hours:';
  147. var hoursInput = document.createElement('input');
  148. hoursInput.setAttribute('type', 'number');
  149. hoursInput.setAttribute('name', 'hours');
  150. hoursInput.setAttribute('value', config.hours);
  151.  
  152. var minuteDiv = document.createElement('div');
  153.  
  154. var minuteLabel = document.createElement('label');
  155. minuteLabel.textContent = 'Minute:';
  156. var minuteInput = document.createElement('input');
  157. minuteInput.setAttribute('type', 'number');
  158. minuteInput.setAttribute('name', 'minute');
  159. minuteInput.setAttribute('value', config.minute);
  160.  
  161. var secondsDiv = document.createElement('div');
  162.  
  163. var secondsLabel = document.createElement('label');
  164. secondsLabel.textContent = 'Seconds:';
  165. var secondsInput = document.createElement('input');
  166. secondsInput.setAttribute('type', 'number');
  167. secondsInput.setAttribute('name', 'seconds');
  168. secondsInput.setAttribute('value', config.seconds);
  169.  
  170. var buttonsDiv = document.createElement('div');
  171.  
  172. var saveButton = document.createElement('button');
  173. saveButton.textContent = 'Save';
  174. saveButton.setAttribute('type', 'submit');
  175.  
  176. var resetButton = document.createElement('button');
  177. resetButton.textContent = 'Reset';
  178. resetButton.setAttribute('type', 'button');
  179. resetButton.addEventListener('click', function () {
  180. document.getElementById('config-form').remove();
  181. document.getElementById('overlay-config-form').remove();
  182. localStorage.setItem('config', JSON.stringify(defaultConfig));
  183. config = defaultConfig;
  184. console.log(config);
  185. var timestampUnix = timestamp(config);
  186. console.log(timestampUnix);
  187. });
  188.  
  189. var closeButton = document.createElement('button');
  190. closeButton.textContent = 'Close';
  191. closeButton.setAttribute('type', 'button');
  192. closeButton.addEventListener('click', function () {
  193. document.getElementById('config-form').remove();
  194. document.getElementById('overlay-config-form').remove();
  195. });
  196.  
  197. overlay.appendChild(form);
  198.  
  199. form.appendChild(heading);
  200. form.appendChild(text);
  201. text.style.marginTop = '20px';
  202.  
  203. form.appendChild(yearDiv);
  204. yearDiv.appendChild(yearLabel);
  205. yearDiv.appendChild(yearInput);
  206.  
  207. yearDiv.style.marginTop = '20px';
  208. yearDiv.style.display = 'inline-flex';
  209. yearLabel.style.marginRight = '5px';
  210. yearLabel.style.width = '70px';
  211. yearInput.style.flex = '1';
  212.  
  213. form.appendChild(monthDiv);
  214. monthDiv.appendChild(monthLabel);
  215. monthDiv.appendChild(monthInput);
  216.  
  217. monthDiv.style.display = 'inline-flex';
  218. monthLabel.style.marginRight = '5px';
  219. monthLabel.style.width = '70px';
  220. monthInput.style.flex = '1';
  221.  
  222. form.appendChild(dayDiv);
  223. dayDiv.appendChild(dayLabel);
  224. dayDiv.appendChild(dayInput);
  225.  
  226. dayDiv.style.display = 'inline-flex';
  227. dayLabel.style.marginRight = '5px';
  228. dayLabel.style.width = '70px';
  229. dayInput.style.flex = '1';
  230.  
  231. form.appendChild(textHour);
  232. textHour.style.marginBottom = '20px';
  233.  
  234. form.appendChild(hoursDiv);
  235. hoursDiv.appendChild(hoursLabel);
  236. hoursDiv.appendChild(hoursInput);
  237.  
  238. hoursDiv.style.display = 'inline-flex';
  239. hoursLabel.style.marginRight = '5px';
  240. hoursLabel.style.width = '70px';
  241. hoursInput.style.flex = '1';
  242.  
  243. form.appendChild(minuteDiv);
  244. minuteDiv.appendChild(minuteLabel);
  245. minuteDiv.appendChild(minuteInput);
  246.  
  247. minuteDiv.style.display = 'inline-flex';
  248. minuteLabel.style.marginRight = '5px';
  249. minuteLabel.style.width = '70px';
  250. minuteInput.style.flex = '1';
  251.  
  252. form.appendChild(secondsDiv);
  253. secondsDiv.appendChild(secondsLabel);
  254. secondsDiv.appendChild(secondsInput);
  255.  
  256. secondsDiv.style.display = 'inline-flex';
  257. secondsLabel.style.marginRight = '5px';
  258. secondsLabel.style.width = '70px';
  259. secondsInput.style.flex = '1';
  260.  
  261. form.querySelectorAll('div').forEach(function (div) {
  262. div.style.marginBottom = '20px';
  263. });
  264.  
  265. form.appendChild(buttonsDiv);
  266. buttonsDiv.appendChild(saveButton);
  267. buttonsDiv.appendChild(resetButton);
  268. buttonsDiv.appendChild(closeButton);
  269.  
  270. // Estilo para o div dos botões
  271. buttonsDiv.style.display = 'flex';
  272. buttonsDiv.style.justifyContent = 'flex-end';
  273.  
  274. // Estilo para os botões
  275. saveButton.style.padding = '8px 16px';
  276. saveButton.style.borderRadius = '4px';
  277. saveButton.style.backgroundColor = '#4CAF50';
  278. saveButton.style.color = '#fff';
  279. saveButton.style.border = '0px';
  280.  
  281. resetButton.style.padding = '8px 16px';
  282. resetButton.style.borderRadius = '4px';
  283. resetButton.style.backgroundColor = '#2196F3';
  284. resetButton.style.color = '#fff';
  285. resetButton.style.border = '0px';
  286. resetButton.style.marginLeft = '10px';
  287.  
  288. closeButton.style.padding = '8px 16px';
  289. closeButton.style.borderRadius = '4px';
  290. closeButton.style.backgroundColor = '#f44336';
  291. closeButton.style.color = '#fff';
  292. closeButton.style.border = '0px';
  293. closeButton.style.marginLeft = '10px';
  294.  
  295. form.addEventListener('submit', function (event) {
  296. event.preventDefault();
  297. saveConfig(form);
  298. });
  299. }
  300.  
  301. function saveConfig(event) {
  302. var year = parseInt(document.querySelector('input[name="year"]').value);
  303. var month = parseInt(document.querySelector('input[name="month"]').value);
  304. var day = parseInt(document.querySelector('input[name="day"]').value);
  305. var hours = parseInt(document.querySelector('input[name="hours"]').value);
  306. var minute = parseInt(document.querySelector('input[name="minute"]').value);
  307. var seconds = parseInt(document.querySelector('input[name="seconds"]').value);
  308.  
  309. document.getElementById('config-form').remove();
  310. document.getElementById('overlay-config-form').remove();
  311.  
  312. localStorage.setItem(
  313. 'config',
  314. JSON.stringify({
  315. year: year,
  316. month: month,
  317. day: day,
  318. hours: hours,
  319. minute: minute,
  320. seconds: seconds,
  321. })
  322. );
  323.  
  324. config = {
  325. year: year,
  326. month: month,
  327. day: day,
  328. hours: hours,
  329. minute: minute,
  330. seconds: seconds,
  331. };
  332.  
  333. console.log(config);
  334. var timestampUnix = timestamp(config);
  335. console.log(timestampUnix);
  336. }
  337.  
  338. function timestamp(config) {
  339. var timestampUnix = new Date(config.year, config.month - 1, config.day, config.hours, config.minute, config.seconds).getTime() / 1000;
  340. document.cookie = 'birthtime=' + timestampUnix + '; Secure; path=/; Max-Age=31556926; SameSite=None';
  341. return timestampUnix;
  342. }
  343.  
  344. window.addEventListener('load', function () {
  345. console.log(config);
  346. var timestampUnix = timestamp(config);
  347. console.log(timestampUnix);
  348. });