Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function skillDataHarvester() {
- // https://wiki.biligame.com/blhx/%E6%8A%80%E8%83%BD
- let
- template = {
- id: "",
- name: "",
- ship_type: "",
- s1: "",
- s2: "",
- s3: "",
- s4: "",
- },
- data = {},
- eff_data = {};
- [...document.querySelectorAll(".wikitable.sortable.jquery-tablesorter>tbody tr")]
- .forEach(tr => {
- let new_data = Object.assign({}, template);
- Object.keys(new_data).forEach((key, i) => {
- new_data[key] = tr.children[i].innerText.trim();
- });
- data[new_data.id] = new_data;
- if (isSkillHaveEff(new_data)) eff_data[new_data.id] = new_data;
- });
- return [data, eff_data]; // [全部技能, 僅技能包含效率的船]
- function isSkillHaveEff(obj) {
- let
- target = ["s1", "s2", "s3", "s4"],
- reg = /效率/;
- return target.some(key => obj[key].match(reg));
- }
- }
Add Comment
Please, Sign In to add comment