Fix Bitwarden compatibility

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

当前为 2022-07-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          Fix Bitwarden compatibility
// @description   Make login/password boxes on selected sites compatible with Bitwarden auto-fill
// @author        MK
// @namespace     max44
// @homepage      https://greasyfork.org/en/users/309172-max44
// @match         https://account.kyivstar.ua/cas/login*
// @match         https://next.privat24.ua/*
// @match         https://login-widget.privat24.ua/*
// @match         https://auth.lifecell.ua/*
// @match         https://new.novaposhta.ua/*
// @icon          https://vault.bitwarden.com/images/favicon-32x32.png
// @version       1.0.2
// @license       MIT
// @require       https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @run-at        document-idle
// ==/UserScript==

(function() {
  'use strict';

  function universalAddIdUsername(input) {
    if (input.getAttribute("id") != "username") {
      input.setAttribute("id", "username");
    }
  }

  function universalAddIdPhone(input) {
    if (input.getAttribute("id") != "phone") {
      input.setAttribute("id", "phone");
    }
  }

  function kyivstarAddIdPUK2(input) {
    if (input.getAttribute("id") == null) {
      if (window.location.href.indexOf("#puk2:") !== -1) {
        input.setAttribute("id", "puk2");
      }
    }
  }

  if (window.location.href.indexOf("https://account.kyivstar.ua/cas/login") == 0) {
    setInterval (function () {
      document.querySelectorAll("input[type='tel']").forEach(universalAddIdUsername);
      document.querySelectorAll("input[type='password']").forEach(kyivstarAddIdPUK2);
    }, 500);
  }

  if (window.location.href.indexOf("https://login-widget.privat24.ua/") == 0) {
    setInterval (function () {
      document.querySelectorAll("input[type='tel']").forEach(universalAddIdUsername);
    }, 500);
  }

  if (window.location.href.indexOf("https://auth.lifecell.ua/") == 0) {
    setInterval (function () {
      document.querySelectorAll("input[autocomplete='username'][inputmode='tel']").forEach(universalAddIdUsername);
    }, 500);
  }

  if (window.location.href.indexOf("https://new.novaposhta.ua/") == 0) {
    setInterval (function () {
      document.querySelectorAll("input.mat-input-element").forEach(universalAddIdPhone);
    }, 500);
  }

})();