Fix Bitwarden compatibility

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

目前为 2022-07-16 提交的版本,查看 最新版本

  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/login*
  8. // @match https://next.privat24.ua/*
  9. // @match https://login-widget.privat24.ua/*
  10. // @match https://auth.lifecell.ua/*
  11. // @icon https://vault.bitwarden.com/images/favicon-32x32.png
  12. // @version 1.0.1
  13. // @license MIT
  14. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
  15. // @run-at document-idle
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. function universalAddIdUsername(input) {
  22. if (input.getAttribute("id") == null) {
  23. input.setAttribute("id", "username");
  24. }
  25. }
  26.  
  27. function kyivstarAddIdPUK2(input) {
  28. if (input.getAttribute("id") == null) {
  29. if (window.location.href.indexOf("#puk2:") !== -1) {
  30. input.setAttribute("id", "puk2");
  31. }
  32. }
  33. }
  34.  
  35. if (window.location.href.indexOf("https://account.kyivstar.ua/cas/login") == 0) {
  36. setInterval (function () {
  37. document.querySelectorAll("input[type='tel']").forEach(universalAddIdUsername);
  38. document.querySelectorAll("input[type='password']").forEach(kyivstarAddIdPUK2);
  39. }, 500);
  40. }
  41.  
  42. if (window.location.href.indexOf("https://login-widget.privat24.ua/") == 0) {
  43. setInterval (function () {
  44. document.querySelectorAll("input[type='tel']").forEach(universalAddIdUsername);
  45. }, 500);
  46. }
  47.  
  48. if (window.location.href.indexOf("https://auth.lifecell.ua/") == 0) {
  49. setInterval (function () {
  50. document.querySelectorAll("input[autocomplete='username'][inputmode='tel']").forEach(universalAddIdUsername);
  51. }, 500);
  52. }
  53.  
  54. })();