├── Docs ├── custom.css └── index.html ├── LICENSE.md ├── README.md ├── bower.json ├── css ├── icecss.css ├── icecss.less └── icecss.min.css ├── font ├── FontAwesome.otf ├── fontawesome-webfont.eot ├── fontawesome-webfont.svg ├── fontawesome-webfont.ttf └── fontawesome-webfont.woff ├── html ├── example.html └── login.html ├── img ├── ajax.gif ├── ice-icon-menu.svg ├── icebg.jpg ├── logo.png └── mlogo.png ├── index.html ├── js ├── icecss.js ├── jquery.min.js └── less.min.js ├── logo.png └── plugin ├── ice_click.js ├── ice_cloud.js ├── ice_code ├── ice_code.css ├── ice_code.js └── ice_code_expands.js ├── ice_date ├── example.html ├── ice_date.css └── ice_date.js ├── ice_fullpage ├── ice-fullpage.css └── ice-fullpage.js ├── ice_image.js ├── ice_scrolly ├── example │ ├── css │ │ └── styles.css │ ├── img │ │ ├── bottle.jpeg │ │ ├── logo.png │ │ ├── nike-bg.jpeg │ │ ├── nike.png │ │ └── old-boy.png │ └── index.html └── ice_scrolly.js ├── ice_storedb.js ├── ice_tab ├── ice_tab.css └── ice_tab.js └── ice_tmpl ├── help.md ├── ice_tmpl.js └── test.html /Docs/custom.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #666; 3 | } 4 | .ice-div a { 5 | text-decoration: none; 6 | } 7 | 8 | .ice-nav li { 9 | padding-left: 5px; 10 | line-height: 2.5em; 11 | cursor: pointer 12 | } 13 | .ice-nav li ul li { 14 | text-align: left; 15 | } 16 | .ice-grid { 17 | margin: 0 0 0 -25px; 18 | padding: 0; 19 | list-style: none; 20 | } 21 | .ice-grid>* { 22 | margin: 0; 23 | float: left; 24 | } 25 | .tm-icons > [class*="ice-width-"] { 26 | padding-bottom: 5px; 27 | padding-top: 5px; 28 | } 29 | .ice-width-medium-1-4 { 30 | width: 25%; 31 | } 32 | .ice-width-1-2, .ice-width-2-4, .ice-width-3-6, .ice-width-5-10 { 33 | width: 50%; 34 | } 35 | [class*=ice-width] { 36 | -moz-box-sizing: border-box; 37 | box-sizing: border-box; 38 | width: 100%; 39 | } 40 | .ice-grid li { 41 | width: 24%; 42 | float: left; 43 | } 44 | .ding { 45 | position: fixed; 46 | top: 90%; 47 | left: 95%; 48 | width: 50; 49 | height: 50; 50 | text-align: center; 51 | font-size: 30px; 52 | line-height: 50px; 53 | background: #297fb8; 54 | cursor: pointer 55 | } 56 | .ding a { 57 | color: #fff; 58 | text-decoration: none; 59 | } 60 | .ice-nav-plus{ 61 | margin-top: 70px; 62 | } 63 | .ice-nav-panel{ 64 | padding-top: 70px; 65 | } 66 | .ice-div .ice-title{ 67 | font-weight: bold; 68 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) BESD 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](http://cdn.besdlab.cn/icecss/compatible.gif) 2 | ![](http://cdn.besdlab.cn/icecss-yqh.jpg) 3 | ====== 4 | 5 | **什么是ICECSS?** 6 | 7 | ICECSS是一个以冰山为灵感的开源高效的基于Jquery的CSS框架,不仅有着开发快速、美观易用等特点,官方本身还提供CDN服务、快速开发demo和测试的云服务等等。 8 | 9 | 注意:为确保最好的效果,IE浏览器最好是在9以上。 10 | 11 | **ICECSS 主题** 12 | 13 | ICECSS for HEXO:https://github.com/T-baby/ICE-HEXO 14 | 15 | **如何使用?** 16 | 17 | 在html文件头部引用ICECSS的CSS 18 | 19 | `` 20 | 21 | 在html文件尾部引用ICECSS的JS(注意,ICECSS是基于jQuery的,所以在引用ICECSS的JS文件前请先导入jQuery) 22 | 23 | `` 24 | 25 | `` 26 | 27 | ------------------------ 28 | 29 | ICECSS也支持Less 30 | 31 | 在html头部引用less 32 | 33 | `` 34 | 35 | 然后在尾部引用less的js文件 36 | 37 | `` 38 | 39 | `` 40 | 41 | `` 42 | 43 | **说明文档** 44 | 45 | 新版文档请到官网查看:http://besdlab.cn/ICECSS/ 46 | 47 | 中国区分发: 48 | 49 | https://coding.net/u/besd/p/ICECSS/ 50 | 51 | http://git.oschina.net/t-baby/ICECSS 52 | 53 | **案例** 54 | 55 | http://besdlab.cn/ 56 | 57 | http://besdlab.cn/blog 58 | 59 | http://besdlab.cn/ICECSS/ 60 | 61 | **您可以加入用户体验小组** 62 | 63 | 用户体验小组能够第一时间获得ICECSS的最新版本,并帮助开发小组进行测试和改进。具有以下特权: 64 | 65 | 1、能够在第一时间获得最新版本。 66 | 67 | 2、为ICECSS提供的优质代码在经过开发小组审核后可以加入官方的版本。 68 | 69 | 3、可以全程参与ICECSS的设计、开发、用户体验的过程。 70 | 71 | 4、你建议或者设想可能会直接在ICECSS中实现哦。 72 | 73 | 74 | **如何加入?** 75 | 76 | 加入Q群:320283384 77 | 78 | **版权声明** 79 | 80 | ICECSS遵循MIT协议,希望在使用时将ICECSS的LOGO放在网站上。 81 | 82 | ------------------------ 83 | **更新历史** 84 | 85 | ****1.1 2015年04月28日**** 86 | 87 | ******-修改/修复-****** 88 | 89 | 修复文档中可关闭面板的示例代码错误问题 90 | 91 | 去掉ICECSS原本的code、pre相关样式 92 | 93 | 为文档增加ICECSS新的特性 94 | 95 | 改为用bower管理版本 96 | 97 | ******-增加-****** 98 | 99 | 增加更强大的导航菜单 100 | 101 | 增加日期选择 102 | 103 | 增加选项卡 104 | 105 | 增加代码高亮 106 | 107 | 增加中文优化 108 | 109 | 增加新的官网页面 110 | 111 | 112 | 113 | ****1.0 2015年03月17日**** 114 | 115 | ******-修改/修复-****** 116 | 117 | 再次调整按钮和表单、列表等等,使得ICECSS更加好看和优雅 118 | 119 | 调整了表格的颜色 120 | 121 | 使按钮、菜单等悬浮效果更加平滑 122 | 123 | 修复.ice-form-icon会导致input的宽度不正确的问题 124 | 125 | 更换成新的模板引擎,从artTemplate换成juicer 126 | 127 | ******-增加-****** 128 | 129 | 增加了按钮颜色类 130 | 131 | 132 | 133 | 134 | ****0.9.2 2015年03月03日**** 135 | 136 | ******-修改/修复-****** 137 | 138 | 调整按钮内边距,使按钮看起来更优雅 139 | 140 | 修改了按钮悬浮时的颜色 141 | 142 | 调整th、td的内边距 143 | 144 | 修改了表格ice-table-striped的颜色 145 | 146 | 修正了文档上的一处错误 147 | 148 | ******-增加-****** 149 | 150 | 增加ice-button标签 151 | 152 | 增加一个用于操作本地储存库的插件ice_storedb插件 153 | 154 | 155 | ****2015年01月29日**** 156 | 157 | ******-修改/修复-****** 158 | 159 | 修正了文档上的一些问题 160 | 161 | 修复ice-intro-big固定背景图片失效的问题 162 | 163 | ******-增加-****** 164 | 165 | ice-menu-lucency增加浮动 166 | 167 | 增加视差效果插件 168 | 169 | 增加全屏滚动插件 170 | 171 | 增加预加载超链接插件 172 | 173 | 增加图片延迟载入插件 174 | 175 | ****2015年01月20日**** 176 | 177 | 感谢 一路向阳 帮助封装了抽屉式导航的相关代码 178 | 179 | 对抽屉式导航效果进行了调整 180 | 181 | ****2015年01月17日**** 182 | 183 | ice-div-1-1的width改为100% 184 | 185 | 在导航菜单中增加手风琴功能 186 | 187 | 增加弹出式画布 188 | 189 | 增加汉堡菜单 190 | 191 | 增加BESD云服务支持 192 | 193 | 增加模板引擎 -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ICECSS", 3 | "version": "1.1.0", 4 | "homepage": "http://besdlab.cn/ICECSS", 5 | "authors": [ 6 | "T-baby " 7 | ], 8 | "description": "一个以冰山为灵感的开源高效的基于JQuery的CSS框架", 9 | "keywords": [ 10 | "icecss", 11 | "besd-icecss" 12 | ], 13 | "license": "MIT", 14 | "ignore": [ 15 | "**/.*", 16 | "node_modules", 17 | "bower_components", 18 | "test", 19 | "tests" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /css/icecss.min.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8";html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:'Microsoft Yahei';font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}article,aside,details,figcaption,figure,footer,header,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}a{cursor:pointer}@font-face{font-family:'iconfont';src:url('../font/fontawesome-webfont.eot?v=4.2.0');src:url('../font/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'),url('../font/fontawesome-webfont.woff?v=4.2.0') format('woff'),url('../font/fontawesome-webfont.ttf?v=4.2.0') format('truetype'),url('../font/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}body{font-family:'Helvetica Neue','Microsoft Yahei','Hiragino Sans GB','Microsoft Sans Serif','WenQuanYi Micro Hei',sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}.ice-common,.ice-widescreen,.ice-full{margin:0 auto;height:auto}.ice-full{width:100%}.ice-common{max-width:1020px}.ice-widescreen{max-width:1220px}.ice-div{float:left;margin:0 3% 0 0;display:block}.ice-div-last{margin:0}.ice-div-1-1{width:100%;margin:0}.ice-div-1-2{width:48%}.ice-div-1-3{width:31%}.ice-div-2-3{width:65%}.ice-div-1-4{width:22.5%}.ice-div-1-6{width:14%}.ice-div-4-10{width:38.4%}.ice-div-6-10{width:57.6%}.ice-div-3-10{width:28.8%}.ice-div-7-10{width:67.2%}.ice-div-2-10{width:19.2%}.ice-div-8-10{width:76.8%}.ice-div-1-10{width:9.6%}.ice-div-9-10{width:86.4%}.ice-div-1-12{width:5.49%}.ice-div img{-moz-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:auto;vertical-align:middle}.ice-center-plane{text-align:center;margin-left:auto;margin-right:auto}.ice-center{display:table}.ice-center .ice-center-abs{text-align:center;display:table-cell;vertical-align:middle}.ice-center-test{margin:0 auto;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-pack:center;-webkit-box-align:center;display:-moz-box;-moz-box-orient:horizontal;-moz-box-pack:center;-moz-box-align:center;display:-o-box;-o-box-orient:horizontal;-o-box-pack:center;-o-box-align:center;display:-ms-box;-ms-box-orient:horizontal;-ms-box-pack:center;-ms-box-align:center;display:box;box-orient:horizontal;box-pack:center;box-align:center}.ice-div p{font-weight:400;line-height:20px}.ice-div *+h1,.ice-div *+h2,.ice-div *+h3,.ice-div *+h4,.ice-div *+h5,.ice-div *+h6{margin-top:25px}.ice-div h1,.ice-div h2,.ice-div h3,.ice-div h4,.ice-div h5,.ice-div h6{margin:0 0 15px;font-weight:300;color:#222;text-transform:none}.ice-div h1,.ice-div .ice-h1{font-size:36px;line-height:42px}.ice-div h2,.ice-div .ice-h2{font-size:24px;line-height:30px}.ice-div h3,.ice-div .ice-h3{font-size:18px;line-height:24px}.ice-div h4,.ice-div .ice-h4{font-size:16px;line-height:22px}.ice-div h5,.ice-div .ice-h5{font-size:14px;line-height:20px}.ice-div h6,.ice-div .ice-h6{font-size:12px;line-height:18px}.ice-div *+p,.ice-div *+hr,.ice-div *+ul,.ice-div *+ol,.ice-div *+dl,.ice-div *+blockquote,.ice-div *+pre,.ice-div *+address,.ice-div *+fieldset,.ice-div *+figure{margin-top:15px}.ice-div hr{border-top:1px solid #e5e5e5;display:block;padding:0;border:0}.ice-div blockquote{padding-left:10px;border-left:5px solid #e5e5e5;line-height:22px}.ice-div .ice-title{margin-bottom:15px;padding-left:10px;border-left:3px solid #297fb8;line-height:22px}.ice-div img{-moz-box-sizing:border-box;box-sizing:border-box;max-width:100%;height:auto;vertical-align:middle}.ice-div ul,.ice-div dir{list-style-type:disc;-webkit-margin-before:1em;-webkit-margin-after:1em;-webkit-margin-start:0;-webkit-margin-end:0;-webkit-padding-start:40px;font-size:14px}.ice-div li{margin-bottom:1.8em;display:list-item;text-align:-webkit-match-parent}.ice-div ol{display:block;list-style-type:decimal;-webkit-margin-before:1em;-webkit-margin-after:1em;-webkit-margin-start:0;-webkit-margin-end:0;-webkit-padding-start:40px;font-size:14px}.ice-div dl{font-size:14px;display:block}.ice-div dl dt{font-weight:bold}.ice-div dl dd{margin:10px 0 15px 0;color:#666}.ice-div tt,.ice-div code,.ice-div kbd,.ice-div samp{font-family:"΢ÈíÑźÚ","microsoft yahei"}.ice-div a{color:inherit}.ice-div .ice-panel{padding:10px;margin-bottom:15px;font-size:14px;line-height:14px;-moz-tab-size:4;tab-size:4;border:1px solid #e5e5e5}.ice-div .ice-panel-original{margin:0 15px;padding:10px;margin-bottom:15px;font-size:14px;line-height:14px;-moz-tab-size:4;tab-size:4}.ice-div .ice-panel-point{padding:10px;margin-bottom:15px;font-size:14px;line-height:14px;-moz-tab-size:4;tab-size:4;border:1px solid #e5e5e5}.ice-div .ice-close{cursor:pointer;color:inherit;float:right;-moz-box-sizing:content-box;box-sizing:content-box;display:inline-block;width:20px;line-height:20px;text-align:center;opacity:.3;padding:0;border:0;-webkit-appearance:none;background:0}.ice-div .ice-close:after{display:block;content:"\f00d";font-family:iconfont}.ice-div .ice-panel-point a{color:inherit;text-decoration:none}.ice-div .ice-button,.ice-div button,.ice-div [type=button]{cursor:pointer;display:inline-block;min-width:120px;padding:10px 25px;margin-bottom:16px;border:0;font-size:1em;line-height:1.4em;text-align:center;text-decoration:none;-webkit-transition:border-color .25s,background-color .25s,color .25s;transition:border-color .25s,background-color .25s,color .25s;background:#2a80b9;color:#fff}.ice-div .ice-button:hover,.ice-div button:hover,.ice-div [type=button]:hover{background:#3598dc}.ice-div .ice-button-mini{padding:5px 15px;min-width:30px;font-size:.8em;line-height:1.2em}.ice-div .ice-button-big{padding:12px 45px;min-width:200px;font-size:1.4em}.ice-div .ice-button-ghost{background:transparent;border:2px solid #4378a7;padding:8px 25px;border:2px solid #4378a7;color:#297fb8;background:0}.ice-div .ice-button-ghost:hover{color:#fff;background:#297fb8;border:2px solid #297fb8}.ice-div .ice-button-ghost-custom{cursor:pointer;outline:0;color:none;background:0;border:2px solid none}.ice-menu{top:0;left:0;width:100%;height:50px;background:#2c3d4f;z-index:3;-webkit-transition:all .5s ease-in-out}.ice-menu a{text-decoration:none}.ice-menu:after{content:"";display:table;clear:both}.ice-main-nav{float:right;margin-right:5%;width:44px;height:100%;background:url("../img/ice-icon-menu.svg") no-repeat center center;font-family:'iconfont';font-size:12px;background-size:44px 44px;cursor:pointer}.ice-main-nav ul{margin:0;position:absolute;list-style:none;top:0;left:0;width:100%;-webkit-transform:translatey(-100%);-moz-transform:translatey(-100%);-ms-transform:translatey(-100%);-o-transform:translatey(-100%);transform:translatey(-100%)}.ice-main-nav a{-webkit-transition:border-color .25s,background-color .25s,color .25s;transition:border-color .25s,background-color .25s,color .25s;display:block;font-size:13px;height:50px;line-height:50px;padding-left:5%;background:#2e313d;border-top:1px solid #353846;color:#fff;font-family:'Microsoft Yahei'}.ice-menu-logo{height:100%;font-weight:bold;top:0;left:0;float:left;line-height:50px;padding:0 20px;min-height:50px;color:#fff;background-color:#297fb8;-webkit-transition:all .5s ease-in-out}.ice-main-nav ul.is-visible{-webkit-transform:translatey(50px);-moz-transform:translatey(50px);-ms-transform:translatey(50px);-o-transform:translatey(50px);transform:translatey(50px)}.ice-fixed{position:fixed}.ice-intro-big{height:100%;width:100%;background-position:center;background-attachment:fixed;background-repeat:no-repeat;background-size:cover}.ice-menu-hover a:hover{background:#297fb8}.ice-menu-lucency{background:0;position:absolute}.ice-menu-lucency .ice-menu-logo{background:0}.ice-menu-hover .ice-main-nav a:hover{background:#297fb8}.is-visible{padding:0}.ice-subnav{padding:0;list-style:none}.ice-subnav li{cursor:pointer;color:#297fb8;font-size:12px;display:inline-block;line-height:15px;padding:3px 15px}.ice-subnav li:hover{text-decoration:underline}.ice-subnav .active{color:#fff;background-color:#297fb8}.ice-subnav-line>li:nth-child(n+2){border-left:1px solid #e5e5e5}.ice-page{margin:15px;padding:0;list-style:none;text-align:center;color:#297fb8}.ice-page li{cursor:pointer;display:inline-block;width:20px;height:20px;line-height:18px}.ice-page li:hover{text-decoration:underline}.ice-page .active{color:#fff;background-color:#297fb8}.ice-page .disabled{color:#a5a5a5}.ice-page .disabled:hover{text-decoration:none}.ice-nav{width:100%;padding-left:0;text-align:center;list-style:none}.ice-nav li{margin:0;padding:0;list-style:none;font-size:.9em;line-height:2em;-webkit-transition:border-color .25s,background-color .25s,color .25s;transition:border-color .25s,background-color .25s,color .25s}.ice-nav li:hover{background:#f7f7f7}.ice-nav .active{color:#fff;background:#297fb8}.ice-nav .active:hover{color:#fff;background:#297fb8}.ice-nav li ul li{padding-left:20px;text-align:center;background:#fff}.ice-nav .ice-nav-f .ice-icon-sort-down{margin-left:20px}.ice-nav-plus{position:fixed;overflow:scroll;background-color:#fff;height:100%}.ice-nav-plus .ice-nav{padding-left:10%}.ice-nav-panel{margin-left:20%}.ice-switch{width:50px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.ice-switch-checkbox{display:none}.ice-switch-label{display:block;overflow:hidden;cursor:pointer}.ice-switch-inner{width:200%;margin-left:-100%;-moz-transition:margin .3s ease-in 0s;-webkit-transition:margin .3s ease-in 0s;-o-transition:margin .3s ease-in 0s;transition:margin .3s ease-in 0s}.ice-switch-inner>div{float:left;width:50%;height:20px;padding:0;line-height:20px;font-size:14px;color:white;font-family:Trebuchet,Arial,sans-serif;font-weight:bold;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.ice-switch-active{padding-left:10px;background-color:#297fb8;color:#fff}.ice-switch-active-custom{padding-left:10px;color:#fff}.ice-switch-inner .ice-switch-inactive{background-color:#a5a5a5;color:#fff}.ice-switch-bottom{width:20px;margin:1px;background:#fff;position:absolute;top:0;bottom:0;right:28px;-moz-transition:all .3s ease-in 0s;-webkit-transition:all .3s ease-in 0s;-o-transition:all .3s ease-in 0s;transition:all .3s ease-in 0s}.ice-switch-checkbox:checked+.ice-switch-label .ice-switch-inner{margin-left:0}.ice-switch-checkbox:checked+.ice-switch-label .ice-switch-bottom{right:0}.ice-bar{position:relative;width:100%;background:#ccc}.ice-bar div{display:block;position:relative;background:#297fb8;height:2%}.ice-bar-custom{position:relative;width:100%;background:#ccc}.ice-bar-custom div{display:block;position:relative;height:2%}.ice-table{width:100%;margin-bottom:15px;border-collapse:collapse;border-spacing:0}.ice-table caption{text-align:left;color:#a5a5a5;font-size:12px;font-style:italic}.ice-table tfoot{font-size:12px;font-style:italic}.ice-table th{text-align:left;padding:.5em 1em;border-bottom:1px solid #e5e5e5}.ice-table td{padding:.5em 1em;border-bottom:1px solid #e5e5e5}.ice-table-striped tr:nth-child(odd)>td{background-color:#f7f7f7}.ice-table-hover tbody tr:hover{color:#fff;background-color:#3598db}.ice-text-left{text-align:left!important}.ice-text-right{text-align:right!important}.ice-text-center{text-align:center!important}.ice-text-top{vertical-align:top!important}.ice-text-middle{vertical-align:middle!important}.ice-text-bottom{vertical-align:bottom!important}.ice-text-break{word-wrap:break-word;-webkit-hyphens:auto;-ms-hyphens:auto;-moz-hyphens:auto;hyphens:auto}.ice-text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ice-text-nowrap{white-space:nowrap}.ice-form select,.ice-form textarea,.ice-form input:not([type]),.ice-form input[type=text],.ice-form input[type=password],.ice-form input[type=datetime],.ice-form input[type=datetime-local],.ice-form input[type=date],.ice-form input[type=month],.ice-form input[type=time],.ice-form input[type=week],.ice-form input[type=number],.ice-form input[type=email],.ice-form input[type=url],.ice-form input[type=search],.ice-form input[type=tel],.ice-form input[type=color]{height:2.625em;width:50%;max-width:100%;padding:.5em;margin-bottom:16px;font-weight:normal;color:#555;font-size:1em;border:2px solid #ddd;-webkit-font-smoothing:antialiased;-webkit-appearance:none;-webkit-transition:border-color .25s,color .25s;transition:border-color .25s,color .25s}.ice-onerow:before,.ice-onerow:after{content:" ";display:table}.ice-onerow:after{clear:both}.ice-onerow+.ice-onerow{margin-top:15px}.ice-form-icon{position:relative;max-width:100%}.ice-form-icon>[class*=ice-icon-]{position:absolute;top:50%;width:30px;margin-top:-13px;font-size:14px;color:#999;text-align:center;pointer-events:none}[class*=ice-icon-]{font-family:iconfont;display:inline-block;font-weight:400;font-style:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ice-form-icon>input{padding-left:30px!important}.ice-form-label{width:150px;margin-top:13px;float:left}.ice-form legend{width:100%;padding-bottom:15px;font-size:18px;line-height:30px}.ice-form input:focus,.ice-form textarea:focus{outline:0;border:2px solid #2a80b9}.ice-form select:focus{outline:2px solid #297fb8}.ice-form input[type=radio],.ice-form input[type=checkbox]{display:inline-block;height:16px;width:16px;border:1px solid #e5e5e5;overflow:hidden;vertical-align:middle;text-align:center;-webkit-appearance:none;outline:0;background:0}.ice-form input[type=checkbox]:checked:before{content:"\f00c";font-family:'iconfont';font-size:13.5px;-webkit-font-smoothing:antialiased;text-align:center;line-height:13.5px;color:#297fb8}.ice-form input[type=radio]:checked:before{content:"■";font-family:'iconfont';font-size:13.5px;-webkit-font-smoothing:antialiased;text-align:center;line-height:13.5px;color:#297fb8}.ice-form textarea{min-height:80px}.ice-nav{padding:0}.ice-nav ul{padding:0}.ice-icon{display:inline-block;font:normal normal normal 14px/1 iconfont;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ice-icon-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.ice-icon-2x{font-size:2em}.ice-icon-3x{font-size:3em}.ice-icon-4x{font-size:4em}.ice-icon-5x{font-size:5em}.ice-icon-fw{width:1.28571429em;text-align:center}.ice-icon-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.ice-icon-ul>li{position:relative}.ice-icon-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.ice-icon-li.ice-icon-lg{left:-1.85714286em}.ice-icon-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.ice-icon.pull-left{margin-right:.3em}.ice-icon.pull-right{margin-left:.3em}.ice-icon-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.ice-icon-rotate-90{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.ice-icon-rotate-180{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.ice-icon-rotate-270{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.ice-icon-flip-horizontal{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.ice-icon-flip-vertical{-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .ice-icon-rotate-90,:root .ice-icon-rotate-180,:root .ice-icon-rotate-270,:root .ice-icon-flip-horizontal,:root .ice-icon-flip-vertical{filter:none}.ice-icon-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.ice-icon-stack-1x,.ice-icon-stack-2x{position:absolute;left:0;width:100%;text-align:center}.ice-icon-stack-1x{line-height:inherit}.ice-icon-stack-2x{font-size:2em}.ice-icon-inverse{color:#fff}.ice-icon-glass:before{content:"\f000"}.ice-icon-music:before{content:"\f001"}.ice-icon-search:before{content:"\f002"}.ice-icon-envelope-o:before{content:"\f003"}.ice-icon-heart:before{content:"\f004"}.ice-icon-star:before{content:"\f005"}.ice-icon-star-o:before{content:"\f006"}.ice-icon-user:before{content:"\f007"}.ice-icon-film:before{content:"\f008"}.ice-icon-th-large:before{content:"\f009"}.ice-icon-th:before{content:"\f00a"}.ice-icon-th-list:before{content:"\f00b"}.ice-icon-check:before{content:"\f00c"}.ice-icon-remove:before,.ice-icon-close:before,.ice-icon-times:before{content:"\f00d"}.ice-icon-search-plus:before{content:"\f00e"}.ice-icon-search-minus:before{content:"\f010"}.ice-icon-power-off:before{content:"\f011"}.ice-icon-signal:before{content:"\f012"}.ice-icon-gear:before,.ice-icon-cog:before{content:"\f013"}.ice-icon-trash-o:before{content:"\f014"}.ice-icon-home:before{content:"\f015"}.ice-icon-file-o:before{content:"\f016"}.ice-icon-clock-o:before{content:"\f017"}.ice-icon-road:before{content:"\f018"}.ice-icon-download:before{content:"\f019"}.ice-icon-arrow-circle-o-down:before{content:"\f01a"}.ice-icon-arrow-circle-o-up:before{content:"\f01b"}.ice-icon-inbox:before{content:"\f01c"}.ice-icon-play-circle-o:before{content:"\f01d"}.ice-icon-rotate-right:before,.ice-icon-repeat:before{content:"\f01e"}.ice-icon-refresh:before{content:"\f021"}.ice-icon-list-alt:before{content:"\f022"}.ice-icon-lock:before{content:"\f023"}.ice-icon-flag:before{content:"\f024"}.ice-icon-headphones:before{content:"\f025"}.ice-icon-volume-off:before{content:"\f026"}.ice-icon-volume-down:before{content:"\f027"}.ice-icon-volume-up:before{content:"\f028"}.ice-icon-qrcode:before{content:"\f029"}.ice-icon-barcode:before{content:"\f02a"}.ice-icon-tag:before{content:"\f02b"}.ice-icon-tags:before{content:"\f02c"}.ice-icon-book:before{content:"\f02d"}.ice-icon-bookmark:before{content:"\f02e"}.ice-icon-print:before{content:"\f02f"}.ice-icon-camera:before{content:"\f030"}.ice-icon-font:before{content:"\f031"}.ice-icon-bold:before{content:"\f032"}.ice-icon-italic:before{content:"\f033"}.ice-icon-text-height:before{content:"\f034"}.ice-icon-text-width:before{content:"\f035"}.ice-icon-align-left:before{content:"\f036"}.ice-icon-align-center:before{content:"\f037"}.ice-icon-align-right:before{content:"\f038"}.ice-icon-align-justify:before{content:"\f039"}.ice-icon-list:before{content:"\f03a"}.ice-icon-dedent:before,.ice-icon-outdent:before{content:"\f03b"}.ice-icon-indent:before{content:"\f03c"}.ice-icon-video-camera:before{content:"\f03d"}.ice-icon-photo:before,.ice-icon-image:before,.ice-icon-picture-o:before{content:"\f03e"}.ice-icon-pencil:before{content:"\f040"}.ice-icon-map-marker:before{content:"\f041"}.ice-icon-adjust:before{content:"\f042"}.ice-icon-tint:before{content:"\f043"}.ice-icon-edit:before,.ice-icon-pencil-square-o:before{content:"\f044"}.ice-icon-share-square-o:before{content:"\f045"}.ice-icon-check-square-o:before{content:"\f046"}.ice-icon-arrows:before{content:"\f047"}.ice-icon-step-backward:before{content:"\f048"}.ice-icon-fast-backward:before{content:"\f049"}.ice-icon-backward:before{content:"\f04a"}.ice-icon-play:before{content:"\f04b"}.ice-icon-pause:before{content:"\f04c"}.ice-icon-stop:before{content:"\f04d"}.ice-icon-forward:before{content:"\f04e"}.ice-icon-fast-forward:before{content:"\f050"}.ice-icon-step-forward:before{content:"\f051"}.ice-icon-eject:before{content:"\f052"}.ice-icon-chevron-left:before{content:"\f053"}.ice-icon-chevron-right:before{content:"\f054"}.ice-icon-plus-circle:before{content:"\f055"}.ice-icon-minus-circle:before{content:"\f056"}.ice-icon-times-circle:before{content:"\f057"}.ice-icon-check-circle:before{content:"\f058"}.ice-icon-question-circle:before{content:"\f059"}.ice-icon-info-circle:before{content:"\f05a"}.ice-icon-crosshairs:before{content:"\f05b"}.ice-icon-times-circle-o:before{content:"\f05c"}.ice-icon-check-circle-o:before{content:"\f05d"}.ice-icon-ban:before{content:"\f05e"}.ice-icon-arrow-left:before{content:"\f060"}.ice-icon-arrow-right:before{content:"\f061"}.ice-icon-arrow-up:before{content:"\f062"}.ice-icon-arrow-down:before{content:"\f063"}.ice-icon-mail-forward:before,.ice-icon-share:before{content:"\f064"}.ice-icon-expand:before{content:"\f065"}.ice-icon-compress:before{content:"\f066"}.ice-icon-plus:before{content:"\f067"}.ice-icon-minus:before{content:"\f068"}.ice-icon-asterisk:before{content:"\f069"}.ice-icon-exclamation-circle:before{content:"\f06a"}.ice-icon-gift:before{content:"\f06b"}.ice-icon-leaf:before{content:"\f06c"}.ice-icon-fire:before{content:"\f06d"}.ice-icon-eye:before{content:"\f06e"}.ice-icon-eye-slash:before{content:"\f070"}.ice-icon-warning:before,.ice-icon-exclamation-triangle:before{content:"\f071"}.ice-icon-plane:before{content:"\f072"}.ice-icon-calendar:before{content:"\f073"}.ice-icon-random:before{content:"\f074"}.ice-icon-comment:before{content:"\f075"}.ice-icon-magnet:before{content:"\f076"}.ice-icon-chevron-up:before{content:"\f077"}.ice-icon-chevron-down:before{content:"\f078"}.ice-icon-retweet:before{content:"\f079"}.ice-icon-shopping-cart:before{content:"\f07a"}.ice-icon-folder:before{content:"\f07b"}.ice-icon-folder-open:before{content:"\f07c"}.ice-icon-arrows-v:before{content:"\f07d"}.ice-icon-arrows-h:before{content:"\f07e"}.ice-icon-bar-chart-o:before,.ice-icon-bar-chart:before{content:"\f080"}.ice-icon-twitter-square:before{content:"\f081"}.ice-icon-facebook-square:before{content:"\f082"}.ice-icon-camera-retro:before{content:"\f083"}.ice-icon-key:before{content:"\f084"}.ice-icon-gears:before,.ice-icon-cogs:before{content:"\f085"}.ice-icon-comments:before{content:"\f086"}.ice-icon-thumbs-o-up:before{content:"\f087"}.ice-icon-thumbs-o-down:before{content:"\f088"}.ice-icon-star-half:before{content:"\f089"}.ice-icon-heart-o:before{content:"\f08a"}.ice-icon-sign-out:before{content:"\f08b"}.ice-icon-linkedin-square:before{content:"\f08c"}.ice-icon-thumb-tack:before{content:"\f08d"}.ice-icon-external-link:before{content:"\f08e"}.ice-icon-sign-in:before{content:"\f090"}.ice-icon-trophy:before{content:"\f091"}.ice-icon-github-square:before{content:"\f092"}.ice-icon-upload:before{content:"\f093"}.ice-icon-lemon-o:before{content:"\f094"}.ice-icon-phone:before{content:"\f095"}.ice-icon-square-o:before{content:"\f096"}.ice-icon-bookmark-o:before{content:"\f097"}.ice-icon-phone-square:before{content:"\f098"}.ice-icon-twitter:before{content:"\f099"}.ice-icon-facebook:before{content:"\f09a"}.ice-icon-github:before{content:"\f09b"}.ice-icon-unlock:before{content:"\f09c"}.ice-icon-credit-card:before{content:"\f09d"}.ice-icon-rss:before{content:"\f09e"}.ice-icon-hdd-o:before{content:"\f0a0"}.ice-icon-bullhorn:before{content:"\f0a1"}.ice-icon-bell:before{content:"\f0f3"}.ice-icon-certificate:before{content:"\f0a3"}.ice-icon-hand-o-right:before{content:"\f0a4"}.ice-icon-hand-o-left:before{content:"\f0a5"}.ice-icon-hand-o-up:before{content:"\f0a6"}.ice-icon-hand-o-down:before{content:"\f0a7"}.ice-icon-arrow-circle-left:before{content:"\f0a8"}.ice-icon-arrow-circle-right:before{content:"\f0a9"}.ice-icon-arrow-circle-up:before{content:"\f0aa"}.ice-icon-arrow-circle-down:before{content:"\f0ab"}.ice-icon-globe:before{content:"\f0ac"}.ice-icon-wrench:before{content:"\f0ad"}.ice-icon-tasks:before{content:"\f0ae"}.ice-icon-filter:before{content:"\f0b0"}.ice-icon-briefcase:before{content:"\f0b1"}.ice-icon-arrows-alt:before{content:"\f0b2"}.ice-icon-group:before,.ice-icon-users:before{content:"\f0c0"}.ice-icon-chain:before,.ice-icon-link:before{content:"\f0c1"}.ice-icon-cloud:before{content:"\f0c2"}.ice-icon-flask:before{content:"\f0c3"}.ice-icon-cut:before,.ice-icon-scissors:before{content:"\f0c4"}.ice-icon-copy:before,.ice-icon-files-o:before{content:"\f0c5"}.ice-icon-paperclip:before{content:"\f0c6"}.ice-icon-save:before,.ice-icon-floppy-o:before{content:"\f0c7"}.ice-icon-square:before{content:"\f0c8"}.ice-icon-navicon:before,.ice-icon-reorder:before,.ice-icon-bars:before{content:"\f0c9"}.ice-icon-list-ul:before{content:"\f0ca"}.ice-icon-list-ol:before{content:"\f0cb"}.ice-icon-strikethrough:before{content:"\f0cc"}.ice-icon-underline:before{content:"\f0cd"}.ice-icon-table:before{content:"\f0ce"}.ice-icon-magic:before{content:"\f0d0"}.ice-icon-truck:before{content:"\f0d1"}.ice-icon-pinterest:before{content:"\f0d2"}.ice-icon-pinterest-square:before{content:"\f0d3"}.ice-icon-google-plus-square:before{content:"\f0d4"}.ice-icon-google-plus:before{content:"\f0d5"}.ice-icon-money:before{content:"\f0d6"}.ice-icon-caret-down:before{content:"\f0d7"}.ice-icon-caret-up:before{content:"\f0d8"}.ice-icon-caret-left:before{content:"\f0d9"}.ice-icon-caret-right:before{content:"\f0da"}.ice-icon-columns:before{content:"\f0db"}.ice-icon-unsorted:before,.ice-icon-sort:before{content:"\f0dc"}.ice-icon-sort-down:before,.ice-icon-sort-desc:before{content:"\f0dd"}.ice-icon-sort-up:before,.ice-icon-sort-asc:before{content:"\f0de"}.ice-icon-envelope:before{content:"\f0e0"}.ice-icon-linkedin:before{content:"\f0e1"}.ice-icon-rotate-left:before,.ice-icon-undo:before{content:"\f0e2"}.ice-icon-legal:before,.ice-icon-gavel:before{content:"\f0e3"}.ice-icon-dashboard:before,.ice-icon-tachometer:before{content:"\f0e4"}.ice-icon-comment-o:before{content:"\f0e5"}.ice-icon-comments-o:before{content:"\f0e6"}.ice-icon-flash:before,.ice-icon-bolt:before{content:"\f0e7"}.ice-icon-sitemap:before{content:"\f0e8"}.ice-icon-umbrella:before{content:"\f0e9"}.ice-icon-paste:before,.ice-icon-clipboard:before{content:"\f0ea"}.ice-icon-lightbulb-o:before{content:"\f0eb"}.ice-icon-exchange:before{content:"\f0ec"}.ice-icon-cloud-download:before{content:"\f0ed"}.ice-icon-cloud-upload:before{content:"\f0ee"}.ice-icon-user-md:before{content:"\f0f0"}.ice-icon-stethoscope:before{content:"\f0f1"}.ice-icon-suitcase:before{content:"\f0f2"}.ice-icon-bell-o:before{content:"\f0a2"}.ice-icon-coffee:before{content:"\f0f4"}.ice-icon-cutlery:before{content:"\f0f5"}.ice-icon-file-text-o:before{content:"\f0f6"}.ice-icon-building-o:before{content:"\f0f7"}.ice-icon-hospital-o:before{content:"\f0f8"}.ice-icon-ambulance:before{content:"\f0f9"}.ice-icon-medkit:before{content:"\f0fa"}.ice-icon-fighter-jet:before{content:"\f0fb"}.ice-icon-beer:before{content:"\f0fc"}.ice-icon-h-square:before{content:"\f0fd"}.ice-icon-plus-square:before{content:"\f0fe"}.ice-icon-angle-double-left:before{content:"\f100"}.ice-icon-angle-double-right:before{content:"\f101"}.ice-icon-angle-double-up:before{content:"\f102"}.ice-icon-angle-double-down:before{content:"\f103"}.ice-icon-angle-left:before{content:"\f104"}.ice-icon-angle-right:before{content:"\f105"}.ice-icon-angle-up:before{content:"\f106"}.ice-icon-angle-down:before{content:"\f107"}.ice-icon-desktop:before{content:"\f108"}.ice-icon-laptop:before{content:"\f109"}.ice-icon-tablet:before{content:"\f10a"}.ice-icon-mobile-phone:before,.ice-icon-mobile:before{content:"\f10b"}.ice-icon-circle-o:before{content:"\f10c"}.ice-icon-quote-left:before{content:"\f10d"}.ice-icon-quote-right:before{content:"\f10e"}.ice-icon-spinner:before{content:"\f110"}.ice-icon-circle:before{content:"\f111"}.ice-icon-mail-reply:before,.ice-icon-reply:before{content:"\f112"}.ice-icon-github-alt:before{content:"\f113"}.ice-icon-folder-o:before{content:"\f114"}.ice-icon-folder-open-o:before{content:"\f115"}.ice-icon-smile-o:before{content:"\f118"}.ice-icon-frown-o:before{content:"\f119"}.ice-icon-meh-o:before{content:"\f11a"}.ice-icon-gamepad:before{content:"\f11b"}.ice-icon-keyboard-o:before{content:"\f11c"}.ice-icon-flag-o:before{content:"\f11d"}.ice-icon-flag-checkered:before{content:"\f11e"}.ice-icon-terminal:before{content:"\f120"}.ice-icon-code:before{content:"\f121"}.ice-icon-mail-reply-all:before,.ice-icon-reply-all:before{content:"\f122"}.ice-icon-star-half-empty:before,.ice-icon-star-half-full:before,.ice-icon-star-half-o:before{content:"\f123"}.ice-icon-location-arrow:before{content:"\f124"}.ice-icon-crop:before{content:"\f125"}.ice-icon-code-fork:before{content:"\f126"}.ice-icon-unlink:before,.ice-icon-chain-broken:before{content:"\f127"}.ice-icon-question:before{content:"\f128"}.ice-icon-info:before{content:"\f129"}.ice-icon-exclamation:before{content:"\f12a"}.ice-icon-superscript:before{content:"\f12b"}.ice-icon-subscript:before{content:"\f12c"}.ice-icon-eraser:before{content:"\f12d"}.ice-icon-puzzle-piece:before{content:"\f12e"}.ice-icon-microphone:before{content:"\f130"}.ice-icon-microphone-slash:before{content:"\f131"}.ice-icon-shield:before{content:"\f132"}.ice-icon-calendar-o:before{content:"\f133"}.ice-icon-fire-extinguisher:before{content:"\f134"}.ice-icon-rocket:before{content:"\f135"}.ice-icon-maxcdn:before{content:"\f136"}.ice-icon-chevron-circle-left:before{content:"\f137"}.ice-icon-chevron-circle-right:before{content:"\f138"}.ice-icon-chevron-circle-up:before{content:"\f139"}.ice-icon-chevron-circle-down:before{content:"\f13a"}.ice-icon-html5:before{content:"\f13b"}.ice-icon-css3:before{content:"\f13c"}.ice-icon-anchor:before{content:"\f13d"}.ice-icon-unlock-alt:before{content:"\f13e"}.ice-icon-bullseye:before{content:"\f140"}.ice-icon-ellipsis-h:before{content:"\f141"}.ice-icon-ellipsis-v:before{content:"\f142"}.ice-icon-rss-square:before{content:"\f143"}.ice-icon-play-circle:before{content:"\f144"}.ice-icon-ticket:before{content:"\f145"}.ice-icon-minus-square:before{content:"\f146"}.ice-icon-minus-square-o:before{content:"\f147"}.ice-icon-level-up:before{content:"\f148"}.ice-icon-level-down:before{content:"\f149"}.ice-icon-check-square:before{content:"\f14a"}.ice-icon-pencil-square:before{content:"\f14b"}.ice-icon-external-link-square:before{content:"\f14c"}.ice-icon-share-square:before{content:"\f14d"}.ice-icon-compass:before{content:"\f14e"}.ice-icon-toggle-down:before,.ice-icon-caret-square-o-down:before{content:"\f150"}.ice-icon-toggle-up:before,.ice-icon-caret-square-o-up:before{content:"\f151"}.ice-icon-toggle-right:before,.ice-icon-caret-square-o-right:before{content:"\f152"}.ice-icon-euro:before,.ice-icon-eur:before{content:"\f153"}.ice-icon-gbp:before{content:"\f154"}.ice-icon-dollar:before,.ice-icon-usd:before{content:"\f155"}.ice-icon-rupee:before,.ice-icon-inr:before{content:"\f156"}.ice-icon-cny:before,.ice-icon-rmb:before,.ice-icon-yen:before,.ice-icon-jpy:before{content:"\f157"}.ice-icon-ruble:before,.ice-icon-rouble:before,.ice-icon-rub:before{content:"\f158"}.ice-icon-won:before,.ice-icon-krw:before{content:"\f159"}.ice-icon-bitcoin:before,.ice-icon-btc:before{content:"\f15a"}.ice-icon-file:before{content:"\f15b"}.ice-icon-file-text:before{content:"\f15c"}.ice-icon-sort-alpha-asc:before{content:"\f15d"}.ice-icon-sort-alpha-desc:before{content:"\f15e"}.ice-icon-sort-amount-asc:before{content:"\f160"}.ice-icon-sort-amount-desc:before{content:"\f161"}.ice-icon-sort-numeric-asc:before{content:"\f162"}.ice-icon-sort-numeric-desc:before{content:"\f163"}.ice-icon-thumbs-up:before{content:"\f164"}.ice-icon-thumbs-down:before{content:"\f165"}.ice-icon-youtube-square:before{content:"\f166"}.ice-icon-youtube:before{content:"\f167"}.ice-icon-xing:before{content:"\f168"}.ice-icon-xing-square:before{content:"\f169"}.ice-icon-youtube-play:before{content:"\f16a"}.ice-icon-dropbox:before{content:"\f16b"}.ice-icon-stack-overflow:before{content:"\f16c"}.ice-icon-instagram:before{content:"\f16d"}.ice-icon-flickr:before{content:"\f16e"}.ice-icon-adn:before{content:"\f170"}.ice-icon-bitbucket:before{content:"\f171"}.ice-icon-bitbucket-square:before{content:"\f172"}.ice-icon-tumblr:before{content:"\f173"}.ice-icon-tumblr-square:before{content:"\f174"}.ice-icon-long-arrow-down:before{content:"\f175"}.ice-icon-long-arrow-up:before{content:"\f176"}.ice-icon-long-arrow-left:before{content:"\f177"}.ice-icon-long-arrow-right:before{content:"\f178"}.ice-icon-apple:before{content:"\f179"}.ice-icon-windows:before{content:"\f17a"}.ice-icon-android:before{content:"\f17b"}.ice-icon-linux:before{content:"\f17c"}.ice-icon-dribbble:before{content:"\f17d"}.ice-icon-skype:before{content:"\f17e"}.ice-icon-foursquare:before{content:"\f180"}.ice-icon-trello:before{content:"\f181"}.ice-icon-female:before{content:"\f182"}.ice-icon-male:before{content:"\f183"}.ice-icon-gittip:before{content:"\f184"}.ice-icon-sun-o:before{content:"\f185"}.ice-icon-moon-o:before{content:"\f186"}.ice-icon-archive:before{content:"\f187"}.ice-icon-bug:before{content:"\f188"}.ice-icon-vk:before{content:"\f189"}.ice-icon-weibo:before{content:"\f18a"}.ice-icon-renren:before{content:"\f18b"}.ice-icon-pagelines:before{content:"\f18c"}.ice-icon-stack-exchange:before{content:"\f18d"}.ice-icon-arrow-circle-o-right:before{content:"\f18e"}.ice-icon-arrow-circle-o-left:before{content:"\f190"}.ice-icon-toggle-left:before,.ice-icon-caret-square-o-left:before{content:"\f191"}.ice-icon-dot-circle-o:before{content:"\f192"}.ice-icon-wheelchair:before{content:"\f193"}.ice-icon-vimeo-square:before{content:"\f194"}.ice-icon-turkish-lira:before,.ice-icon-try:before{content:"\f195"}.ice-icon-plus-square-o:before{content:"\f196"}.ice-icon-space-shuttle:before{content:"\f197"}.ice-icon-slack:before{content:"\f198"}.ice-icon-envelope-square:before{content:"\f199"}.ice-icon-wordpress:before{content:"\f19a"}.ice-icon-openid:before{content:"\f19b"}.ice-icon-institution:before,.ice-icon-bank:before,.ice-icon-university:before{content:"\f19c"}.ice-icon-mortar-board:before,.ice-icon-graduation-cap:before{content:"\f19d"}.ice-icon-yahoo:before{content:"\f19e"}.ice-icon-google:before{content:"\f1a0"}.ice-icon-reddit:before{content:"\f1a1"}.ice-icon-reddit-square:before{content:"\f1a2"}.ice-icon-stumbleupon-circle:before{content:"\f1a3"}.ice-icon-stumbleupon:before{content:"\f1a4"}.ice-icon-delicious:before{content:"\f1a5"}.ice-icon-digg:before{content:"\f1a6"}.ice-icon-pied-piper:before{content:"\f1a7"}.ice-icon-pied-piper-alt:before{content:"\f1a8"}.ice-icon-drupal:before{content:"\f1a9"}.ice-icon-joomla:before{content:"\f1aa"}.ice-icon-language:before{content:"\f1ab"}.ice-icon-fax:before{content:"\f1ac"}.ice-icon-building:before{content:"\f1ad"}.ice-icon-child:before{content:"\f1ae"}.ice-icon-paw:before{content:"\f1b0"}.ice-icon-spoon:before{content:"\f1b1"}.ice-icon-cube:before{content:"\f1b2"}.ice-icon-cubes:before{content:"\f1b3"}.ice-icon-behance:before{content:"\f1b4"}.ice-icon-behance-square:before{content:"\f1b5"}.ice-icon-steam:before{content:"\f1b6"}.ice-icon-steam-square:before{content:"\f1b7"}.ice-icon-recycle:before{content:"\f1b8"}.ice-icon-automobile:before,.ice-icon-car:before{content:"\f1b9"}.ice-icon-cab:before,.ice-icon-taxi:before{content:"\f1ba"}.ice-icon-tree:before{content:"\f1bb"}.ice-icon-spotify:before{content:"\f1bc"}.ice-icon-deviantart:before{content:"\f1bd"}.ice-icon-soundcloud:before{content:"\f1be"}.ice-icon-database:before{content:"\f1c0"}.ice-icon-file-pdf-o:before{content:"\f1c1"}.ice-icon-file-word-o:before{content:"\f1c2"}.ice-icon-file-excel-o:before{content:"\f1c3"}.ice-icon-file-powerpoint-o:before{content:"\f1c4"}.ice-icon-file-photo-o:before,.ice-icon-file-picture-o:before,.ice-icon-file-image-o:before{content:"\f1c5"}.ice-icon-file-zip-o:before,.ice-icon-file-archive-o:before{content:"\f1c6"}.ice-icon-file-sound-o:before,.ice-icon-file-audio-o:before{content:"\f1c7"}.ice-icon-file-movie-o:before,.ice-icon-file-video-o:before{content:"\f1c8"}.ice-icon-file-code-o:before{content:"\f1c9"}.ice-icon-vine:before{content:"\f1ca"}.ice-icon-codepen:before{content:"\f1cb"}.ice-icon-jsfiddle:before{content:"\f1cc"}.ice-icon-life-bouy:before,.ice-icon-life-buoy:before,.ice-icon-life-saver:before,.ice-icon-support:before,.ice-icon-life-ring:before{content:"\f1cd"}.ice-icon-circle-o-notch:before{content:"\f1ce"}.ice-icon-ra:before,.ice-icon-rebel:before{content:"\f1d0"}.ice-icon-ge:before,.ice-icon-empire:before{content:"\f1d1"}.ice-icon-git-square:before{content:"\f1d2"}.ice-icon-git:before{content:"\f1d3"}.ice-icon-hacker-news:before{content:"\f1d4"}.ice-icon-tencent-weibo:before{content:"\f1d5"}.ice-icon-qq:before{content:"\f1d6"}.ice-icon-wechat:before,.ice-icon-weixin:before{content:"\f1d7"}.ice-icon-send:before,.ice-icon-paper-plane:before{content:"\f1d8"}.ice-icon-send-o:before,.ice-icon-paper-plane-o:before{content:"\f1d9"}.ice-icon-history:before{content:"\f1da"}.ice-icon-circle-thin:before{content:"\f1db"}.ice-icon-header:before{content:"\f1dc"}.ice-icon-paragraph:before{content:"\f1dd"}.ice-icon-sliders:before{content:"\f1de"}.ice-icon-share-alt:before{content:"\f1e0"}.ice-icon-share-alt-square:before{content:"\f1e1"}.ice-icon-bomb:before{content:"\f1e2"}.ice-icon-soccer-ball-o:before,.ice-icon-futbol-o:before{content:"\f1e3"}.ice-icon-tty:before{content:"\f1e4"}.ice-icon-binoculars:before{content:"\f1e5"}.ice-icon-plug:before{content:"\f1e6"}.ice-icon-slideshare:before{content:"\f1e7"}.ice-icon-twitch:before{content:"\f1e8"}.ice-icon-yelp:before{content:"\f1e9"}.ice-icon-newspaper-o:before{content:"\f1ea"}.ice-icon-wifi:before{content:"\f1eb"}.ice-icon-calculator:before{content:"\f1ec"}.ice-icon-paypal:before{content:"\f1ed"}.ice-icon-google-wallet:before{content:"\f1ee"}.ice-icon-cc-visa:before{content:"\f1f0"}.ice-icon-cc-mastercard:before{content:"\f1f1"}.ice-icon-cc-discover:before{content:"\f1f2"}.ice-icon-cc-amex:before{content:"\f1f3"}.ice-icon-cc-paypal:before{content:"\f1f4"}.ice-icon-cc-stripe:before{content:"\f1f5"}.ice-icon-bell-slash:before{content:"\f1f6"}.ice-icon-bell-slash-o:before{content:"\f1f7"}.ice-icon-trash:before{content:"\f1f8"}.ice-icon-copyright:before{content:"\f1f9"}.ice-icon-at:before{content:"\f1fa"}.ice-icon-eyedropper:before{content:"\f1fb"}.ice-icon-paint-brush:before{content:"\f1fc"}.ice-icon-birthday-cake:before{content:"\f1fd"}.ice-icon-area-chart:before{content:"\f1fe"}.ice-icon-pie-chart:before{content:"\f200"}.ice-icon-line-chart:before{content:"\f201"}.ice-icon-lastfm:before{content:"\f202"}.ice-icon-lastfm-square:before{content:"\f203"}.ice-icon-toggle-off:before{content:"\f204"}.ice-icon-toggle-on:before{content:"\f205"}.ice-icon-bicycle:before{content:"\f206"}.ice-icon-bus:before{content:"\f207"}.ice-icon-ioxhost:before{content:"\f208"}.ice-icon-angellist:before{content:"\f209"}.ice-icon-cc:before{content:"\f20a"}.ice-icon-shekel:before,.ice-icon-sheqel:before,.ice-icon-ils:before{content:"\f20b"}.ice-icon-meanpath:before{content:"\f20c"}.ice-eject{position:fixed;z-index:100;top:0;left:0;height:100%;width:100%;background:#000;display:none;opacity:.4}.ice-eject-w{width:40%;padding:20px;position:fixed;z-index:1100;top:100px;left:28%;border:1px solid #ccc;background:#fff;opacity:0;display:none}.ice-menu-sp-w{position:fixed;z-index:100;top:0;left:0;height:100%;width:100%;background:#000;display:none;opacity:.1}.ice-menu-sp{-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;-moz-perspective:1000;-ms-perspective:1000;perspective:1000;color:white;width:260px;height:100%;position:fixed;z-index:999;background:#2c3d4f}.ice-menu-sp h3{color:#fff;font-size:1.9em;padding:20px;margin:0;font-weight:300;background:#297fb8}.ice-menu-sp ul{width:100%;margin:0;padding:0;list-style-type:none}.ice-menu-sp ul li{display:block;height:40px;line-height:2.5em;padding:10px;font-size:1em;border-bottom:1px solid #283646;cursor:hand}.ice-menu-sp ul li:hover{background:#297fb8}.ice-menu-sp-right{right:-260px}.ice-menu-sp-left{left:-260px}@media screen and (max-width:55.1875em){.ice-menu-sp{width:190px}.ice-menu-sp-right{right:-190px}.ice-menu-sp-left{left:-190px}}@media screen and (max-height:26.375em){.ice-menu-sp ul li{line-height:2em;height:30px}}.ice-color-white{color:#297fb8;background-color:#fff}.ice-color-green-1{color:#fff;background-color:#1bbc9d}.ice-color-green-2{color:#fff;background-color:#16a086}.ice-color-green-3{color:#fff;background-color:#2fcc71}.ice-color-green-4{color:#fff;background-color:#27ae61}.ice-color-yellow-1{color:#fff;background-color:#f1c40f}.ice-color-yellow-2{color:#fff;background-color:#f49c14}.ice-color-orange-1{color:#fff;background-color:#e77e23}.ice-color-orange-2{color:#fff;background-color:#d55401}.ice-color-blue-1{color:#fff;background-color:#3598dc}.ice-color-blue-2{color:#fff;background-color:#2a80b9}.ice-color-red-1{color:#fff;background-color:#e84c3d}.ice-color-red-2{color:#fff;background-color:#c1392b}.ice-color-purple-1{color:#fff;background-color:#9c59b8}.ice-color-purple-2{color:#fff;background-color:#8f44ad}.ice-color-bwhite{color:#fff;border-color:#fff}.ice-color-bgreen-1{color:#1bbc9d;border-color:#1bbc9d}.ice-color-bgreen-2{color:#16a086;border-color:#16a086}.ice-color-bgreen-3{color:#2fcc71;border-color:#2fcc71}.ice-color-bgreen-4{color:#27ae61;border-color:#27ae61}.ice-color-byellow-1{color:#f1c40f;border-color:#f1c40f}.ice-color-byellow-2{color:#f49c14;border-color:#f49c14}.ice-color-borange-1{color:#e77e23;border-color:#e77e23}.ice-color-borange-2{color:#d55401;border-color:#d55401}.ice-color-bblue-1{color:#3598dc;border-color:#3598dc}.ice-color-bblue-2{color:#2a80b9;border-color:#2a80b9}.ice-color-bred-1{color:#e84c3d;border-color:#e84c3d}.ice-color-bred-2{color:#c1392b;border-color:#c1392b}.ice-color-bpurple-1{color:#9c59b8;border-color:#9c59b8}.ice-color-bpurple-2{color:#8f44ad;border-color:#8f44ad}.ice-div .ice-button-green{background-color:#1bbc9d;color:#fff}.ice-div .ice-button-green:hover{background-color:#16a086;color:#fff}.ice-div .ice-button-red{background-color:#e84c3d;color:#fff}.ice-div .ice-button-red:hover{background-color:#c1392b;color:#fff}.ice-div .ice-button-yellow{background-color:#f1c40f;color:#fff}.ice-div .ice-button-yellow:hover{background-color:#f49c14;color:#fff}.ice-div .ice-button-orange{background-color:#e77e23;color:#fff}.ice-div .ice-button-orange:hover{background-color:#d55401;color:#fff}.serif{font-family:Palatino,Optima,Georgia,serif}.ice-chinese p,.ice-chinese pre,.ice-chinese ul,.ice-chinese ol,.ice-chinese dl,.ice-chinese form,.ice-chinese hr,.ice-chinese table,.ice-chinese-p,.ice-chinese-pre,.ice-chinese-ul,.ice-chinese-ol,.ice-chinese-dl,.ice-chinese-form,.ice-chinese-hr,.ice-chinese-table,blockquote{margin-bottom:1.8em}h1,h2,h3,h4,h5,h6{font-family:'Helvetica Neue','Microsoft Yahei','Hiragino Sans GB','Microsoft Sans Serif','WenQuanYi Micro Hei',sans-serif;font-weight:200;color:#000}.ice-chinese h1,.ice-chinese h2,.ice-chinese h3,.ice-chinese h4,.ice-chinese h5,.ice-chinese h6,.ice-chinese-h1,.ice-chinese-h2,.ice-chinese-h3,.ice-chinese-h4,.ice-chinese-h5,.ice-chinese-h6{margin-bottom:.4em;line-height:1.5}.ice-chinese h1,.ice-chinese-h1{font-size:2em}.ice-chinese h2,.ice-chinese-h2{font-size:1.8em}.ice-chinese h3,.ice-chinese-h3{font-size:1.6em}.ice-chinese h4,.ice-chinese-h4{font-size:1.4em}.ice-chinese h5,.ice-chinese h6,.ice-chinese-h5,.ice-chinese-h6{font-size:1.2em}.ice-chinese ul,.ice-chinese-ul{margin-left:1.3em;list-style:disc}.ice-chinese ol,.ice-chinese-ol{list-style:decimal;margin-left:1.9em}.ice-chinese li ul,.ice-chinese li ol,.ice-chinese-ul ul,.ice-chinese-ul ol,.ice-chinese-ol ul,.ice-chinese-ol ol{margin-top:0;margin-bottom:0;margin-left:2em}.ice-chinese li ul,.ice-chinese-ul ul,.ice-chinese-ol ul{list-style:circle}.ice-chinese table th,.ice-chinese table td,.ice-chinese-table th,.ice-chinese-table td .ice-chinese table caption{border:1px solid #ddd;padding:.5em 1em;color:#666}.ice-chinese table th,.ice-chinese-table th{background:#fbfbfb}.ice-chinese table thead th,.ice-chinese-table thead th{background:#f1f1f1}.ice-chinese table caption{border-bottom:0}.ice-chinese-input,.ice-chinese-textarea{-webkit-appearance:none;border-radius:0}::-moz-selection{background:#08c;color:#fff}::selection{background:#08c;color:#fff}.ice-chinese-em,.ice-chinese em,legend,caption{color:#000;font-weight:inherit}.ice-chinese-em{position:relative}.ice-chinese-em:after{position:absolute;top:.65em;left:0;width:100%;overflow:hidden;content:"・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・"}.ice-chinese img{max-width:100%}@media all and (min-width:1024px){.onepcssgrid-1000{max-width:1000px}.ice-div .onerow{padding:0}}@media all and (max-width:768px){.ice-div{float:none;width:100%}.ice-nav{display:none}.ice-nav-plus{display:none;overflow:hidden}.ice-nav-panel{margin-left:0}}@media only screen and (min-width:768px){.ice-menu{height:70px;-webkit-transition:all .3s ease-in-out}.ice-menu-logo{line-height:70px;height:70px;-webkit-transition:all .5s ease-in-out}.ice-main-nav{width:auto;height:auto;background:0;cursor:auto}.ice-main-nav ul{position:static;width:auto;-webkit-transform:translatey(0);-moz-transform:translatey(0);-ms-transform:translatey(0);-o-transform:translatey(0);transform:translatey(0);line-height:70px}.ice-main-nav ul.is-visible{-webkit-transform:translatey(0);-moz-transform:translatey(0);-ms-transform:translatey(0);-o-transform:translatey(0);transform:translatey(0)}.ice-main-nav li{display:inline-block;margin-left:1em;font-size:13px;cursor:pointer;-webkit-transition:padding .05s linear;-moz-transition:padding .05s linear;-ms-transition:padding .05s linear;-o-transition:padding .05s linear;transition:padding .05s linear}.ice-main-nav a{display:inline-block;height:auto;line-height:normal;background:transparent;padding:.6em 1em;border-top:0;font-size:13px;text-transform:uppercase}.ice-main-nav a:hover{background:0}}@media only screen and (min-width:1170px){.ice-content{position:relative;padding:2em 0;line-height:1.6;z-index:2}.ice-content::before{content:'';position:absolute;bottom:100%;left:0;width:100%;height:50px;background:-webkit-linear-gradient(bottom,rgba(46,49,61,0.5),rgba(46,49,61,0));background:linear-gradient(to top,rgba(46,49,61,0.5),rgba(46,49,61,0))}} -------------------------------------------------------------------------------- /font/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/font/FontAwesome.otf -------------------------------------------------------------------------------- /font/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/font/fontawesome-webfont.eot -------------------------------------------------------------------------------- /font/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/font/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /font/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/font/fontawesome-webfont.woff -------------------------------------------------------------------------------- /html/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Amail 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 | -------------------------------------------------------------------------------- /html/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Amail 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 | -------------------------------------------------------------------------------- /img/ajax.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/img/ajax.gif -------------------------------------------------------------------------------- /img/ice-icon-menu.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /img/icebg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/img/icebg.jpg -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/img/logo.png -------------------------------------------------------------------------------- /img/mlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/img/mlogo.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ICECSS 6 | 9 | 10 | 11 |
12 | 15 | 24 |
25 |
26 |
27 |

ICECSS is a simple css frame.

28 | 29 |
30 |
31 |
32 |

You can see more of document

33 | 34 |
35 |
36 |
37 |
38 |
39 |

40 |
41 |
42 |

Light

43 |

ICECSS is a light CSS 's framework .The core just only 70k.

44 |
45 |
46 |
47 |
48 |

49 |
50 |
51 |

Simple

52 |

Easy to use and had little difficulty.

53 |
54 |
55 |
56 |
57 |

58 |
59 |
60 |

Clean

61 |

Using the namespace way to name, reduce pollution .

62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |

70 |
71 |
72 |

Service

73 |

The official offer cloud serving and CND to ICECSS .

74 |
75 |
76 |
77 |
78 |

79 |
80 |
81 |

Compatible

82 |

Super strong compatibility, compatible with other mainstream CSS framework .

83 |
84 |
85 |
86 |
87 |

88 |
89 |
90 |

Support

91 |

If have any problem when you are using? Timely response within 24 hours .

92 |
93 |
94 |
95 |
96 |
97 | 98 | 99 | 130 | 131 | -------------------------------------------------------------------------------- /js/icecss.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function($) { 2 | 3 | //对导航菜单增加下拉图标 4 | $('.ice-nav-f').append(""); 5 | 6 | //导航栏操作 7 | $('.ice-main-nav').on('click', function(event) { 8 | if ($(event.target).is('.ice-main-nav')) $(this).children('ul').toggleClass('is-visible'); 9 | }); 10 | 11 | //关闭按钮 12 | $('.ice-close').click(function() { 13 | this.parentNode.style.display = 'none'; 14 | }); 15 | //手风琴 16 | $(".ice-nav-accordion li").click(function(){ 17 | $(this).next().toggle('slow'); 18 | }); 19 | 20 | 21 | }); 22 | 23 | 24 | //弹出式画布插件 25 | 26 | (function($) { 27 | $.fn.extend({ 28 | ice_eject: function() { 29 | var temp = $("
"); 30 | $("body").append(temp); 31 | return this.each(function() { 32 | $(this).click(function(e) { 33 | var wid = $(this).attr("href"); 34 | $(".ice-eject").click(function() { 35 | close_w(wid) 36 | }); 37 | $(".ice-eject-close").click(function() { 38 | close_w(wid) 39 | }); 40 | $(".ice-eject").fadeIn(); 41 | $(wid).css({ 42 | "display": "block", 43 | }); 44 | $(wid).fadeTo(200, 1); 45 | e.preventDefault() 46 | }) 47 | }); 48 | 49 | function close_w(wid) { 50 | $(".ice-eject").fadeOut(200); 51 | $(wid).css({ 52 | "display": "none" 53 | }) 54 | } 55 | } 56 | }) 57 | })(jQuery); 58 | 59 | //平滑移动插件 60 | (function($) { 61 | $.extend($.fn, { 62 | ice_scroll: function(time, to) { 63 | time = time || 800; 64 | to = to || 1; 65 | $('a[href*=#]', this).click(function() { 66 | if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 67 | var $target = $(this.hash); 68 | $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); 69 | if ($target.length) { 70 | if (to == 1) { 71 | $('html,body').animate({ 72 | scrollTop: $target.offset().top 73 | }, time); 74 | } else if (to == 2) { 75 | $('html,body').animate({ 76 | scrollLeft: $target.offset().left 77 | }, time); 78 | } else { 79 | alert('error!'); 80 | } 81 | return false; 82 | } 83 | } 84 | }); 85 | } 86 | }); 87 | })(jQuery); 88 | 89 | 90 | //滚动监控插件 91 | (function() { 92 | var t = [].indexOf || function(t) { 93 | for (var e = 0, n = this.length; e < n; e++) { 94 | if (e in this && this[e] === t) return e 95 | } 96 | return -1 97 | }, 98 | e = [].slice; 99 | (function(t, e) { 100 | if (typeof define === "function" && define.amd) { 101 | return define("waypoints", ["jquery"], function(n) { 102 | return e(n, t) 103 | }) 104 | } else { 105 | return e(t.jQuery, t) 106 | } 107 | })(window, function(n, r) { 108 | var i, o, l, s, f, u, c, a, h, d, p, y, v, w, g, m; 109 | i = n(r); 110 | a = t.call(r, "ontouchstart") >= 0; 111 | s = { 112 | horizontal: {}, 113 | vertical: {} 114 | }; 115 | f = 1; 116 | c = {}; 117 | u = "waypoints-context-id"; 118 | p = "resize.waypoints"; 119 | y = "scroll.waypoints"; 120 | v = 1; 121 | w = "waypoints-waypoint-ids"; 122 | g = "waypoint"; 123 | m = "waypoints"; 124 | o = function() { 125 | function t(t) { 126 | var e = this; 127 | this.$element = t; 128 | this.element = t[0]; 129 | this.didResize = false; 130 | this.didScroll = false; 131 | this.id = "context" + f++; 132 | this.oldScroll = { 133 | x: t.scrollLeft(), 134 | y: t.scrollTop() 135 | }; 136 | this.waypoints = { 137 | horizontal: {}, 138 | vertical: {} 139 | }; 140 | this.element[u] = this.id; 141 | c[this.id] = this; 142 | t.bind(y, function() { 143 | var t; 144 | if (!(e.didScroll || a)) { 145 | e.didScroll = true; 146 | t = function() { 147 | e.doScroll(); 148 | return e.didScroll = false 149 | }; 150 | return r.setTimeout(t, n[m].settings.scrollThrottle) 151 | } 152 | }); 153 | t.bind(p, function() { 154 | var t; 155 | if (!e.didResize) { 156 | e.didResize = true; 157 | t = function() { 158 | n[m]("refresh"); 159 | return e.didResize = false 160 | }; 161 | return r.setTimeout(t, n[m].settings.resizeThrottle) 162 | } 163 | }) 164 | } 165 | t.prototype.doScroll = function() { 166 | var t, e = this; 167 | t = { 168 | horizontal: { 169 | newScroll: this.$element.scrollLeft(), 170 | oldScroll: this.oldScroll.x, 171 | forward: "right", 172 | backward: "left" 173 | }, 174 | vertical: { 175 | newScroll: this.$element.scrollTop(), 176 | oldScroll: this.oldScroll.y, 177 | forward: "down", 178 | backward: "up" 179 | } 180 | }; 181 | if (a && (!t.vertical.oldScroll || !t.vertical.newScroll)) { 182 | n[m]("refresh") 183 | } 184 | n.each(t, function(t, r) { 185 | var i, o, l; 186 | l = []; 187 | o = r.newScroll > r.oldScroll; 188 | i = o ? r.forward : r.backward; 189 | n.each(e.waypoints[t], function(t, e) { 190 | var n, i; 191 | if (r.oldScroll < (n = e.offset) && n <= r.newScroll) { 192 | return l.push(e) 193 | } else if (r.newScroll < (i = e.offset) && i <= r.oldScroll) { 194 | return l.push(e) 195 | } 196 | }); 197 | l.sort(function(t, e) { 198 | return t.offset - e.offset 199 | }); 200 | if (!o) { 201 | l.reverse() 202 | } 203 | return n.each(l, function(t, e) { 204 | if (e.options.continuous || t === l.length - 1) { 205 | return e.trigger([i]) 206 | } 207 | }) 208 | }); 209 | return this.oldScroll = { 210 | x: t.horizontal.newScroll, 211 | y: t.vertical.newScroll 212 | } 213 | }; 214 | t.prototype.refresh = function() { 215 | var t, e, r, i = this; 216 | r = n.isWindow(this.element); 217 | e = this.$element.offset(); 218 | this.doScroll(); 219 | t = { 220 | horizontal: { 221 | contextOffset: r ? 0 : e.left, 222 | contextScroll: r ? 0 : this.oldScroll.x, 223 | contextDimension: this.$element.width(), 224 | oldScroll: this.oldScroll.x, 225 | forward: "right", 226 | backward: "left", 227 | offsetProp: "left" 228 | }, 229 | vertical: { 230 | contextOffset: r ? 0 : e.top, 231 | contextScroll: r ? 0 : this.oldScroll.y, 232 | contextDimension: r ? n[m]("viewportHeight") : this.$element.height(), 233 | oldScroll: this.oldScroll.y, 234 | forward: "down", 235 | backward: "up", 236 | offsetProp: "top" 237 | } 238 | }; 239 | return n.each(t, function(t, e) { 240 | return n.each(i.waypoints[t], function(t, r) { 241 | var i, o, l, s, f; 242 | i = r.options.offset; 243 | l = r.offset; 244 | o = n.isWindow(r.element) ? 0 : r.$element.offset()[e.offsetProp]; 245 | if (n.isFunction(i)) { 246 | i = i.apply(r.element) 247 | } else if (typeof i === "string") { 248 | i = parseFloat(i); 249 | if (r.options.offset.indexOf("%") > -1) { 250 | i = Math.ceil(e.contextDimension * i / 100) 251 | } 252 | } 253 | r.offset = o - e.contextOffset + e.contextScroll - i; 254 | if (r.options.onlyOnScroll && l != null || !r.enabled) { 255 | return 256 | } 257 | if (l !== null && l < (s = e.oldScroll) && s <= r.offset) { 258 | return r.trigger([e.backward]) 259 | } else if (l !== null && l > (f = e.oldScroll) && f >= r.offset) { 260 | return r.trigger([e.forward]) 261 | } else if (l === null && e.oldScroll >= r.offset) { 262 | return r.trigger([e.forward]) 263 | } 264 | }) 265 | }) 266 | }; 267 | t.prototype.checkEmpty = function() { 268 | if (n.isEmptyObject(this.waypoints.horizontal) && n.isEmptyObject(this.waypoints.vertical)) { 269 | this.$element.unbind([p, y].join(" ")); 270 | return delete c[this.id] 271 | } 272 | }; 273 | return t 274 | }(); 275 | l = function() { 276 | function t(t, e, r) { 277 | var i, o; 278 | if (r.offset === "bottom-in-view") { 279 | r.offset = function() { 280 | var t; 281 | t = n[m]("viewportHeight"); 282 | if (!n.isWindow(e.element)) { 283 | t = e.$element.height() 284 | } 285 | return t - n(this).outerHeight() 286 | } 287 | } 288 | this.$element = t; 289 | this.element = t[0]; 290 | this.axis = r.horizontal ? "horizontal" : "vertical"; 291 | this.callback = r.handler; 292 | this.context = e; 293 | this.enabled = r.enabled; 294 | this.id = "waypoints" + v++; 295 | this.offset = null; 296 | this.options = r; 297 | e.waypoints[this.axis][this.id] = this; 298 | s[this.axis][this.id] = this; 299 | i = (o = this.element[w]) != null ? o : []; 300 | i.push(this.id); 301 | this.element[w] = i 302 | } 303 | t.prototype.trigger = function(t) { 304 | if (!this.enabled) { 305 | return 306 | } 307 | if (this.callback != null) { 308 | this.callback.apply(this.element, t) 309 | } 310 | if (this.options.triggerOnce) { 311 | return this.destroy() 312 | } 313 | }; 314 | t.prototype.disable = function() { 315 | return this.enabled = false 316 | }; 317 | t.prototype.enable = function() { 318 | this.context.refresh(); 319 | return this.enabled = true 320 | }; 321 | t.prototype.destroy = function() { 322 | delete s[this.axis][this.id]; 323 | delete this.context.waypoints[this.axis][this.id]; 324 | return this.context.checkEmpty() 325 | }; 326 | t.getWaypointsByElement = function(t) { 327 | var e, r; 328 | r = t[w]; 329 | if (!r) { 330 | return [] 331 | } 332 | e = n.extend({}, s.horizontal, s.vertical); 333 | return n.map(r, function(t) { 334 | return e[t] 335 | }) 336 | }; 337 | return t 338 | }(); 339 | d = { 340 | init: function(t, e) { 341 | var r; 342 | e = n.extend({}, n.fn[g].defaults, e); 343 | if ((r = e.handler) == null) { 344 | e.handler = t 345 | } 346 | this.each(function() { 347 | var t, r, i, s; 348 | t = n(this); 349 | i = (s = e.context) != null ? s : n.fn[g].defaults.context; 350 | if (!n.isWindow(i)) { 351 | i = t.closest(i) 352 | } 353 | i = n(i); 354 | r = c[i[0][u]]; 355 | if (!r) { 356 | r = new o(i) 357 | } 358 | return new l(t, r, e) 359 | }); 360 | n[m]("refresh"); 361 | return this 362 | }, 363 | disable: function() { 364 | return d._invoke.call(this, "disable") 365 | }, 366 | enable: function() { 367 | return d._invoke.call(this, "enable") 368 | }, 369 | destroy: function() { 370 | return d._invoke.call(this, "destroy") 371 | }, 372 | prev: function(t, e) { 373 | return d._traverse.call(this, t, e, function(t, e, n) { 374 | if (e > 0) { 375 | return t.push(n[e - 1]) 376 | } 377 | }) 378 | }, 379 | next: function(t, e) { 380 | return d._traverse.call(this, t, e, function(t, e, n) { 381 | if (e < n.length - 1) { 382 | return t.push(n[e + 1]) 383 | } 384 | }) 385 | }, 386 | _traverse: function(t, e, i) { 387 | var o, l; 388 | if (t == null) { 389 | t = "vertical" 390 | } 391 | if (e == null) { 392 | e = r 393 | } 394 | l = h.aggregate(e); 395 | o = []; 396 | this.each(function() { 397 | var e; 398 | e = n.inArray(this, l[t]); 399 | return i(o, e, l[t]) 400 | }); 401 | return this.pushStack(o) 402 | }, 403 | _invoke: function(t) { 404 | this.each(function() { 405 | var e; 406 | e = l.getWaypointsByElement(this); 407 | return n.each(e, function(e, n) { 408 | n[t](); 409 | return true 410 | }) 411 | }); 412 | return this 413 | } 414 | }; 415 | n.fn[g] = function() { 416 | var t, r; 417 | r = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : []; 418 | if (d[r]) { 419 | return d[r].apply(this, t) 420 | } else if (n.isFunction(r)) { 421 | return d.init.apply(this, arguments) 422 | } else if (n.isPlainObject(r)) { 423 | return d.init.apply(this, [null, r]) 424 | } else if (!r) { 425 | return n.error("jQuery Waypoints needs a callback function or handler option.") 426 | } else { 427 | return n.error("The " + r + " method does not exist in jQuery Waypoints.") 428 | } 429 | }; 430 | n.fn[g].defaults = { 431 | context: r, 432 | continuous: true, 433 | enabled: true, 434 | horizontal: false, 435 | offset: 0, 436 | triggerOnce: false 437 | }; 438 | h = { 439 | refresh: function() { 440 | return n.each(c, function(t, e) { 441 | return e.refresh() 442 | }) 443 | }, 444 | viewportHeight: function() { 445 | var t; 446 | return (t = r.innerHeight) != null ? t : i.height() 447 | }, 448 | aggregate: function(t) { 449 | var e, r, i; 450 | e = s; 451 | if (t) { 452 | e = (i = c[n(t)[0][u]]) != null ? i.waypoints : void 0 453 | } 454 | if (!e) { 455 | return [] 456 | } 457 | r = { 458 | horizontal: [], 459 | vertical: [] 460 | }; 461 | n.each(r, function(t, i) { 462 | n.each(e[t], function(t, e) { 463 | return i.push(e) 464 | }); 465 | i.sort(function(t, e) { 466 | return t.offset - e.offset 467 | }); 468 | r[t] = n.map(i, function(t) { 469 | return t.element 470 | }); 471 | return r[t] = n.unique(r[t]) 472 | }); 473 | return r 474 | }, 475 | above: function(t) { 476 | if (t == null) { 477 | t = r 478 | } 479 | return h._filter(t, "vertical", function(t, e) { 480 | return e.offset <= t.oldScroll.y 481 | }) 482 | }, 483 | below: function(t) { 484 | if (t == null) { 485 | t = r 486 | } 487 | return h._filter(t, "vertical", function(t, e) { 488 | return e.offset > t.oldScroll.y 489 | }) 490 | }, 491 | left: function(t) { 492 | if (t == null) { 493 | t = r 494 | } 495 | return h._filter(t, "horizontal", function(t, e) { 496 | return e.offset <= t.oldScroll.x 497 | }) 498 | }, 499 | right: function(t) { 500 | if (t == null) { 501 | t = r 502 | } 503 | return h._filter(t, "horizontal", function(t, e) { 504 | return e.offset > t.oldScroll.x 505 | }) 506 | }, 507 | enable: function() { 508 | return h._invoke("enable") 509 | }, 510 | disable: function() { 511 | return h._invoke("disable") 512 | }, 513 | destroy: function() { 514 | return h._invoke("destroy") 515 | }, 516 | extendFn: function(t, e) { 517 | return d[t] = e 518 | }, 519 | _invoke: function(t) { 520 | var e; 521 | e = n.extend({}, s.vertical, s.horizontal); 522 | return n.each(e, function(e, n) { 523 | n[t](); 524 | return true 525 | }) 526 | }, 527 | _filter: function(t, e, r) { 528 | var i, o; 529 | i = c[n(t)[0][u]]; 530 | if (!i) { 531 | return [] 532 | } 533 | o = []; 534 | n.each(i.waypoints[e], function(t, e) { 535 | if (r(i, e)) { 536 | return o.push(e) 537 | } 538 | }); 539 | o.sort(function(t, e) { 540 | return t.offset - e.offset 541 | }); 542 | return n.map(o, function(t) { 543 | return t.element 544 | }) 545 | } 546 | }; 547 | n[m] = function() { 548 | var t, n; 549 | n = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : []; 550 | if (h[n]) { 551 | return h[n].apply(null, t) 552 | } else { 553 | return h.aggregate.call(null, n) 554 | } 555 | }; 556 | n[m].settings = { 557 | resizeThrottle: 100, 558 | scrollThrottle: 30 559 | }; 560 | return i.on("load.waypoints", function() { 561 | return n[m]("refresh") 562 | }) 563 | }) 564 | }).call(this); 565 | 566 | 567 | 568 | 569 | 570 | 571 | //抽屉式导航 572 | 573 | (function ($) { 574 | $.fn.ice_spmenu = function () { 575 | $(".ice-sp-left").click(function () { 576 | var spWidth = $('.ice-menu-sp').width(); 577 | var temp = $("
"); 578 | $("body").append(temp); 579 | temp.click(function () { 580 | var spWidth = $('.ice-menu-sp').width(); 581 | $(".ice-menu-sp-w").fadeOut(); 582 | 583 | $(".ice-menu-sp-left").animate({ 584 | left: -1 * spWidth 585 | }); 586 | 587 | }) 588 | $(".ice-menu-sp-w").fadeIn(); 589 | $(".ice-menu-sp-left").animate({ 590 | left: '0' 591 | }); 592 | }) 593 | $(".ice-sp-right").click(function () { 594 | var spWidth = $('.ice-menu-sp').width(); 595 | var temp = $("
"); 596 | $("body").append(temp); 597 | temp.click(function () { 598 | var spWidth = $('.ice-menu-sp').width(); 599 | $(".ice-menu-sp-w").fadeOut(); 600 | $(".ice-menu-sp-right").animate({ 601 | right: -1 * spWidth 602 | }) 603 | }) 604 | $(".ice-menu-sp-w").fadeIn(); 605 | $(".ice-menu-sp-right").animate({ 606 | right: '0' 607 | }); 608 | }) 609 | 610 | 611 | } 612 | })(jQuery); 613 | 614 | 615 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/logo.png -------------------------------------------------------------------------------- /plugin/ice_click.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | */ 5 | 6 | //提前加载链接 7 | 8 | 9 | var ice_click = function(document, location) { 10 | 11 | var $ua = navigator.userAgent, 12 | $isChromeForIOS = $ua.indexOf(' CriOS/') > -1, 13 | $hasTouch = 'createTouch' in document, 14 | $currentLocationWithoutHash, 15 | $urlToPreload, 16 | $preloadTimer, 17 | $lastTouchTimestamp, 18 | 19 | 20 | $history = {}, 21 | $xhr, 22 | $url = false, 23 | $title = false, 24 | $mustRedirect = false, 25 | $body = false, 26 | $timing = {}, 27 | $isPreloading = false, 28 | $isWaitingForCompletion = false, 29 | $trackedAssets = [], 30 | 31 | $useWhitelist, 32 | $preloadOnMousedown, 33 | $delayBeforePreload, 34 | $eventsCallbacks = { 35 | fetch: [], 36 | receive: [], 37 | wait: [], 38 | change: [] 39 | } 40 | 41 | 42 | 43 | 44 | 45 | function removeHash(url) { 46 | var index = url.indexOf('#') 47 | if (index < 0) { 48 | return url 49 | } 50 | return url.substr(0, index) 51 | } 52 | 53 | function getLinkTarget(target) { 54 | while (target && target.nodeName != 'A') { 55 | target = target.parentNode 56 | } 57 | return target 58 | } 59 | 60 | function isBlacklisted(elem) { 61 | do { 62 | if (!elem.hasAttribute) { // Parent of 63 | break 64 | } 65 | if (elem.hasAttribute('data-instant')) { 66 | return false 67 | } 68 | if (elem.hasAttribute('data-no-instant')) { 69 | return true 70 | } 71 | } 72 | while (elem = elem.parentNode); 73 | return false 74 | } 75 | 76 | function isWhitelisted(elem) { 77 | do { 78 | if (!elem.hasAttribute) { // Parent of 79 | break 80 | } 81 | if (elem.hasAttribute('data-no-instant')) { 82 | return false 83 | } 84 | if (elem.hasAttribute('data-instant')) { 85 | return true 86 | } 87 | } 88 | while (elem = elem.parentNode); 89 | return false 90 | } 91 | 92 | function isPreloadable(a) { 93 | var domain = location.protocol + '//' + location.host 94 | 95 | if (a.target // target="_blank" etc. 96 | || a.hasAttribute('download') 97 | || a.href.indexOf(domain + '/') != 0 // Another domain, or no href attribute 98 | || (a.href.indexOf('#') > -1 99 | && removeHash(a.href) == $currentLocationWithoutHash) // Anchor 100 | || ($useWhitelist 101 | ? !isWhitelisted(a) 102 | : isBlacklisted(a)) 103 | ) { 104 | return false 105 | } 106 | return true 107 | } 108 | 109 | function triggerPageEvent(eventType, arg1, arg2, arg3) { 110 | var returnValue = false 111 | for (var i = 0; i < $eventsCallbacks[eventType].length; i++) { 112 | if (eventType == 'receive') { 113 | var altered = $eventsCallbacks[eventType][i](arg1, arg2, arg3) 114 | if (altered) { 115 | /* Update args for the next iteration of the loop. */ 116 | if ('body' in altered) { 117 | arg2 = altered.body 118 | } 119 | if ('title' in altered) { 120 | arg3 = altered.title 121 | } 122 | 123 | returnValue = altered 124 | } 125 | } 126 | else { 127 | $eventsCallbacks[eventType][i](arg1, arg2, arg3) 128 | } 129 | } 130 | return returnValue 131 | } 132 | 133 | function changePage(title, body, newUrl, scrollY) { 134 | document.documentElement.replaceChild(body, document.body) 135 | /* We cannot just use `document.body = doc.body`, it causes Safari (tested 136 | 5.1, 6.0 and Mobile 7.0) to execute script tags directly. 137 | */ 138 | 139 | if (newUrl) { 140 | history.pushState(null, null, newUrl) 141 | 142 | var hashIndex = newUrl.indexOf('#'), 143 | hashElem = hashIndex > -1 144 | && document.getElementById(newUrl.substr(hashIndex + 1)), 145 | offset = 0 146 | 147 | if (hashElem) { 148 | while (hashElem.offsetParent) { 149 | offset += hashElem.offsetTop 150 | 151 | hashElem = hashElem.offsetParent 152 | } 153 | } 154 | scrollTo(0, offset) 155 | 156 | $currentLocationWithoutHash = removeHash(newUrl) 157 | } 158 | else { 159 | scrollTo(0, scrollY) 160 | } 161 | 162 | if ($isChromeForIOS && document.title == title) { 163 | /* Chrome for iOS: 164 | * 165 | * 1. Removes title on pushState, so the title needs to be set after. 166 | * 167 | * 2. Will not set the title if it’s identical when trimmed, so 168 | * appending a space won't do, but a non-breaking space works. 169 | */ 170 | document.title = title + String.fromCharCode(160) 171 | } 172 | else { 173 | document.title = title 174 | } 175 | 176 | instantanize() 177 | bar.done() 178 | triggerPageEvent('change', false) 179 | 180 | // Real event, useful for combining userscripts, but only for that so it’s undocumented. 181 | var userscriptEvent = document.createEvent('HTMLEvents') 182 | userscriptEvent.initEvent('instantclick:newpage', true, true) 183 | dispatchEvent(userscriptEvent) 184 | } 185 | 186 | function setPreloadingAsHalted() { 187 | $isPreloading = false 188 | $isWaitingForCompletion = false 189 | } 190 | 191 | function removeNoscriptTags(html) { 192 | /* Must be done on text, not on a node's innerHTML, otherwise strange 193 | * things happen with implicitly closed elements (see the Noscript test). 194 | */ 195 | return html.replace(//gi, '') 196 | } 197 | 198 | 199 | ////////// EVENT HANDLERS ////////// 200 | 201 | 202 | function mousedown(e) { 203 | if ($lastTouchTimestamp > (+new Date - 500)) { 204 | return // Otherwise, click doesn’t fire 205 | } 206 | 207 | var a = getLinkTarget(e.target) 208 | 209 | if (!a || !isPreloadable(a)) { 210 | return 211 | } 212 | 213 | preload(a.href) 214 | } 215 | 216 | function mouseover(e) { 217 | if ($lastTouchTimestamp > (+new Date - 500)) { 218 | return // Otherwise, click doesn’t fire 219 | } 220 | 221 | var a = getLinkTarget(e.target) 222 | 223 | if (!a || !isPreloadable(a)) { 224 | return 225 | } 226 | 227 | a.addEventListener('mouseout', mouseout) 228 | 229 | if (!$delayBeforePreload) { 230 | preload(a.href) 231 | } 232 | else { 233 | $urlToPreload = a.href 234 | $preloadTimer = setTimeout(preload, $delayBeforePreload) 235 | } 236 | } 237 | 238 | function touchstart(e) { 239 | $lastTouchTimestamp = +new Date 240 | 241 | var a = getLinkTarget(e.target) 242 | 243 | if (!a || !isPreloadable(a)) { 244 | return 245 | } 246 | 247 | if ($preloadOnMousedown) { 248 | a.removeEventListener('mousedown', mousedown) 249 | } 250 | else { 251 | a.removeEventListener('mouseover', mouseover) 252 | } 253 | preload(a.href) 254 | } 255 | 256 | function click(e) { 257 | var a = getLinkTarget(e.target) 258 | 259 | if (!a || !isPreloadable(a)) { 260 | return 261 | } 262 | 263 | if (e.which > 1 || e.metaKey || e.ctrlKey) { // Opening in new tab 264 | return 265 | } 266 | e.preventDefault() 267 | display(a.href) 268 | } 269 | 270 | function mouseout() { 271 | if ($preloadTimer) { 272 | clearTimeout($preloadTimer) 273 | $preloadTimer = false 274 | return 275 | } 276 | 277 | if (!$isPreloading || $isWaitingForCompletion) { 278 | return 279 | } 280 | $xhr.abort() 281 | setPreloadingAsHalted() 282 | } 283 | 284 | function readystatechange() { 285 | if ($xhr.readyState < 4) { 286 | return 287 | } 288 | if ($xhr.status == 0) { 289 | /* Request aborted */ 290 | return 291 | } 292 | 293 | $timing.ready = +new Date - $timing.start 294 | 295 | if ($xhr.getResponseHeader('Content-Type').match(/\/(x|ht|xht)ml/)) { 296 | var doc = document.implementation.createHTMLDocument('') 297 | doc.documentElement.innerHTML = removeNoscriptTags($xhr.responseText) 298 | $title = doc.title 299 | $body = doc.body 300 | 301 | var alteredOnReceive = triggerPageEvent('receive', $url, $body, $title) 302 | if (alteredOnReceive) { 303 | if ('body' in alteredOnReceive) { 304 | $body = alteredOnReceive.body 305 | } 306 | if ('title' in alteredOnReceive) { 307 | $title = alteredOnReceive.title 308 | } 309 | } 310 | 311 | var urlWithoutHash = removeHash($url) 312 | $history[urlWithoutHash] = { 313 | body: $body, 314 | title: $title, 315 | scrollY: urlWithoutHash in $history ? $history[urlWithoutHash].scrollY : 0 316 | } 317 | 318 | var elems = doc.head.children, 319 | found = 0, 320 | elem, 321 | data 322 | 323 | for (var i = elems.length - 1; i >= 0; i--) { 324 | elem = elems[i] 325 | if (elem.hasAttribute('data-instant-track')) { 326 | data = elem.getAttribute('href') || elem.getAttribute('src') || elem.innerHTML 327 | for (var j = $trackedAssets.length - 1; j >= 0; j--) { 328 | if ($trackedAssets[j] == data) { 329 | found++ 330 | } 331 | } 332 | } 333 | } 334 | if (found != $trackedAssets.length) { 335 | $mustRedirect = true // Assets have changed 336 | } 337 | } 338 | else { 339 | $mustRedirect = true // Not an HTML document 340 | } 341 | 342 | if ($isWaitingForCompletion) { 343 | $isWaitingForCompletion = false 344 | display($url) 345 | } 346 | } 347 | 348 | 349 | ////////// MAIN FUNCTIONS ////////// 350 | 351 | 352 | function instantanize(isInitializing) { 353 | document.body.addEventListener('touchstart', touchstart, true) 354 | if ($preloadOnMousedown) { 355 | document.body.addEventListener('mousedown', mousedown, true) 356 | } 357 | else { 358 | document.body.addEventListener('mouseover', mouseover, true) 359 | } 360 | document.body.addEventListener('click', click, true) 361 | 362 | if (!isInitializing) { 363 | var scripts = document.body.getElementsByTagName('script'), 364 | script, 365 | copy, 366 | parentNode, 367 | nextSibling 368 | 369 | for (i = 0, j = scripts.length; i < j; i++) { 370 | script = scripts[i] 371 | if (script.hasAttribute('data-no-instant')) { 372 | continue 373 | } 374 | copy = document.createElement('script') 375 | if (script.src) { 376 | copy.src = script.src 377 | } 378 | if (script.innerHTML) { 379 | copy.innerHTML = script.innerHTML 380 | } 381 | parentNode = script.parentNode 382 | nextSibling = script.nextSibling 383 | parentNode.removeChild(script) 384 | parentNode.insertBefore(copy, nextSibling) 385 | } 386 | } 387 | } 388 | 389 | function preload(url) { 390 | if (!$preloadOnMousedown 391 | && 'display' in $timing 392 | && +new Date - ($timing.start + $timing.display) < 100) { 393 | 394 | return 395 | } 396 | if ($preloadTimer) { 397 | clearTimeout($preloadTimer) 398 | $preloadTimer = false 399 | } 400 | 401 | if (!url) { 402 | url = $urlToPreload 403 | } 404 | 405 | if ($isPreloading && (url == $url || $isWaitingForCompletion)) { 406 | return 407 | } 408 | $isPreloading = true 409 | $isWaitingForCompletion = false 410 | 411 | $url = url 412 | $body = false 413 | $mustRedirect = false 414 | $timing = { 415 | start: +new Date 416 | } 417 | triggerPageEvent('fetch') 418 | $xhr.open('GET', url) 419 | $xhr.send() 420 | } 421 | 422 | function display(url) { 423 | if (!('display' in $timing)) { 424 | $timing.display = +new Date - $timing.start 425 | } 426 | if ($preloadTimer || !$isPreloading) { 427 | 428 | 429 | if ($preloadTimer && $url && $url != url) { 430 | 431 | location.href = url 432 | return 433 | } 434 | 435 | preload(url) 436 | bar.start(0, true) 437 | triggerPageEvent('wait') 438 | $isWaitingForCompletion = true 439 | return 440 | } 441 | if ($isWaitingForCompletion) { 442 | 443 | location.href = url 444 | return 445 | } 446 | if ($mustRedirect) { 447 | location.href = $url 448 | return 449 | } 450 | if (!$body) { 451 | bar.start(0, true) 452 | triggerPageEvent('wait') 453 | $isWaitingForCompletion = true 454 | return 455 | } 456 | $history[$currentLocationWithoutHash].scrollY = pageYOffset 457 | setPreloadingAsHalted() 458 | changePage($title, $body, $url) 459 | } 460 | 461 | 462 | 463 | 464 | 465 | var bar = function() { 466 | var $barContainer, 467 | $barElement, 468 | $barTransformProperty, 469 | $barProgress, 470 | $barTimer 471 | 472 | function init() { 473 | $barContainer = document.createElement('div') 474 | $barContainer.id = 'instantclick' 475 | $barElement = document.createElement('div') 476 | $barElement.id = 'instantclick-bar' 477 | $barElement.className = 'instantclick-bar' 478 | $barContainer.appendChild($barElement) 479 | 480 | var vendors = ['Webkit', 'Moz', 'O'] 481 | 482 | $barTransformProperty = 'transform' 483 | if (!($barTransformProperty in $barElement.style)) { 484 | for (var i = 0; i < 3; i++) { 485 | if (vendors[i] + 'Transform' in $barElement.style) { 486 | $barTransformProperty = vendors[i] + 'Transform' 487 | } 488 | } 489 | } 490 | 491 | var transitionProperty = 'transition' 492 | if (!(transitionProperty in $barElement.style)) { 493 | for (var i = 0; i < 3; i++) { 494 | if (vendors[i] + 'Transition' in $barElement.style) { 495 | transitionProperty = '-' + vendors[i].toLowerCase() + '-' + transitionProperty 496 | } 497 | } 498 | } 499 | 500 | var style = document.createElement('style') 501 | style.innerHTML = '#instantclick{position:' + ($hasTouch ? 'absolute' : 'fixed') + ';top:0;left:0;width:100%;pointer-events:none;z-index:2147483647;' + transitionProperty + ':opacity .25s .1s}' 502 | + '.instantclick-bar{background:#29d;width:100%;margin-left:-100%;height:2px;' + transitionProperty + ':all .25s}' 503 | /* We set the bar's background in `.instantclick-bar` so that it can be 504 | overriden in CSS with `#instantclick-bar`, as IDs have higher priority. 505 | */ 506 | document.head.appendChild(style) 507 | 508 | if ($hasTouch) { 509 | updatePositionAndScale() 510 | addEventListener('resize', updatePositionAndScale) 511 | addEventListener('scroll', updatePositionAndScale) 512 | } 513 | 514 | } 515 | 516 | function start(at, jump) { 517 | $barProgress = at 518 | if (document.getElementById($barContainer.id)) { 519 | document.body.removeChild($barContainer) 520 | } 521 | $barContainer.style.opacity = '1' 522 | if (document.getElementById($barContainer.id)) { 523 | document.body.removeChild($barContainer) 524 | /* So there's no CSS animation if already done once and it goes from 1 to 0 */ 525 | } 526 | update() 527 | if (jump) { 528 | setTimeout(jumpStart, 0) 529 | /* Must be done in a timer, otherwise the CSS animation doesn't happen. */ 530 | } 531 | clearTimeout($barTimer) 532 | $barTimer = setTimeout(inc, 500) 533 | } 534 | 535 | function jumpStart() { 536 | $barProgress = 10 537 | update() 538 | } 539 | 540 | function inc() { 541 | $barProgress += 1 + (Math.random() * 2) 542 | if ($barProgress >= 98) { 543 | $barProgress = 98 544 | } 545 | else { 546 | $barTimer = setTimeout(inc, 500) 547 | } 548 | update() 549 | } 550 | 551 | function update() { 552 | $barElement.style[$barTransformProperty] = 'translate(' + $barProgress + '%)' 553 | if (!document.getElementById($barContainer.id)) { 554 | document.body.appendChild($barContainer) 555 | } 556 | } 557 | 558 | function done() { 559 | if (document.getElementById($barContainer.id)) { 560 | clearTimeout($barTimer) 561 | $barProgress = 100 562 | update() 563 | $barContainer.style.opacity = '0' 564 | /* If you're debugging, setting this to 0.5 is handy. */ 565 | return 566 | } 567 | 568 | /* The bar container hasn't been appended: It's a new page. */ 569 | start($barProgress == 100 ? 0 : $barProgress) 570 | /* $barProgress is 100 on popstate, usually. */ 571 | setTimeout(done, 0) 572 | /* Must be done in a timer, otherwise the CSS animation doesn't happen. */ 573 | } 574 | 575 | function updatePositionAndScale() { 576 | /* Adapted from code by Sam Stephenson and Mislav Marohnić 577 | http://signalvnoise.com/posts/2407 578 | */ 579 | 580 | $barContainer.style.left = pageXOffset + 'px' 581 | $barContainer.style.width = innerWidth + 'px' 582 | $barContainer.style.top = pageYOffset + 'px' 583 | 584 | var landscape = 'orientation' in window && Math.abs(orientation) == 90, 585 | scaleY = innerWidth / screen[landscape ? 'height' : 'width'] * 2 586 | /* We multiply the size by 2 because the progress bar is harder 587 | to notice on a mobile device. 588 | */ 589 | $barContainer.style[$barTransformProperty] = 'scaleY(' + scaleY + ')' 590 | } 591 | 592 | return { 593 | init: init, 594 | start: start, 595 | done: done 596 | } 597 | }() 598 | 599 | 600 | ////////// PUBLIC VARIABLE AND FUNCTIONS ////////// 601 | 602 | var supported = 'pushState' in history 603 | && (!$ua.match('Android') || $ua.match('Chrome/')) 604 | && location.protocol != "file:" 605 | 606 | 607 | function init() { 608 | if ($currentLocationWithoutHash) { 609 | /* Already initialized */ 610 | return 611 | } 612 | if (!supported) { 613 | triggerPageEvent('change', true) 614 | return 615 | } 616 | for (var i = arguments.length - 1; i >= 0; i--) { 617 | var arg = arguments[i] 618 | if (arg === true) { 619 | $useWhitelist = true 620 | } 621 | else if (arg == 'mousedown') { 622 | $preloadOnMousedown = true 623 | } 624 | else if (typeof arg == 'number') { 625 | $delayBeforePreload = arg 626 | } 627 | } 628 | $currentLocationWithoutHash = removeHash(location.href) 629 | $history[$currentLocationWithoutHash] = { 630 | body: document.body, 631 | title: document.title, 632 | scrollY: pageYOffset 633 | } 634 | 635 | var elems = document.head.children, 636 | elem, 637 | data 638 | for (var i = elems.length - 1; i >= 0; i--) { 639 | elem = elems[i] 640 | if (elem.hasAttribute('data-instant-track')) { 641 | data = elem.getAttribute('href') || elem.getAttribute('src') || elem.innerHTML 642 | /* We can't use just `elem.href` and `elem.src` because we can't 643 | retrieve `href`s and `src`s from the Ajax response. 644 | */ 645 | $trackedAssets.push(data) 646 | } 647 | } 648 | 649 | $xhr = new XMLHttpRequest() 650 | $xhr.addEventListener('readystatechange', readystatechange) 651 | 652 | instantanize(true) 653 | 654 | bar.init() 655 | 656 | triggerPageEvent('change', true) 657 | 658 | addEventListener('popstate', function() { 659 | var loc = removeHash(location.href) 660 | if (loc == $currentLocationWithoutHash) { 661 | return 662 | } 663 | 664 | if (!(loc in $history)) { 665 | location.href = location.href 666 | /* Reloads the page while using cache for scripts, styles and images, 667 | unlike `location.reload()` */ 668 | return 669 | } 670 | 671 | $history[$currentLocationWithoutHash].scrollY = pageYOffset 672 | $currentLocationWithoutHash = loc 673 | changePage($history[loc].title, $history[loc].body, false, $history[loc].scrollY) 674 | }) 675 | } 676 | 677 | function on(eventType, callback) { 678 | $eventsCallbacks[eventType].push(callback) 679 | } 680 | 681 | 682 | //////////////////// 683 | 684 | 685 | return { 686 | supported: supported, 687 | init: init, 688 | on: on 689 | } 690 | 691 | }(document, location); 692 | -------------------------------------------------------------------------------- /plugin/ice_cloud.js: -------------------------------------------------------------------------------- 1 | 2 | //云服务SDK 3 | function ice_cloud() { 4 | 5 | var ice = this; 6 | 7 | //云中心地址 8 | this.url = "http://cloud.besdlab.cn/"; 9 | this.link = ""; 10 | //初始化变量 11 | this.username = "null"; 12 | this.password = "null"; 13 | this.email = "null"; 14 | this.num = 0; 15 | this.value1 = "null"; 16 | this.value2 = "null"; 17 | this.value3 = "null"; 18 | this.value4 = "null"; 19 | this.id = 0; 20 | 21 | //初始化用于存储结果的变量 22 | this.result = "null"; 23 | 24 | 25 | //请将开发者ID填写在这 26 | this.devid = "null"; 27 | 28 | 29 | //设置开发者ID 30 | this.setDevid = function(d) { 31 | ice.devid = d; 32 | }; 33 | 34 | //调用api接口登录 35 | this.login = function(u, p) { 36 | ice.link = ice.url + "api/login"; 37 | ice.username = u; 38 | ice.password = p; 39 | return ice.cloud_ajax(); 40 | }; 41 | 42 | //调用api接口注册 43 | this.register = function(u, p, e) { 44 | ice.link = ice.url + "api/register"; 45 | ice.username = u; 46 | ice.password = p; 47 | ice.email = e; 48 | return ice.cloud_ajax(); 49 | }; 50 | 51 | //调用api接口退出登录 52 | this.logout = function() { 53 | ice.link = ice.url + "manage/account/logout"; 54 | return ice.cloud_ajax(); 55 | }; 56 | 57 | //验证登录,如果已登录返回账户名和开发者ID 58 | this.loged = function() { 59 | ice.link = ice.url + "manage/account/loged"; 60 | return ice.cloud_ajax(); 61 | }; 62 | 63 | //调用api向数据仓库增加数据 64 | this.storeAdd = function(v1, v2, v3, v4) { 65 | ice.link = ice.url + "api/store/add"; 66 | ice.value1 = v1; 67 | ice.value2 = v2; 68 | ice.value3 = v3; 69 | ice.value4 = v4; 70 | return ice.cloud_ajax(); 71 | }; 72 | 73 | //调用api删除数据仓库中指定ID的数据 74 | this.storeDelete = function(i) { 75 | ice.link = ice.url + "api/store/delete" 76 | ice.id = i; 77 | return ice.cloud_ajax(); 78 | }; 79 | 80 | //根据条件查找数据仓库 81 | this.storeSearch = function(n, v1, v2, v3, v4) { 82 | ice.link = ice.url + "api/store/search"; 83 | ice.num = n; 84 | ice.value1 = v1; 85 | ice.value2 = v2; 86 | ice.value3 = v3; 87 | ice.value4 = v4; 88 | return ice.cloud_ajax(); 89 | }; 90 | 91 | //调用api修改数据 92 | this.storeUp = function(id, v1, v2, v3, v4) { 93 | ice.link = ice.url + "api/store/up"; 94 | ice.id = id; 95 | ice.value1 = v1; 96 | ice.value2 = v2; 97 | ice.value3 = v3; 98 | ice.value4 = v4; 99 | return ice.cloud_ajax(); 100 | }; 101 | 102 | //开发者授权 103 | this.manageLogin = function(u, p) { 104 | ice.link = ice.url + "manage/login"; 105 | ice.username = u; 106 | ice.password = p; 107 | return ice.cloud_ajax(); 108 | }; 109 | 110 | //增加public数据 111 | this.addPublic = function(v1, v2, v3, v4) { 112 | ice.link = ice.url + "api/store_public/addpublic"; 113 | ice.value1 = v1; 114 | ice.value2 = v2; 115 | ice.value3 = v3; 116 | ice.value4 = v4; 117 | return ice.cloud_ajax(); 118 | }; 119 | //删除public数据 120 | this.delPublic = function(i) { 121 | ice.link = ice.url + "api/store_public/delpublic"; 122 | ice.id = i; 123 | return ice.cloud_ajax(); 124 | }; 125 | 126 | //修改public数据 127 | this.upPublic = function(id, v1, v2, v3, v4) { 128 | ice.link = ice.url + "api/store_public/uppublic"; 129 | ice.id = id; 130 | ice.value1 = v1; 131 | ice.value2 = v2; 132 | ice.value3 = v3; 133 | ice.value4 = v4; 134 | return ice.cloud_ajax(); 135 | }; 136 | 137 | //获取public数据 138 | this.serPublic = function() { 139 | ice.link = ice.url + "api/store_public/serpublic"; 140 | return ice.cloud_ajax(); 141 | }; 142 | 143 | //获取result 144 | this.getResult = function() { 145 | return ice.result; 146 | }; 147 | 148 | 149 | //AJAX方法 150 | this.cloud_ajax = function() { 151 | $.ajax(ice.link, { 152 | 153 | type: "POST", 154 | 155 | xhrFields: { 156 | 157 | withCredentials: true, 158 | useDefaultXhrHeader: false 159 | 160 | }, 161 | async: false, 162 | data: { 163 | id: ice.id, 164 | username: ice.username, 165 | password: ice.password, 166 | email: ice.email, 167 | devid: ice.devid, 168 | num: ice.num, 169 | value1: ice.value1, 170 | value2: ice.value2, 171 | value3: ice.value3, 172 | value4: ice.value4 173 | 174 | 175 | }, 176 | 177 | crossDomain: true, 178 | 179 | success: function(data, status, xhr) { 180 | ice.result = data["result"]; 181 | 182 | } 183 | 184 | }); 185 | 186 | } 187 | 188 | 189 | 190 | 191 | } 192 | -------------------------------------------------------------------------------- /plugin/ice_code/ice_code.css: -------------------------------------------------------------------------------- 1 | /*封装自Prism*/ 2 | code[class*="language-"], 3 | pre[class*="language-"] { 4 | color: #f8f8f2; 5 | text-shadow: 0 1px rgba(0, 0, 0, 0.3); 6 | font-family: 'Microsoft Yahei', 'Andale Mono', monospace; 7 | direction: ltr; 8 | text-align: left; 9 | white-space: pre; 10 | word-spacing: normal; 11 | word-break: normal; 12 | line-height: 1.5; 13 | 14 | -moz-tab-size: 4; 15 | -o-tab-size: 4; 16 | tab-size: 4; 17 | 18 | -webkit-hyphens: none; 19 | -moz-hyphens: none; 20 | -ms-hyphens: none; 21 | hyphens: none; 22 | } 23 | 24 | 25 | pre[class*="language-"] { 26 | padding: 1em; 27 | margin: .5em 0; 28 | overflow: auto; 29 | } 30 | 31 | :not(pre) > code[class*="language-"], 32 | pre[class*="language-"] { 33 | background: #272822; 34 | } 35 | 36 | /* Inline code */ 37 | :not(pre) > code[class*="language-"] { 38 | padding: .1em; 39 | border-radius: .3em; 40 | } 41 | 42 | .token.comment, 43 | .token.prolog, 44 | .token.doctype, 45 | .token.cdata { 46 | color: slategray; 47 | } 48 | 49 | .token.punctuation { 50 | color: #f8f8f2; 51 | } 52 | 53 | .namespace { 54 | opacity: .7; 55 | } 56 | 57 | .token.property, 58 | .token.tag, 59 | .token.constant, 60 | .token.symbol, 61 | .token.deleted { 62 | color: #f92672; 63 | } 64 | 65 | .token.boolean, 66 | .token.number { 67 | color: #ae81ff; 68 | } 69 | 70 | .token.selector, 71 | .token.attr-name, 72 | .token.string, 73 | .token.char, 74 | .token.builtin, 75 | .token.inserted { 76 | color: #a6e22e; 77 | } 78 | 79 | .token.operator, 80 | .token.entity, 81 | .token.url, 82 | .language-css .token.string, 83 | .style .token.string, 84 | .token.variable { 85 | color: #f8f8f2; 86 | } 87 | 88 | .token.atrule, 89 | .token.attr-value, 90 | .token.function { 91 | color: #e6db74; 92 | } 93 | 94 | .token.keyword { 95 | color: #66d9ef; 96 | } 97 | 98 | .token.regex, 99 | .token.important { 100 | color: #fd971f; 101 | } 102 | 103 | .token.important, 104 | .token.bold { 105 | font-weight: bold; 106 | } 107 | .token.italic { 108 | font-style: italic; 109 | } 110 | 111 | .token.entity { 112 | cursor: help; 113 | } 114 | -------------------------------------------------------------------------------- /plugin/ice_code/ice_code.js: -------------------------------------------------------------------------------- 1 | //封装自Prism 2 | 3 | self = (typeof window !== 'undefined') 4 | ? window // if in browser 5 | : ( 6 | (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) 7 | ? self // if in worker 8 | : {} // if in node js 9 | ); 10 | 11 | 12 | 13 | var ice_code = (function(){ 14 | 15 | 16 | var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; 17 | 18 | var _ = self.ice_code = { 19 | util: { 20 | encode: function (tokens) { 21 | if (tokens instanceof Token) { 22 | return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); 23 | } else if (_.util.type(tokens) === 'Array') { 24 | return tokens.map(_.util.encode); 25 | } else { 26 | return tokens.replace(/&/g, '&').replace(/ text.length) { 256 | // Something went terribly wrong, ABORT, ABORT! 257 | break tokenloop; 258 | } 259 | 260 | if (str instanceof Token) { 261 | continue; 262 | } 263 | 264 | pattern.lastIndex = 0; 265 | 266 | var match = pattern.exec(str); 267 | 268 | if (match) { 269 | if(lookbehind) { 270 | lookbehindLength = match[1].length; 271 | } 272 | 273 | var from = match.index - 1 + lookbehindLength, 274 | match = match[0].slice(lookbehindLength), 275 | len = match.length, 276 | to = from + len, 277 | before = str.slice(0, from + 1), 278 | after = str.slice(to + 1); 279 | 280 | var args = [i, 1]; 281 | 282 | if (before) { 283 | args.push(before); 284 | } 285 | 286 | var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias); 287 | 288 | args.push(wrapped); 289 | 290 | if (after) { 291 | args.push(after); 292 | } 293 | 294 | Array.prototype.splice.apply(strarr, args); 295 | } 296 | } 297 | } 298 | } 299 | 300 | return strarr; 301 | }, 302 | 303 | hooks: { 304 | all: {}, 305 | 306 | add: function (name, callback) { 307 | var hooks = _.hooks.all; 308 | 309 | hooks[name] = hooks[name] || []; 310 | 311 | hooks[name].push(callback); 312 | }, 313 | 314 | run: function (name, env) { 315 | var callbacks = _.hooks.all[name]; 316 | 317 | if (!callbacks || !callbacks.length) { 318 | return; 319 | } 320 | 321 | for (var i=0, callback; callback = callbacks[i++];) { 322 | callback(env); 323 | } 324 | } 325 | } 326 | }; 327 | 328 | var Token = _.Token = function(type, content, alias) { 329 | this.type = type; 330 | this.content = content; 331 | this.alias = alias; 332 | }; 333 | 334 | Token.stringify = function(o, language, parent) { 335 | if (typeof o == 'string') { 336 | return o; 337 | } 338 | 339 | if (_.util.type(o) === 'Array') { 340 | return o.map(function(element) { 341 | return Token.stringify(element, language, o); 342 | }).join(''); 343 | } 344 | 345 | var env = { 346 | type: o.type, 347 | content: Token.stringify(o.content, language, parent), 348 | tag: 'span', 349 | classes: ['token', o.type], 350 | attributes: {}, 351 | language: language, 352 | parent: parent 353 | }; 354 | 355 | if (env.type == 'comment') { 356 | env.attributes['spellcheck'] = 'true'; 357 | } 358 | 359 | if (o.alias) { 360 | var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; 361 | Array.prototype.push.apply(env.classes, aliases); 362 | } 363 | 364 | _.hooks.run('wrap', env); 365 | 366 | var attributes = ''; 367 | 368 | for (var name in env.attributes) { 369 | attributes += name + '="' + (env.attributes[name] || '') + '"'; 370 | } 371 | 372 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; 373 | 374 | }; 375 | 376 | if (!self.document) { 377 | if (!self.addEventListener) { 378 | 379 | return self.ice_code; 380 | } 381 | 382 | self.addEventListener('message', function(evt) { 383 | var message = JSON.parse(evt.data), 384 | lang = message.language, 385 | code = message.code; 386 | 387 | self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang])))); 388 | self.close(); 389 | }, false); 390 | 391 | return self.ice_code; 392 | } 393 | 394 | 395 | var script = document.getElementsByTagName('script'); 396 | 397 | script = script[script.length - 1]; 398 | 399 | if (script) { 400 | _.filename = script.src; 401 | 402 | if (document.addEventListener && !script.hasAttribute('data-manual')) { 403 | document.addEventListener('DOMContentLoaded', _.highlightAll); 404 | } 405 | } 406 | 407 | return self.ice_code; 408 | 409 | })(); 410 | 411 | if (typeof module !== 'undefined' && module.exports) { 412 | module.exports = ice_code; 413 | } 414 | 415 | 416 | 417 | 418 | ice_code.languages.markup = { 419 | 'comment': //, 420 | 'prolog': /<\?.+?\?>/, 421 | 'doctype': //, 422 | 'cdata': //i, 423 | 'tag': { 424 | pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/i, 425 | inside: { 426 | 'tag': { 427 | pattern: /^<\/?[\w:-]+/i, 428 | inside: { 429 | 'punctuation': /^<\/?/, 430 | 'namespace': /^[\w-]+?:/ 431 | } 432 | }, 433 | 'attr-value': { 434 | pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, 435 | inside: { 436 | 'punctuation': /=|>|"/ 437 | } 438 | }, 439 | 'punctuation': /\/?>/, 440 | 'attr-name': { 441 | pattern: /[\w:-]+/, 442 | inside: { 443 | 'namespace': /^[\w-]+?:/ 444 | } 445 | } 446 | 447 | } 448 | }, 449 | 'entity': /&#?[\da-z]{1,8};/i 450 | }; 451 | 452 | 453 | ice_code.hooks.add('wrap', function(env) { 454 | 455 | if (env.type === 'entity') { 456 | env.attributes['title'] = env.content.replace(/&/, '&'); 457 | } 458 | }); 459 | 460 | 461 | 462 | 463 | ice_code.languages.css = { 464 | 'comment': /\/\*[\w\W]*?\*\//, 465 | 'atrule': { 466 | pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, 467 | inside: { 468 | 'punctuation': /[;:]/ 469 | } 470 | }, 471 | 'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i, 472 | 'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/, 473 | 'string': /("|')(\\\n|\\?.)*?\1/, 474 | 'property': /(\b|\B)[\w-]+(?=\s*:)/i, 475 | 'important': /\B!important\b/i, 476 | 'punctuation': /[\{\};:]/, 477 | 'function': /[-a-z0-9]+(?=\()/i 478 | }; 479 | 480 | if (ice_code.languages.markup) { 481 | ice_code.languages.insertBefore('markup', 'tag', { 482 | 'style': { 483 | pattern: /[\w\W]*?<\/style>/i, 484 | inside: { 485 | 'tag': { 486 | pattern: /|<\/style>/i, 487 | inside: ice_code.languages.markup.tag.inside 488 | }, 489 | rest: ice_code.languages.css 490 | }, 491 | alias: 'language-css' 492 | } 493 | }); 494 | 495 | ice_code.languages.insertBefore('inside', 'attr-value', { 496 | 'style-attr': { 497 | pattern: /\s*style=("|').*?\1/i, 498 | inside: { 499 | 'attr-name': { 500 | pattern: /^\s*style/i, 501 | inside: ice_code.languages.markup.tag.inside 502 | }, 503 | 'punctuation': /^\s*=\s*['"]|['"]\s*$/, 504 | 'attr-value': { 505 | pattern: /.+/i, 506 | inside: ice_code.languages.css 507 | } 508 | }, 509 | alias: 'language-css' 510 | } 511 | }, ice_code.languages.markup.tag); 512 | } 513 | 514 | 515 | 516 | ice_code.languages.clike = { 517 | 'comment': [ 518 | { 519 | pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, 520 | lookbehind: true 521 | }, 522 | { 523 | pattern: /(^|[^\\:])\/\/.*/, 524 | lookbehind: true 525 | } 526 | ], 527 | 'string': /("|')(\\\n|\\?.)*?\1/, 528 | 'class-name': { 529 | pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i, 530 | lookbehind: true, 531 | inside: { 532 | punctuation: /(\.|\\)/ 533 | } 534 | }, 535 | 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, 536 | 'boolean': /\b(true|false)\b/, 537 | 'function': { 538 | pattern: /[a-z0-9_]+\(/i, 539 | inside: { 540 | punctuation: /\(/ 541 | } 542 | }, 543 | 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/, 544 | 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/, 545 | 'ignore': /&(lt|gt|amp);/i, 546 | 'punctuation': /[{}[\];(),.:]/ 547 | }; 548 | 549 | 550 | 551 | 552 | ice_code.languages.javascript = ice_code.languages.extend('clike', { 553 | 'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/, 554 | 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/, 555 | 'function': /(?!\d)[a-z0-9_$]+(?=\()/i 556 | }); 557 | 558 | ice_code.languages.insertBefore('javascript', 'keyword', { 559 | 'regex': { 560 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/, 561 | lookbehind: true 562 | } 563 | }); 564 | 565 | if (ice_code.languages.markup) { 566 | ice_code.languages.insertBefore('markup', 'tag', { 567 | 'script': { 568 | pattern: /[\w\W]*?<\/script>/i, 569 | inside: { 570 | 'tag': { 571 | pattern: /|<\/script>/i, 572 | inside: ice_code.languages.markup.tag.inside 573 | }, 574 | rest: ice_code.languages.javascript 575 | }, 576 | alias: 'language-javascript' 577 | } 578 | }); 579 | } 580 | 581 | 582 | 583 | 584 | (function () { 585 | if (!self.ice_code || !self.document || !document.querySelector) { 586 | return; 587 | } 588 | 589 | self.ice_code.fileHighlight = function() { 590 | 591 | var Extensions = { 592 | 'js': 'javascript', 593 | 'html': 'markup', 594 | 'svg': 'markup', 595 | 'xml': 'markup', 596 | 'py': 'python', 597 | 'rb': 'ruby', 598 | 'ps1': 'powershell', 599 | 'psm1': 'powershell' 600 | }; 601 | 602 | Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { 603 | var src = pre.getAttribute('data-src'); 604 | var extension = (src.match(/\.(\w+)$/) || [,''])[1]; 605 | var language = Extensions[extension] || extension; 606 | 607 | var code = document.createElement('code'); 608 | code.className = 'language-' + language; 609 | 610 | pre.textContent = ''; 611 | 612 | code.textContent = 'Loading…'; 613 | 614 | pre.appendChild(code); 615 | 616 | var xhr = new XMLHttpRequest(); 617 | 618 | xhr.open('GET', src, true); 619 | 620 | xhr.onreadystatechange = function() { 621 | if (xhr.readyState == 4) { 622 | 623 | if (xhr.status < 400 && xhr.responseText) { 624 | code.textContent = xhr.responseText; 625 | 626 | ice_code.highlightElement(code); 627 | } 628 | else if (xhr.status >= 400) { 629 | code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; 630 | } 631 | else { 632 | code.textContent = '✖ Error: File does not exist or is empty'; 633 | } 634 | } 635 | }; 636 | 637 | xhr.send(null); 638 | }); 639 | 640 | }; 641 | 642 | self.ice_code.fileHighlight(); 643 | 644 | })(); 645 | -------------------------------------------------------------------------------- /plugin/ice_code/ice_code_expands.js: -------------------------------------------------------------------------------- 1 | //C语言 2 | 3 | ice_code.languages.c = ice_code.languages.extend('clike', { 4 | 5 | 'string': /("|')([^\n\\\1]|\\.|\\\r*\n)*?\1/, 6 | 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, 7 | 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\// 8 | }); 9 | 10 | ice_code.languages.insertBefore('c', 'string', { 11 | 12 | 'property': { 13 | 14 | pattern: /((^|\n)\s*)#\s*[a-z]+([^\n\\]|\\.|\\\r*\n)*/i, 15 | lookbehind: true, 16 | inside: { 17 | 'string': { 18 | pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/, 19 | lookbehind: true 20 | } 21 | } 22 | } 23 | }); 24 | 25 | delete ice_code.languages.c['class-name']; 26 | delete ice_code.languages.c['boolean']; 27 | 28 | 29 | //go语言 30 | 31 | ice_code.languages.go = ice_code.languages.extend('clike', { 32 | 'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/, 33 | 'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/, 34 | 'boolean': /\b(_|iota|nil|true|false)\b/, 35 | 'operator': /([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/, 36 | 'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i, 37 | 'string': /("|'|`)(\\?.|\r|\n)*?\1/ 38 | }); 39 | delete ice_code.languages.go['class-name']; 40 | 41 | 42 | 43 | ice_code.languages.php = ice_code.languages.extend('clike', { 44 | 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, 45 | 'constant': /\b[A-Z0-9_]{2,}\b/, 46 | 'comment': { 47 | pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(\/\/).*?(\r?\n|$))/, 48 | lookbehind: true 49 | } 50 | }); 51 | 52 | //PHP语言 53 | 54 | ice_code.languages.insertBefore('php', 'class-name', { 55 | 'shell-comment': { 56 | pattern: /(^|[^\\])#.*?(\r?\n|$)/, 57 | lookbehind: true, 58 | alias: 'comment' 59 | } 60 | }); 61 | 62 | ice_code.languages.insertBefore('php', 'keyword', { 63 | 'delimiter': /(\?>|<\?php|<\?)/i, 64 | 'variable': /(\$\w+)\b/i, 65 | 'package': { 66 | pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, 67 | lookbehind: true, 68 | inside: { 69 | punctuation: /\\/ 70 | } 71 | } 72 | }); 73 | 74 | // Must be defined after the function pattern 75 | ice_code.languages.insertBefore('php', 'operator', { 76 | 'property': { 77 | pattern: /(->)[\w]+/, 78 | lookbehind: true 79 | } 80 | }); 81 | 82 | // Add HTML support of the markup language exists 83 | if (ice_code.languages.markup) { 84 | 85 | // Tokenize all inline PHP blocks that are wrapped in 86 | // This allows for easy PHP + markup highlighting 87 | ice_code.hooks.add('before-highlight', function(env) { 88 | if (env.language !== 'php') { 89 | return; 90 | } 91 | 92 | env.tokenStack = []; 93 | 94 | env.backupCode = env.code; 95 | env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function(match) { 96 | env.tokenStack.push(match); 97 | 98 | return '{{{PHP' + env.tokenStack.length + '}}}'; 99 | }); 100 | }); 101 | 102 | // Restore env.code for other plugins (e.g. line-numbers) 103 | ice_code.hooks.add('before-insert', function(env) { 104 | if (env.language === 'php') { 105 | env.code = env.backupCode; 106 | delete env.backupCode; 107 | } 108 | }); 109 | 110 | // Re-insert the tokens after highlighting 111 | ice_code.hooks.add('after-highlight', function(env) { 112 | if (env.language !== 'php') { 113 | return; 114 | } 115 | 116 | for (var i = 0, t; t = env.tokenStack[i]; i++) { 117 | env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', ice_code.highlight(t, env.grammar, 'php')); 118 | } 119 | 120 | env.element.innerHTML = env.highlightedCode; 121 | }); 122 | 123 | // Wrap tokens in classes that are missing them 124 | ice_code.hooks.add('wrap', function(env) { 125 | if (env.language === 'php' && env.type === 'markup') { 126 | env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, "$1"); 127 | } 128 | }); 129 | 130 | // Add the rules before all others 131 | ice_code.languages.insertBefore('php', 'comment', { 132 | 'markup': { 133 | pattern: /<[^?]\/?(.*?)>/, 134 | inside: ice_code.languages.markup 135 | }, 136 | 'php': /\{\{\{PHP[0-9]+\}\}\}/ 137 | }); 138 | } 139 | 140 | //ruby 141 | ice_code.languages.ruby = ice_code.languages.extend('clike', { 142 | 'comment': /#[^\r\n]*(\r?\n|$)/, 143 | 'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/, 144 | 'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/, 145 | 'constant': /\b[A-Z][a-zA-Z_0-9]*[?!]?\b/ 146 | }); 147 | 148 | ice_code.languages.insertBefore('ruby', 'keyword', { 149 | 'regex': { 150 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/, 151 | lookbehind: true 152 | }, 153 | 'variable': /[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/, 154 | 'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/ 155 | }); 156 | 157 | 158 | //java 159 | ice_code.languages.java = ice_code.languages.extend('clike', { 160 | 'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/, 161 | 'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/i, 162 | 'operator': { 163 | pattern: /(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/m, 164 | lookbehind: true 165 | } 166 | }); 167 | 168 | //markdown 169 | ice_code.languages.markdown = ice_code.languages.extend('markup', {}); 170 | ice_code.languages.insertBefore('markdown', 'prolog', { 171 | 'blockquote': { 172 | // > ... 173 | pattern: /(^|\n)>(?:[\t ]*>)*/, 174 | lookbehind: true, 175 | alias: 'punctuation' 176 | }, 177 | 'code': [ 178 | { 179 | // Prefixed by 4 spaces or 1 tab 180 | pattern: /(^|\n)(?: {4}|\t).+/, 181 | lookbehind: true, 182 | alias: 'keyword' 183 | }, 184 | { 185 | // `code` 186 | // ``code`` 187 | pattern: /``.+?``|`[^`\n]+`/, 188 | alias: 'keyword' 189 | } 190 | ], 191 | 'title': [ 192 | { 193 | // title 1 194 | // ======= 195 | 196 | // title 2 197 | // ------- 198 | pattern: /\w+.*\n(?:==+|--+)/, 199 | alias: 'important', 200 | inside: { 201 | punctuation: /==+$|--+$/ 202 | } 203 | }, 204 | { 205 | // # title 1 206 | // ###### title 6 207 | pattern: /((?:^|\n)\s*)#+.+/, 208 | lookbehind: true, 209 | alias: 'important', 210 | inside: { 211 | punctuation: /^#+|#+$/ 212 | } 213 | } 214 | ], 215 | 'hr': { 216 | // *** 217 | // --- 218 | // * * * 219 | // ----------- 220 | pattern: /((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/, 221 | lookbehind: true, 222 | alias: 'punctuation' 223 | }, 224 | 'list': { 225 | // * item 226 | // + item 227 | // - item 228 | // 1. item 229 | pattern: /((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/, 230 | lookbehind: true, 231 | alias: 'punctuation' 232 | }, 233 | 'url-reference': { 234 | // [id]: http://example.com "Optional title" 235 | // [id]: http://example.com 'Optional title' 236 | // [id]: http://example.com (Optional title) 237 | // [id]: "Optional title" 238 | pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/, 239 | inside: { 240 | 'variable': { 241 | pattern: /^(!?\[)[^\]]+/, 242 | lookbehind: true 243 | }, 244 | 'string': /(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/, 245 | 'punctuation': /[[\]\(\)<>:]/ 246 | }, 247 | alias: 'url' 248 | }, 249 | 'bold': { 250 | // **strong** 251 | // __strong__ 252 | 253 | // Allow only one line break 254 | pattern: /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/, 255 | lookbehind: true, 256 | inside: { 257 | 'punctuation': /^\*\*|^__|\*\*\s*$|__\s*$/ 258 | } 259 | }, 260 | 'italic': { 261 | // *em* 262 | // _em_ 263 | 264 | // Allow only one line break 265 | pattern: /(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/, 266 | lookbehind: true, 267 | inside: { 268 | 'punctuation': /^[*_]|[*_]$/ 269 | } 270 | }, 271 | 'url': { 272 | // [example](http://example.com "Optional title") 273 | // [example] [id] 274 | pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/, 275 | inside: { 276 | 'variable': { 277 | pattern: /(!?\[)[^\]]+(?=\]$)/, 278 | lookbehind: true 279 | }, 280 | 'string': { 281 | pattern: /"(?:[^"]|\\")*"(?=\)$)/ 282 | } 283 | } 284 | } 285 | }); 286 | 287 | ice_code.languages.markdown['bold'].inside['url'] = ice_code.util.clone(ice_code.languages.markdown['url']); 288 | ice_code.languages.markdown['italic'].inside['url'] = ice_code.util.clone(ice_code.languages.markdown['url']); 289 | ice_code.languages.markdown['bold'].inside['italic'] = ice_code.util.clone(ice_code.languages.markdown['italic']); 290 | ice_code.languages.markdown['italic'].inside['bold'] = ice_code.util.clone(ice_code.languages.markdown['bold']); 291 | 292 | //c# 293 | ice_code.languages.cpp = ice_code.languages.extend('c', { 294 | 'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, 295 | 'boolean': /\b(true|false)\b/, 296 | 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/ 297 | }); 298 | 299 | ice_code.languages.insertBefore('cpp', 'keyword', { 300 | 'class-name': { 301 | pattern: /(class\s+)[a-z0-9_]+/i, 302 | lookbehind: true 303 | } 304 | }); 305 | 306 | //git 307 | ice_code.languages.git = { 308 | 309 | 'comment': /^#.*$/m, 310 | 311 | 'string': /("|')(\\?.)*?\1/m, 312 | 313 | 314 | 'command': { 315 | pattern: /^.*\$ git .*$/m, 316 | inside: { 317 | 318 | 'parameter': /\s(--|-)\w+/m 319 | } 320 | }, 321 | 322 | 323 | 'deleted': /^-(?!-).+$/m, 324 | 'inserted': /^\+(?!\+).+$/m, 325 | 326 | 327 | 'commit_sha1': /^commit \w{40}$/m 328 | }; 329 | -------------------------------------------------------------------------------- /plugin/ice_date/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /plugin/ice_date/ice_date.css: -------------------------------------------------------------------------------- 1 | /* 日期选择组件 开始 */ 2 | 3 | .ice_date-container { 4 | position: absolute; 5 | z-index: 201312; 6 | float: left; 7 | font-family: 'Microsoft Yahei'; 8 | font-size: 12px; 9 | line-height: 30px; 10 | } 11 | 12 | .ice_date-arrow, 13 | .ice_date-arrow:after { 14 | display: block; 15 | width: 0; 16 | height: 0; 17 | border: 5px solid transparent; 18 | } 19 | 20 | .ice_date-arrow { 21 | position: relative; 22 | margin: 0 10px; 23 | border-bottom-color: #9cf; 24 | } 25 | 26 | .ice_date-arrow:after { 27 | position: absolute; 28 | top: -4px; 29 | left: -5px; 30 | content: " "; 31 | border-bottom-color: #fff; 32 | } 33 | 34 | .ice_date-content { 35 | width: 210px; 36 | -webkit-box-sizing: content-box; 37 | box-sizing: content-box; 38 | border: 1px solid #ccc; 39 | border-top-color: #9cf; 40 | -webkit-box-shadow: 0 0 3px #ccc; 41 | box-shadow: 0 0 3px #ccc; 42 | } 43 | 44 | .ice_date-prev, 45 | .ice_date-next { 46 | font-size: 18px; 47 | } 48 | 49 | .ice_date-content ul:before, 50 | .ice_date-content ul:after { 51 | display: table; 52 | content: ""; 53 | } 54 | 55 | .ice_date-content ul:after { 56 | clear: both; 57 | } 58 | 59 | .ice_date-content ul { 60 | width: 102%; 61 | padding: 0; 62 | margin: 0; 63 | 64 | *zoom: 1; 65 | } 66 | 67 | .ice_date-content li { 68 | float: left; 69 | width: 30px; 70 | height: 30px; 71 | padding: 0; 72 | margin: 0; 73 | text-align: center; 74 | list-style: none; 75 | cursor: pointer; 76 | background-color: #fff; 77 | } 78 | 79 | .ice_date-content .col-1 { 80 | width: 30px; 81 | } 82 | 83 | .ice_date-content .col-2 { 84 | width: 60px; 85 | } 86 | 87 | .ice_date-content .col-3 { 88 | width: 90px; 89 | } 90 | 91 | .ice_date-content .col-4 { 92 | width: 120px; 93 | } 94 | 95 | .ice_date-content .col-5 { 96 | width: 150px; 97 | } 98 | 99 | .ice_date-content .col-6 { 100 | width: 180px; 101 | } 102 | 103 | .ice_date-content .col-7 { 104 | width: 210px; 105 | } 106 | 107 | .ice_date-content li:hover { 108 | color: #FFFFFF; 109 | background-color: #3598DC; 110 | } 111 | 112 | .ice_date-content .selected { 113 | color: #3598DC; 114 | } 115 | .ice_date-content .selected:hover { 116 | color: #FFFFFF; 117 | } 118 | 119 | .ice_date-content .disabled, 120 | .ice_date-content .disabled:hover { 121 | color: #ccc; 122 | } 123 | 124 | .ice_date-years li, 125 | .ice_date-months li { 126 | width: 52.5px; 127 | height: 52.5px; 128 | line-height: 52.5px; 129 | } 130 | 131 | .ice_date-week li, 132 | .ice_date-week li:hover { 133 | background-color: #2A80B9; 134 | color: #FFFFFF; 135 | } 136 | /* 日期选择组件 结束 */ -------------------------------------------------------------------------------- /plugin/ice_date/ice_date.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 封转自Datepicker 3 | * https://github.com/fengyuanchen/Datepicker 4 | */ 5 | 6 | (function (factory) { 7 | if (typeof define === "function" && define.amd) { 8 | // AMD. Register as anonymous module. 9 | define(["jquery"], factory); 10 | } else { 11 | // Browser globals. 12 | factory(jQuery); 13 | } 14 | })(function ($) { 15 | 16 | "use strict"; 17 | 18 | var $window = $(window), 19 | $document = $(document), 20 | ice_date = function (element, options) { 21 | this.$element = $(element); 22 | this.defaults = $.extend({}, ice_date.defaults, this.$element.data(), $.isPlainObject(options) ? options : {}); 23 | this.init(); 24 | }; 25 | 26 | ice_date.prototype = { 27 | constructor: ice_date, 28 | 29 | init: function () { 30 | var trigger = this.defaults.trigger; 31 | 32 | this.$trigger = trigger ? $(trigger) : this.$element; 33 | this.$picker = $(this.defaults.template); 34 | this.$years = this.$picker.find("[data-type='years picker']"); 35 | this.$months = this.$picker.find("[data-type='months picker']"); 36 | this.$days = this.$picker.find("[data-type='days picker']"); 37 | this.$picker.appendTo("body"); 38 | this.place(); 39 | this.hide(); 40 | 41 | this.format = ice_date.fn.parseFormat(this.defaults.dateFormat); 42 | this.fillWeek(); 43 | this.enable(); 44 | }, 45 | 46 | enable: function () { 47 | if (this.enabled) { 48 | return; 49 | } 50 | 51 | if (this.$element.is("input")) { 52 | this.$element.on("keyup", $.proxy(this.update, this)); 53 | 54 | if (!this.defaults.trigger) { 55 | this.$element.on("focus", $.proxy(this.show, this)); 56 | } 57 | } 58 | 59 | this.$trigger.on("click", $.proxy(this.show, this)); 60 | 61 | this.$picker.on({ 62 | click: $.proxy(this.click, this), 63 | mousedown: $.proxy(this.mousedown, this) 64 | }); 65 | 66 | this.update(); 67 | this.enabled = true; 68 | }, 69 | 70 | disable: function () { 71 | if (!this.enabled) { 72 | return; 73 | } 74 | 75 | if (this.$element.is("input")) { 76 | this.$element.off("keyup", this.update); 77 | 78 | if (!this.defaults.trigger) { 79 | this.$element.off("focus", this.show); 80 | } 81 | } 82 | 83 | this.$trigger.off("click", this.show); 84 | 85 | this.$picker.off({ 86 | click: this.click, 87 | mousedown: this.mousedown 88 | }); 89 | 90 | this.hide(); 91 | this.enabled = false; 92 | }, 93 | 94 | showView: function (type) { 95 | var format = this.format; 96 | 97 | if (format.year || format.month || format.day) { 98 | switch (type) { 99 | 100 | case 2: 101 | case "years": 102 | this.$months.hide(); 103 | this.$days.hide(); 104 | 105 | if (format.year) { 106 | this.fillYears(); 107 | this.$years.show(); 108 | } else { 109 | this.showView(0); 110 | } 111 | 112 | break; 113 | 114 | case 1: 115 | case "months": 116 | this.$years.hide(); 117 | this.$days.hide(); 118 | 119 | if (format.month) { 120 | this.fillMonths(); 121 | this.$months.show(); 122 | } else { 123 | this.showView(2); 124 | } 125 | 126 | break; 127 | 128 | // case 0: 129 | // case "days": 130 | default: 131 | this.$years.hide(); 132 | this.$months.hide(); 133 | 134 | if (format.day) { 135 | this.fillDays(); 136 | this.$days.show(); 137 | } else { 138 | this.showView(1); 139 | } 140 | } 141 | } 142 | }, 143 | 144 | hideView: function () { 145 | if (this.defaults.autoClose) { 146 | this.hide(); 147 | } 148 | }, 149 | 150 | place: function () { 151 | var offset = this.$trigger.offset(), 152 | height = this.$trigger.outerHeight(); 153 | 154 | this.$picker.css({ 155 | top: offset.top + height, 156 | left: offset.left 157 | }); 158 | }, 159 | 160 | show: function () { 161 | if (!this.enabled) { 162 | return; 163 | } 164 | 165 | this.$picker.show(); 166 | $window.on("resize", $.proxy(this.place, this)); 167 | $document.on("mousedown", $.proxy(this.hide, this)); 168 | 169 | this.place(); 170 | this.showView(this.defaults.viewStart); 171 | }, 172 | 173 | hide: function () { 174 | this.$picker.hide(); 175 | $window.off("resize", this.place); 176 | $document.off("mousedown", this.hide); 177 | }, 178 | 179 | mousedown: function (e) { 180 | e.stopPropagation(); 181 | e.preventDefault(); 182 | }, 183 | 184 | update: function () { 185 | var viewDate = this.$element.is("input") ? this.$element.prop("value") : this.$element.text(); 186 | 187 | this.date = ice_date.fn.parseDate(viewDate, this.format); 188 | this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), this.date.getDate(), 0, 0, 0, 0); 189 | this.fillAll(); 190 | }, 191 | 192 | output: function () { 193 | var $element = this.$element, 194 | date = ice_date.fn.formatDate(this.date, this.format); 195 | 196 | if ($element.is("input")) { 197 | $element.prop("value", date).trigger("change"); 198 | } else { 199 | $element.text(date); 200 | } 201 | }, 202 | 203 | template: function (options) { 204 | var defaults = { 205 | text: "", 206 | type: "", 207 | selected: false, 208 | disabled: false 209 | }; 210 | 211 | $.extend(defaults, options); 212 | 213 | return [ 214 | '<' + this.defaults.itemTag + ' ', 215 | (defaults.selected ? 'class="' + this.defaults.selectedClass + '"' : 216 | defaults.disabled ? 'class="' + this.defaults.disabledClass + '"' : ''), 217 | (defaults.type ? ' data-type="' + defaults.type + '"' : ''), 218 | '>', 219 | defaults.text, 220 | '' 221 | ].join(""); 222 | }, 223 | 224 | fillAll: function () { 225 | this.fillYears(); 226 | this.fillMonths(); 227 | this.fillDays(); 228 | }, 229 | 230 | fillYears: function () { 231 | var title = "", 232 | items = [], 233 | suffix = this.defaults.yearSuffix || "", 234 | year = this.date.getFullYear(), 235 | viewYear = this.viewDate.getFullYear(), 236 | isCurrent, 237 | i; 238 | 239 | title = (viewYear - 5) + suffix + " - " + (viewYear + 6) + suffix; 240 | 241 | for (i = -5; i < 7; i++) { 242 | isCurrent = (viewYear + i) === year; 243 | items.push(this.template({ 244 | text: viewYear + i, 245 | type: isCurrent ? "year selected" : "year", 246 | selected: isCurrent, 247 | disabled: i === -5 || i === 6 248 | })); 249 | } 250 | 251 | this.$picker.find("[data-type='years current']").html(title); 252 | this.$picker.find("[data-type='years']").empty().html(items.join("")); 253 | }, 254 | 255 | fillMonths: function () { 256 | var title = "", 257 | items = [], 258 | options = this.defaults.monthsShort, 259 | year = this.date.getFullYear(), 260 | month = this.date.getMonth(), 261 | viewYear = this.viewDate.getFullYear(), 262 | isCurrent, 263 | i; 264 | 265 | title = viewYear.toString() + this.defaults.yearSuffix || ""; 266 | 267 | for (i = 0; i < 12; i++) { 268 | isCurrent = viewYear === year && i === month; 269 | 270 | items.push(this.template({ 271 | text: options[i], 272 | type: isCurrent ? "month selected" : "month", 273 | selected: isCurrent 274 | })); 275 | } 276 | 277 | this.$picker.find("[data-type='year current']").html(title); 278 | this.$picker.find("[data-type='months']").empty().html(items.join("")); 279 | }, 280 | 281 | fillWeek: function () { 282 | var items = [], 283 | options = this.defaults.daysMin, 284 | weekStart = parseInt(this.defaults.weekStart, 10) % 7, 285 | i; 286 | 287 | options = $.merge(options.slice(weekStart), options.slice(0, weekStart)); 288 | 289 | for (i = 0; i < 7; i++) { 290 | items.push(this.template({ 291 | text: options[i] 292 | })); 293 | } 294 | 295 | this.$picker.find("[data-type='week']").empty().html(items.join("")); 296 | }, 297 | 298 | fillDays: function () { 299 | var title = "", 300 | items = [], 301 | prevItems = [], 302 | currentItems = [], 303 | nextItems = [], 304 | options = this.defaults.monthsShort, 305 | suffix = this.defaults.yearSuffix || "", 306 | year = this.date.getFullYear(), 307 | month = this.date.getMonth(), 308 | day = this.date.getDate(), 309 | viewYear = this.viewDate.getFullYear(), 310 | viewMonth = this.viewDate.getMonth(), 311 | weekStart = parseInt(this.defaults.weekStart, 10) % 7, 312 | isCurrent, 313 | isDisabled, 314 | length, 315 | date, 316 | i, 317 | n; 318 | 319 | // Title of current month 320 | title = this.defaults.showMonthAfterYear ? (viewYear + suffix + " " + options[viewMonth]) : options[viewMonth] + " " + viewYear + suffix; 321 | 322 | // Days of prev month 323 | length = viewMonth === 0 ? ice_date.fn.getDaysInMonth(viewYear - 1, 11) : ice_date.fn.getDaysInMonth(viewYear, viewMonth - 1); 324 | 325 | for (i = 1; i <= length; i++) { 326 | prevItems.push(this.template({ 327 | text: i, 328 | type: "day prev", 329 | disabled: true 330 | })); 331 | } 332 | 333 | date = new Date(viewYear, viewMonth, 1, 0, 0, 0, 0); // The first day of current month 334 | n = (7 + (date.getDay() - weekStart)) % 7; 335 | n = n > 0 ? n : 7; 336 | prevItems = prevItems.slice((length - n)); 337 | 338 | // Days of prev month next 339 | length = viewMonth === 11 ? ice_date.fn.getDaysInMonth(viewYear + 1, 0) : ice_date.fn.getDaysInMonth(viewYear, viewMonth + 1); 340 | 341 | for (i = 1; i <= length; i++) { 342 | nextItems.push(this.template({ 343 | text: i, 344 | type: "day next", 345 | disabled: true 346 | })); 347 | } 348 | 349 | length = ice_date.fn.getDaysInMonth(viewYear, viewMonth); 350 | date = new Date(viewYear, viewMonth, length, 0, 0, 0, 0); // The last day of current month 351 | n = (7 - (date.getDay() + 1 - weekStart)) % 7; 352 | n = n >= (7 * 6 - (prevItems.length + length)) ? n : n + 7; // 7 * 6 : 7 columns & 6 rows, 42 items 353 | nextItems = nextItems.slice(0, n); 354 | 355 | // Days of current month 356 | for (i = 1; i <= length; i++) { 357 | isCurrent = viewYear === year && viewMonth === month && i === day; 358 | isDisabled = this.defaults.isDisabled(new Date(viewYear, viewMonth, i)); 359 | 360 | currentItems.push(this.template({ 361 | text: i, 362 | type: isDisabled ? "day disabled" : isCurrent ? "day selected" : "day", 363 | selected: isCurrent, 364 | disabled: isDisabled 365 | })); 366 | } 367 | 368 | // Merge all the days 369 | $.merge(items, prevItems); 370 | $.merge(items, currentItems); 371 | $.merge(items, nextItems); 372 | 373 | this.$picker.find("[data-type='month current']").html(title); 374 | this.$picker.find("[data-type='days']").empty().html(items.join("")); 375 | }, 376 | 377 | click: function (e) { 378 | var $target = $(e.target), 379 | yearRegex = /^\d{2,4}$/, 380 | isYear = false, 381 | viewYear, 382 | viewMonth, 383 | viewDay, 384 | year, 385 | type; 386 | 387 | e.stopPropagation(); 388 | e.preventDefault(); 389 | 390 | if ($target.length === 0) { 391 | return; 392 | } 393 | 394 | viewYear = this.viewDate.getFullYear(); 395 | viewMonth = this.viewDate.getMonth(); 396 | viewDay = this.viewDate.getDate(); 397 | type = $target.data().type; 398 | 399 | switch (type) { 400 | case "years prev": 401 | case "years next": 402 | viewYear = type === "years prev" ? viewYear - 10 : viewYear + 10; 403 | year = $target.text(); 404 | isYear = yearRegex.test(year); 405 | 406 | if (isYear) { 407 | viewYear = parseInt(year, 10); 408 | this.date = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 409 | } 410 | 411 | this.viewDate = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 412 | this.fillYears(); 413 | 414 | if (isYear) { 415 | this.showView(1); 416 | this.output(); 417 | } 418 | 419 | break; 420 | 421 | case "year prev": 422 | case "year next": 423 | viewYear = type === "year prev" ? viewYear - 1 : viewYear + 1; 424 | this.viewDate = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 425 | this.fillMonths(); 426 | break; 427 | 428 | case "year current": 429 | 430 | if (this.format.year) { 431 | this.showView(2); 432 | } 433 | 434 | break; 435 | 436 | case "year selected": 437 | 438 | if (this.format.month) { 439 | this.showView(1); 440 | } else { 441 | this.hideView(); 442 | } 443 | 444 | break; 445 | 446 | case "year": 447 | viewYear = parseInt($target.text(), 10); 448 | this.date = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 449 | this.viewDate = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 450 | 451 | if (this.format.month) { 452 | this.showView(1); 453 | } else { 454 | this.hideView(); 455 | } 456 | 457 | this.output(); 458 | break; 459 | 460 | case "month prev": 461 | case "month next": 462 | viewMonth = type === "month prev" ? viewMonth - 1 : type === "month next" ? viewMonth + 1 : viewMonth; 463 | this.viewDate = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 464 | this.fillDays(); 465 | break; 466 | 467 | case "month current": 468 | 469 | if (this.format.month) { 470 | this.showView(1); 471 | } 472 | 473 | break; 474 | 475 | case "month selected": 476 | 477 | if (this.format.day) { 478 | this.showView(0); 479 | } else { 480 | this.hideView(); 481 | } 482 | 483 | break; 484 | 485 | case "month": 486 | viewMonth = $target.parent().children().index($target); 487 | this.date = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 488 | this.viewDate = new Date(viewYear, viewMonth, Math.min(viewDay, 28), 0, 0, 0, 0); 489 | 490 | if (this.format.day) { 491 | this.showView(0); 492 | } else { 493 | this.hideView(); 494 | } 495 | 496 | this.output(); 497 | break; 498 | 499 | case "day prev": 500 | case "day next": 501 | case "day": 502 | viewMonth = type === "day prev" ? viewMonth - 1 : type === "day next" ? viewMonth + 1 : viewMonth; 503 | viewDay = parseInt($target.text(), 10); 504 | this.date = new Date(viewYear, viewMonth, viewDay, 0, 0, 0, 0); 505 | this.viewDate = new Date(viewYear, viewMonth, viewDay, 0, 0, 0, 0); 506 | this.fillDays(); 507 | 508 | if (type === "day") { 509 | this.hideView(); 510 | } 511 | 512 | this.output(); 513 | break; 514 | 515 | case "day selected": 516 | this.hideView(); 517 | this.output(); 518 | break; 519 | 520 | case "day disabled": 521 | this.hideView(); 522 | break; 523 | 524 | // No default 525 | } 526 | } 527 | }; 528 | 529 | // Common methods 530 | ice_date.fn = { 531 | isLeapYear: function (year) { 532 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; 533 | }, 534 | 535 | getDaysInMonth: function (year, month) { 536 | return [31, (this.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; 537 | }, 538 | 539 | parseFormat: function (format) { 540 | var separator = format.match(/[.\/\-\s].*?/) || "/", 541 | parts = format.split(/\W+/), 542 | length, 543 | i; 544 | 545 | if (!parts || parts.length === 0) { 546 | throw new Error("Invalid date format."); 547 | } 548 | 549 | format = { 550 | separator: separator[0], 551 | parts: parts 552 | }; 553 | 554 | for (i = 0, length = parts.length; i < length; i++) { 555 | switch (parts[i]) { 556 | case "dd": 557 | case "d": 558 | format.day = true; 559 | break; 560 | 561 | case "mm": 562 | case "m": 563 | format.month = true; 564 | break; 565 | 566 | case "yyyy": 567 | case "yy": 568 | format.year = true; 569 | break; 570 | 571 | // No default 572 | } 573 | } 574 | 575 | return format; 576 | }, 577 | 578 | parseDate: function (date, format) { 579 | var parts, 580 | length, 581 | year, 582 | day, 583 | month, 584 | val, 585 | i; 586 | 587 | parts = typeof date === "string" && date.length > 0 ? date.split(format.separator) : []; 588 | length = format.parts.length; 589 | 590 | date = new Date(); 591 | year = date.getFullYear(); 592 | day = date.getDate(); 593 | month = date.getMonth(); 594 | 595 | if (parts.length === length) { 596 | for (i = 0; i < length; i++) { 597 | val = parseInt(parts[i], 10) || 1; 598 | 599 | switch (format.parts[i]) { 600 | case "dd": 601 | case "d": 602 | day = val; 603 | break; 604 | 605 | case "mm": 606 | case "m": 607 | month = val - 1; 608 | break; 609 | 610 | case "yy": 611 | year = 2000 + val; 612 | break; 613 | 614 | case "yyyy": 615 | year = val; 616 | break; 617 | 618 | // No default 619 | } 620 | } 621 | } 622 | 623 | return new Date(year, month, day, 0, 0, 0, 0); 624 | }, 625 | 626 | formatDate: function (date, format) { 627 | var val = { 628 | d: date.getDate(), 629 | m: date.getMonth() + 1, 630 | yy: date.getFullYear().toString().substring(2), 631 | yyyy: date.getFullYear() 632 | }, 633 | parts = [], 634 | length = format.parts.length, 635 | i; 636 | 637 | val.dd = (val.d < 10 ? "0" : "") + val.d; 638 | val.mm = (val.m < 10 ? "0" : "") + val.m; 639 | 640 | for (i = 0; i < length; i++) { 641 | parts.push(val[format.parts[i]]); 642 | } 643 | 644 | return parts.join(format.separator); 645 | } 646 | }; 647 | 648 | ice_date.defaults = { 649 | autoClose: false, 650 | dateFormat: "mm/dd/yyyy", 651 | days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], 652 | daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], 653 | daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], 654 | disabledClass: "disabled", 655 | 656 | isDisabled: function ( /* date */ ) { 657 | return false; 658 | }, 659 | 660 | itemTag: "li", 661 | months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 662 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 663 | selectedClass: "selected", 664 | showMonthAfterYear: false, 665 | template: [ 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 | ].join(""), 697 | trigger: undefined, 698 | viewStart: 0, // 0 for "days", 1 for "months", 2 for "years" 699 | weekStart: 0, // 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, 6 for Saturday 700 | yearSuffix: "" 701 | }; 702 | 703 | ice_date.setDefaults = function (options) { 704 | $.extend(ice_date.defaults, options); 705 | }; 706 | 707 | // Register as jQuery plugin 708 | $.fn.ice_date = function (options) { 709 | return this.each(function () { 710 | var $this = $(this), 711 | data = $this.data("ice_date"); 712 | 713 | if (!data) { 714 | data = new ice_date(this, options); 715 | $this.data("ice_date", data); 716 | } 717 | 718 | if (typeof options === "string" && $.isFunction(data[options])) { 719 | data[options](); 720 | } 721 | }); 722 | }; 723 | 724 | $.fn.ice_date.constructor = ice_date; 725 | $.fn.ice_date.setDefaults = ice_date.setDefaults; 726 | 727 | $(function () { 728 | $("[ice_date]").ice_date(); 729 | }); 730 | }); 731 | 732 | 733 | 734 | //本地化,如果要英文的,把下面的代码删掉即可 735 | $.fn.ice_date.setDefaults({ 736 | autoClose: false, 737 | dateFormat: "yyyy-mm-dd", 738 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], 739 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], 740 | daysMin: ["日", "一", "二", "三", "四", "五", "六"], 741 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 742 | monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], 743 | showMonthAfterYear: true, 744 | viewStart: 0, // days 745 | weekStart: 1, // Monday 746 | yearSuffix: "年" 747 | }); -------------------------------------------------------------------------------- /plugin/ice_fullpage/ice-fullpage.css: -------------------------------------------------------------------------------- 1 | /** 2 | * fullPage 2.4.6 3 | * https://github.com/alvarotrigo/fullPage.js 4 | * MIT licensed 5 | * 6 | * Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo 7 | */ 8 | 9 | html, 10 | body { 11 | margin: 0; 12 | padding: 0; 13 | overflow: hidden; 14 | /*Avoid flicker on slides transitions for mobile phones #336 */ 15 | 16 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 17 | } 18 | #superContainer { 19 | height: 100%; 20 | position: relative; 21 | /* Touch detection for Windows 8 */ 22 | 23 | -ms-touch-action: none; 24 | /* IE 11 on Windows Phone 8.1*/ 25 | 26 | touch-action: none; 27 | } 28 | .ice-fp-section { 29 | position: relative; 30 | -webkit-box-sizing: border-box; 31 | /* Safari<=5 Android<=3 */ 32 | 33 | -moz-box-sizing: border-box; 34 | /* <=28 */ 35 | 36 | box-sizing: border-box; 37 | 38 | } 39 | .ice-fp-slide { 40 | float: left; 41 | } 42 | .ice-fp-slide, 43 | .ice-fp-slidesContainer { 44 | height: 100%; 45 | display: block; 46 | } 47 | .ice-fp-slides { 48 | z-index: 1; 49 | height: 100%; 50 | overflow: hidden; 51 | position: relative; 52 | -webkit-transition: all 0.3s ease-out; 53 | /* Safari<=6 Android<=4.3 */ 54 | 55 | transition: all 0.3s ease-out; 56 | } 57 | .ice-fp-section.ice-fp-table, 58 | .ice-fp-slide.ice-fp-table { 59 | display: table; 60 | table-layout: fixed; 61 | width: 100%; 62 | height: 100%; 63 | } 64 | .ice-fp-tableCell { 65 | display: table-cell; 66 | vertical-align: middle; 67 | width: 100%; 68 | height: 100%; 69 | } 70 | .ice-fp-slidesContainer { 71 | float: left; 72 | position: relative; 73 | } 74 | .ice-fp-controlArrow { 75 | position: absolute; 76 | z-index: 4; 77 | top: 50%; 78 | cursor: pointer; 79 | width: 0; 80 | height: 0; 81 | border-style: solid; 82 | margin-top: -38px; 83 | } 84 | .ice-fp-controlArrow.ice-fp-prev { 85 | left: 15px; 86 | width: 0; 87 | border-width: 15px 20px 15px 0; 88 | border-color: transparent #297FB8 transparent transparent; 89 | border-radius: 5px; 90 | } 91 | .ice-fp-controlArrow.ice-fp-next { 92 | right: 15px; 93 | border-width: 15px 0 15px 20px; 94 | border-color: transparent transparent transparent #297FB8; 95 | border-radius: 5px; 96 | } 97 | .ice-fp-scrollable { 98 | overflow: scroll; 99 | } 100 | .ice-fp-notransition { 101 | -webkit-transition: none !important; 102 | transition: none !important; 103 | } 104 | #ice-fp-nav { 105 | position: fixed; 106 | z-index: 100; 107 | margin-top: -32px; 108 | top: 50%; 109 | opacity: 1; 110 | } 111 | #ice-fp-nav.right { 112 | right: 17px; 113 | } 114 | #ice-fp-nav.left { 115 | left: 17px; 116 | } 117 | .ice-fp-slidesNav { 118 | position: absolute; 119 | z-index: 4; 120 | left: 50%; 121 | opacity: 1; 122 | } 123 | .ice-fp-slidesNav.bottom { 124 | bottom: 17px; 125 | } 126 | .ice-fp-slidesNav.top { 127 | top: 17px; 128 | } 129 | #ice-fp-nav ul, 130 | .ice-fp-slidesNav ul { 131 | margin: 0; 132 | padding: 0; 133 | } 134 | #ice-fp-nav ul li, 135 | .ice-fp-slidesNav ul li { 136 | display: block; 137 | width: 14px; 138 | height: 13px; 139 | margin: 7px; 140 | position: relative; 141 | } 142 | .ice-fp-slidesNav ul li { 143 | display: inline-block; 144 | } 145 | #ice-fp-nav ul li a, 146 | .ice-fp-slidesNav ul li a { 147 | display: block; 148 | position: relative; 149 | z-index: 1; 150 | width: 100%; 151 | height: 100%; 152 | cursor: pointer; 153 | text-decoration: none; 154 | } 155 | #ice-fp-nav ul li a.active span, 156 | .ice-fp-slidesNav ul li a.active span { 157 | background: #333; 158 | } 159 | #ice-fp-nav ul li a span, 160 | .ice-fp-slidesNav ul li a span { 161 | top: 2px; 162 | left: 2px; 163 | width: 8px; 164 | height: 8px; 165 | border: 1px solid #000; 166 | background: rgba(0, 0, 0, 0); 167 | border-radius: 50%; 168 | position: absolute; 169 | z-index: 1; 170 | } 171 | #ice-fp-nav ul li .ice-fp-tooltip { 172 | position: absolute; 173 | top: -2px; 174 | color: #fff; 175 | font-size: 14px; 176 | font-family: arial, helvetica, sans-serif; 177 | white-space: nowrap; 178 | max-width: 220px; 179 | overflow: hidden; 180 | display: block; 181 | opacity: 0; 182 | width: 0; 183 | } 184 | #ice-fp-nav ul li:hover .ice-fp-tooltip { 185 | -webkit-transition: opacity 0.2s ease-in; 186 | transition: opacity 0.2s ease-in; 187 | width: auto; 188 | opacity: 1; 189 | } 190 | #ice-fp-nav ul li .ice-fp-tooltip.right { 191 | right: 20px; 192 | } 193 | #ice-fp-nav ul li .ice-fp-tooltip.left { 194 | left: 20px; 195 | } -------------------------------------------------------------------------------- /plugin/ice_image.js: -------------------------------------------------------------------------------- 1 | 2 | //图片延迟加载 3 | 4 | 5 | (function (root, factory) { 6 | if (typeof define === 'function' && define.amd) { 7 | define(function() { 8 | return factory(root); 9 | }); 10 | } else if (typeof exports === 'object') { 11 | module.exports = factory; 12 | } else { 13 | root.ice_echo = factory(root); 14 | } 15 | })(this, function (root) { 16 | 17 | 'use strict'; 18 | 19 | var ice_echo = {}; 20 | 21 | var callback = function () {}; 22 | 23 | var offset, poll, delay, useDebounce, unload; 24 | 25 | var inView = function (element, view) { 26 | var box = element.getBoundingClientRect(); 27 | return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b); 28 | }; 29 | 30 | var debounceOrThrottle = function () { 31 | if(!useDebounce && !!poll) { 32 | return; 33 | } 34 | clearTimeout(poll); 35 | poll = setTimeout(function(){ 36 | ice_echo.render(); 37 | poll = null; 38 | }, delay); 39 | }; 40 | 41 | ice_echo.init = function (opts) { 42 | opts = opts || {}; 43 | var offsetAll = opts.offset || 0; 44 | var offsetVertical = opts.offsetVertical || offsetAll; 45 | var offsetHorizontal = opts.offsetHorizontal || offsetAll; 46 | var optionToInt = function (opt, fallback) { 47 | return parseInt(opt || fallback, 10); 48 | }; 49 | offset = { 50 | t: optionToInt(opts.offsetTop, offsetVertical), 51 | b: optionToInt(opts.offsetBottom, offsetVertical), 52 | l: optionToInt(opts.offsetLeft, offsetHorizontal), 53 | r: optionToInt(opts.offsetRight, offsetHorizontal) 54 | }; 55 | delay = optionToInt(opts.throttle, 250); 56 | useDebounce = opts.debounce !== false; 57 | unload = !!opts.unload; 58 | callback = opts.callback || callback; 59 | ice_echo.render(); 60 | if (document.addEventListener) { 61 | root.addEventListener('scroll', debounceOrThrottle, false); 62 | root.addEventListener('load', debounceOrThrottle, false); 63 | } else { 64 | root.attachEvent('onscroll', debounceOrThrottle); 65 | root.attachEvent('onload', debounceOrThrottle); 66 | } 67 | }; 68 | 69 | ice_echo.render = function () { 70 | var nodes = document.querySelectorAll('img[data-echo], [data-echo-background]'); 71 | var length = nodes.length; 72 | var src, elem; 73 | var view = { 74 | l: 0 - offset.l, 75 | t: 0 - offset.t, 76 | b: (root.innerHeight || document.documentElement.clientHeight) + offset.b, 77 | r: (root.innerWidth || document.documentElement.clientWidth) + offset.r 78 | }; 79 | for (var i = 0; i < length; i++) { 80 | elem = nodes[i]; 81 | if (inView(elem, view)) { 82 | 83 | if (unload) { 84 | elem.setAttribute('data-echo-placeholder', elem.src); 85 | } 86 | 87 | if (elem.getAttribute('data-echo-background') !== null) { 88 | elem.style.backgroundImage = "url(" + elem.getAttribute('data-echo-background') + ")"; 89 | } 90 | else { 91 | elem.src = elem.getAttribute('data-echo'); 92 | } 93 | 94 | if (!unload) { 95 | elem.removeAttribute('data-echo'); 96 | } 97 | 98 | callback(elem, 'load'); 99 | } 100 | else if (unload && !!(src = elem.getAttribute('data-echo-placeholder'))) { 101 | 102 | if (elem.getAttribute('data-echo-background') !== null) { 103 | elem.style.backgroundImage = "url(" + src + ")"; 104 | } 105 | else { 106 | elem.src = src; 107 | } 108 | 109 | elem.removeAttribute('data-echo-placeholder'); 110 | callback(elem, 'unload'); 111 | } 112 | } 113 | if (!length) { 114 | ice_echo.detach(); 115 | } 116 | }; 117 | 118 | ice_echo.detach = function () { 119 | if (document.removeEventListener) { 120 | root.removeEventListener('scroll', debounceOrThrottle); 121 | } else { 122 | root.detachEvent('onscroll', debounceOrThrottle); 123 | } 124 | clearTimeout(poll); 125 | }; 126 | 127 | return ice_echo; 128 | 129 | }); 130 | 131 | -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/css/styles.css: -------------------------------------------------------------------------------- 1 | /* Reset */ 2 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0} 3 | body{font:13px/1.1 Helvetica,sans-serif;} 4 | p{line-height:1.6;} 5 | /* Example page */ 6 | strong{font-weight:bold;} 7 | header{height:100px;} 8 | header img{float:left;margin:14px 0 0 14px} 9 | header h1{margin-left:14px;float:left;font-size:20px;line-height:100px;} 10 | 11 | section { 12 | min-height: 1000px; 13 | position: relative; 14 | width: 100% !important; 15 | min-width: 1000px; 16 | margin: 0; 17 | padding: 0; 18 | overflow: hidden; 19 | } 20 | 21 | section:nth-of-type(1){background:whitesmoke;height:1200px;} 22 | section:nth-of-type(2){background:black;height:1600px;} 23 | 24 | #story-freext>div:nth-of-type(1) { 25 | background: url(../img/nike-bg.jpeg) 50% 0 no-repeat fixed; 26 | margin: 0; 27 | height: 1600px; 28 | position:absolute; 29 | width:100%; 30 | top:0;left:0; 31 | } 32 | 33 | #story-freext>div:nth-of-type(2) { 34 | background: url(../img/nike.png) 50% 0 no-repeat fixed; 35 | margin: 0; 36 | height: 1600px; 37 | position:absolute; 38 | top:0px;left:100px; 39 | width:100%; 40 | } 41 | 42 | #bottle>div:nth-of-type(1){ 43 | background: url(../img/bottle.jpeg) 50% 0 no-repeat fixed; 44 | margin: 0; 45 | height: 1200px; 46 | position:absolute; 47 | top:0;left:0; 48 | width:100%; 49 | } 50 | 51 | section h1{color:#4F9426;width:300px;font-size:65px;margin-bottom:14px;} 52 | section p{color:black;width:300px;} 53 | section article{position:absolute;top:240px;left:40px;width:300px;z-index:4;} 54 | 55 | .parallax-item{position:absolute;z-index:5;top:40px;left:400px;} 56 | -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/img/bottle.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/plugin/ice_scrolly/example/img/bottle.jpeg -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/plugin/ice_scrolly/example/img/logo.png -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/img/nike-bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/plugin/ice_scrolly/example/img/nike-bg.jpeg -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/img/nike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/plugin/ice_scrolly/example/img/nike.png -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/img/old-boy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/T-baby/ICECss/74e77beff8ded518d02c1e971432a2f80c8c76e7/plugin/ice_scrolly/example/img/old-boy.png -------------------------------------------------------------------------------- /plugin/ice_scrolly/example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
          8 | 9 |

          ice_scrolly: a simple jQuery parallax plugin

          10 |
          11 | 12 |
          13 |
          14 |

          Our products are a load of rubbish.

          15 |

          NIKE FREE TR FIT 16 | Each Nike 2010 World Championship Football jersey is made entirely from recycled polyester. That's up to eight recycled plastic bottles per jersey. In total, that diverted nearly 13 million plastic bottles from landfills. Yes, you read right. 13 million. Plastic. Bottles.

          17 |
          18 |
          19 |
          20 |
          21 |
          22 |

          One shoe does good, 23 | the other shoe kicks ass.

          24 |

          NIKE FREE TR FIT 25 | The Free TR Fit is designed with a lower environmental impact using 26 | environmentally preferred rubber, water-based cementing and recycled polyester. 27 | That means every step in the multi-directional flex groove outsole replicates 28 | the foot's natural movement and helps women get more out of their workout without 29 | leaving a huge environmental footprint. Everyone's a winner.

          30 |
          31 |
          32 |
          33 |
          34 |
          35 | 36 | 37 | 38 | 43 | 44 | -------------------------------------------------------------------------------- /plugin/ice_scrolly/ice_scrolly.js: -------------------------------------------------------------------------------- 1 | /* From https://github.com/Victa/scrolly*/ 2 | (function ( $, window, document, undefined ) { 3 | // Create the defaults once 4 | var pluginName = 'ice_scrolly', 5 | defaults = { 6 | bgParallax: false 7 | }, 8 | didScroll = false; 9 | 10 | function Plugin( element, options ) { 11 | this.element = element; 12 | this.$element = $(this.element); 13 | 14 | this.options = $.extend( {}, defaults, options) ; 15 | 16 | this._defaults = defaults; 17 | this._name = pluginName; 18 | 19 | this.init(); 20 | } 21 | 22 | Plugin.prototype.init = function () { 23 | var self = this; 24 | this.startPosition = this.$element.position().top; 25 | this.offsetTop = this.$element.offset().top; 26 | this.height = this.$element.outerHeight(true); 27 | this.velocity = this.$element.attr('data-velocity'); 28 | this.bgStart = parseInt(this.$element.attr('data-fit'), 10); 29 | 30 | $(document).scroll(function(){ 31 | self.didScroll = true; 32 | }); 33 | 34 | setInterval(function() { 35 | if (self.didScroll) { 36 | self.didScroll = false; 37 | self.scrolly(); 38 | } 39 | }, 10); 40 | }; 41 | 42 | Plugin.prototype.scrolly = function() { 43 | var dT = $(window).scrollTop(), 44 | wH = $(window).height(), 45 | position = this.startPosition; 46 | 47 | if(this.offsetTop >= (dT+wH)) { 48 | this.$element.addClass('scrolly-invisible'); 49 | } else { 50 | if(this.$element.hasClass('scrolly-invisible')){ 51 | position = this.startPosition + (dT + ( wH - this.offsetTop ) ) * this.velocity; 52 | } else { 53 | position = this.startPosition + dT * this.velocity; 54 | } 55 | } 56 | // Fix background position 57 | if(this.bgStart){ position = position + this.bgStart; } 58 | 59 | if(this.options.bgParallax === true) { 60 | this.$element.css({backgroundPosition: '50% '+position+'px'}); 61 | } else { 62 | this.$element.css({top: position}); 63 | } 64 | }; 65 | 66 | $.fn[pluginName] = function ( options ) { 67 | return this.each(function () { 68 | if (!$.data(this, 'plugin_' + pluginName)) { 69 | $.data(this, 'plugin_' + pluginName, new Plugin( this, options )); 70 | } 71 | }); 72 | }; 73 | 74 | })(jQuery, window, document); 75 | -------------------------------------------------------------------------------- /plugin/ice_storedb.js: -------------------------------------------------------------------------------- 1 | var ice_storedb = function(collectionName){ 2 | collectionName = collectionName ? collectionName : 'default'; 3 | 4 | var err; 5 | var cache = localStorage[collectionName] ? JSON.parse(localStorage[collectionName]) : []; 6 | 7 | return { 8 | 9 | insert: function(obj,callback){ 10 | obj["_id"] = new Date().valueOf(); 11 | cache.push(obj); 12 | localStorage.setItem(collectionName,JSON.stringify(cache)); 13 | if(callback) 14 | callback(err,obj); 15 | }, 16 | 17 | find: function(obj, callback){ 18 | if(arguments.length == 0){ 19 | return cache; 20 | } else { 21 | var result = []; 22 | 23 | for(var key in obj){ 24 | for(var i = 0; i < cache.length; i++){ 25 | if(cache[i][key] == obj[key]){ 26 | result.push(cache[i]); 27 | } 28 | } 29 | } 30 | if(callback) 31 | callback(err,result); 32 | else 33 | return result; 34 | } 35 | }, 36 | 37 | update: function(obj,upsert,callback){ 38 | 39 | for(var key in obj){ 40 | for(var i = 0; i < cache.length; i++){ 41 | if(cache[i][key] == obj[key]){ 42 | 43 | end_loops: 44 | for(var upsrt in upsert){ 45 | switch(upsrt){ 46 | case "$inc": 47 | for(var newkey in upsert[upsrt]){ 48 | cache[i][newkey] = parseInt(cache[i][newkey]) + parseInt(upsert[upsrt][newkey]); 49 | } 50 | break; 51 | 52 | case "$set": 53 | for(var newkey in upsert[upsrt]){ 54 | cache[i][newkey] = upsert[upsrt][newkey]; 55 | } 56 | break; 57 | 58 | case "$push": 59 | for(var newkey in upsert[upsrt]){ 60 | cache[i][newkey].push(upsert[upsrt][newkey]); 61 | } 62 | break; 63 | 64 | default: 65 | upsert['_id'] = cache[i]['_id']; 66 | cache[i] = upsert; 67 | break end_loops; 68 | } 69 | } 70 | } 71 | } 72 | } 73 | localStorage.setItem(collectionName,JSON.stringify(cache)); 74 | if(callback) 75 | callback(err); 76 | 77 | }, 78 | 79 | remove: function(obj,callback){ 80 | if(arguments.length == 0){ 81 | localStorage.removeItem(collectionName); 82 | } else { 83 | 84 | for(var key in obj){ 85 | for (var i = cache.length - 1; i >= 0; i--) { 86 | if(cache[i][key] == obj[key]){ 87 | cache.splice(i,1); 88 | } 89 | } 90 | } 91 | localStorage.setItem(collectionName, JSON.stringify(cache)); 92 | } 93 | 94 | if(callback) 95 | callback(err); 96 | 97 | } 98 | 99 | }; 100 | }; 101 | -------------------------------------------------------------------------------- /plugin/ice_tab/ice_tab.css: -------------------------------------------------------------------------------- 1 | html{ 2 | font-family: 'Microsoft Yahei'; 3 | } 4 | .ice-tab a:active,a:focus { 5 | outline: expression(hideFocus='true'); 6 | } 7 | 8 | .ice-tab p { 9 | margin-bottom: 20px; 10 | } 11 | 12 | 13 | .ice-tab{ 14 | width: 100%; 15 | margin-bottom: 40px; 16 | } 17 | 18 | .ice-tab li { 19 | float: left; 20 | margin-right: 2px; 21 | } 22 | 23 | .ice-tab li a { 24 | position: relative; 25 | display: block; 26 | padding: 17px 30px; 27 | text-decoration: none; 28 | background-color: #e5e5e5; 29 | color: #484848; 30 | } 31 | 32 | .ice-tab li a:hover { 33 | background: #2A80B9; 34 | color: #ffffff; 35 | } 36 | 37 | .ice-tab-container{ 38 | padding: 40px; 39 | overflow: hidden; 40 | position: relative; 41 | border:1px solid #cecece; 42 | background: white; 43 | height: auto; 44 | } 45 | 46 | .ice-tab-container div { 47 | margin-right: 40px; 48 | } 49 | 50 | .transition { 51 | -webkit-transition: all .3s ease-in-out; 52 | -moz-transition: all .3s ease-in-out; 53 | -o-transition: all .3s ease-in-out; 54 | -ms-transition: all .3s ease-in-out; 55 | transition: all .3s ease-in-out; 56 | 57 | -webkit-transition-delay: .3s; 58 | -moz-transition-delay: .3s; 59 | -o-transition-delay: .3s; 60 | -ms-transition-delay: .3s; 61 | transition-delay: .3s; 62 | } 63 | 64 | .make_transist { 65 | -webkit-transition: all .3s ease-in-out; 66 | -moz-transition: all .3s ease-in-out; 67 | -o-transition: all .3s ease-in-out; 68 | -ms-transition: all .3s ease-in-out; 69 | transition: all .3s ease-in-out; 70 | } 71 | 72 | .hideleft { 73 | -webkit-transform: translateX(-100%); 74 | -moz-transform: translateX(-100%); 75 | -o-transform: translateX(-100%); 76 | -ms-transform: translateX(-100%); 77 | transform: translateX(-100%); 78 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; 79 | filter: alpha(opacity=0); 80 | opacity: 0; 81 | } 82 | 83 | .showleft { 84 | -webkit-transform: translateX(0px); 85 | -moz-transform: translateX(0px); 86 | -o-transform: translateX(0px); 87 | -ms-transform: translateX(0px); 88 | transform: translateX(0px); 89 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 90 | filter: alpha(opacity=100); 91 | opacity: 1; 92 | 93 | -webkit-transition-delay: .3s; 94 | -moz-transition-delay: .3s; 95 | -o-transition-delay: .3s; 96 | -ms-transition-delay: .3s; 97 | transition-delay: .3s; 98 | } 99 | 100 | 101 | .tabulous_active { 102 | background: #ffffff !important; 103 | color: #3598DC !important; 104 | border-bottom: 1px solid #ffffff; 105 | border-left: 1px solid #cecece; 106 | border-right: 1px solid #cecece; 107 | border-top: 1px solid #3598DC; 108 | z-index: 2; 109 | top: 1; 110 | } 111 | 112 | .tabulousclear { 113 | display: block; 114 | clear: both; 115 | } 116 | /*解决CSS污染问题*/ 117 | .ice-tab ul{ 118 | margin:0; 119 | padding: 0; 120 | } 121 | .ice-tab ul li{ 122 | margin-bottom:0; 123 | } -------------------------------------------------------------------------------- /plugin/ice_tab/ice_tab.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 封装自tabulous 3 | */ 4 | 5 | (function ( $, window, document, undefined ) { 6 | 7 | var pluginName = "ice_tab", 8 | defaults = ""; 9 | 10 | // $('').appendTo('head'); 11 | 12 | function Plugin( element, options ) { 13 | this.element = element; 14 | this.$elem = $(this.element); 15 | this.options = $.extend( {}, defaults, options ); 16 | this._defaults = defaults; 17 | this._name = pluginName; 18 | this.init(); 19 | } 20 | 21 | Plugin.prototype = { 22 | 23 | init: function() { 24 | 25 | var links = this.$elem.find('a'); 26 | var firstchild = this.$elem.find('li:first-child').find('a'); 27 | var lastchild = this.$elem.find('li:last-child').after(''); 28 | 29 | 30 | tab_content = this.$elem.find('div').not(':first').not(':nth-child(1)').addClass('hideleft'); 31 | 32 | 33 | var firstdiv = this.$elem.find('.ice-tab-container'); 34 | var firstdivheight = firstdiv.find('div:first').height(); 35 | 36 | var alldivs = this.$elem.find('div:first').find('div'); 37 | 38 | alldivs.css({'position': 'absolute','top':'40px'}); 39 | 40 | firstdiv.css('height',firstdivheight+'px'); 41 | 42 | firstchild.addClass('tabulous_active'); 43 | 44 | links.bind('click', {myOptions: this.options}, function(e) { 45 | e.preventDefault(); 46 | 47 | var $options = e.data.myOptions; 48 | var effect = $options.effect; 49 | 50 | var mythis = $(this); 51 | var thisform = mythis.parent().parent().parent(); 52 | var thislink = mythis.attr('href'); 53 | 54 | 55 | firstdiv.addClass('transition'); 56 | 57 | links.removeClass('tabulous_active'); 58 | mythis.addClass('tabulous_active'); 59 | thisdivwidth = thisform.find('div'+thislink).height(); 60 | 61 | 62 | alldivs.removeClass('showleft').addClass('make_transist').addClass('hideleft'); 63 | thisform.find('div'+thislink).addClass('make_transist').addClass('showleft'); 64 | firstdiv.css('height',thisdivwidth+'px'); 65 | 66 | 67 | 68 | 69 | }); 70 | 71 | 72 | 73 | 74 | 75 | 76 | }, 77 | 78 | yourOtherFunction: function(el, options) { 79 | // some logic 80 | } 81 | }; 82 | 83 | // A really lightweight plugin wrapper around the constructor, 84 | // preventing against multiple instantiations 85 | $.fn[pluginName] = function ( options ) { 86 | return this.each(function () { 87 | new Plugin( this, options ); 88 | }); 89 | }; 90 | 91 | })( jQuery, window, document ); 92 | 93 | 94 | -------------------------------------------------------------------------------- /plugin/ice_tmpl/help.md: -------------------------------------------------------------------------------- 1 | ## ice_tmpl 中文文档 2 | 3 | ice_tmpl封装自Juicer 4 | 5 | ### ice_tmpl 的引入 6 | 7 | 176 | 177 | Javascript 代码: 178 | 179 | var tpl = 'Hi, {@include "#subTpl", subData}, End.'; 180 | 181 | ice_tmpl(tpl, { 182 | subData: { 183 | name: 'ice_tmpl' 184 | } 185 | }); 186 | 187 | //输出 Hi, I'm sub content, ice_tmpl, End. 188 | //或者通过数据引入子模板,下述代码也将会有相同的渲染结果: 189 | 190 | var tpl = 'Hi, {@include subTpl, subData}, End.'; 191 | 192 | ice_tmpl(tpl, { 193 | subTpl: "I'm sub content, ${name}", 194 | subData: { 195 | name: 'ice_tmpl' 196 | } 197 | }); 198 | 199 | 200 | ## * 一个完整的例子 201 | 202 | HTML 代码: 203 | 204 | 221 | 222 | Javascript 代码: 223 | 224 | var data = { 225 | list: [ 226 | {name:' guokai', show: true}, 227 | {name:' benben', show: false}, 228 | {name:' dierbaby', show: true} 229 | ], 230 | blah: [ 231 | {num: 1}, 232 | {num: 2}, 233 | {num: 3, inner:[ 234 | {'time': '15:00'}, 235 | {'time': '16:00'}, 236 | {'time': '17:00'}, 237 | {'time': '18:00'} 238 | ]}, 239 | {num: 4} 240 | ] 241 | }; 242 | 243 | var tpl = document.getElementById('tpl').innerHTML; 244 | var html = ice_tmpl(tpl, data); 245 | -------------------------------------------------------------------------------- /plugin/ice_tmpl/ice_tmpl.js: -------------------------------------------------------------------------------- 1 | /* 2 | ********** ice_tmpl ********** 3 | ${A Fast template engine} 4 | Project Home: http://ice_tmpl.name 5 | 6 | Author: Guokai 7 | Gtalk: badkaikai@gmail.com 8 | Blog: http://benben.cc 9 | Licence: MIT License 10 | Version: 0.6.8-stable 11 | */ 12 | 13 | (function() { 14 | 15 | // This is the main function for not only compiling but also rendering. 16 | // there's at least two parameters need to be provided, one is the tpl, 17 | // another is the data, the tpl can either be a string, or an id like #id. 18 | // if only tpl was given, it'll return the compiled reusable function. 19 | // if tpl and data were given at the same time, it'll return the rendered 20 | // result immediately. 21 | 22 | var ice_tmpl = function() { 23 | var args = [].slice.call(arguments); 24 | 25 | args.push(ice_tmpl.options); 26 | 27 | if(args[0].match(/^\s*#([\w:\-\.]+)\s*$/igm)) { 28 | args[0].replace(/^\s*#([\w:\-\.]+)\s*$/igm, function($, $id) { 29 | var _document = document; 30 | var elem = _document && _document.getElementById($id); 31 | args[0] = elem ? (elem.value || elem.innerHTML) : $; 32 | }); 33 | } 34 | 35 | if(typeof(document) !== 'undefined' && document.body) { 36 | ice_tmpl.compile.call(ice_tmpl, document.body.innerHTML); 37 | } 38 | 39 | if(arguments.length == 1) { 40 | return ice_tmpl.compile.apply(ice_tmpl, args); 41 | } 42 | 43 | if(arguments.length >= 2) { 44 | return ice_tmpl.to_html.apply(ice_tmpl, args); 45 | } 46 | }; 47 | 48 | var __escapehtml = { 49 | escapehash: { 50 | '<': '<', 51 | '>': '>', 52 | '&': '&', 53 | '"': '"', 54 | "'": ''', 55 | '/': '/' 56 | }, 57 | escapereplace: function(k) { 58 | return __escapehtml.escapehash[k]; 59 | }, 60 | escaping: function(str) { 61 | return typeof(str) !== 'string' ? str : str.replace(/[&<>"]/igm, this.escapereplace); 62 | }, 63 | detection: function(data) { 64 | return typeof(data) === 'undefined' ? '' : data; 65 | } 66 | }; 67 | 68 | var __throw = function(error) { 69 | if(typeof(console) !== 'undefined') { 70 | if(console.warn) { 71 | console.warn(error); 72 | return; 73 | } 74 | 75 | if(console.log) { 76 | console.log(error); 77 | return; 78 | } 79 | } 80 | 81 | throw(error); 82 | }; 83 | 84 | var __creator = function(o, proto) { 85 | o = o !== Object(o) ? {} : o; 86 | 87 | if(o.__proto__) { 88 | o.__proto__ = proto; 89 | return o; 90 | } 91 | 92 | var empty = function() {}; 93 | var n = Object.create ? 94 | Object.create(proto) : 95 | new(empty.prototype = proto, empty); 96 | 97 | for(var i in o) { 98 | if(o.hasOwnProperty(i)) { 99 | n[i] = o[i]; 100 | } 101 | } 102 | 103 | return n; 104 | }; 105 | 106 | var annotate = function(fn) { 107 | var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; 108 | var FN_ARG_SPLIT = /,/; 109 | var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; 110 | var FN_BODY = /^function[^{]+{([\s\S]*)}/m; 111 | var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; 112 | var args = [], 113 | fnText, 114 | fnBody, 115 | argDecl; 116 | 117 | if (typeof fn === 'function') { 118 | if (fn.length) { 119 | fnText = fn.toString(); 120 | } 121 | } else if(typeof fn === 'string') { 122 | fnText = fn; 123 | } 124 | 125 | fnText = fnText.replace(STRIP_COMMENTS, ''); 126 | fnText = fnText.trim(); 127 | argDecl = fnText.match(FN_ARGS); 128 | fnBody = fnText.match(FN_BODY)[1].trim(); 129 | 130 | for(var i = 0; i < argDecl[1].split(FN_ARG_SPLIT).length; i++) { 131 | var arg = argDecl[1].split(FN_ARG_SPLIT)[i]; 132 | arg.replace(FN_ARG, function(all, underscore, name) { 133 | args.push(name); 134 | }); 135 | } 136 | 137 | return [args, fnBody]; 138 | }; 139 | 140 | ice_tmpl.__cache = {}; 141 | ice_tmpl.version = '0.6.8-stable'; 142 | ice_tmpl.settings = {}; 143 | 144 | ice_tmpl.tags = { 145 | operationOpen: '{@', 146 | operationClose: '}', 147 | interpolateOpen: '\\${', 148 | interpolateClose: '}', 149 | noneencodeOpen: '\\$\\${', 150 | noneencodeClose: '}', 151 | commentOpen: '\\{#', 152 | commentClose: '\\}' 153 | }; 154 | 155 | ice_tmpl.options = { 156 | cache: true, 157 | strip: true, 158 | errorhandling: true, 159 | detection: true, 160 | _method: __creator({ 161 | __escapehtml: __escapehtml, 162 | __throw: __throw, 163 | __ice_tmpl: ice_tmpl 164 | }, {}) 165 | }; 166 | 167 | ice_tmpl.tagInit = function() { 168 | var forstart = ice_tmpl.tags.operationOpen + 'each\\s*([^}]*?)\\s*as\\s*(\\w*?)\\s*(,\\s*\\w*?)?' + ice_tmpl.tags.operationClose; 169 | var forend = ice_tmpl.tags.operationOpen + '\\/each' + ice_tmpl.tags.operationClose; 170 | var ifstart = ice_tmpl.tags.operationOpen + 'if\\s*([^}]*?)' + ice_tmpl.tags.operationClose; 171 | var ifend = ice_tmpl.tags.operationOpen + '\\/if' + ice_tmpl.tags.operationClose; 172 | var elsestart = ice_tmpl.tags.operationOpen + 'else' + ice_tmpl.tags.operationClose; 173 | var elseifstart = ice_tmpl.tags.operationOpen + 'else if\\s*([^}]*?)' + ice_tmpl.tags.operationClose; 174 | var interpolate = ice_tmpl.tags.interpolateOpen + '([\\s\\S]+?)' + ice_tmpl.tags.interpolateClose; 175 | var noneencode = ice_tmpl.tags.noneencodeOpen + '([\\s\\S]+?)' + ice_tmpl.tags.noneencodeClose; 176 | var inlinecomment = ice_tmpl.tags.commentOpen + '[^}]*?' + ice_tmpl.tags.commentClose; 177 | var rangestart = ice_tmpl.tags.operationOpen + 'each\\s*(\\w*?)\\s*in\\s*range\\(([^}]+?)\\s*,\\s*([^}]+?)\\)' + ice_tmpl.tags.operationClose; 178 | var include = ice_tmpl.tags.operationOpen + 'include\\s*([^}]*?)\\s*,\\s*([^}]*?)' + ice_tmpl.tags.operationClose; 179 | var helperRegisterStart = ice_tmpl.tags.operationOpen + 'helper\\s*([^}]*?)\\s*' + ice_tmpl.tags.operationClose; 180 | var helperRegisterBody = '([\\s\\S]*?)'; 181 | var helperRegisterEnd = ice_tmpl.tags.operationOpen + '\\/helper' + ice_tmpl.tags.operationClose; 182 | 183 | ice_tmpl.settings.forstart = new RegExp(forstart, 'igm'); 184 | ice_tmpl.settings.forend = new RegExp(forend, 'igm'); 185 | ice_tmpl.settings.ifstart = new RegExp(ifstart, 'igm'); 186 | ice_tmpl.settings.ifend = new RegExp(ifend, 'igm'); 187 | ice_tmpl.settings.elsestart = new RegExp(elsestart, 'igm'); 188 | ice_tmpl.settings.elseifstart = new RegExp(elseifstart, 'igm'); 189 | ice_tmpl.settings.interpolate = new RegExp(interpolate, 'igm'); 190 | ice_tmpl.settings.noneencode = new RegExp(noneencode, 'igm'); 191 | ice_tmpl.settings.inlinecomment = new RegExp(inlinecomment, 'igm'); 192 | ice_tmpl.settings.rangestart = new RegExp(rangestart, 'igm'); 193 | ice_tmpl.settings.include = new RegExp(include, 'igm'); 194 | ice_tmpl.settings.helperRegister = new RegExp(helperRegisterStart + helperRegisterBody + helperRegisterEnd, 'igm'); 195 | }; 196 | 197 | ice_tmpl.tagInit(); 198 | 199 | // Using this method to set the options by given conf-name and conf-value, 200 | // you can also provide more than one key-value pair wrapped by an object. 201 | // this interface also used to custom the template tag delimater, for this 202 | // situation, the conf-name must begin with tag::, for example: ice_tmpl.set 203 | // ('tag::operationOpen', '{@'). 204 | 205 | ice_tmpl.set = function(conf, value) { 206 | var that = this; 207 | 208 | var escapePattern = function(v) { 209 | return v.replace(/[\$\(\)\[\]\+\^\{\}\?\*\|\.]/igm, function($) { 210 | return '\\' + $; 211 | }); 212 | }; 213 | 214 | var set = function(conf, value) { 215 | var tag = conf.match(/^tag::(.*)$/i); 216 | 217 | if(tag) { 218 | that.tags[tag[1]] = escapePattern(value); 219 | that.tagInit(); 220 | return; 221 | } 222 | 223 | that.options[conf] = value; 224 | }; 225 | 226 | if(arguments.length === 2) { 227 | set(conf, value); 228 | return; 229 | } 230 | 231 | if(conf === Object(conf)) { 232 | for(var i in conf) { 233 | if(conf.hasOwnProperty(i)) { 234 | set(i, conf[i]); 235 | } 236 | } 237 | } 238 | }; 239 | 240 | // Before you're using custom functions in your template like ${name | fnName}, 241 | // you need to register this fn by ice_tmpl.register('fnName', fn). 242 | 243 | ice_tmpl.register = function(fname, fn) { 244 | var _method = this.options._method; 245 | 246 | if(_method.hasOwnProperty(fname)) { 247 | return false; 248 | } 249 | 250 | return _method[fname] = fn; 251 | }; 252 | 253 | // remove the registered function in the memory by the provided function name. 254 | // for example: ice_tmpl.unregister('fnName'). 255 | 256 | ice_tmpl.unregister = function(fname) { 257 | var _method = this.options._method; 258 | 259 | if(_method.hasOwnProperty(fname)) { 260 | return delete _method[fname]; 261 | } 262 | }; 263 | 264 | ice_tmpl.template = function(options) { 265 | var that = this; 266 | 267 | this.options = options; 268 | 269 | this.__interpolate = function(_name, _escape, options) { 270 | var _define = _name.split('|'), _fn = _define[0] || '', _cluster; 271 | 272 | if(_define.length > 1) { 273 | _name = _define.shift(); 274 | _cluster = _define.shift().split(','); 275 | _fn = '_method.' + _cluster.shift() + '.call({}, ' + [_name].concat(_cluster) + ')'; 276 | } 277 | 278 | return '<%= ' + (_escape ? '_method.__escapehtml.escaping' : '') + '(' + 279 | (!options || options.detection !== false ? '_method.__escapehtml.detection' : '') + '(' + 280 | _fn + 281 | ')' + 282 | ')' + 283 | ' %>'; 284 | }; 285 | 286 | this.__removeShell = function(tpl, options) { 287 | var _counter = 0; 288 | 289 | tpl = tpl 290 | // inline helper register 291 | .replace(ice_tmpl.settings.helperRegister, function($, helperName, fnText) { 292 | var anno = annotate(fnText); 293 | var fnArgs = anno[0]; 294 | var fnBody = anno[1]; 295 | var fn = new Function(fnArgs.join(','), fnBody); 296 | 297 | ice_tmpl.register(helperName, fn); 298 | return $; 299 | }) 300 | 301 | // for expression 302 | .replace(ice_tmpl.settings.forstart, function($, _name, alias, key) { 303 | var alias = alias || 'value', key = key && key.substr(1); 304 | var _iterate = 'i' + _counter++; 305 | return '<% ~function() {' + 306 | 'for(var ' + _iterate + ' in ' + _name + ') {' + 307 | 'if(' + _name + '.hasOwnProperty(' + _iterate + ')) {' + 308 | 'var ' + alias + '=' + _name + '[' + _iterate + '];' + 309 | (key ? ('var ' + key + '=' + _iterate + ';') : '') + 310 | ' %>'; 311 | }) 312 | .replace(ice_tmpl.settings.forend, '<% }}}(); %>') 313 | 314 | // if expression 315 | .replace(ice_tmpl.settings.ifstart, function($, condition) { 316 | return '<% if(' + condition + ') { %>'; 317 | }) 318 | .replace(ice_tmpl.settings.ifend, '<% } %>') 319 | 320 | // else expression 321 | .replace(ice_tmpl.settings.elsestart, function($) { 322 | return '<% } else { %>'; 323 | }) 324 | 325 | // else if expression 326 | .replace(ice_tmpl.settings.elseifstart, function($, condition) { 327 | return '<% } else if(' + condition + ') { %>'; 328 | }) 329 | 330 | // interpolate without escape 331 | .replace(ice_tmpl.settings.noneencode, function($, _name) { 332 | return that.__interpolate(_name, false, options); 333 | }) 334 | 335 | // interpolate with escape 336 | .replace(ice_tmpl.settings.interpolate, function($, _name) { 337 | return that.__interpolate(_name, true, options); 338 | }) 339 | 340 | // clean up comments 341 | .replace(ice_tmpl.settings.inlinecomment, '') 342 | 343 | // range expression 344 | .replace(ice_tmpl.settings.rangestart, function($, _name, start, end) { 345 | var _iterate = 'j' + _counter++; 346 | return '<% ~function() {' + 347 | 'for(var ' + _iterate + '=' + start + ';' + _iterate + '<' + end + ';' + _iterate + '++) {{' + 348 | 'var ' + _name + '=' + _iterate + ';' + 349 | ' %>'; 350 | }) 351 | 352 | // include sub-template 353 | .replace(ice_tmpl.settings.include, function($, tpl, data) { 354 | // compatible for node.js 355 | if(tpl.match(/^file\:\/\//igm)) return $; 356 | return '<%= _method.__ice_tmpl(' + tpl + ', ' + data + '); %>'; 357 | }); 358 | 359 | // exception handling 360 | if(!options || options.errorhandling !== false) { 361 | tpl = '<% try { %>' + tpl; 362 | tpl += '<% } catch(e) {_method.__throw("ice_tmpl Render Exception: "+e.message);} %>'; 363 | } 364 | 365 | return tpl; 366 | }; 367 | 368 | this.__toNative = function(tpl, options) { 369 | return this.__convert(tpl, !options || options.strip); 370 | }; 371 | 372 | this.__lexicalAnalyze = function(tpl) { 373 | var buffer = []; 374 | var method = []; 375 | var prefix = ''; 376 | var reserved = [ 377 | 'if', 'each', '_', '_method', 'console', 378 | 'break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 379 | 'finally', 'for', 'function', 'in', 'instanceof', 'new', 'return', 'switch', 380 | 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'null', 'typeof', 381 | 'class', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', 382 | 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'const', 'arguments', 383 | 'true', 'false', 'undefined', 'NaN' 384 | ]; 385 | 386 | var indexOf = function(array, item) { 387 | if (Array.prototype.indexOf && array.indexOf === Array.prototype.indexOf) { 388 | return array.indexOf(item); 389 | } 390 | 391 | for(var i=0; i < array.length; i++) { 392 | if(array[i] === item) return i; 393 | } 394 | 395 | return -1; 396 | }; 397 | 398 | var variableAnalyze = function($, statement) { 399 | statement = statement.match(/\w+/igm)[0]; 400 | 401 | if(indexOf(buffer, statement) === -1 && indexOf(reserved, statement) === -1 && indexOf(method, statement) === -1) { 402 | 403 | // avoid re-declare native function, if not do this, template 404 | // `{@if encodeURIComponent(name)}` could be throw undefined. 405 | 406 | if(typeof(window) !== 'undefined' && typeof(window[statement]) === 'function' && window[statement].toString().match(/^\s*?function \w+\(\) \{\s*?\[native code\]\s*?\}\s*?$/i)) { 407 | return $; 408 | } 409 | 410 | // compatible for node.js 411 | if(typeof(global) !== 'undefined' && typeof(global[statement]) === 'function' && global[statement].toString().match(/^\s*?function \w+\(\) \{\s*?\[native code\]\s*?\}\s*?$/i)) { 412 | return $; 413 | } 414 | 415 | // avoid re-declare registered function, if not do this, template 416 | // `{@if registered_func(name)}` could be throw undefined. 417 | 418 | if(typeof(ice_tmpl.options._method[statement]) === 'function' || ice_tmpl.options._method.hasOwnProperty(statement)) { 419 | method.push(statement); 420 | return $; 421 | } 422 | 423 | buffer.push(statement); // fuck ie 424 | } 425 | 426 | return $; 427 | }; 428 | 429 | tpl.replace(ice_tmpl.settings.forstart, variableAnalyze). 430 | replace(ice_tmpl.settings.interpolate, variableAnalyze). 431 | replace(ice_tmpl.settings.ifstart, variableAnalyze). 432 | replace(ice_tmpl.settings.elseifstart, variableAnalyze). 433 | replace(ice_tmpl.settings.include, variableAnalyze). 434 | replace(/[\+\-\*\/%!\?\|\^&~<>=,\(\)\[\]]\s*([A-Za-z_]+)/igm, variableAnalyze); 435 | 436 | for(var i = 0;i < buffer.length; i++) { 437 | prefix += 'var ' + buffer[i] + '=_.' + buffer[i] + ';'; 438 | } 439 | 440 | for(var i = 0;i < method.length; i++) { 441 | prefix += 'var ' + method[i] + '=_method.' + method[i] + ';'; 442 | } 443 | 444 | return '<% ' + prefix + ' %>'; 445 | }; 446 | 447 | this.__convert=function(tpl, strip) { 448 | var buffer = [].join(''); 449 | 450 | buffer += "'use strict';"; // use strict mode 451 | buffer += "var _=_||{};"; 452 | buffer += "var _out='';_out+='"; 453 | 454 | if(strip !== false) { 455 | buffer += tpl 456 | .replace(/\\/g, "\\\\") 457 | .replace(/[\r\t\n]/g, " ") 458 | .replace(/'(?=[^%]*%>)/g, "\t") 459 | .split("'").join("\\'") 460 | .split("\t").join("'") 461 | .replace(/<%=(.+?)%>/g, "';_out+=$1;_out+='") 462 | .split("<%").join("';") 463 | .split("%>").join("_out+='")+ 464 | "';return _out;"; 465 | 466 | return buffer; 467 | } 468 | 469 | buffer += tpl 470 | .replace(/\\/g, "\\\\") 471 | .replace(/[\r]/g, "\\r") 472 | .replace(/[\t]/g, "\\t") 473 | .replace(/[\n]/g, "\\n") 474 | .replace(/'(?=[^%]*%>)/g, "\t") 475 | .split("'").join("\\'") 476 | .split("\t").join("'") 477 | .replace(/<%=(.+?)%>/g, "';_out+=$1;_out+='") 478 | .split("<%").join("';") 479 | .split("%>").join("_out+='")+ 480 | "';return _out.replace(/[\\r\\n]\\s+[\\r\\n]/g, '\\r\\n');"; 481 | 482 | return buffer; 483 | }; 484 | 485 | this.parse = function(tpl, options) { 486 | var _that = this; 487 | 488 | if(!options || options.loose !== false) { 489 | tpl = this.__lexicalAnalyze(tpl) + tpl; 490 | } 491 | 492 | tpl = this.__removeShell(tpl, options); 493 | tpl = this.__toNative(tpl, options); 494 | 495 | this._render = new Function('_, _method', tpl); 496 | 497 | this.render = function(_, _method) { 498 | if(!_method || _method !== that.options._method) { 499 | _method = __creator(_method, that.options._method); 500 | } 501 | 502 | return _that._render.call(this, _, _method); 503 | }; 504 | 505 | return this; 506 | }; 507 | }; 508 | 509 | ice_tmpl.compile = function(tpl, options) { 510 | if(!options || options !== this.options) { 511 | options = __creator(options, this.options); 512 | } 513 | 514 | try { 515 | var engine = this.__cache[tpl] ? 516 | this.__cache[tpl] : 517 | new this.template(this.options).parse(tpl, options); 518 | 519 | if(!options || options.cache !== false) { 520 | this.__cache[tpl] = engine; 521 | } 522 | 523 | return engine; 524 | 525 | } catch(e) { 526 | __throw('ice_tmpl Compile Exception: ' + e.message); 527 | 528 | return { 529 | render: function() {} // noop 530 | }; 531 | } 532 | }; 533 | 534 | ice_tmpl.to_html = function(tpl, data, options) { 535 | if(!options || options !== this.options) { 536 | options = __creator(options, this.options); 537 | } 538 | 539 | return this.compile(tpl, options).render(data, options._method); 540 | }; 541 | 542 | typeof(module) !== 'undefined' && module.exports ? module.exports = ice_tmpl : this.ice_tmpl = ice_tmpl; 543 | 544 | })(); 545 | -------------------------------------------------------------------------------- /plugin/ice_tmpl/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 75 | --------------------------------------------------------------------------------