Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议拆分一下结构 #13

Open
hack86 opened this issue Jul 30, 2020 · 3 comments
Open

建议拆分一下结构 #13

hack86 opened this issue Jul 30, 2020 · 3 comments

Comments

@hack86
Copy link

hack86 commented Jul 30, 2020

1、阴历农历的转换为基础库js
2、节气与星座等,分别独立成js文件
3、通过简单脚本可以合并所有的,也可以按需索取

好处:减少文本容量

@hack86
Copy link
Author

hack86 commented Jul 30, 2020

工程建议:
源文件:不同的js文件,开发时直接编写。
发布时:通过gulp合并基础、节气、星座等,生成calendar.min.js。并去除注释

@hack86
Copy link
Author

hack86 commented Jul 30, 2020

其中 sTermInfo 变量占用了6650字符,我简单做了字符转换了,压缩后可降至1927字符。整体通过uglifyjs压缩后可从29k缩减成10k。当然如果将节气星座解耦,还能更小。以下代码可直接替换,贡献给需要的朋友。如作者原意我可以帮助修改结构。

var sTermInfo = function () {
    let b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
    let st0 = '97783,97bd0,97c36,b0b6f,c9274,c91aa,97b6b,97bd1,9801e,c9210,c965c,c920e,97bcf,97c35,98082,c95f8,c920f,b06bd,b0722,e1cfc,b0270,9801d,c8dc2,7f595,7f530,b0b0b,7f0e3,7f148,7f531,7f0e4,b0723,b0b70,b0721,7f0e2,b0787,7f149,7f07e,b02d5,7ec96,66aa8,98083,6665b,665f6,66a44'.split(',');
    let st1 = 'ABCDEF,GHIJKL,MNOPKQ,BRSKTQ,UBCDEF,GHIJKL,MNIPKQ,BRSKTQ,UBCDEF,GHIJKL,MNIPKQ,BRSKTQ,UBCDEF,AHIJKL,GHIPKQ,BVOPTQ,BBCDJW,AHCJEF,GHIPKL,BVOPTQ,BBCDJW,ABCJEF,GHIPKL,MNOPTQ,BBCDJW,ABCJE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Oig,kdceDS,apnION,qabOel,majOig,kdceDS,aprION,qabOel,majOiR,kdceDg,aprION,qabOSN,majOiR,kdceDg,hprION,qabISN,majOiR,kdceDg,hbcZDS'.split(',');
    let res = [];
    for (let i = 0; i < st1.length; i += 1) {
        let s = '';
        for (let j = 0; j < 6; j += 1) {
            s += st0[b64.indexOf(st1[i].charAt(j))];
        }
        res.push(s);
    }
    return res;
}();

@jjonline
Copy link
Owner

jjonline commented Aug 9, 2020

接收PR合并,您可以修改代码发PR过来合并进去,感谢支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants