Исправил баг с генерацие личного кода. Сгенерировал новую версию
This commit is contained in:
parent
6da07187a0
commit
0d8b349015
@ -24,6 +24,17 @@ function insertValueToNode(target, value) {
|
|||||||
|
|
||||||
chrome.runtime.onMessage.addListener(
|
chrome.runtime.onMessage.addListener(
|
||||||
function(autocompleteDTO, sender, sendResponse) {
|
function(autocompleteDTO, sender, sendResponse) {
|
||||||
|
switch (autocompleteDTO.action) {
|
||||||
|
case 'insert':
|
||||||
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
|
insertValueToNode(autocompleteDTO.target || null, autocompleteDTO.value || '')
|
||||||
|
break
|
||||||
|
case 'clean_notification':
|
||||||
|
var elementList = document.querySelectorAll('.uk-notify-message');
|
||||||
|
elementList.forEach(function(elementItem) {
|
||||||
|
elementItem.remove()
|
||||||
|
});
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
2
popup/dist/index.html
vendored
2
popup/dist/index.html
vendored
@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.41c99ca8.css" rel="preload" as="style"><link href="/popup/dist/js/app.b9d76837.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.41c99ca8.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.b9d76837.js"></script></body></html>
|
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/popup/dist/favicon.ico"><![endif]--><title>sveak-helper</title><link href="/popup/dist/css/app.41c99ca8.css" rel="preload" as="style"><link href="/popup/dist/js/app.9f60f961.js" rel="preload" as="script"><link href="/popup/dist/js/chunk-vendors.49bbd58a.js" rel="preload" as="script"><link href="/popup/dist/css/app.41c99ca8.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/popup/dist/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/popup/dist/img/icons/favicon-16x16.png"><link rel="manifest" href="/popup/dist/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="sveak-helper"><link rel="apple-touch-icon" href="/popup/dist/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/popup/dist/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but sveak-helper doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/popup/dist/js/chunk-vendors.49bbd58a.js"></script><script src="/popup/dist/js/app.9f60f961.js"></script></body></html>
|
2
popup/dist/js/app.9f60f961.js
vendored
Normal file
2
popup/dist/js/app.9f60f961.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
popup/dist/js/app.9f60f961.js.map
vendored
Normal file
1
popup/dist/js/app.9f60f961.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
popup/dist/js/app.b9d76837.js
vendored
2
popup/dist/js/app.b9d76837.js
vendored
File diff suppressed because one or more lines are too long
1
popup/dist/js/app.b9d76837.js.map
vendored
1
popup/dist/js/app.b9d76837.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,15 +1,15 @@
|
|||||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||||
{
|
{
|
||||||
"revision": "67e5a2be8d8880b2bc55",
|
"revision": "3e936da90702a5197189",
|
||||||
"url": "/css/app.41c99ca8.css"
|
"url": "/css/app.41c99ca8.css"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "bca1067d524c5d14daccdf286aa8015a",
|
"revision": "97d955ddd9995138724db802e2dab3da",
|
||||||
"url": "/index.html"
|
"url": "/index.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "67e5a2be8d8880b2bc55",
|
"revision": "3e936da90702a5197189",
|
||||||
"url": "/js/app.b9d76837.js"
|
"url": "/js/app.9f60f961.js"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"revision": "55fa3e18a2c5425a215c",
|
"revision": "55fa3e18a2c5425a215c",
|
2
popup/dist/service-worker.js
vendored
2
popup/dist/service-worker.js
vendored
@ -14,7 +14,7 @@
|
|||||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||||
|
|
||||||
importScripts(
|
importScripts(
|
||||||
"/precache-manifest.54c8bc8d3e1537ddd6d60bfb5aff3d0f.js"
|
"/precache-manifest.874d68b58bbb73356bc2a8570f02bb3c.js"
|
||||||
);
|
);
|
||||||
|
|
||||||
workbox.core.setCacheNameDetails({prefix: "sveak-helper"});
|
workbox.core.setCacheNameDetails({prefix: "sveak-helper"});
|
||||||
|
4
popup/src/classes/Enum/Action.ts
Normal file
4
popup/src/classes/Enum/Action.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export enum Action {
|
||||||
|
INSERT = 'insert',
|
||||||
|
CLEAN_NOTIFICATION = 'clean_notification',
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
export class Sender {
|
export class Sender {
|
||||||
send (message: Record<string, any>) {
|
send (message: Record<string, any>) {
|
||||||
|
if (typeof chrome !== 'undefined') {
|
||||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs: any) {
|
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs: any) {
|
||||||
chrome.tabs.sendMessage(tabs[0].id, message, function (response: any) {
|
chrome.tabs.sendMessage(tabs[0].id, message, function (response: any) {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
@ -7,5 +8,6 @@ export class Sender {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new Sender()
|
export default new Sender()
|
||||||
|
@ -18,16 +18,15 @@ export class PersonalIdGenerator {
|
|||||||
* @param gender
|
* @param gender
|
||||||
*/
|
*/
|
||||||
generate (country: Country, gender: Gender) {
|
generate (country: Country, gender: Gender) {
|
||||||
console.log(country, gender)
|
const year = this.getYearPart()
|
||||||
const n = this.getYearPart()
|
const month = this.getMonthPart()
|
||||||
const r = this.getMonthPart()
|
const day = this.getDayPart()
|
||||||
const i = this.getDayPart()
|
|
||||||
const o = this.getIdNumPart()
|
const o = this.getIdNumPart()
|
||||||
const a = this.getGenderPart(country, gender)
|
const a = this.getGenderPart(country, gender)
|
||||||
console.log(country, gender, a)
|
const l = this.getControlSum(country, year, month, day, o, a)
|
||||||
const l = this.getControlSum(country, n, r, i, o, a)
|
const l2 = this.getChecksum(a + year + month + day + o)
|
||||||
|
|
||||||
return Country.POLAND === country ? n + r + i + o + a + l : a + n + r + i + o + l
|
return a + year + month + day + o + l2
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,6 +96,29 @@ export class PersonalIdGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* public static function getChecksum($personalId)
|
||||||
|
{
|
||||||
|
$s1 = $s2 = 0;
|
||||||
|
$k1 = 1;
|
||||||
|
$k2 = 3;
|
||||||
|
|
||||||
|
for ($i = 0; $i < strlen($personalId) - 1; $i++) {
|
||||||
|
$s1 += $personalId[$i] * $k1;
|
||||||
|
$s2 += $personalId[$i] * $k2;
|
||||||
|
$k1 = ($k1 == 9) ? 1 : $k1 + 1;
|
||||||
|
$k2 = ($k2 == 9) ? 1 : $k2 + 1;
|
||||||
|
}
|
||||||
|
$checksum = 0;
|
||||||
|
if (($s1 % 11) < 10) {
|
||||||
|
$checksum = $s1 % 11;
|
||||||
|
} elseif (($s2 % 11) < 10) {
|
||||||
|
$checksum = $s2 % 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $checksum;
|
||||||
|
}
|
||||||
|
*
|
||||||
|
*
|
||||||
* e.getControlSum = function (e, t, n, r, i, o) {
|
* e.getControlSum = function (e, t, n, r, i, o) {
|
||||||
var a, l;
|
var a, l;
|
||||||
if ("pl" === e) return l = +(a = t + n + r + i + o)[0] + 3 * +a[1] + 7 * +a[2] + 9 * +a[3] + +a[4] + 3 * +a[5] + 7 * +a[6] + 9 * +a[7] + +a[8] + 3 * +a[9], 0 != (l %= 10) && (l = 10 - l), String(l);
|
if ("pl" === e) return l = +(a = t + n + r + i + o)[0] + 3 * +a[1] + 7 * +a[2] + 9 * +a[3] + +a[4] + 3 * +a[5] + 7 * +a[6] + 9 * +a[7] + +a[8] + 3 * +a[9], 0 != (l %= 10) && (l = 10 - l), String(l);
|
||||||
@ -138,6 +160,53 @@ export class PersonalIdGenerator {
|
|||||||
d %= 11
|
d %= 11
|
||||||
return (c %= 11) < 10 ? String(c) : d < 10 ? String(d) : String(0)
|
return (c %= 11) < 10 ? String(c) : d < 10 ? String(d) : String(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getChecksum (code: string) {
|
||||||
|
let b = 1
|
||||||
|
let c = 3
|
||||||
|
let d = 0
|
||||||
|
let e = 0
|
||||||
|
let i
|
||||||
|
let digit
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
digit = parseInt(code[i])
|
||||||
|
d += digit * b
|
||||||
|
e += digit * c
|
||||||
|
b++; if (b === 10) b = 1
|
||||||
|
c++; if (c === 10) c = 1
|
||||||
|
}
|
||||||
|
d = d % 11
|
||||||
|
e = e % 11
|
||||||
|
if (d < 10) {
|
||||||
|
return d
|
||||||
|
} else if (e < 10) {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// getChecksum($personalId)
|
||||||
|
// {
|
||||||
|
// $s1 = $s2 = 0;
|
||||||
|
// $k1 = 1;
|
||||||
|
// $k2 = 3;
|
||||||
|
//
|
||||||
|
// for ($i = 0; $i < strlen($personalId) - 1; $i++) {
|
||||||
|
// $s1 += $personalId[$i] * $k1;
|
||||||
|
// $s2 += $personalId[$i] * $k2;
|
||||||
|
// $k1 = ($k1 == 9) ? 1 : $k1 + 1;
|
||||||
|
// $k2 = ($k2 == 9) ? 1 : $k2 + 1;
|
||||||
|
// }
|
||||||
|
// $checksum = 0;
|
||||||
|
// if (($s1 % 11) < 10) {
|
||||||
|
// $checksum = $s1 % 11;
|
||||||
|
// } elseif (($s2 % 11) < 10) {
|
||||||
|
// $checksum = $s2 % 11;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return $checksum;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new PersonalIdGenerator()
|
export default new PersonalIdGenerator()
|
||||||
|
@ -8,6 +8,7 @@ import { Person } from '@/classes/DTO/Person'
|
|||||||
import VueClipboard from 'vue-clipboard2'
|
import VueClipboard from 'vue-clipboard2'
|
||||||
import { Target } from '@/classes/Enum/Target'
|
import { Target } from '@/classes/Enum/Target'
|
||||||
import sender from '@/classes/Service/Browser/Chrome/Sender'
|
import sender from '@/classes/Service/Browser/Chrome/Sender'
|
||||||
|
import { Action } from '@/classes/Enum/Action'
|
||||||
|
|
||||||
Vue.use(VueClipboard)
|
Vue.use(VueClipboard)
|
||||||
|
|
||||||
@ -55,8 +56,15 @@ export default class HelloWorld extends Vue {
|
|||||||
|
|
||||||
insertValueToNode (target: Target, value: string): void {
|
insertValueToNode (target: Target, value: string): void {
|
||||||
sender.send({
|
sender.send({
|
||||||
|
action: Action.INSERT,
|
||||||
target: target,
|
target: target,
|
||||||
value: value
|
value: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanNotifications (): void {
|
||||||
|
sender.send({
|
||||||
|
action: Action.CLEAN_NOTIFICATION
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-row__item">
|
<div class="form-row__item">
|
||||||
<button>Clean</button>
|
<button
|
||||||
|
@click="cleanNotifications"
|
||||||
|
>Clean</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user