├── Calendar_Soyaine.css ├── Calendar_Soyaine.html ├── Calendar_Soyaine.js ├── README.md ├── img ├── flow-diagram.png └── prototype-sketch.png └── out ├── Calendar_Soyaine.js.html ├── fonts ├── OpenSans-Bold-webfont.eot ├── OpenSans-Bold-webfont.svg ├── OpenSans-Bold-webfont.woff ├── OpenSans-BoldItalic-webfont.eot ├── OpenSans-BoldItalic-webfont.svg ├── OpenSans-BoldItalic-webfont.woff ├── OpenSans-Italic-webfont.eot ├── OpenSans-Italic-webfont.svg ├── OpenSans-Italic-webfont.woff ├── OpenSans-Light-webfont.eot ├── OpenSans-Light-webfont.svg ├── OpenSans-Light-webfont.woff ├── OpenSans-LightItalic-webfont.eot ├── OpenSans-LightItalic-webfont.svg ├── OpenSans-LightItalic-webfont.woff ├── OpenSans-Regular-webfont.eot ├── OpenSans-Regular-webfont.svg └── OpenSans-Regular-webfont.woff ├── global.html ├── index.html ├── scripts ├── linenumber.js └── prettify │ ├── Apache-License-2.0.txt │ ├── lang-css.js │ └── prettify.js └── styles ├── jsdoc-default.css ├── prettify-jsdoc.css └── prettify-tomorrow.css /Calendar_Soyaine.css: -------------------------------------------------------------------------------- 1 | * { 2 | font-family: "微软雅黑 Light"; 3 | font-size:18px; 4 | color:#000; 5 | text-align:center; 6 | -webkit-box-sizing:border-box; 7 | -moz-box-sizing:border-box; 8 | box-sizing:border-box; 9 | margin:0; 10 | } 11 | 12 | body { 13 | 14 | } 15 | 16 | a, a:visited, a:active { 17 | font-size: 14px; 18 | color: #0095dd; 19 | text-decoration: none; 20 | } 21 | 22 | a:hover { 23 | text-decoration: underline; 24 | } 25 | 26 | #calendar_s { 27 | width:80%; 28 | height:100%; 29 | color:#e25c38; 30 | display:table; 31 | margin:auto; 32 | } 33 | 34 | #todayInfo { 35 | font-size-adjust:inherit; 36 | float:right; 37 | width:30%; 38 | height:80%; 39 | top:0; 40 | background-color:#FAEBD7; 41 | align-content:center; 42 | display:table; 43 | } 44 | 45 | nav { 46 | position:relative; 47 | margin-left:0; 48 | top:0; 49 | height:20%; 50 | background-color:#86a9c0; 51 | -webkit-align-items:center; 52 | align-items:center; 53 | -webkit-align-content:center; 54 | } 55 | 56 | #backToday #holiday{ 57 | float:right; 58 | } 59 | 60 | #bjTime { 61 | float:left; 62 | } 63 | 64 | #calendar { 65 | float:left; 66 | width:70%; 67 | top:0; 68 | bottom:0; 69 | left:0; 70 | height:80%; 71 | background-color:#E9967A; 72 | display:table-cell; 73 | } 74 | 75 | td { 76 | border-bottom-color:#000; 77 | position:relative; 78 | left:0; 79 | text-align:center; 80 | margin-bottom:1px; 81 | background-color:#B0E0E6; 82 | border:1px; 83 | } 84 | .todayTd { 85 | background-color: #FFFFFF; 86 | } 87 | 88 | .date { 89 | 90 | } 91 | 92 | .dateNum { 93 | font-size: xx-large; 94 | color: #e25c38; 95 | } 96 | 97 | .date:hover { 98 | text-decoration: underline; 99 | } 100 | 101 | table { 102 | border:1em; 103 | width:100%; 104 | } 105 | 106 | thead { 107 | font-weight: bolder; 108 | } 109 | 110 | #dateZone { 111 | width:100%; 112 | height:100%; 113 | } 114 | 115 | #dateTable.td { 116 | height:3em; 117 | } 118 | 119 | @media screen and (max-width: 599px){ 120 | nav { 121 | display: inline; 122 | } 123 | } -------------------------------------------------------------------------------- /Calendar_Soyaine.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Calendar by Soyaine 7 | 8 | 9 | 10 |
11 | 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 | 60 |
61 |
62 |
2016-04-08
63 |
星期五
64 |
8
65 |
66 | 78 |
79 |
80 | 81 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Calendar_Soyaine.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by SongYuting . 3 | */ 4 | 5 | /** 6 | * @summary 当前日期 7 | * @desc 用于记录当前日历状态的Date对象,随用户的操作而不断更新 8 | * @type {Date} 9 | */ 10 | var currentDate = new Date(); 11 | 12 | /** 13 | * @summary 今日日期 14 | * @desc 用于记录今日信息的Date对象,创建后不改变,供“回到今天”使用 15 | * @type {Date} 16 | */ 17 | var today = new Date(); 18 | var thisMonth = today.getMonth(); 19 | var thisYear = today.getFullYear(); 20 | //newCalendar(thisYear, thisMonth); 21 | 22 | /** 23 | * @summary 今日日期 24 | * @desc 在操作日期发生改变时,记录上一次操作后的日期,与currentDate相差一次操作,供日期切换使用 25 | * @type {Date} 26 | */ 27 | var datedDate;// 28 | 29 | 30 | //初始生成日历 31 | newCalendar(); 32 | 33 | /** 34 | * 35 | * “上一年”切换按钮监听 36 | */ 37 | var btnLastYear = document.getElementById("lastYear"); 38 | btnLastYear.addEventListener("click", function() { 39 | var currentYear = currentDate.getFullYear(); 40 | currentDate.setYear( --currentYear ); 41 | newCalendar(); 42 | }, false); 43 | 44 | /** 45 | * 46 | * “下一年”切换按钮监听 47 | */ 48 | var btnNextYear = document.getElementById("nextYear"); 49 | btnNextYear.addEventListener("click", function() { 50 | var currentYear = currentDate.getFullYear(); 51 | currentDate.setYear( ++currentYear ); 52 | newCalendar(); 53 | }, false); 54 | 55 | /** 56 | * 57 | * “上个月”切换按钮监听 58 | */ 59 | var btnLastMonth = document.getElementById("lastMonth"); 60 | btnLastMonth.addEventListener("click", function() { 61 | var currentMonth = currentDate.getMonth(); 62 | currentDate.setMonth( --currentMonth ); 63 | newCalendar(); 64 | }, false); 65 | 66 | /** 67 | * 68 | * “下个月”切换按钮监听 69 | */ 70 | var btnNextMonth = document.getElementById("nextMonth"); 71 | btnNextMonth.addEventListener("click", function() { 72 | var currentMonth = currentDate.getMonth(); 73 | currentDate.setMonth( ++currentMonth); 74 | newCalendar(); 75 | }, false); 76 | 77 | /** 78 | * 79 | * “回到今天”切换按钮监听 80 | */ 81 | var btnBackToday = document.getElementById("backToday"); 82 | btnBackToday.addEventListener("click", function() { 83 | var nowTime = today.getTime(); 84 | currentDate.setTime(nowTime); 85 | newCalendar(); 86 | }, false); 87 | 88 | var dateNav = document.getElementsByClassName("date"); 89 | 90 | 91 | /** 92 | * @summary 根据指定 年-月(格式:YYYY-MM)生成当月日历 93 | * @desc 主体部分。 94 | * 利用Date的构造函数调用参数, 95 | * 当数值大于合理范围时,会被调整为相邻值,以此获取此月日历中第一行第一列的日期。 96 | * 若指定月份的1号是周日,表明日历不含上月的日期,无需特殊处理; 97 | * 若指定月份的1号不是周日,则取相反数(原理: 1 - 周几 + 1),获取所需日期。 98 | * 注:此处为方便生成表格使用(++date),日期计数取为从0开始,即1号由0表示,与Date.prototype.getDate()所得相差1。 99 | * 灵感来源:{@link http://jszen.blogspot.com/2007_07_01_archive.html} 100 | * @param {number} year - 预生成日历的年份 101 | * @param {number} month - 预生成日历的月份 102 | * @returns {date} currentDate - 当前日期(仅年份、月份发生改变) 103 | * 104 | */ 105 | function newCalendar() { 106 | var month = currentDate.getMonth(); 107 | var year = currentDate.getFullYear(); 108 | var date = currentDate.getDate(); 109 | var thisMonthDay = new Date(year, month, 1); 110 | var thisMonthFirstDay = thisMonthDay.getDay(); 111 | var thisMonthFirstDate = new Date(year, month, - thisMonthFirstDay); 112 | generateTable(thisMonthFirstDate); //生成日历主体的日期区域 113 | generateNav(year, month); //生成导航区域 114 | generateToday(); //生成今日信息区域 115 | currentDate.setYear(year); 116 | currentDate.setMonth(month); 117 | return currentDate; 118 | } 119 | 120 | /** 121 | * @summary 设定导航区域 122 | * @desc 利用年、月设定相关值 123 | * @param {number} year - 预生成日历的年份 124 | * @param {number} month - 预生成日历的月份 125 | * @todo 加入实时变化的时间 126 | * 127 | */ 128 | function generateNav(year, month) { 129 | var navYear = document.getElementById("year"); 130 | var navMonth = document.getElementById("month"); 131 | navYear.innerText = year.toString(); 132 | navMonth.innerText = (month + 1).toString(); 133 | } 134 | 135 | /** 136 | * @summary 根据日历首位日期,生成日历主体表格 137 | * @desc 首位日期指:日历的表格中第一行第一列位置的日期。 138 | * 利用Date的相关特性处理跨月份的情况,循环后 139 | * 生成 6*7 表格,加入DOM树,形成日历的主体日期区域。 140 | * @param {date} firstDate - 日历表格中第一行、第一列的日期数(从0开始) 141 | */ 142 | function generateTable(firstDate) { 143 | //获取日历日期部分Node 144 | var dateTable = document.getElementById("dateTable"); 145 | //若不是第一次生成,则需要把此前生成的日历去掉 146 | while (dateTable.firstChild) { 147 | dateTable.removeChild(dateTable.firstChild); 148 | } 149 | var date = firstDate.getDate(); 150 | for (var i = 0; i < 6; i++){ 151 | var newRow = document.createElement("tr"); 152 | for(var j = 0; j < 7; j++){ 153 | var newDate = document.createElement("td"); 154 | //获取日期信息 155 | firstDate.setDate(++date); 156 | date = firstDate.getDate(); 157 | newDate.innerText = date; 158 | //设置Node的id,便于后期操作 159 | var dateInfo = firstDate.toLocaleDateString(); 160 | newDate.setAttribute("id",dateInfo); 161 | newDate.setAttribute("class", "date"); 162 | //设置点击事件,防止被解释为数字,用转义字符加上双引号 163 | newDate.setAttribute("onclick", "generateToday(\"" + dateInfo+ "\")"); 164 | newRow.appendChild(newDate); 165 | } 166 | dateTable.appendChild(newRow); 167 | } 168 | } 169 | 170 | /** 171 | * 172 | * @summary 根据具体日期,生成/切换今日详细信息 173 | * @desc 在进行日期切换时,点击某个日期或“回到今天”,根据生成日历时设置的id,修改今日信息区域,相关信息随之改变 174 | * @param {string} dateString - 表示日期的字符串,格式 YYYY/MM/DD 175 | * @todo 获取星座、宜&忌、农历天干地支等信息 176 | */ 177 | function generateToday(dateString) { 178 | if(dateString){ //若传递了参数,根据参数设定值 179 | var info = dateString.split("/"); 180 | currentDate.setYear(info[0]); //坑:切换日期跨月时很容易出错 181 | if( currentDate.getDate() > 30) { 182 | currentDate.setDate(info[2]); 183 | currentDate.setMonth(parseInt(info[1])-1 ); 184 | }else { 185 | currentDate.setMonth(parseInt(info[1])-1 ); 186 | currentDate.setDate(info[2]); 187 | } 188 | } 189 | if( datedDate == null){ 190 | //第一次生成 191 | datedDate = new Date(); 192 | }else{ 193 | //获取前一次操作时涉及的元素,清除样式 194 | var datedDateString = datedDate.toLocaleDateString(); 195 | document.getElementById(datedDateString).setAttribute("class","date"); 196 | } 197 | var dateInfo = currentDate.toLocaleDateString(); //获取YYYY/MM/DD格式的日期 198 | var dayNum = currentDate.getDate(); //获取日期号数 199 | var weekInfo = currentDate.getDay(); 200 | var weekArray = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; 201 | document.getElementById("dateInfo").innerText = dateInfo; //DOM操作日期 202 | document.getElementById("dateNum").innerText = dayNum.toString(); //DOM操作号数 203 | document.getElementById("weekInfo").innerText = weekArray[weekInfo]; 204 | var dateTd = document.getElementById(dateInfo); 205 | dateTd.setAttribute("class","todayTd"); //设定新的CSS样式 206 | // 记录此次操作的日期 207 | datedDate.setYear(currentDate.getFullYear()); //坑:这里的顺序不能颠倒,否则切换月的时候会错 208 | datedDate.setMonth(currentDate.getMonth()); 209 | datedDate.setDate(currentDate.getDate()); 210 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JS_Calendar 2 | Calendar written in JavaScript. 3 | 所有代码均为手写,[产品文档](/out/index.html)使用JSDoc生成。 4 | 具体的完成过程细节:[简书-前端小白如何用JavaScript写一个简单日历](http://www.jianshu.com/p/4fea34254dff)。 5 | 6 | ###需求分析: 7 | 1. 选择年、月,显示此年此月日历(列表选择、上下按钮) 8 | 2. 选择日期,显示当日(选择日)信息: 9 | - year-month-day 10 | - 星期 11 | - 农历年月日 12 | - 星座 13 | - 历史上的今天 14 | 3. 返回到今天 15 | 4. 显示当前时间(实时变化) 16 | 5. 日历中显示主要假期 17 | 6. 可选择的假期列表,并在日历定位假期区间 18 | 19 | ###内容 - 对应HTML 20 | 根据需求分析中涉及到的内容,提炼出与HTML标签相对应的内容块,写出HTML。 21 | 22 | 1. Navigate 23 | - 北京时间 24 | - 年月选项 25 | - 回到今天 26 | - 今年假期 27 | - Calendar 28 | - 日期排列 29 | - 农历日期节气 30 | - 国际节假日标识 31 | - Today 32 | - 日期:YYYY-MM-DD 33 | - 星期 34 | - 日期:DAY 35 | - 农历日期:生肖-月-初几 36 | - 天干地支日期:年-月-日 37 | - 星座 38 | - 宜&忌 39 | - 历史上的今天 40 | 41 | ###设计 42 | ![初期界面设计思路](/img/prototype-sketch.png) 43 | 44 | ###解决思路&完成情况 45 | 我的思路是,解决内容的问题后,其次是布局与样式,最后是JavaScript的实现。 46 | 47 | 以下是我在做任务的过程中逐步列出的细分任务点,问句部分是解决的疑惑。 48 | 49 | 50 | 1. 内容 51 | - 用div分成3大块 52 | - 用table还是lists来放calendar部分内容? - 都试过之后选择了table,结构上可读性较高 53 | - 如何分块展示不同信息? - 运用div和CSS作区分 54 | 55 | 2. CSS实现布局 56 | - 浮动效果 57 | - table的宽度:按比例 58 | - 选定日期的CSS样式 59 | - 节假日的样式(未完成) 60 | - 适应手机屏幕的样式(未完成) 61 | - 找相关背景图片的素材(未完成) 62 | 63 | 3. JavaScript时间日历生成 64 | - DOM操作生成table 65 | - 公历日历算法 66 | - 用JavaScript实现 67 | - 农历节气、国际节假日(未完成) 68 | - 用JavaScript实现 69 | - 写注释,完善文档 70 | 4. 功能细节点 71 | - 年份、月份切换:上一年/月、下一年/月 72 | - 日期切换:点击日期,todayInfo变化,CSS样式变化 73 | - 今年假期:下拉框选择,日历跳转至假期第一天(未完成) 74 | 75 | 5. 产品文档 76 | - 写代码的时候写上注释,JSDoc生成 77 | - 写README.md文档,加入JSDoc 78 | - 整理绘制流程图,插入README.md 79 | - 插入简书文章、Github链接 80 | 81 | 82 | ###算法实现 83 | 以下是在编写代码的过程中,借助画流程图对主体部分进行思考的记录,具体细节在调试过程中有部分调整。 84 | 85 | 主体:generateCalendar(), generateToday() 86 | ![部分方法的流程图](/img/flow-diagram.png) 87 | 88 | ##其他 89 | 刚接触前端不久,还有很多地方需要提高,之后会继续进行学习,完善这个日历。 90 | 91 | 在这个任务中,日历生成算法主要受到[The Strange Zen Of JavaScript](http://jszen.blogspot.com/2007_07_01_archive.html)里这篇文章的启发,CSS的知识掌握主要在[学习CSS布局](http://zh.learnlayout.com/position.html)这个网站中得到提高,JavaScript则是通过Coursera上的[HTML, CSS and JavaScript](https://coursera.org/learn/html-css-javascript)课程进行了学习。 92 | 93 | 同时翻阅的书籍有: 94 | 95 | - HTML & CSS 96 | - JavaScript & jQuery交互式Web前端开发 97 | - JavaScript DOM编程艺术 98 | - CSS权威指南 99 | -------------------------------------------------------------------------------- /img/flow-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/img/flow-diagram.png -------------------------------------------------------------------------------- /img/prototype-sketch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/img/prototype-sketch.png -------------------------------------------------------------------------------- /out/Calendar_Soyaine.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: Calendar_Soyaine.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: Calendar_Soyaine.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
/**
 30 |  * Created by SongYuting .
 31 |  */
 32 | 
 33 | /**
 34 |  * @summary 当前日期
 35 |  * @desc 用于记录当前日历状态的Date对象,随用户的操作而不断更新
 36 |  * @type {Date}
 37 |  */
 38 | var currentDate = new Date();
 39 | 
 40 | /**
 41 |  * @summary 今日日期
 42 |  * @desc 用于记录今日信息的Date对象,创建后不改变,供“回到今天”使用
 43 |  * @type {Date}
 44 |  */
 45 | var today = new Date();
 46 | var thisMonth = today.getMonth();
 47 | var thisYear = today.getFullYear();
 48 | //newCalendar(thisYear, thisMonth);
 49 | 
 50 | /**
 51 |  * @summary 今日日期
 52 |  * @desc 在操作日期发生改变时,记录上一次操作后的日期,与currentDate相差一次操作,供日期切换使用
 53 |  * @type {Date}
 54 |  */
 55 | var datedDate;//
 56 | 
 57 | 
 58 | //初始生成日历
 59 | newCalendar();
 60 | 
 61 | /**
 62 |  *
 63 |  * “上一年”切换按钮监听
 64 |  */
 65 | var btnLastYear = document.getElementById("lastYear");
 66 | btnLastYear.addEventListener("click", function() {
 67 |     var currentYear = currentDate.getFullYear();
 68 |     currentDate.setYear( --currentYear );
 69 |     newCalendar();
 70 | }, false);
 71 | 
 72 | /**
 73 |  *
 74 |  * “下一年”切换按钮监听
 75 |  */
 76 | var btnNextYear = document.getElementById("nextYear");
 77 | btnNextYear.addEventListener("click", function() {
 78 |     var currentYear = currentDate.getFullYear();
 79 |     currentDate.setYear( ++currentYear );
 80 |     newCalendar();
 81 | }, false);
 82 | 
 83 | /**
 84 |  *
 85 |  * “上个月”切换按钮监听
 86 |  */
 87 | var btnLastMonth = document.getElementById("lastMonth");
 88 | btnLastMonth.addEventListener("click", function() {
 89 |     var currentMonth = currentDate.getMonth();
 90 |     currentDate.setMonth( --currentMonth );
 91 |     newCalendar();
 92 | }, false);
 93 | 
 94 | /**
 95 |  *
 96 |  * “下个月”切换按钮监听
 97 |  */
 98 | var btnNextMonth = document.getElementById("nextMonth");
 99 | btnNextMonth.addEventListener("click", function() {
100 |     var currentMonth = currentDate.getMonth();
101 |     currentDate.setMonth( ++currentMonth);
102 |     newCalendar();
103 | }, false);
104 | 
105 | /**
106 |  *
107 |  * “回到今天”切换按钮监听
108 |  */
109 | var btnBackToday = document.getElementById("backToday");
110 | btnBackToday.addEventListener("click", function() {
111 |     var nowTime = today.getTime();
112 |     currentDate.setTime(nowTime);
113 |     newCalendar();
114 | }, false);
115 | 
116 | var dateNav = document.getElementsByClassName("date");
117 | 
118 | 
119 | /**
120 |  * @summary 根据指定 年-月(格式:YYYY-MM)生成当月日历
121 |  * @desc 主体部分。
122 |  * 利用Date的构造函数调用参数,
123 |  * 当数值大于合理范围时,会被调整为相邻值,以此获取此月日历中第一行第一列的日期。
124 |  * 若指定月份的1号是周日,表明日历不含上月的日期,无需特殊处理;
125 |  * 若指定月份的1号不是周日,则取相反数(原理: 1 - 周几 + 1),获取所需日期。
126 |  * 注:此处为方便生成表格使用(++date),日期计数取为从0开始,即1号由0表示,与Date.prototype.getDate()所得相差1。
127 |  * 灵感来源:{@link http://jszen.blogspot.com/2007_07_01_archive.html}
128 |  * @param {number} year - 预生成日历的年份
129 |  * @param {number} month - 预生成日历的月份
130 |  * @returns {date} currentDate - 当前日期(仅年份、月份发生改变)
131 |  *
132 |  */
133 | function newCalendar() {
134 |     var month = currentDate.getMonth();
135 |     var year = currentDate.getFullYear();
136 |     var date = currentDate.getDate();
137 |     var thisMonthDay = new Date(year, month, 1);
138 |     var thisMonthFirstDay = thisMonthDay.getDay();
139 |     var thisMonthFirstDate = new Date(year, month, - thisMonthFirstDay);
140 |     generateTable(thisMonthFirstDate);  //生成日历主体的日期区域
141 |     generateNav(year, month);  //生成导航区域
142 |     generateToday();  //生成今日信息区域
143 |     currentDate.setYear(year);
144 |     currentDate.setMonth(month);
145 |     return currentDate;
146 | }
147 | 
148 | /**
149 |  * @summary 设定导航区域
150 |  * @desc 利用年、月设定相关值
151 |  * @param {number} year - 预生成日历的年份
152 |  * @param {number} month - 预生成日历的月份
153 |  * @todo 加入实时变化的时间
154 |  *
155 |  */
156 | function generateNav(year, month) {
157 |     var navYear = document.getElementById("year");
158 |     var navMonth = document.getElementById("month");
159 |     navYear.innerText = year.toString();
160 |     navMonth.innerText = (month + 1).toString();
161 | }
162 | 
163 | /**
164 |  * @summary 根据日历首位日期,生成日历主体表格
165 |  * @desc 首位日期指:日历的表格中第一行第一列位置的日期。
166 |  * 利用Date的相关特性处理跨月份的情况,循环后
167 |  * 生成 6*7 表格,加入DOM树,形成日历的主体日期区域。
168 |  * @param {date} firstDate - 日历表格中第一行、第一列的日期数(从0开始)
169 |  */
170 | function generateTable(firstDate) {
171 |     //获取日历日期部分Node
172 |     var dateTable = document.getElementById("dateTable");
173 |     //若不是第一次生成,则需要把此前生成的日历去掉
174 |     while (dateTable.firstChild) {
175 |         dateTable.removeChild(dateTable.firstChild);
176 |     }
177 |     var date = firstDate.getDate();
178 |     for (var i = 0; i < 6; i++){
179 |         var newRow = document.createElement("tr");
180 |         for(var j = 0; j < 7; j++){
181 |             var newDate = document.createElement("td");
182 |             //获取日期信息
183 |             firstDate.setDate(++date);
184 |             date = firstDate.getDate();
185 |             newDate.innerText = date;
186 |             //设置Node的id,便于后期操作
187 |             var dateInfo = firstDate.toLocaleDateString();
188 |             newDate.setAttribute("id",dateInfo);
189 |             newDate.setAttribute("class", "date");
190 |             //设置点击事件,防止被解释为数字,用转义字符加上双引号
191 |             newDate.setAttribute("onclick", "generateToday(\"" + dateInfo+ "\")");
192 |             newRow.appendChild(newDate);
193 |         }
194 |         dateTable.appendChild(newRow);
195 |     }
196 | }
197 | 
198 | /**
199 |  *
200 |  * @summary 根据具体日期,生成/切换今日详细信息
201 |  * @desc 在进行日期切换时,点击某个日期或“回到今天”,根据生成日历时设置的id,修改今日信息区域,相关信息随之改变
202 |  * @param {string} dateString - 表示日期的字符串,格式 YYYY/MM/DD
203 |  * @todo 获取星座、宜&忌、农历天干地支等信息
204 |  */
205 | function generateToday(dateString) {
206 |     if(dateString){ //若传递了参数,根据参数设定值
207 |         var info = dateString.split("/");
208 |         currentDate.setYear(info[0]); //坑:切换日期跨月时很容易出错
209 |         if( currentDate.getDate() > 30) {
210 |             currentDate.setDate(info[2]);
211 |             currentDate.setMonth(parseInt(info[1])-1 );
212 |         }else {
213 |             currentDate.setMonth(parseInt(info[1])-1 );
214 |             currentDate.setDate(info[2]);
215 |         }
216 |     }
217 |     if( datedDate == null){
218 |         //第一次生成
219 |         datedDate = new Date();
220 |     }else{
221 |         //获取前一次操作时涉及的元素,清除样式
222 |         var datedDateString = datedDate.toLocaleDateString();
223 |         document.getElementById(datedDateString).setAttribute("class","date");
224 |     }
225 |     var dateInfo = currentDate.toLocaleDateString(); //获取YYYY/MM/DD格式的日期
226 |     var dayNum = currentDate.getDate(); //获取日期号数
227 |     var weekInfo = currentDate.getDay();
228 |     var weekArray = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
229 |     document.getElementById("dateInfo").innerText = dateInfo; //DOM操作日期
230 |     document.getElementById("dateNum").innerText = dayNum.toString(); //DOM操作号数
231 |     document.getElementById("weekInfo").innerText = weekArray[weekInfo];
232 |     var dateTd = document.getElementById(dateInfo);
233 |     dateTd.setAttribute("class","todayTd"); //设定新的CSS样式
234 |     // 记录此次操作的日期
235 |     datedDate.setYear(currentDate.getFullYear()); //坑:这里的顺序不能颠倒,否则切换月的时候会错
236 |     datedDate.setMonth(currentDate.getMonth());
237 |     datedDate.setDate(currentDate.getDate());
238 | }
239 |
240 |
241 | 242 | 243 | 244 | 245 |
246 | 247 | 250 | 251 |
252 | 253 | 256 | 257 | 258 | 259 | 260 | 261 | -------------------------------------------------------------------------------- /out/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /out/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /out/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /out/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-Light-webfont.svg: -------------------------------------------------------------------------------- 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 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 1425 | 1426 | 1427 | 1428 | 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | 1436 | 1437 | 1438 | 1439 | 1440 | 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | 1455 | 1456 | 1457 | 1458 | 1459 | 1460 | 1461 | 1462 | 1463 | 1464 | 1465 | 1466 | 1467 | 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 1474 | 1475 | 1476 | 1477 | 1478 | 1479 | 1480 | 1481 | 1482 | 1483 | 1484 | 1485 | 1486 | 1487 | 1488 | 1489 | 1490 | 1491 | 1492 | 1493 | 1494 | 1495 | 1496 | 1497 | 1498 | 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | 1505 | 1506 | 1507 | 1508 | 1509 | 1510 | 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | 1517 | 1518 | 1519 | 1520 | 1521 | 1522 | 1523 | 1524 | 1525 | 1526 | 1527 | 1528 | 1529 | 1530 | 1531 | 1532 | 1533 | 1534 | 1535 | 1536 | 1537 | 1538 | 1539 | 1540 | 1541 | 1542 | 1543 | 1544 | 1545 | 1546 | 1547 | 1548 | 1549 | 1550 | 1551 | 1552 | 1553 | 1554 | 1555 | 1556 | 1557 | 1558 | 1559 | 1560 | 1561 | 1562 | 1563 | 1564 | 1565 | 1566 | 1567 | 1568 | 1569 | 1570 | 1571 | 1572 | 1573 | 1574 | 1575 | 1576 | 1577 | 1578 | 1579 | 1580 | 1581 | 1582 | 1583 | 1584 | 1585 | 1586 | 1587 | 1588 | 1589 | 1590 | 1591 | 1592 | 1593 | 1594 | 1595 | 1596 | 1597 | 1598 | 1599 | 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 1606 | 1607 | 1608 | 1609 | 1610 | 1611 | 1612 | 1613 | 1614 | 1615 | 1616 | 1617 | 1618 | 1619 | 1620 | 1621 | 1622 | 1623 | 1624 | 1625 | 1626 | 1627 | 1628 | 1629 | 1630 | 1631 | 1632 | 1633 | 1634 | 1635 | 1636 | 1637 | 1638 | 1639 | 1640 | 1641 | 1642 | 1643 | 1644 | 1645 | 1646 | 1647 | 1648 | 1649 | 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 1657 | 1658 | 1659 | 1660 | 1661 | 1662 | 1663 | 1664 | 1665 | 1666 | 1667 | 1668 | 1669 | 1670 | 1671 | 1672 | 1673 | 1674 | 1675 | 1676 | 1677 | 1678 | 1679 | 1680 | 1681 | 1682 | 1683 | 1684 | 1685 | 1686 | 1687 | 1688 | 1689 | 1690 | 1691 | 1692 | 1693 | 1694 | 1695 | 1696 | 1697 | 1698 | 1699 | 1700 | 1701 | 1702 | 1703 | 1704 | 1705 | 1706 | 1707 | 1708 | 1709 | 1710 | 1711 | 1712 | 1713 | 1714 | 1715 | 1716 | 1717 | 1718 | 1719 | 1720 | 1721 | 1722 | 1723 | 1724 | 1725 | 1726 | 1727 | 1728 | 1729 | 1730 | 1731 | 1732 | 1733 | 1734 | 1735 | 1736 | 1737 | 1738 | 1739 | 1740 | 1741 | 1742 | 1743 | 1744 | 1745 | 1746 | 1747 | 1748 | 1749 | 1750 | 1751 | 1752 | 1753 | 1754 | 1755 | 1756 | 1757 | 1758 | 1759 | 1760 | 1761 | 1762 | 1763 | 1764 | 1765 | 1766 | 1767 | 1768 | 1769 | 1770 | 1771 | 1772 | 1773 | 1774 | 1775 | 1776 | 1777 | 1778 | 1779 | 1780 | 1781 | 1782 | 1783 | 1784 | 1785 | 1786 | 1787 | 1788 | 1789 | 1790 | 1791 | 1792 | 1793 | 1794 | 1795 | 1796 | 1797 | 1798 | 1799 | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | 1813 | 1814 | 1815 | 1816 | 1817 | 1818 | 1819 | 1820 | 1821 | 1822 | 1823 | 1824 | 1825 | 1826 | 1827 | 1828 | 1829 | 1830 | 1831 | -------------------------------------------------------------------------------- /out/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /out/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /out/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /out/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soyaine/JS_Calendar/82f68eb7381d4b7233d5653da20c162e195e96ed/out/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /out/global.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Global 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Global

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

32 | 33 | 34 |
35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
78 | 79 | 80 | 81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |

Members

96 | 97 | 98 | 99 |

btnBackToday

100 | 101 | 102 | 103 | 104 |
105 | “回到今天”切换按钮监听 106 |
107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 |
Source:
142 |
145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 |
153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 |

btnLastMonth

162 | 163 | 164 | 165 | 166 |
167 | “上个月”切换按钮监听 168 |
169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 |
177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 |
Source:
204 |
207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 |
215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 |

btnLastYear

224 | 225 | 226 | 227 | 228 |
229 | “上一年”切换按钮监听 230 |
231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 |
239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 |
Source:
266 |
269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 |
277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 |

btnNextMonth

286 | 287 | 288 | 289 | 290 |
291 | “下个月”切换按钮监听 292 |
293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 |
301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 |
Source:
328 |
331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 |
339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 |

btnNextYear

348 | 349 | 350 | 351 | 352 |
353 | “下一年”切换按钮监听 354 |
355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 |
363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 |
Source:
390 |
393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 |
401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

currentDate :Date

410 | 411 | 412 |

当前日期

413 | 414 | 415 | 416 |
417 | 用于记录当前日历状态的Date对象,随用户的操作而不断更新 418 |
419 | 420 | 421 | 422 |
Type:
423 |
    424 |
  • 425 | 426 | Date 427 | 428 | 429 |
  • 430 |
431 | 432 | 433 | 434 | 435 | 436 |
437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 |
Source:
464 |
467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 |
475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 |

datedDate :Date

484 | 485 | 486 |

今日日期

487 | 488 | 489 | 490 |
491 | 在操作日期发生改变时,记录上一次操作后的日期,与currentDate相差一次操作,供日期切换使用 492 |
493 | 494 | 495 | 496 |
Type:
497 |
    498 |
  • 499 | 500 | Date 501 | 502 | 503 |
  • 504 |
505 | 506 | 507 | 508 | 509 | 510 |
511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 |
Source:
538 |
541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 |
549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 |

today :Date

558 | 559 | 560 |

今日日期

561 | 562 | 563 | 564 |
565 | 用于记录今日信息的Date对象,创建后不改变,供“回到今天”使用 566 |
567 | 568 | 569 | 570 |
Type:
571 |
    572 |
  • 573 | 574 | Date 575 | 576 | 577 |
  • 578 |
579 | 580 | 581 | 582 | 583 | 584 |
585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 |
Source:
612 |
615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 |
623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 |

Methods

634 | 635 | 636 | 637 | 638 | 639 | 640 |

generateNav(year, month)

641 | 642 | 643 |

设定导航区域

644 | 645 | 646 | 647 | 648 |
649 | 利用年、月设定相关值 650 |
651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 |
Parameters:
661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 |
NameTypeDescription
year 689 | 690 | 691 | number 692 | 693 | 694 | 695 | 预生成日历的年份
month 712 | 713 | 714 | number 715 | 716 | 717 | 718 | 预生成日历的月份
730 | 731 | 732 | 733 | 734 | 735 | 736 |
737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 |
Source:
764 |
767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 |
To Do:
775 |
776 |
    777 |
  • 加入实时变化的时间
  • 778 |
779 |
780 | 781 |
782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 |

generateTable(firstDate)

804 | 805 | 806 |

根据日历首位日期,生成日历主体表格

807 | 808 | 809 | 810 | 811 |
812 | 首位日期指:日历的表格中第一行第一列位置的日期。 利用Date的相关特性处理跨月份的情况,循环后 生成 6*7 表格,加入DOM树,形成日历的主体日期区域。 813 |
814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 |
Parameters:
824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 |
NameTypeDescription
firstDate 852 | 853 | 854 | date 855 | 856 | 857 | 858 | 日历表格中第一行、第一列的日期数(从0开始)
870 | 871 | 872 | 873 | 874 | 875 | 876 |
877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 |
Source:
904 |
907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 |
915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 |

generateToday(dateString)

937 | 938 | 939 |

根据具体日期,生成/切换今日详细信息

940 | 941 | 942 | 943 | 944 |
945 | 在进行日期切换时,点击某个日期或“回到今天”,根据生成日历时设置的id,修改今日信息区域,相关信息随之改变 946 |
947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 |
Parameters:
957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 |
NameTypeDescription
dateString 985 | 986 | 987 | string 988 | 989 | 990 | 991 | 表示日期的字符串,格式 YYYY/MM/DD
1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 |
1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 |
Source:
1037 |
1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 |
To Do:
1048 |
1049 |
    1050 |
  • 获取星座、宜&忌、农历天干地支等信息
  • 1051 |
1052 |
1053 | 1054 |
1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 |

newCalendar(year, month) → {date}

1077 | 1078 | 1079 |

根据指定 年-月(格式:YYYY-MM)生成当月日历

1080 | 1081 | 1082 | 1083 | 1084 |
1085 | 主体部分。 利用Date的构造函数调用参数, 当数值大于合理范围时,会被调整为相邻值,以此获取此月日历中第一行第一列的日期。 若指定月份的1号是周日,表明日历不含上月的日期,无需特殊处理; 若指定月份的1号不是周日,则取相反数(原理: 1 - 周几 + 1),获取所需日期。 注:此处为方便生成表格使用(++date),日期计数取为从0开始,即1号由0表示,与Date.prototype.getDate()所得相差1。 灵感来源:http://jszen.blogspot.com/2007_07_01_archive.html 1086 |
1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 |
Parameters:
1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 |
NameTypeDescription
year 1125 | 1126 | 1127 | number 1128 | 1129 | 1130 | 1131 | 预生成日历的年份
month 1148 | 1149 | 1150 | number 1151 | 1152 | 1153 | 1154 | 预生成日历的月份
1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 |
1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 |
Source:
1200 |
1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 |
1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 |
Returns:
1225 | 1226 | 1227 |
1228 | currentDate - 当前日期(仅年份、月份发生改变) 1229 |
1230 | 1231 | 1232 | 1233 |
1234 |
1235 | Type 1236 |
1237 |
1238 | 1239 | date 1240 | 1241 | 1242 |
1243 |
1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 |
1256 | 1257 |
1258 | 1259 | 1260 | 1261 | 1262 |
1263 | 1264 | 1267 | 1268 |
1269 | 1270 | 1273 | 1274 | 1275 | 1276 | 1277 | -------------------------------------------------------------------------------- /out/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Home 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Home

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |

JS_Calendar

Calendar written in JavaScript. 47 | 来源于360前端星计划中的一个任务,所有代码均为手写,产品文档使用JSDoc生成。

48 |

###需求分析:

49 |
    50 |
  1. 选择年、月,显示此年此月日历(列表选择、上下按钮)
  2. 51 |
  3. 选择日期,显示当日(选择日)信息:
      52 |
    • year-month-day
    • 53 |
    • 星期
    • 54 |
    • 农历年月日
    • 55 |
    • 星座
    • 56 |
    • 历史上的今天
    • 57 |
    58 |
  4. 59 |
  5. 返回到今天
  6. 60 |
  7. 显示当前时间(实时变化)
  8. 61 |
  9. 日历中显示主要假期
  10. 62 |
  11. 可选择的假期列表,并在日历定位假期区间
  12. 63 |
64 |

###内容 - 对应HTML 65 | 根据需求分析中涉及到的内容,提炼出与HTML标签相对应的内容块,写出HTML。

66 |
    67 |
  1. Navigate

    68 |
      69 |
    • 北京时间
    • 70 |
    • 年月选项
    • 71 |
    • 回到今天
    • 72 |
    • 今年假期
    • 73 |
    74 |
  2. 75 |
  3. Calendar

    76 |
      77 |
    • 日期排列
    • 78 |
    • 农历日期节气
    • 79 |
    • 国际节假日标识
    • 80 |
    81 |
  4. 82 |
  5. Today

    83 |
      84 |
    • 日期:YYYY-MM-DD
    • 85 |
    • 星期
    • 86 |
    • 日期:DAY
    • 87 |
    • 农历日期:生肖-月-初几
    • 88 |
    • 天干地支日期:年-月-日
    • 89 |
    • 星座
    • 90 |
    • 宜&忌
    • 91 |
    • 历史上的今天
    • 92 |
    93 |
  6. 94 |
95 |

###设计 96 | 初期界面设计思路

97 |

###解决思路&完成情况 98 | 我的思路是,解决内容的问题后,其次是布局与样式,最后是JavaScript的实现。

99 |

以下是我在做任务的过程中逐步列出的细分任务点,问句部分是解决的疑惑。

100 |
    101 |
  1. 内容 102 | 用div分成3大块 103 | 用table还是lists来放calendar部分内容? - 都试过之后选择了table,结构上可读性较高 104 | 如何分块展示不同信息? - 运用div和CSS作区分

    105 |
  2. 106 |
  3. CSS实现布局 107 | 浮动效果 108 | table的宽度:按比例 109 | 选定日期的CSS样式 110 | 节假日的样式(未完成) 111 | 适应手机屏幕的样式(未完成) 112 | 找相关背景图片的素材(未完成)

    113 |
  4. 114 |
  5. JavaScript时间日历生成 115 | DOM操作生成table 116 | 公历日历算法 117 | 用JavaScript实现 118 | 农历节气、国际节假日(未完成) 119 | 用JavaScript实现 120 | 写注释,完善文档

    121 |
  6. 122 |
  7. 功能细节点 123 | 年份、月份切换:上一年/月、下一年/月 124 | 日期切换:点击日期,todayInfo变化,CSS样式变化 125 | 今年假期:下拉框选择,日历跳转至假期第一天(未完成)

    126 |
  8. 127 |
  9. 产品文档 128 | 写代码的时候写上注释,JSDoc生成 129 | 写README.md文档,加入JSDoc 130 | 整理绘制流程图,插入README.md 131 | 插入简书文章、Github链接

    132 |
  10. 133 |
134 |

###算法实现 135 | 以下是在编写代码的过程中,借助画流程图对主体部分进行思考的记录,具体细节在调试过程中有部分调整。

136 |

主体:generateCalendar(), generateToday() 137 | 部分方法的流程图

138 |

##其他 139 | 刚接触前端不久,还有很多地方需要提高,之后会继续进行学习,完善这个日历。

140 |

在这个任务中,日历生成算法主要受到The Strange Zen Of JavaScript里这篇文章的启发,CSS部分主要在学习CSS布局这个网站中得到提到,JavaScript则是通过Coursera上的HTML, CSS and JavaScript课程进行了学习。

141 |

同时翻阅的书籍有:

142 |
    143 |
  • HTML & CSS
  • 144 |
  • JavaScript & jQuery交互式Web前端开发
  • 145 |
  • JavaScript DOM编程艺术
  • 146 |
  • CSS权威指南
  • 147 |
148 |
149 | 150 | 151 | 152 | 153 | 154 | 155 |
156 | 157 | 160 | 161 |
162 | 163 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /out/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /out/scripts/prettify/Apache-License-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /out/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /out/scripts/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; 2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= 3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), 9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, 10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, 11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, 12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), 13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} 14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], 18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ 21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), 22 | ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", 23 | /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), 24 | ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 25 | hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= 26 | !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p p:first-child, 338 | .props td.description > p:first-child 339 | { 340 | margin-top: 0; 341 | padding-top: 0; 342 | } 343 | 344 | .params td.description > p:last-child, 345 | .props td.description > p:last-child 346 | { 347 | margin-bottom: 0; 348 | padding-bottom: 0; 349 | } 350 | 351 | .disabled { 352 | color: #454545; 353 | } 354 | -------------------------------------------------------------------------------- /out/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /out/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | --------------------------------------------------------------------------------