Fix Bitwarden compatibility

Make login/password boxes on selected sites compatible with Bitwarden auto-fill

目前为 2024-12-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Fix Bitwarden compatibility
  3. // @description Make login/password boxes on selected sites compatible with Bitwarden auto-fill
  4. // @author MK
  5. // @namespace max44
  6. // @homepage https://greasyfork.org/en/users/309172-max44
  7. // @match https://account.kyivstar.ua/cas/*
  8. // @match https://*.privat24.ua/*
  9. // @match https://*.privatbank.ua/*
  10. // @match https://auth.lifecell.ua/*
  11. // @match https://new.novaposhta.ua/*
  12. // @match https://otpsmart.com.ua/*
  13. // @match https://kvkmeters.ssmt.com.ua/*
  14. // @match https://my.fora.ua/*
  15. // @match https://ecodrive.in.ua/*
  16. // @match https://login.yasno.ua/*
  17. // @match https://*.aliexpress.com/*
  18. // @icon https://vault.bitwarden.com/images/favicon-32x32.png
  19. // @version 1.1.1
  20. // @license MIT
  21. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  22. // @run-at document-start
  23. // ==/UserScript==
  24.  
  25. (function() {
  26. 'use strict';
  27.  
  28. //Workaround: This document requires 'TrustedHTML' assignment
  29. if (window.trustedTypes && trustedTypes.createPolicy) {
  30. if (!trustedTypes.defaultPolicy) {
  31. const passThroughFn = (x) => x;
  32. trustedTypes.createPolicy('default', {
  33. createHTML: passThroughFn,
  34. createScriptURL: passThroughFn,
  35. createScript: passThroughFn,
  36. });
  37. }
  38. }
  39.  
  40. function universalAddIdUsername(input) {
  41. //if (input.getAttribute("id") != "username") {
  42. input.setAttribute("id", "username");
  43. //}
  44. }
  45.  
  46. function universalAddIdPassword(input) {
  47. //if (input.getAttribute("id") != "password") {
  48. input.setAttribute("id", "password");
  49. //}
  50. }
  51.  
  52. function universalAddIdPhone(input) {
  53. //if (input.getAttribute("id") != "phone") {
  54. input.setAttribute("id", "phone");
  55. //}
  56. }
  57.  
  58. function universalAddIdSuperpass(input) {
  59. //if (input.getAttribute("id") != "superpass") {
  60. input.setAttribute("id", "superpass");
  61. //}
  62. }
  63.  
  64. function kyivstarAddIdPUK2(input) {
  65. if (input.getAttribute("id") == null) {
  66. if (window.location.href.indexOf("puk2") !== -1) {
  67. input.setAttribute("id", "puk2");
  68. }
  69. }
  70. }
  71.  
  72. if (window.location.href.indexOf("https://account.kyivstar.ua/cas/") == 0) {
  73. setInterval (function () {
  74. document.querySelectorAll("form .input-container input[type='text']:not(#username)").forEach(universalAddIdUsername);
  75. document.querySelectorAll("input[type='password']").forEach(kyivstarAddIdPUK2);
  76. //document.querySelectorAll("form div.[class^='PasswordInput'] .input-container input[type='text']#username").forEach(universalAddIdPassword);
  77. }, 500);
  78. }
  79.  
  80. if (window.location.href.indexOf(".privat24.ua/") > 0 || window.location.href.indexOf(".privatbank.ua/") > 0) {
  81. setInterval (function () {
  82. document.querySelectorAll("input[type='tel']:not(#username)").forEach(universalAddIdUsername);
  83. }, 500);
  84. }
  85.  
  86. if (window.location.href.indexOf("https://auth.lifecell.ua/") == 0) {
  87. setInterval (function () {
  88. document.querySelectorAll("input[autocomplete='username'][inputmode='tel']:not(#username)").forEach(universalAddIdUsername);
  89. document.querySelectorAll("form.superpass-form input[autocomplete='one-time-code']:not(#superpass)").forEach(universalAddIdSuperpass);
  90. }, 500);
  91. }
  92.  
  93. if (window.location.href.indexOf("https://new.novaposhta.ua/") == 0) {
  94. setInterval (function () {
  95. document.querySelectorAll("input.mat-input-element:not(#phone)").forEach(universalAddIdPhone);
  96. }, 500);
  97. }
  98.  
  99. if (window.location.href.indexOf("https://otpsmart.com.ua/") == 0) {
  100. setInterval (function () {
  101. document.querySelectorAll("input#userNameVisual:not(#username)").forEach(universalAddIdUsername);
  102. }, 500);
  103. }
  104.  
  105. if (window.location.href.indexOf("https://kvkmeters.ssmt.com.ua/") == 0) {
  106. setInterval (function () {
  107. document.querySelectorAll("input#consumerCode:not(#username)").forEach(universalAddIdUsername);
  108. }, 500);
  109. }
  110.  
  111. if (window.location.href.indexOf("https://my.fora.ua/") == 0) {
  112. setInterval (function () {
  113. document.querySelectorAll("input[name='phone']:not(#username)").forEach(universalAddIdUsername);
  114. }, 500);
  115. }
  116.  
  117. if (window.location.href.indexOf("https://ecodrive.in.ua/") == 0) {
  118. setInterval (function () {
  119. document.querySelectorAll("input[name='user_login']:not(#username)").forEach(universalAddIdUsername);
  120. document.querySelectorAll("input[name='password']:not(#password)").forEach(universalAddIdPassword);
  121. }, 500);
  122. }
  123.  
  124. if (window.location.href.indexOf("https://login.yasno.ua/") == 0) {
  125. setInterval (function () {
  126. document.querySelectorAll("input[type='tel']:not(#username)").forEach(universalAddIdUsername);
  127. }, 500);
  128. }
  129.  
  130. if (window.location.href.indexOf(".aliexpress.com/") > 0) {
  131. setInterval (function () {
  132. document.querySelectorAll("input.cosmos-input:not(#username)").forEach(universalAddIdUsername);
  133. }, 500);
  134. }
  135.  
  136.  
  137. })();