├── README.md ├── calendar.html ├── css ├── calendar.css └── reset.css ├── dist ├── calendar.html ├── css │ ├── calendar.css │ ├── calendar.min.css │ ├── reset.css │ └── reset.min.css ├── img │ ├── bk_polyicon.png │ ├── bk_polyicon1.gif │ ├── favicon.ico │ ├── favicon.png │ ├── icons_0e814c16.png │ ├── icons_5c448026.gif │ ├── layericon.gif │ ├── layericon.png │ ├── tip-arrow-bottom.png │ ├── tip-arrow-top.png │ ├── tip-bottom.png │ ├── tip-left-bottom.png │ ├── tip-left-top.png │ ├── tip-left.png │ ├── tip-right-bottom.png │ ├── tip-right-top.png │ ├── tip-right.png │ ├── tip-top.png │ └── toplist_dot.png ├── js │ ├── calendar.js │ └── calendar.min.js └── lib │ ├── hl2008.js │ ├── hl2009.js │ ├── hl2010.js │ ├── hl2011.js │ ├── hl2012.js │ ├── hl2013.js │ ├── hl2014.js │ ├── hl2015.js │ ├── hl2016.js │ ├── hl2017.js │ ├── hl2018.js │ ├── hl2019.js │ ├── hl2020.js │ ├── wt2014.js │ ├── wt2015.js │ └── wt2016.js ├── doc ├── html │ ├── css │ │ ├── base.lib.min.css │ │ ├── layout.min.css │ │ ├── mdeditor.lib.min.css │ │ └── prettify-cmd.css │ ├── img │ │ ├── app.gif │ │ ├── calendar_api.png │ │ ├── console_show.png │ │ ├── construct.png │ │ ├── default-head.jpg │ │ ├── dom_api.png │ │ ├── favicon.png │ │ └── main.gif │ └── index.html ├── pdf │ └── index.pdf └── readme.txt ├── gulpfile.js ├── img ├── bk_polyicon.png ├── bk_polyicon1.gif ├── favicon.ico ├── favicon.png ├── icons_0e814c16.png ├── icons_5c448026.gif ├── layericon.gif ├── layericon.png ├── tip-arrow-bottom.png ├── tip-arrow-top.png ├── tip-bottom.png ├── tip-left-bottom.png ├── tip-left-top.png ├── tip-left.png ├── tip-right-bottom.png ├── tip-right-top.png ├── tip-right.png ├── tip-top.png └── toplist_dot.png ├── install └── setup.exe ├── js ├── calendar.js ├── common.js ├── dom.js ├── event.js └── main.js ├── lib ├── hl2008.js ├── hl2009.js ├── hl2010.js ├── hl2011.js ├── hl2012.js ├── hl2013.js ├── hl2014.js ├── hl2015.js ├── hl2016.js ├── hl2017.js ├── hl2018.js ├── hl2019.js ├── hl2020.js ├── wt2014.js ├── wt2015.js └── wt2016.js └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # 万年历 Calender 2 | 3 | ------ 4 | 5 | ## 一、摘要 6 | 7 | - [万年历 Calender](#万年历-calender) 8 | - [一、摘要](#一摘要) 9 | - [二、简介](#二简介) 10 | - [三、开发流程](#三开发流程) 11 | - [四、主要模块](#四主要模块) 12 | - [五、目录结构](#五目录结构) 13 | - [六、接口文档](#六接口文档) 14 | - [1. Calendar类](#1-calendar类) 15 | - [2. Dom类](#2-dom类) 16 | - [七、调试日历](#七调试日历) 17 | - [八、移动适配](#八移动适配) 18 | - [九、后续开发](#九后续开发) 19 | - [十、总结](#十总结) 20 | 21 | ------ 22 | 23 | ## 二、简介 24 | 25 | 本款万年历实现了农历,公历,天干地支,24节气,国内国际假日,每日宜忌(08年~20年),节假日(14年~16年)的查询。 26 | 万年历界面采用百度日历UI界面,核心JS代码手动编写,没有依赖函数库。代码采用模块式开发,gulp构建,HBuilder开发。***另用node-webkit打包了一版桌面应用,方便使用。*** 27 | 28 |  29 | 30 | ## 三、开发流程 31 | 32 | - [ ] 选择一款日历UI(经过筛选,百度日历的UI比较简洁漂亮)。 33 | - [ ] 编写JavaScript核心代码,实现农历、公历等日期信息参数的查询。 34 | - [ ] 将JavaScript代码和UI界面,整合到一起。期间涉及DOM生成模块(实现模板功能),Event模块,CSS模块(切换主题和UI),日历算法核心模块,仿jQuery模块(工具类)。 35 | - [ ] 使用gulp前端构建工具打包发布工程。 36 | - [ ] 编写开发文档。 37 | 38 | ## 四、主要模块 39 | - [x] 核心算法模块(calender.js) 40 | - [x] 仿jQuery模块,提供工具函数(common.js) 41 | - [x] Dom模块,生成HTML页面结构(dom.js) 42 | - [x] Event模块,日历中各种事件(event.js) 43 | - [x] 入口模块(main.js) 44 | 45 | ## 五、目录结构 46 | 47 |  48 | 49 | ## 六、接口文档 50 | 51 | 日历主要有两个全局变量window.Calendar和window.DOM,Calender类主要实现了日历相关的功能,DOM类实现了主要的jQuery函数。 52 | 53 | ### 1. Calendar类 54 |  55 | 56 | ### 2. Dom类 57 |  58 | ## 七、调试日历 59 |  60 | ## 八、移动适配 61 | ```css 62 | /* 小屏幕(平板,大于等于 768px) */ 63 | @media (max-width: 600px) { 64 | .op-calendar-new-right{ 65 | display:none; 66 | } 67 | .c-container{ 68 | width:409px; 69 | border-right: 2px solid #57abff; 70 | } 71 | } 72 | ``` 73 |  74 | 75 | ## 九、后续开发 76 | - [ ] 模块之间通过require加载。 77 | - [ ] CSS通过Less等css编译工具编译完成。 78 | - [ ] 只做了简单媒体查询样式代码的编写,移动端适配的功能有待完善和开发。 79 | - [ ] 对HTML结构要求比较苛刻,暂不支持模板替换和主题替换。 80 | 81 | ## 十、总结 82 | 限于时间原因,不能更多的书写详细的文档,还希望各位大神拜读源码了。通过该项目又一次发现了自己技术的不足,需要继续学习.... 83 | 84 | 85 | 86 | ------ 87 | 88 | 89 | 90 | 作者 魏国兴 91 | 邮箱 1607646162@qq.com 92 | 2016 年 04月 13日 93 | 94 | 95 | -------------------------------------------------------------------------------- /calendar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |<%=today%> <%=week%>
',o+='<%=dayTime%>
',o+='',o+="<%=lunarMonth%><%=lunarDay%><%=eraYear%>年 【<%=zodiac%>】<%=eraMonth%>月 <%=eraDay%>日
",o+='',o+='宜<%=yDay%>',o+='忌<%=jDay%>
',o+="@魏国兴
19 |
20 | 2016-04-13 23:40
21 |
22 | 字数 1018
23 | 阅读 0
24 |
25 | 34 |
本款万年历实现了农历,公历,天干地支,24节气,国内国际假日,每日宜忌(08年~20年),节假日(14年~16年)的查询。
万年历界面采用百度日历UI界面,核心JS代码手动编写,没有依赖函数库。代码采用模块式开发,gulp构建,HBuilder开发。
62 | 另用node-webkit打包了一版桌面应用,方便使用。


日历主要有两个全局变量window.Calendar和window.DOM,Calender类主要实现了日历相关的功能,DOM类实现了主要的jQuery函数。
88 | 89 |


100 |
/* 小屏幕(平板,大于等于 768px) */@media (max-width: 600px) {.op-calendar-new-right{display:none;}.c-container{width:409px;border-right: 2px solid #57abff;}}

限于时间原因,不能更多的书写详细的文档,还希望各位大神拜读源码了。通过该项目又一次发现了自己技术的不足,需要继续学习....
113 |作者 魏国兴
邮箱 1607646162@qq.com
2016 年 04月 13日
<%=today%> <%=week%>
'; 151 | dtmpl+='<%=dayTime%>
'; 152 | dtmpl+=''; 153 | dtmpl+='<%=lunarMonth%><%=lunarDay%><%=eraYear%>年 【<%=zodiac%>】<%=eraMonth%>月 <%=eraDay%>日
'; 154 | dtmpl+=''; 156 | dtmpl+='宜<%=yDay%>'; 157 | dtmpl+='忌<%=jDay%>
'; 158 | dtmpl+='