Skip to content

Instantly share code, notes, and snippets.

@gwokae
Last active November 9, 2023 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwokae/43883c342fd5ed5e9e4fa5c2b8457426 to your computer and use it in GitHub Desktop.
Save gwokae/43883c342fd5ed5e9e4fa5c2b8457426 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name 監理服務網 網路選號小助手
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author @gwokae
// @match https://www.mvdis.gov.tw/m3-emv-plate/webpickno/queryPickNo*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gov.tw
// @grant none
// ==/UserScript==
// 參考資料: https://car16.com/blog/how-to-apply-feng-shui-to-your-car
const PLATE_RE = /(\S+)\-(\d+)/;
const badSum = [6, 18, 14, 16, 19, 22, 26, 29, 32];
const goodSum = [
1, 3, 5, 7, 8, 9, 11, 13, 15, 17, 23, 24, 31, 33, 35, 37, 39, 41, 45, 48,
];
const sumDesc = [
'1:繁榮發達,信用得固,萬人仰望,可獲成功。(吉)',
'2:動搖不安,一榮一枯,一盛一衰,勞而無功。(凶)',
'3:立身出世,有貴人助,天賜吉祥,四海名揚。(吉)',
'4:日被雲遮,苦難折磨,非有毅力,難望成功。(凶)',
'5:陰陽和合,精神惀快,榮譽達利,一門興隆。(吉)',
'6:萬寶集門,天降幸運,立志奮發,得成大功。(吉)',
'7:精力旺盛,頭腦明敏,排除萬難,必獲成功。(吉)',
'8:努力發達,貫徹志望,不忘進退,可期成功。(吉)',
'9:雖抱奇才,有才無命,獨營無力,財利難望。(凶)',
'10:烏雲遮月,暗淡無光,空費心力,徒勞無功。(凶)',
'11:草木逢春,枝葉沾露,穩建著實,必得人望。(吉)',
'12:薄弱無力,孤立無援,外祥內苦,謀事難成。(凶)',
'13:天賦吉運,能得人望,善用智慧,必獲成功。(吉)',
'14:忍得苦難,必有後福,是成是敗,惟靠堅毅。(凶)',
'15:謙恭做事,外得人和,大事成就,一門興隆。(吉)',
'16:能獲眾望,成就大業,名利雙收,盟主四方。(吉)',
'17:排除萬難,有貴人助,把握時機,可得成功。(吉)',
'18:經商做事,順利昌隆,如能慎始,百事亨通。(吉)',
'19:成功雖早,慎防虧空,內外不和,障礙重重。(凶)',
'20:智高志大,歷盡艱難,焦心憂勞,進退兩難。(凶)',
'21:先歷困苦,後得幸福,霜雪梅花,春來怒放。(吉)',
'22:秋草逢霜,懷才不遇,憂愁怨苦,事不如意。(凶)',
'23:旭日昇天,名顯四方,漸次進展,終成大業。(吉)',
'24:錦繡前程,須靠自力,多用智謀,能奏大功。(吉)',
'25:天時地利,只久人和,講信修睦,即可成功。(吉)',
'26:波瀾起伏,千變萬化,凌駕萬難,必可成功。(凶帶吉)',
'27:一成一敗,一盛一衰,惟靠謹慎,可守成功。(吉帶凶)',
'28:魚臨旱地,難逃惡運,此數大凶,不如更名。(凶)',
'29:如龍得雲,青雲直上,智謀奮進,才略奏功。(吉)',
'30:吉凶參半,得失相伴,投機取巧,如賭一樣。(吉帶凶)',
'31:此數大吉,名利雙收,漸進向上,大業成就。(吉)',
'32:池中之龍,風雲際會,一躍上天,成功可望。(吉)',
'33:意氣用事,人和必失,如能慎始,必可昌隆。(吉)',
'34:災難不絕,難望成功,此數大凶,不如更名。(凶)',
'35:處事嚴謹,進退保守,學智兼具,成就非凡。(吉)',
'36:波瀾重疊,常陷窮困,動不如靜,有才無命。(凶)',
];
const suffixData = [
{
desc: '伏位代表等待、蓄勢待發、臥虎藏龍、財庫、狀況延續、忍耐等狀況含意。',
list: [11, 22, 33, 44, 66, 77, 88, 99],
color: 'green',
},
{
desc: '延年代表獨當一面、生命力意志力極強、綿綿不絶、大將之風、貴人偏財、領導者。',
list: [19, 91, 78, 87, 43, 34, 26, 62],
color: 'green',
},
{
desc: '生氣代表轉機、貴人相助、豁然開朗、生氣勃勃。',
list: [14, 41, 67, 76, 93, 39, 28, 82],
color: 'green',
},
{
desc: '天醫代表延壽、適當的醫療、財富、智慧。',
list: [13, 31, 68, 86, 94, 49, 72, 27],
color: 'green',
},
// bad
{
desc: '六煞代表人際關係不佳、感情不順利、桃花糾紛。',
list: [16, 61, 74, 47, 38, 83, 92, 29],
color: 'red',
},
{
desc: '絕命代表起伏波動大、非富即貧、大起大落及冒險行為。',
list: [12, 21, 69, 96, 84, 48, 37, 73],
color: 'red',
},
{
desc: '禍害代表身體病痛、口舌官非、意外及車關。',
list: [17, 71, 98, 89, 64, 46, 32, 23],
color: 'red',
},
{
desc: '五鬼代表小人糾纏、難以捉摸、不循正軌。',
list: [18, 81, 97, 79, 36, 63, 42, 24],
color: 'red',
},
];
function find(suffix) {
let result;
suffixData.forEach((item, idx) => {
if (result) return;
const i = item.list.indexOf(suffix);
if (i !== -1) result = item;
});
return result;
}
function execute() {
Array.from(document.querySelectorAll('div.number_cell > a')).forEach((el) => {
const { innerText: plate } = el;
const m = plate.match(PLATE_RE);
if (!m) {
return;
}
const [, str, num] = m;
// 尾碼
const suffix = parseInt(num.slice(-2));
let suffixResult = find(suffix);
if (suffixResult) {
const prefix = parseInt(num.slice(0, -2));
el.innerHTML = `${str}-${prefix}<span style="color: ${suffixResult.color};" title="${suffixResult.desc}">${suffix}</span>`;
}
// 總和
const sum = Array.from(num).reduce((x, t) => {
return parseInt(t) + x;
}, 0);
const div = document.createElement('div');
div.innerHTML = `數字總和: ${sum}`;
if (badSum.includes(sum)) div.style = 'color: red;';
else if (goodSum.includes(sum)) div.style = 'color: green;';
div.title = sumDesc[sum - 1];
el.parentElement?.appendChild(div, el);
});
}
(function () {
'use strict';
execute();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment