Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

content.min.js 1.4 KiB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. 'use strict';
  3. var _formParser = require('./form-parser');
  4. chrome.runtime.onMessage.addListener(function (message) {
  5. var loginForm = (0, _formParser.getLoginForm)();
  6. loginForm.loginField.value = message.login;
  7. loginForm.passwordField.value = message.password;
  8. loginForm.form.submit();
  9. });
  10. },{"./form-parser":2}],2:[function(require,module,exports){
  11. 'use strict';
  12. Object.defineProperty(exports, "__esModule", {
  13. value: true
  14. });
  15. function getLoginForm() {
  16. var loginForm = {};
  17. Array.from(document.forms).forEach(function (form) {
  18. var i = 0;
  19. var inputs = Array.from(document.querySelectorAll('input'));
  20. inputs.forEach(function (node) {
  21. if (node.type === 'password') {
  22. loginForm.form = form;
  23. loginForm.passwordField = node;
  24. if (i > 0) {
  25. loginForm.loginField = inputs[i - 1];
  26. }
  27. }
  28. i++;
  29. });
  30. });
  31. return loginForm;
  32. }
  33. exports.getLoginForm = getLoginForm;
  34. },{}]},{},[1]);