├── assets
├── 16.png
├── 24.png
├── 32.png
├── 64.png
├── 128.png
├── 256.png
├── audio
│ ├── drop.mp3
│ ├── wet.mp3
│ ├── arpeggio.mp3
│ ├── waterWave.wav
│ ├── oringz-w435.mp3
│ ├── oringz-w437.mp3
│ ├── quiet-knock.mp3
│ ├── all-eyes-on-me.mp3
│ ├── jingle-bells-sms.mp3
│ ├── smodyssey_piano.mp3
│ ├── jingle-jingle-bells.mp3
│ ├── you-wouldnt-believe.mp3
│ └── and-a-happy-new-year-sms.mp3
└── picture
│ ├── rest.png
│ ├── work.jpg
│ ├── drink.png
│ ├── medical.png
│ └── tea-cup.png
├── screenshots
├── drink.png
├── home.png
├── eyecare.png
├── introduce.png
├── notification.png
└── configuration.png
├── background.js
├── manifest.json
├── README.md
├── plugins
└── clockpicker
│ ├── clockpicker.css
│ ├── standalone.css
│ └── clockpicker.js
├── style.css
├── js
├── main.js
└── jquery-3.1.1.min.js
└── window.html
/assets/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/16.png
--------------------------------------------------------------------------------
/assets/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/24.png
--------------------------------------------------------------------------------
/assets/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/32.png
--------------------------------------------------------------------------------
/assets/64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/64.png
--------------------------------------------------------------------------------
/assets/128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/128.png
--------------------------------------------------------------------------------
/assets/256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/256.png
--------------------------------------------------------------------------------
/assets/audio/drop.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/drop.mp3
--------------------------------------------------------------------------------
/assets/audio/wet.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/wet.mp3
--------------------------------------------------------------------------------
/screenshots/drink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/drink.png
--------------------------------------------------------------------------------
/screenshots/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/home.png
--------------------------------------------------------------------------------
/assets/picture/rest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/picture/rest.png
--------------------------------------------------------------------------------
/assets/picture/work.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/picture/work.jpg
--------------------------------------------------------------------------------
/screenshots/eyecare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/eyecare.png
--------------------------------------------------------------------------------
/assets/audio/arpeggio.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/arpeggio.mp3
--------------------------------------------------------------------------------
/assets/audio/waterWave.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/waterWave.wav
--------------------------------------------------------------------------------
/assets/picture/drink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/picture/drink.png
--------------------------------------------------------------------------------
/assets/picture/medical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/picture/medical.png
--------------------------------------------------------------------------------
/assets/picture/tea-cup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/picture/tea-cup.png
--------------------------------------------------------------------------------
/screenshots/introduce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/introduce.png
--------------------------------------------------------------------------------
/assets/audio/oringz-w435.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/oringz-w435.mp3
--------------------------------------------------------------------------------
/assets/audio/oringz-w437.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/oringz-w437.mp3
--------------------------------------------------------------------------------
/assets/audio/quiet-knock.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/quiet-knock.mp3
--------------------------------------------------------------------------------
/screenshots/notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/notification.png
--------------------------------------------------------------------------------
/assets/audio/all-eyes-on-me.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/all-eyes-on-me.mp3
--------------------------------------------------------------------------------
/screenshots/configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/screenshots/configuration.png
--------------------------------------------------------------------------------
/assets/audio/jingle-bells-sms.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/jingle-bells-sms.mp3
--------------------------------------------------------------------------------
/assets/audio/smodyssey_piano.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/smodyssey_piano.mp3
--------------------------------------------------------------------------------
/assets/audio/jingle-jingle-bells.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/jingle-jingle-bells.mp3
--------------------------------------------------------------------------------
/assets/audio/you-wouldnt-believe.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/you-wouldnt-believe.mp3
--------------------------------------------------------------------------------
/assets/audio/and-a-happy-new-year-sms.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yinyimingall/Tomato-Clock/HEAD/assets/audio/and-a-happy-new-year-sms.mp3
--------------------------------------------------------------------------------
/background.js:
--------------------------------------------------------------------------------
1 | chrome.app.runtime.onLaunched.addListener(launch);
2 |
3 | function launch() {
4 | chrome.app.window.create('window.html', {
5 | id: 'main',
6 | bounds: {
7 | width: 1024,
8 | height: 720,
9 | left: 100,
10 | top: 100
11 | },
12 | minWidth: 960,
13 | minHeight: 640,
14 | alwaysOnTop: true
15 | });
16 | }
17 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "name": "Tomato",
4 | "version": "1.0.0",
5 | "description": "工作学习时间管理",
6 | "icons": {
7 | "48" : "assets/64.png",
8 | "128": "assets/128.png"
9 | },
10 | "permissions": [
11 | "storage",
12 | "alwaysOnTopWindows",
13 | "notifications"
14 | ],
15 | "app": {
16 | "background": {
17 | "scripts": ["background.js"]
18 | }
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tomato Clock 番茄时钟
2 | ## 介绍
3 | 番茄APP为了解决长时间使用电脑而忘记休息、护眼、喝水的问题而设计,番茄APP运行在Chrome上,
4 | 所以不管你是用window、Mac还是linux,只要装有Chrome浏览器的地方就能运行番茄APP。页面
5 | 经过我精心设计,我大体满意了。希望番茄APP可以帮你提高工作学习效率的同时带给你健康办公的习惯。
6 | ## 页面展示
7 | 介绍
8 | 
9 | 主页
10 | 
11 | 时钟设置
12 | 
13 | 声音设置
14 | 
15 | 护眼设置
16 | 
17 | 喝水设置
18 | 
19 |
20 | ## 使用技术
21 | 此APP使用基本HTML、CSS、JavaScript、Jquery完成。
22 |
--------------------------------------------------------------------------------
/plugins/clockpicker/clockpicker.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
3 | * Copyright 2014 Wang Shenwei.
4 | * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
5 | */
6 |
7 | .clockpicker .input-group-addon {
8 | cursor: pointer;
9 | }
10 | .clockpicker-moving {
11 | cursor: move;
12 | }
13 | .clockpicker-align-left.popover > .arrow {
14 | left: 25px;
15 | }
16 | .clockpicker-align-top.popover > .arrow {
17 | top: 17px;
18 | }
19 | .clockpicker-align-right.popover > .arrow {
20 | left: auto;
21 | right: 25px;
22 | }
23 | .clockpicker-align-bottom.popover > .arrow {
24 | top: auto;
25 | bottom: 6px;
26 | }
27 | .clockpicker-popover .popover-title {
28 | background-color: #fff;
29 | color: #999;
30 | font-size: 24px;
31 | font-weight: bold;
32 | line-height: 30px;
33 | text-align: center;
34 | }
35 | .clockpicker-popover .popover-title span {
36 | cursor: pointer;
37 | }
38 | .clockpicker-popover .popover-content {
39 | background-color: #f8f8f8;
40 | padding: 12px;
41 | }
42 | .popover-content:last-child {
43 | border-bottom-left-radius: 5px;
44 | border-bottom-right-radius: 5px;
45 | }
46 | .clockpicker-plate {
47 | background-color: #fff;
48 | border: 1px solid #ccc;
49 | border-radius: 50%;
50 | width: 200px;
51 | height: 200px;
52 | overflow: visible;
53 | position: relative;
54 | /* Disable text selection highlighting. Thanks to Hermanya */
55 | -webkit-touch-callout: none;
56 | -webkit-user-select: none;
57 | -khtml-user-select: none;
58 | -moz-user-select: none;
59 | -ms-user-select: none;
60 | user-select: none;
61 | }
62 | .clockpicker-canvas,
63 | .clockpicker-dial {
64 | width: 200px;
65 | height: 200px;
66 | position: absolute;
67 | left: -1px;
68 | top: -1px;
69 | }
70 | .clockpicker-minutes {
71 | visibility: hidden;
72 | }
73 | .clockpicker-tick {
74 | border-radius: 50%;
75 | color: #666;
76 | line-height: 26px;
77 | text-align: center;
78 | width: 26px;
79 | height: 26px;
80 | position: absolute;
81 | cursor: pointer;
82 | }
83 | .clockpicker-tick.active,
84 | .clockpicker-tick:hover {
85 | background-color: rgb(192, 229, 247);
86 | background-color: rgba(0, 149, 221, .25);
87 | }
88 | .clockpicker-button {
89 | background-image: none;
90 | background-color: #fff;
91 | border-width: 1px 0 0;
92 | border-top-left-radius: 0;
93 | border-top-right-radius: 0;
94 | margin: 0;
95 | padding: 10px 0;
96 | }
97 | .clockpicker-button:hover {
98 | background-image: none;
99 | background-color: #ebebeb;
100 | }
101 | .clockpicker-button:focus {
102 | outline: none!important;
103 | }
104 | .clockpicker-dial {
105 | -webkit-transition: -webkit-transform 350ms, opacity 350ms;
106 | -moz-transition: -moz-transform 350ms, opacity 350ms;
107 | -ms-transition: -ms-transform 350ms, opacity 350ms;
108 | -o-transition: -o-transform 350ms, opacity 350ms;
109 | transition: transform 350ms, opacity 350ms;
110 | }
111 | .clockpicker-dial-out {
112 | opacity: 0;
113 | }
114 | .clockpicker-hours.clockpicker-dial-out {
115 | -webkit-transform: scale(1.2, 1.2);
116 | -moz-transform: scale(1.2, 1.2);
117 | -ms-transform: scale(1.2, 1.2);
118 | -o-transform: scale(1.2, 1.2);
119 | transform: scale(1.2, 1.2);
120 | }
121 | .clockpicker-minutes.clockpicker-dial-out {
122 | -webkit-transform: scale(.8, .8);
123 | -moz-transform: scale(.8, .8);
124 | -ms-transform: scale(.8, .8);
125 | -o-transform: scale(.8, .8);
126 | transform: scale(.8, .8);
127 | }
128 | .clockpicker-canvas {
129 | -webkit-transition: opacity 175ms;
130 | -moz-transition: opacity 175ms;
131 | -ms-transition: opacity 175ms;
132 | -o-transition: opacity 175ms;
133 | transition: opacity 175ms;
134 | }
135 | .clockpicker-canvas-out {
136 | opacity: 0.25;
137 | }
138 | .clockpicker-canvas-bearing,
139 | .clockpicker-canvas-fg {
140 | stroke: none;
141 | fill: rgb(0, 149, 221);
142 | }
143 | .clockpicker-canvas-bg {
144 | stroke: none;
145 | fill: rgb(192, 229, 247);
146 | }
147 | .clockpicker-canvas-bg-trans {
148 | fill: rgba(0, 149, 221, .25);
149 | }
150 | .clockpicker-canvas line {
151 | stroke: rgb(0, 149, 221);
152 | stroke-width: 1;
153 | stroke-linecap: round;
154 | /*shape-rendering: crispEdges;*/
155 | }
156 | .clockpicker-button.am-button {
157 | margin: 1px;
158 | padding: 5px;
159 | border: 1px solid rgba(0, 0, 0, .2);
160 | border-radius: 4px;
161 |
162 | }
163 | .clockpicker-button.pm-button {
164 | margin: 1px 1px 1px 136px;
165 | padding: 5px;
166 | border: 1px solid rgba(0, 0, 0, .2);
167 | border-radius: 4px;
168 | }
169 |
--------------------------------------------------------------------------------
/plugins/clockpicker/standalone.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * ClockPicker v{package.version} for jQuery (http://weareoutman.github.io/clockpicker/)
3 | * Copyright 2014 Wang Shenwei.
4 | * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
5 | *
6 | * Bootstrap v3.1.1 (http://getbootstrap.com)
7 | * Copyright 2011-2014 Twitter, Inc.
8 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
9 | */
10 |
11 | /* Picked from bootstrap: .popover, .btn, .text-primary */
12 |
13 | .popover {
14 | position: absolute;
15 | top: 0;
16 | left: 0;
17 | z-index: 1010;
18 | display: none;
19 | max-width: 276px;
20 | padding: 1px;
21 | text-align: left;
22 | white-space: normal;
23 | background-color: #fff;
24 | background-clip: padding-box;
25 | border: 1px solid #ccc;
26 | border: 1px solid rgba(0, 0, 0, .2);
27 | border-radius: 6px;
28 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
29 | box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
30 | }
31 | .popover.top {
32 | margin-top: -10px;
33 | }
34 | .popover.right {
35 | margin-left: 10px;
36 | }
37 | .popover.bottom {
38 | margin-top: 10px;
39 | }
40 | .popover.left {
41 | margin-left: -10px;
42 | }
43 | .popover-title {
44 | padding: 8px 14px;
45 | margin: 0;
46 | font-size: 14px;
47 | font-weight: normal;
48 | line-height: 18px;
49 | background-color: #f7f7f7;
50 | border-bottom: 1px solid #ebebeb;
51 | border-radius: 5px 5px 0 0;
52 | }
53 | .popover-content {
54 | padding: 9px 14px;
55 | }
56 | .popover > .arrow,
57 | .popover > .arrow:after {
58 | position: absolute;
59 | display: block;
60 | width: 0;
61 | height: 0;
62 | border-color: transparent;
63 | border-style: solid;
64 | /* The following are set in WordPress (wp-admin/css/revisions.css) - reset them to initial values */
65 | overflow:visible;
66 | margin:0;
67 | padding:0;
68 | z-index:auto;
69 | background-color:transparent;
70 | -webkit-box-shadow:none;
71 | box-shadow:none;
72 | bottom:auto;
73 | left:auto;
74 | right:auto;
75 | top:auto;
76 | -webkit-transform:none;
77 | -ms-transform:none;
78 | transform:none;
79 | }
80 | .popover > .arrow {
81 | border-width: 11px;
82 | }
83 | .popover > .arrow:after {
84 | content: "";
85 | border-width: 10px;
86 | }
87 | .popover.top > .arrow {
88 | bottom: -11px;
89 | left: 50%;
90 | margin-left: -11px;
91 | border-top-color: #999;
92 | border-top-color: rgba(0, 0, 0, .25);
93 | border-bottom-width: 0;
94 | }
95 | .popover.top > .arrow:after {
96 | bottom: 1px;
97 | margin-left: -10px;
98 | content: " ";
99 | border-top-color: #fff;
100 | border-bottom-width: 0;
101 | }
102 | .popover.right > .arrow {
103 | top: 50%;
104 | left: -11px;
105 | margin-top: -11px;
106 | border-right-color: #999;
107 | border-right-color: rgba(0, 0, 0, .25);
108 | border-left-width: 0;
109 | }
110 | .popover.right > .arrow:after {
111 | bottom: -10px;
112 | left: 1px;
113 | content: " ";
114 | border-right-color: #fff;
115 | border-left-width: 0;
116 | }
117 | .popover.bottom > .arrow {
118 | top: -11px;
119 | left: 50%;
120 | margin-left: -11px;
121 | border-top-width: 0;
122 | border-bottom-color: #999;
123 | border-bottom-color: rgba(0, 0, 0, .25);
124 | }
125 | .popover.bottom > .arrow:after {
126 | top: 1px;
127 | margin-left: -10px;
128 | content: " ";
129 | border-top-width: 0;
130 | border-bottom-color: #fff;
131 | }
132 | .popover.left > .arrow {
133 | top: 50%;
134 | right: -11px;
135 | margin-top: -11px;
136 | border-right-width: 0;
137 | border-left-color: #999;
138 | border-left-color: rgba(0, 0, 0, .25);
139 | }
140 | .popover.left > .arrow:after {
141 | right: 1px;
142 | bottom: -10px;
143 | content: " ";
144 | border-right-width: 0;
145 | border-left-color: #fff;
146 | }
147 | .btn {
148 | cursor: pointer;
149 | -webkit-user-select: none;
150 | -moz-user-select: none;
151 | -ms-user-select: none;
152 | user-select: none;
153 | background-image: none;
154 | border: 1px solid transparent;
155 |
156 | }
157 | .btn:focus,
158 | .btn:active:focus,
159 | .btn.active:focus {
160 | outline: thin dotted;
161 | outline: 5px auto -webkit-focus-ring-color;
162 | outline-offset: -2px;
163 | }
164 | .btn:hover,
165 | .btn:focus {
166 | color: #333;
167 | text-decoration: none;
168 | }
169 | .btn:active,
170 | .btn.active {
171 | background-image: none;
172 | outline: 0;
173 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
174 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
175 | }
176 | .btn-default {
177 | color: #333;
178 | background-color: #fff;
179 | border-color: #ccc;
180 | }
181 | .btn-default:hover,
182 | .btn-default:focus,
183 | .btn-default:active,
184 | .btn-default.active,
185 | .open .dropdown-toggle.btn-default {
186 | color: #333;
187 | background-color: #ebebeb;
188 | border-color: #adadad;
189 | }
190 | .btn-default:active,
191 | .btn-default.active,
192 | .open .dropdown-toggle.btn-default {
193 | background-image: none;
194 | }
195 | .btn-block {
196 | display: block;
197 | width: 100%;
198 | }
199 | .text-primary {
200 | color: #428bca;
201 | }
202 |
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | font-size: 14px;
5 | }
6 | a {
7 | text-decoration: none;
8 | }
9 | header nav ul li {
10 | height: 58px;
11 | list-style: none;
12 | float: left;
13 | }
14 | header nav ul li:last-child {
15 | float: right;
16 | width: 32%;
17 | }
18 | #home-button {
19 | width: 40%;
20 | }
21 | #desc-button {
22 | width: 58px;
23 | }
24 |
25 | header nav {
26 | -webkit-app-region: drag;
27 | width: 100%;
28 | height: 58px;
29 | background-color: rgb(117, 176, 128);
30 | }
31 | header nav ul li a {
32 | color: rgb(212, 212, 212);
33 | width: 100%;
34 | height: 100%;
35 | display: block;
36 | font-size: 19px;
37 | text-align: center;
38 | line-height: 58px;
39 | }
40 | header nav ul li a:hover {
41 | color: white;
42 | }
43 | .nav-selected {
44 | color: white;
45 | background-color: rgb(93, 150, 104);
46 | }
47 |
48 | #tomato-state {
49 | border-radius: 12px;
50 | height: 34px;
51 | width: 100px;
52 | line-height: 34px;
53 | background-color: rgb(102, 161, 113);
54 | color: rgb(17, 83, 83);
55 | display: inline-block;;
56 | font-size: 18px;
57 | text-align: center;
58 | margin: 12;
59 | }
60 |
61 |
62 | /*start main page*/
63 | #mainPage {
64 | width: 100%;
65 | height: 100%;
66 | }
67 | #countdown {
68 | margin-top: 60px;
69 | font-size: 84px;
70 | text-align: center;
71 | }
72 | #start-button {
73 | width: 120px;
74 | height: 120px;
75 | margin: auto;
76 | margin-top: 20px;
77 | }
78 | #start-button a {
79 | display: block;
80 | width: 100%;
81 | height: 100%;
82 | font-size: 24px;
83 | text-align: center;
84 | line-height: 120px;
85 | border-radius: 100%;
86 | color: white;
87 | background-color: rgb(93, 150, 104);
88 | }
89 | .convert-button a {
90 | color: white !important;
91 | background-color: rgb(107, 10, 10) !important;
92 | }
93 |
94 | .task-message {
95 | padding: 36px;
96 | text-align: center;
97 | }
98 | .task-title{
99 | text-align: left;
100 | margin: auto;
101 | width: 460px;
102 | }
103 | .task-message p {
104 | font-size: 15px;
105 | color: rgb(81, 138, 104);
106 | }
107 | .task-title > p {
108 | color: rgb(144, 57, 24)
109 | }
110 | .task-message table {
111 | margin: auto;
112 | width: 460px;
113 | height: 120px;
114 | margin-bottom: 6px;
115 | /*border: 1px solid black;*/
116 | }
117 | .task-message table th {
118 | font-size: 16px;
119 | color: rgb(68, 131, 90)
120 | /*border: 1px solid green;*/
121 | }
122 | .task-message table td {
123 | font-size: 16px;
124 | text-align: center;
125 | /*border: 1px solid red;*/
126 | }
127 | .task-message span {
128 | font-size: 18px;
129 | color: rgb(200, 60, 0)
130 | }
131 | .task-message span .td-color {
132 | color: rgb(61, 68, 131);
133 | }
134 |
135 | /*end of main page*/
136 |
137 |
138 | /*strat description page*/
139 | #description h2 {
140 | text-align: center;
141 | margin-top: 32px;
142 | font-size: 32px;
143 | }
144 | #description p {
145 | margin: auto;
146 | width: 640px;
147 | margin-top: 24px;
148 | font-size: 18px;
149 | text-align: justify;
150 | }
151 | .limit-container {
152 | width: 640px;
153 | margin: auto;
154 | text-align: right;
155 | }
156 | #description a {
157 |
158 | }
159 | /*end of description page*/
160 |
161 | /*start configure page*/
162 | #configure {
163 |
164 | }
165 | #configure nav {
166 | width: 240px;
167 | float: left;
168 | }
169 | #configure nav ul {
170 | width: 120px;
171 | margin: auto;
172 | margin-top: 60px;
173 | }
174 | #configure nav ul li {
175 | height: 48px;
176 | width: 100%;
177 | text-align: center;
178 | list-style: none;
179 | }
180 | #configure nav ul li a {
181 | display: block;
182 | height: 100%;
183 | width: 100%;
184 | text-align: center;
185 | font-size: 19px;
186 | line-height: 52px;
187 | color: rgb(52, 87, 77);
188 | border-radius: 3px;
189 | }
190 | #configure nav ul li a:hover:not(.config-selected) {
191 | color: rgb(50, 75, 65);
192 | background: rgba(190, 190, 190, 0.4);
193 | }
194 | .config-selected {
195 | color: white !important;
196 | background: rgb(137, 95, 161);
197 | }
198 |
199 | .config-content {
200 | width: 700px;
201 | float: left;
202 | padding-top: 60px;
203 | padding-left: 20px;
204 | }
205 | label {
206 | font-size: 18px;
207 | margin-bottom: 12px;
208 | }
209 | input {
210 | width: 240px;
211 | height: 36px;
212 | font-size: 18px;
213 | }
214 |
215 | .tgl{display:none}
216 | .tgl,.tgl *,.tgl :after,.tgl :before,.tgl+.tgl-btn,.tgl:after,.tgl:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
217 | .tgl ::-moz-selection,.tgl :after::-moz-selection,.tgl :before::-moz-selection,.tgl+.tgl-btn::-moz-selection,.tgl::-moz-selection,.tgl:after::-moz-selection,.tgl:before::-moz-selection{background:0 0}
218 | .tgl ::selection,.tgl :after::selection,.tgl :before::selection,.tgl+.tgl-btn::selection,.tgl::selection,.tgl:after::selection,.tgl:before::selection{background:0 0}
219 | .tgl+.tgl-btn{outline:0;display:block;width:4em;height:2em;position:relative;cursor:pointer}
220 | .tgl+.tgl-btn:after,.tgl+.tgl-btn:before{position:relative;display:block;content:"";width:50%;height:100%}
221 | .tgl+.tgl-btn:after{left:0}
222 | .tgl+.tgl-btn:before{display:none}
223 | .tgl:checked+.tgl-btn:after{left:50%}
224 |
225 | .tgl-flip+.tgl-btn{padding:2px;-webkit-transition:all .2s ease;transition:all .2s ease;font-family:sans-serif;-webkit-perspective:100px;-ms-perspective:100px;perspective:100px}
226 | .tgl-flip+.tgl-btn:after,.tgl-flip+.tgl-btn:before{display:inline-block;-webkit-transition:all .4s ease;transition:all .4s ease;width:100%;text-align:center;position:absolute;line-height:2em;font-weight:700;color:#fff;position:absolute;top:0;left:0;-webkit-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden;border-radius:4px}
227 | .tgl-flip+.tgl-btn:after{content:attr(data-tg-on);background:#02C66F;-webkit-transform:rotateY(-180deg);-ms-transform:rotateY(-180deg);transform:rotateY(-180deg)}
228 | .tgl-flip+.tgl-btn:before{background:#FF3A19;content:attr(data-tg-off)}
229 | .tgl-flip+.tgl-btn:active:before{-webkit-transform:rotateY(-20deg);-ms-transform:rotateY(-20deg);transform:rotateY(-20deg)}
230 | .tgl-flip:checked+.tgl-btn:before{-webkit-transform:rotateY(180deg);-ms-transform:rotateY(180deg);transform:rotateY(180deg)}
231 | .tgl-flip:checked+.tgl-btn:after{-webkit-transform:rotateY(0);-ms-transform:rotateY(0);transform:rotateY(0);left:0;background:#279865}
232 | .tgl-flip:checked+.tgl-btn:active:after{-webkit-transform:rotateY(20deg);-ms-transform:rotateY(20deg);transform:rotateY(20deg)}
233 |
234 |
235 |
236 |
237 | .tgl-skewed+.tgl-btn{overflow:hidden;-webkit-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:all .2s ease;transition:all .2s ease;font-family:sans-serif;background:#888}
238 | .tgl-skewed+.tgl-btn:after,.tgl-skewed+.tgl-btn:before{display:inline-block;-webkit-transition:all .2s ease;transition:all .2s ease;width:100%;text-align:center;position:absolute;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,.4)}
239 | .tgl-skewed+.tgl-btn:after{left:100%;content:attr(data-tg-on)}
240 | .tgl-skewed+.tgl-btn:before{left:0;content:attr(data-tg-off)}
241 | .tgl-skewed+.tgl-btn:active{background:#888}
242 | .tgl-skewed+.tgl-btn:active:before{left:-10%}
243 | .tgl-skewed:checked+.tgl-btn{background:#86d993}
244 | .tgl-skewed:checked+.tgl-btn:before{left:-100%}
245 | .tgl-skewed:checked+.tgl-btn:after{left:0}
246 | .tgl-skewed:checked+.tgl-btn:active:after{left:10%}
247 |
248 |
249 | .button {
250 | margin: 15px 0 35px;
251 |
252 | }
253 |
254 |
255 | /*----------notification configuration page--------*/
256 | .notif-item {
257 | margin-top: 18px;
258 | margin-bottom: 28px;
259 | }
260 | .notif-item form span {
261 | font-size: 18px;
262 | color: rgb(116, 59, 32);
263 | margin-right: 32px;
264 |
265 | }
266 | .notif-item form {
267 | float: left;
268 | margin-right: 36px;
269 | }
270 | .notif-item select {
271 | height: 34px;
272 | width: 220px;
273 | border: none;
274 | border-radius: 3px;
275 | font-size: 18px;
276 | padding: 0px 8px;
277 | background-color: rgba(128, 0, 255, 0.1);
278 | outline: none;
279 | -webkit-appearance: none;
280 | appearance: none;
281 | }
282 | #reset1 {
283 | width: 4em;
284 | height: 2em;
285 | color: white;
286 | font-size: 18px;
287 | font-weight: 500;
288 | text-align: center;
289 | line-height: 2em;
290 | display: block;
291 | background-color: rgb(109, 134, 167);
292 | border-radius: 3px;
293 | }
294 | /*end of notification configuration page*/
295 |
296 |
297 | /*-------drink water page-------*/
298 | .time-item {
299 | margin-bottom: 22px;
300 | }
301 | .time-item>div {
302 | float: left;
303 | }
304 | .list-title {
305 | font-size: 16px;
306 | font-weight: 500;
307 | margin-right: 32px;
308 | color: rgb(32, 88, 75);
309 | }
310 | .time-item div input {
311 | outline: none;
312 | border: none;
313 | text-align: center;
314 | border-radius: 3px;
315 | margin-right: 42px;
316 | background-color: rgba(59, 149, 158, 0.2);
317 | }
318 | .toggle-button{
319 | width: 3em !important;
320 | height: 1.5em !important;
321 | line-height:1.5em;font-weight:700;
322 | border-radius: 3px;
323 | }
324 | /*end of drink water page*/
325 |
326 | /*-----about page------*/
327 | .about {
328 | text-align: center;
329 | margin-left: -50px;
330 | }
331 | .about h2 {
332 | font-size: 24px;
333 | color: rgb(91, 63, 136);
334 | margin-bottom: 20px;
335 | }
336 | .about p {
337 | font-size: 18px;
338 | color: rgb(55, 85, 48);
339 | margin-bottom: 12px;
340 | }
341 | /*end of about page*/
342 |
343 | /*end of configure page*/
344 |
345 |
346 |
347 | /*input------------------------*/
348 | .input {
349 | position: relative;
350 | z-index: 1;
351 | display: inline-block;
352 | margin: 0;
353 | max-width: 400px;
354 | width: calc(100% - 2em);
355 | vertical-align: top;
356 | }
357 |
358 | .input__field {
359 | position: relative;
360 | display: block;
361 | float: right;
362 | padding: 0.8em;
363 | width: 60%;
364 | border: none;
365 | border-radius: 0;
366 | background: #f0f0f0;
367 | color: #aaa;
368 | font-weight: bold;
369 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
370 | -webkit-appearance: none; /* for box shadows to show on iOS */
371 | }
372 |
373 | .input__field:focus {
374 | outline: none;
375 | }
376 |
377 | .input__label {
378 | display: inline-block;
379 | float: right;
380 | padding: 0 1em;
381 | width: 40%;
382 | color: #6a7989;
383 | font-weight: bold;
384 | font-size: 70.25%;
385 | -webkit-touch-callout: none;
386 | -webkit-user-select: none;
387 | -khtml-user-select: none;
388 | -moz-user-select: none;
389 | -ms-user-select: none;
390 | user-select: none;
391 | }
392 |
393 | .input__label-content {
394 | position: relative;
395 | display: block;
396 | padding: 1.6em 0;
397 | width: 100%;
398 | font-size: 18px;
399 | }
400 | /* Isao */
401 | .input__field--isao {
402 | z-index: 10;
403 | padding: 0.75em 0.1em 0.25em;
404 | width: 100%;
405 | background: transparent;
406 | color: #133f75;
407 | }
408 |
409 | .input__label--isao {
410 | position: relative;
411 | overflow: hidden;
412 | padding: 0;
413 | width: 100%;
414 | color: #bf520b;
415 | font-size: 19px;
416 | text-align: left;
417 | }
418 |
419 | .input__label--isao::before {
420 | content: '';
421 | position: absolute;
422 | top: 0;
423 | width: 100%;
424 | height: 7px;
425 | background: #dadada;
426 | -webkit-transform: scale3d(1, 0.4, 1);
427 | transform: scale3d(1, 0.4, 1);
428 | -webkit-transform-origin: 50% 100%;
429 | transform-origin: 50% 100%;
430 | -webkit-transition: -webkit-transform 0.3s, background-color 0.3s;
431 | transition: transform 0.3s, background-color 0.3s;
432 | -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
433 | transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
434 | }
435 |
436 | .input__label--isao::after {
437 | content: attr(data-content);
438 | position: absolute;
439 | top: 0;
440 | left: 0;
441 | padding: 0.75em 0.15em;
442 | color: #da7071;
443 | opacity: 0;
444 | -webkit-transform: translate3d(0, 50%, 0);
445 | transform: translate3d(0, 50%, 0);
446 | -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
447 | transition: opacity 0.3s, transform 0.3s;
448 | -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
449 | transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
450 | pointer-events: none;
451 | }
452 |
453 | .input__field--isao:focus + .input__label--isao::before {
454 | background-color: #da7071;
455 | -webkit-transform: scale3d(1, 1, 1);
456 | transform: scale3d(1, 1, 1);
457 | }
458 |
459 | .input__field--isao:focus + .input__label--isao {
460 | pointer-events: none;
461 | }
462 |
463 | .input__field--isao:focus + .input__label--isao::after {
464 | opacity: 1;
465 | -webkit-transform: translate3d(0, 0, 0);
466 | transform: translate3d(0, 0, 0);
467 | }
468 |
469 | .input__label-content--isao {
470 | padding: 0.75em 0.15em;
471 | -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
472 | transition: opacity 0.3s, transform 0.3s;
473 | -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
474 | transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
475 | }
476 |
477 | .input__field--isao:focus + .input__label--isao .input__label-content--isao {
478 | opacity: 0;
479 | -webkit-transform: translate3d(0, -50%, 0);
480 | transform: translate3d(0, -50%, 0);
481 | }
482 |
--------------------------------------------------------------------------------
/js/main.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $('.clockpicker').clockpicker();
3 | });
4 | $(document).ready(function() {
5 | var processFlag = false;
6 |
7 | var numberInfoObj = {
8 | counts: 0,
9 | short: 0,
10 | long: 0
11 | }
12 | var timeInfoObj = {
13 | worktime: 0,
14 | shorttime: 0,
15 | longtime: 0
16 | }
17 |
18 | var workTimeInterval, shortTimeInterval, longTimeInterval;
19 |
20 | var tomatoCountState, workTimeState, shortTimeState, longTimeState;
21 |
22 | var $tomatoCount = $('#tomato-number');
23 | var $workTime = $('#work-period');
24 | var $shortTime = $('#short-rest');
25 | var $longTime = $('#long-rest');
26 |
27 | var $eyeCare = $('#eyecare');
28 | var $tomatoState = $('#tomato-state');
29 |
30 | var tomatoStorage = {
31 |
32 | }
33 |
34 | chrome.storage.local.get(null, function(result){
35 | if(!$.isEmptyObject(result)) {
36 | console.log('有storage');
37 | console.log(result);
38 | tomatoCountState = result.tomato_number;
39 | workTimeState = result.work_time*60;
40 | shortTimeState = result.short_rest*60;
41 | longTimeState = result.long_rest*60;
42 | audioArray = result.audioArr;
43 | audioSwitchArray = result.isAudioItems;
44 | drinkCheckArray = result.drinklist;
45 | showCountdown(workTimeState);
46 | audioResetView();
47 | audioResetButton();
48 | drinkResetView();
49 | $tomatoCount.val(tomatoCountState);
50 | $workTime.val(workTimeState/60);
51 | $shortTime.val(shortTimeState/60);
52 | $longTime.val(longTimeState/60);
53 |
54 | eyeTimeState = result.eye_care * 60;
55 | $eyeCare.val(result.eye_care);
56 | } else {
57 | console.log('初始设置');
58 | tomatoCountState = $tomatoCount.val();
59 | workTimeState = $workTime.val()*60;
60 | shortTimeState = $shortTime.val()*60;
61 | longTimeState = $longTime.val()*60;
62 | eyeTimeState = $eyeCare.val()*60;
63 | audioSwitchArray = [true, true, true, true, true];
64 | audioArray = [7,3,11,0,2];
65 | getDrinkList();
66 | tomatoStorage = {
67 | tomato_number : tomatoCountState,
68 | work_time : workTimeState/60,
69 | short_rest : shortTimeState/60,
70 | long_rest : longTimeState/60,
71 | isAudioItems : [true, true, true, true, true],
72 | audioArr : audioArray,
73 | eye_care : eyeTimeState/60,
74 | drinklist : drinkCheckArray
75 | }
76 |
77 | chrome.storage.local.set( tomatoStorage, function(){
78 | console.log('storage complited')
79 | });
80 |
81 | }
82 | });
83 |
84 | chrome.storage.onChanged.addListener(function(changes, namespace) {
85 | for (key in changes) {
86 | var storageChange = changes[key];
87 | console.log('Storage key "%s" in namespace "%s" changed. ' +
88 | 'Old value was "%s", new value is "%s".',
89 | key,
90 | namespace,
91 | storageChange.oldValue,
92 | storageChange.newValue);
93 | }
94 | });
95 |
96 | var $navSeleting = $('header nav ul li');
97 | var $section = $('main > div');
98 | $navSeleting.bind("click", function(event){
99 | $(this).siblings('li').find('a').removeClass('nav-selected');
100 | $(this).find('a').addClass('nav-selected');
101 | $section.hide();
102 | $section.eq( $(this).index() ).show();
103 | });
104 |
105 | var $configSeleting = $('#configure nav ul li');
106 | var $configSection = $('#configure > div');
107 | $configSeleting.bind("click", function(event){
108 | $(this).siblings('li').find('a').removeClass('config-selected');
109 | $(this).find('a').addClass('config-selected');
110 | $configSection.hide();
111 | $configSection.eq( $(this).index() ).show();
112 | });
113 |
114 | // 当前信息显示
115 | var $messageFinished = $('#message-finished');
116 | var $messageNember = $('#message-number');
117 | var $thTomato = $('#th-tomato');
118 | var $thShort = $('#th-short');
119 | var $thLong = $('#th-long');
120 | var $tdWorktime = $('#td-worktime');
121 | var $tdShorttime = $('#td-shorttime');
122 | var $tdLongtime = $('#td-longtime');
123 | var $totalTime = $('#total-time');
124 | function showMessage(){
125 | $messageFinished.html((numberInfoObj.counts/tomatoCountState).toFixed(2));
126 | $messageNember.html(tomatoCountState);
127 | $thTomato.html(numberInfoObj.counts);
128 | $thShort.html(numberInfoObj.short);
129 | $thLong.html(numberInfoObj.long);
130 |
131 | var transfer = function(time, res){
132 | var hour, minute;
133 | time = time/60;
134 | hour = parseInt( time/60);
135 | minute = Math.ceil(time % 60);
136 | if(res === 0){
137 | return hour;
138 | } else if (res === 1) {
139 | return minute;
140 | }
141 | }
142 | var total = timeInfoObj.worktime+timeInfoObj.shorttime+timeInfoObj.longtime;
143 | $tdWorktime.html(transfer(timeInfoObj.worktime, 0)+'小时'+transfer(timeInfoObj.worktime, 1)+'分钟');
144 | $tdShorttime.html(transfer(timeInfoObj.shorttime, 0)+'小时'+transfer(timeInfoObj.shorttime, 1)+'分钟');
145 | $tdLongtime.html(transfer(timeInfoObj.longtime, 0)+'小时'+transfer(timeInfoObj.longtime, 1)+'分钟');
146 | $totalTime.html(transfer(total, 0) + '小时' +transfer(total, 1) + '分钟');
147 | }
148 | /*---------------*/
149 | var messageInterval;
150 | $('#start-button').bind("click", function(){
151 | if(processFlag == true) {
152 | processFlag = false;
153 | $(this).removeClass('convert-button a').find('a').text('开始');
154 | } else {
155 | processFlag = true;
156 | $(this).addClass('convert-button a').find('a').text('停止');
157 | }
158 | if(processFlag) {
159 | process();
160 | messageInterval = setInterval(function(){
161 | showMessage();
162 | }, 60000);
163 | } else {
164 | numberInfoObj.counts = 0;
165 | if(workTimeInterval) clearInterval(workTimeInterval);
166 | if(shortTimeInterval) clearInterval(shortTimeInterval);
167 | if(longTimeInterval) clearInterval(longTimeInterval);
168 | clearInterval(messageInterval);
169 | $('#countdown').css('color', 'black');
170 | showCountdown(workTimeState);
171 | $tomatoState.html("无番茄");
172 | }
173 | });
174 |
175 |
176 | $('#clock-config input').change( function(){
177 | var tomatoCountValue = parseInt( $('#tomato-number').val());
178 | var longBreakTimeValue = parseInt( $('#long-rest').val());
179 | var shortBreakTimeValue = parseInt( $('#short-rest').val());
180 | var workTimeValue = parseInt( $('#work-period').val());
181 |
182 | var saveObj = {
183 | tomato_number : tomatoCountValue,
184 | work_time : workTimeValue,
185 | short_rest : shortBreakTimeValue,
186 | long_rest : longBreakTimeValue
187 | };
188 | chrome.storage.local.set(saveObj, function(){
189 | chrome.storage.local.get(saveObj, function(result){
190 | tomatoCountState = result.tomato_number;
191 | workTimeState = result.work_time * 60;
192 | shortTimeState = result.short_rest * 60;
193 | longTimeState = result.long_rest * 60;
194 | console.log('时钟设置已储存');
195 | showCountdown(workTimeState);
196 |
197 | });
198 | });
199 |
200 | });
201 |
202 |
203 |
204 | var $selectList = $('.notify-select');
205 | var audioArray = new Array();
206 | $selectList.each(function(index, el) {
207 | audioArray[index] = $(this).val();
208 | });
209 |
210 | $('.notif-item select').change(function(event) {
211 | $selectList.each(function(index, el) {
212 | audioArray[index] = $(this).val();
213 | console.log('元素' + audioArray[index]);
214 | });
215 |
216 | var audio = {
217 | audioArr : audioArray
218 | };
219 | chrome.storage.local.set( audio, function(){
220 | chrome.storage.local.get( audio, function(result) {
221 | audioArray = result.audioArr;
222 |
223 | for(var i = 0; i < audioArray.length; i++) {
224 | console.log(audioArray[i] + ' :数字对应html里audio的声音');
225 |
226 | }
227 | });
228 | console.log('提醒声音已储存');
229 | });
230 | console.log('select改变了');
231 |
232 | });
233 |
234 | var $notifyAudioReset = $('.notif-item');
235 | var audioResetStateArray = [7,3,11,0,2];
236 | function audioResetView(){
237 | $notifyAudioReset.find("select[name='work'] option").eq(audioArray[0]).prop('selected', true);
238 | $notifyAudioReset.find("select[name='shortrest'] option").eq(audioArray[1]).prop('selected', true);
239 | $notifyAudioReset.find("select[name='longrest'] option").eq(audioArray[2]).prop('selected', true);
240 | $notifyAudioReset.find("select[name='eyecare'] option").eq(audioArray[3]).prop('selected', true);
241 | $notifyAudioReset.find("select[name='drink'] option").eq(audioArray[4]).prop('selected', true);
242 | }
243 |
244 | $('#reset1').bind("click", function(){
245 | $notifyAudioReset.find("select[name='work']").find("option[value='7']").prop('selected', true);
246 | $notifyAudioReset.find("select[name='shortrest']").find("option[value='3']").prop('selected', true);
247 | $notifyAudioReset.find("select[name='longrest']").find("option[value='11']").prop('selected', true);
248 | $notifyAudioReset.find("select[name='eyecare']").find("option[value='0']").prop('selected', true);
249 | $notifyAudioReset.find("select[name='drink']").find("option[value='2']").prop('selected', true);
250 | var audio = {
251 | audioArr : audioResetStateArray
252 | };
253 | chrome.storage.local.set( audio, function(){
254 | chrome.storage.local.get( audio, function(result) {
255 | audioArray = result.audioArr;
256 | });
257 | });
258 | });
259 |
260 | var $audioSwitch = $('.audio-switch');
261 |
262 | function audioResetButton(){
263 | $audioSwitch.each(function(index, el){
264 | if(audioSwitchArray[index]){
265 | $(this).prop("checked", true);
266 | } else{
267 | $(this).prop("checked", false);
268 | }
269 | });
270 | }
271 | $audioSwitch.bind("click", function(){
272 | $audioSwitch.each(function(index, el) {
273 | if( $(this).is(":checked")){
274 | audioSwitchArray[index] = true;
275 | } else {
276 | audioSwitchArray[index] = false;
277 | }
278 | console.log(audioSwitchArray[index]+'....'+index);
279 | });
280 | var isAudioStorage = {
281 | isAudioItems: audioSwitchArray
282 | }
283 | chrome.storage.local.set( isAudioStorage, function(){
284 | chrome.storage.local.get( isAudioStorage, function(result) {
285 | audioSwitchArray = result.isAudioItems;
286 | });
287 | });
288 |
289 | });
290 |
291 | var eyeSwitchState = false;
292 | var $eyeSwitch = $('#eye-button');
293 | $eyeSwitch.bind("click", function(){
294 | if($(this).is(':checked')) {
295 | eyeSwitchState = true;
296 | } else {
297 | eyeSwitchState = false;
298 | }
299 | if(eyeSwitchState) {
300 | eyecareProcess();
301 | } else {
302 | clearInterval(eyeTimeInterval);
303 | }
304 | });
305 |
306 | var eyeTimeInterval;
307 |
308 | var eyeTimeState = parseInt( $eyeCare.val()) * 60;
309 |
310 | $eyeCare.change(function(event) {
311 |
312 | var eyeStorage = $eyeCare.val();
313 | chrome.storage.local.set( {'eye_care' : eyeStorage}, function(){
314 |
315 | });
316 | eyeTimeState = parseInt(eyeStorage) * 60;
317 | });
318 |
319 | var drinkSwitch = $('#drink-button');
320 | var drinkSwitchState = false;
321 | drinkSwitch.bind("click", function(){
322 | if($(this).is(':checked')) {
323 | console.log('喝水选中的');
324 | drinkSwitchState = true;
325 | } else {
326 | drinkSwitchState = false;
327 | }
328 | if(drinkSwitchState) {
329 | drinkProcess();
330 | } else {
331 | clearInterval(drinkTimeInterval);
332 | }
333 | });
334 |
335 | var $drinkInputList = $('.form-control');
336 | var drinkInput = $('.clockpicker input');
337 | var drinkCheckArray = new Array();
338 |
339 | function drinkResetView(){
340 | var arr = new Array();
341 | var st, end;
342 | console.log(drinkCheckArray)
343 | for( v in drinkCheckArray){
344 | if (drinkCheckArray.hasOwnProperty(v)) {
345 |
346 | st = drinkCheckArray[v].substring(0, 2);
347 | end = drinkCheckArray[v].substring(2, 4);
348 | arr[v] = st + ':' + end;
349 | }
350 | }
351 | $drinkInputList.each(function(index, el){
352 | $(this).val(arr[index]);
353 | });
354 |
355 | }
356 |
357 |
358 | function getDrinkList(){
359 | var arr = new Array();
360 | $drinkInputList.each(function(index, el) {
361 | arr[index] = $(this).val();
362 | });
363 |
364 | var st, end;
365 | for (var v in arr) {
366 | if (arr.hasOwnProperty(v)) {
367 | st = arr[v].substring(0, 2);
368 | end = arr[v].substring(3, 5);
369 | arr[v] = st + end;
370 | }
371 | }
372 | drinkCheckArray = arr;
373 | }
374 | drinkInput.change(function(event) {
375 | console.log('喝水设置改变了');
376 | getDrinkList();
377 | var drinkArrayStorage = {
378 | drinklist : drinkCheckArray
379 | }
380 | chrome.storage.local.set( drinkArrayStorage, function(){
381 | chrome.storage.local.get( drinkArrayStorage, function(result) {
382 | drinkCheckArray = result.drinklist;
383 | });
384 | });
385 | });
386 |
387 | var drinkTimeInterval;
388 | function drinkProcess(){
389 | drinkTimeInterval = setInterval(function(){
390 | var drinkDate = new Date();
391 | var hours = drinkDate.getHours();
392 | var minutes = drinkDate.getMinutes();
393 | console.log(hours+minutes+ '时钟相加');
394 | console.log(hours + ':' + minutes);
395 | for (var v in drinkCheckArray) {
396 | if (drinkCheckArray.hasOwnProperty(v)) {
397 | if (drinkCheckArray[v] == (hours * 100 + minutes)) {
398 | console.log(hours + ':' + minutes + '喝水到');
399 | playAduio(4, audioArray, audioSwitchArray[4]);
400 | drinkNotify();
401 | }
402 | }
403 | }
404 | }, 60000);
405 | }
406 |
407 | function process() {
408 | if(processFlag) {
409 | timeColor(true);
410 | var workTime = workTimeState;
411 | var shortTime = shortTimeState;
412 | var longTime = longTimeState;
413 | playAduio(0, audioArray, audioSwitchArray[0]);
414 | workTimeNotify();
415 | tomatoState(0);
416 | var itemFlag = false;
417 | numberInfoObj.counts++;
418 | console.log('numberInfoObj.counts = ' + numberInfoObj.counts);
419 | showMessage();
420 | workTimeInterval = setInterval(function(){
421 | console.log('工作时间');
422 | workTime--;
423 | timeInfoObj.worktime++;
424 | showCountdown(workTime);
425 | if(workTime == 0 && numberInfoObj.counts % tomatoCountState != 0) {
426 | numberInfoObj.short++;
427 | timeColor(false);
428 | playAduio(1, audioArray, audioSwitchArray[1]);
429 | shortRestNotify();
430 | tomatoState(1);
431 | clearInterval(workTimeInterval);
432 | shortTimeInterval = setInterval(function(){
433 | console.log('短时间');
434 | shortTime--;
435 | timeInfoObj.shorttime++;
436 | showCountdown(shortTime);
437 | if(shortTime == 0) {
438 | itemFlag = true;
439 | clearInterval(shortTimeInterval);
440 | if(itemFlag) {
441 | process();
442 | }
443 | }
444 | },1000);
445 | }
446 | if (workTime == 0 && numberInfoObj.counts % tomatoCountState == 0) {
447 | numberInfoObj.long++;
448 | timeColor(false);
449 | playAduio(2, audioArray, audioSwitchArray[2]);
450 | longRestNotify();
451 | tomatoState(2);
452 | clearInterval(workTimeInterval);
453 | longTimeInterval = setInterval(function(){
454 | console.log('长休息时间');
455 | longTime--;
456 | timeInfoObj.longtime++;
457 | showCountdown(longTime);
458 | if(longTime == 0) {
459 | itemFlag = true;
460 | clearInterval(longTimeInterval);
461 | if(itemFlag) {
462 | process();
463 | }
464 | }
465 | }, 1000);
466 | }
467 | },1000);
468 | }
469 | }
470 |
471 | function eyecareProcess() {
472 | console.log('保护眼睛');
473 | var eyeTime = eyeTimeState;
474 | eyeTimeInterval = setInterval(function(){
475 | console.log("eye eyeTime = " + eyeTime);
476 | eyeTime--;
477 | if (eyeTime == 0) {
478 | playAduio(3, audioArray, audioSwitchArray[3]);
479 | eyecareNotify();
480 | clearInterval(eyeTimeInterval);
481 | eyecareProcess();
482 | }
483 | }, 1000);
484 | }
485 |
486 | function playAduio(index, array, isPlay){
487 | if(isPlay){
488 | var k = parseInt(array[index]);
489 | var audio = $('audio');
490 | audio[k].play();
491 | }
492 | }
493 |
494 | function timeColor(colorFlag) {
495 | if(colorFlag) {
496 | $('#countdown').css('color','rgb(31, 51, 116)');
497 | } else{
498 | $('#countdown').css('color','green');
499 | }
500 | }
501 | function workTimeNotify() {
502 | chrome.notifications.create('workreminder', {
503 | type: 'basic',
504 | title: '学习工作啦!',
505 | iconUrl: 'assets/picture/work.jpg',
506 | message: '打起精神,开始学习工作!'
507 | });
508 | }
509 | function shortRestNotify() {
510 | chrome.notifications.create('shortrestreminder', {
511 | type: 'basic',
512 | title: '短休息',
513 | iconUrl: 'assets/picture/tea-cup.png',
514 | message: '工作时间结束,小小休息一下儿!'
515 | });
516 | }
517 |
518 | function longRestNotify() {
519 | chrome.notifications.create('longrestreminder', {
520 | type: 'basic',
521 | title: '长休息',
522 | iconUrl: 'assets/picture/rest.png',
523 | message: '工作时间结束,开启一段长休息!'
524 | });
525 | }
526 |
527 | function eyecareNotify() {
528 | chrome.notifications.create('eyecarereminder', {
529 | type: 'basic',
530 | title: '眼睛要好好保养',
531 | iconUrl: 'assets/picture/medical.png',
532 | message: '适当休息按摩眼睛,眼睛才会更漂亮!'
533 | });
534 | }
535 |
536 | function drinkNotify(){
537 | chrome.notifications.create('drinkreminder', {
538 | type: 'basic',
539 | title: '快去喝杯水吧',
540 | iconUrl: 'assets/picture/drink.png',
541 | message: '人体需要水分进行各类身体运动,快去补水吧!'
542 | });
543 | }
544 |
545 |
546 | function tomatoState(state){
547 | switch(state){
548 | case 0:
549 | $tomatoState.html("工作中");
550 | break;
551 | case 1:
552 | $tomatoState.html("短休息");
553 | break;
554 | case 2:
555 | $tomatoState.html("长休息");
556 | break;
557 | }
558 | }
559 |
560 | function showCountdown( time ) {
561 | var minutes = parseInt(time / 60);
562 | var seconds = time % 60;
563 | $('#countdown').text(checkTime(minutes) + ':' + checkTime(seconds) );
564 | }
565 |
566 | function checkTime(time) {
567 | if( time < 10) {
568 | time = '0' + time;
569 | }
570 | return time;
571 | }
572 |
573 |
574 | });
575 |
--------------------------------------------------------------------------------
/window.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tomato
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
24 |
25 |
26 |
什么是番茄工作法?
27 |
假设你有个名为task的任务。设置4个番茄,每个番茄时长为25分钟,短休息为5分钟,长休息为20分钟,那么每25分钟的工作后会休息5分钟,直到第四个番茄过后来一次20分钟的长休息。随后循环进行番茄工作,直到完成你设定的任务。
28 |
32 |
33 |
34 |
眼睛忘记休息?
35 |
设置眼睛休息提醒吧,让学习工作变得可持续。间隔一定时间提醒你护眼。
36 |
37 |
38 |
忘记喝水?
39 |
设置喝水提醒吧,满足一天正常补水,而不至于忙于学习工作忘记喝水。
40 |
41 |
42 |
43 |
44 |
00:00
45 |
46 |
47 |
50 |
已完成0组番茄(每组有0个番茄)任务
51 |
52 |
53 | | 0个番茄 |
54 | 0个短休息 |
55 | 0个长休息 |
56 |
57 |
58 | | 0小时0分钟 |
59 | 0小时0分钟 |
60 | 0小时0分钟 |
61 |
62 |
63 |
66 |
67 |
68 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
--------------------------------------------------------------------------------
/plugins/clockpicker/clockpicker.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * ClockPicker v{package.version} (http://weareoutman.github.io/clockpicker/)
3 | * Copyright 2014 Wang Shenwei.
4 | * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
5 | */
6 |
7 | ;(function(){
8 | var $ = window.jQuery,
9 | $win = $(window),
10 | $doc = $(document),
11 | $body;
12 |
13 | // Can I use inline svg ?
14 | var svgNS = 'http://www.w3.org/2000/svg',
15 | svgSupported = 'SVGAngle' in window && (function(){
16 | var supported,
17 | el = document.createElement('div');
18 | el.innerHTML = '';
19 | supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
20 | el.innerHTML = '';
21 | return supported;
22 | })();
23 |
24 | // Can I use transition ?
25 | var transitionSupported = (function(){
26 | var style = document.createElement('div').style;
27 | return 'transition' in style ||
28 | 'WebkitTransition' in style ||
29 | 'MozTransition' in style ||
30 | 'msTransition' in style ||
31 | 'OTransition' in style;
32 | })();
33 |
34 | // Listen touch events in touch screen device, instead of mouse events in desktop.
35 | var touchSupported = 'ontouchstart' in window,
36 | mousedownEvent = 'mousedown' + ( touchSupported ? ' touchstart' : ''),
37 | mousemoveEvent = 'mousemove.clockpicker' + ( touchSupported ? ' touchmove.clockpicker' : ''),
38 | mouseupEvent = 'mouseup.clockpicker' + ( touchSupported ? ' touchend.clockpicker' : '');
39 |
40 | // Vibrate the device if supported
41 | var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
42 |
43 | function createSvgElement(name) {
44 | return document.createElementNS(svgNS, name);
45 | }
46 |
47 | function leadingZero(num) {
48 | return (num < 10 ? '0' : '') + num;
49 | }
50 |
51 | // Get a unique id
52 | var idCounter = 0;
53 | function uniqueId(prefix) {
54 | var id = ++idCounter + '';
55 | return prefix ? prefix + id : id;
56 | }
57 |
58 | // Clock size
59 | var dialRadius = 100,
60 | outerRadius = 80,
61 | // innerRadius = 80 on 12 hour clock
62 | innerRadius = 54,
63 | tickRadius = 13,
64 | diameter = dialRadius * 2,
65 | duration = transitionSupported ? 350 : 1;
66 |
67 | // Popover template
68 | var tpl = [
69 | '',
70 | '
',
71 | '
',
72 | '',
73 | ' : ',
74 | '',
75 | '',
76 | '
',
77 | '
',
78 | '
',
79 | '
',
80 | '
',
81 | '
',
82 | '
',
83 | '
',
84 | '',
85 | '
',
86 | '
'
87 | ].join('');
88 |
89 | // ClockPicker
90 | function ClockPicker(element, options) {
91 | var popover = $(tpl),
92 | plate = popover.find('.clockpicker-plate'),
93 | hoursView = popover.find('.clockpicker-hours'),
94 | minutesView = popover.find('.clockpicker-minutes'),
95 | amPmBlock = popover.find('.clockpicker-am-pm-block'),
96 | isInput = element.prop('tagName') === 'INPUT',
97 | input = isInput ? element : element.find('input'),
98 | addon = element.find('.input-group-addon'),
99 | self = this,
100 | timer;
101 |
102 | this.id = uniqueId('cp');
103 | this.element = element;
104 | this.options = options;
105 | this.isAppended = false;
106 | this.isShown = false;
107 | this.currentView = 'hours';
108 | this.isInput = isInput;
109 | this.input = input;
110 | this.addon = addon;
111 | this.popover = popover;
112 | this.plate = plate;
113 | this.hoursView = hoursView;
114 | this.minutesView = minutesView;
115 | this.amPmBlock = amPmBlock;
116 | this.spanHours = popover.find('.clockpicker-span-hours');
117 | this.spanMinutes = popover.find('.clockpicker-span-minutes');
118 | this.spanAmPm = popover.find('.clockpicker-span-am-pm');
119 | this.amOrPm = "PM";
120 |
121 | // Setup for for 12 hour clock if option is selected
122 | if (options.twelvehour) {
123 |
124 | var amPmButtonsTemplate = ['',
125 | '',
127 | '',
129 | '
'].join('');
130 |
131 | var amPmButtons = $(amPmButtonsTemplate);
132 | //amPmButtons.appendTo(plate);
133 |
134 | ////Not working b/c they are not shown when this runs
135 | //$('clockpicker-am-button')
136 | // .on("click", function() {
137 | // self.amOrPm = "AM";
138 | // $('.clockpicker-span-am-pm').empty().append('AM');
139 | // });
140 | //
141 | //$('clockpicker-pm-button')
142 | // .on("click", function() {
143 | // self.amOrPm = "PM";
144 | // $('.clockpicker-span-am-pm').empty().append('PM');
145 | // });
146 |
147 | $('')
148 | .on("click", function() {
149 | self.amOrPm = "AM";
150 | $('.clockpicker-span-am-pm').empty().append('AM');
151 | }).appendTo(this.amPmBlock);
152 |
153 |
154 | $('')
155 | .on("click", function() {
156 | self.amOrPm = 'PM';
157 | $('.clockpicker-span-am-pm').empty().append('PM');
158 | }).appendTo(this.amPmBlock);
159 |
160 | }
161 |
162 | if (! options.autoclose) {
163 | // If autoclose is not setted, append a button
164 | $('')
165 | .click($.proxy(this.done, this))
166 | .appendTo(popover);
167 | }
168 |
169 | // Placement and arrow align - make sure they make sense.
170 | if ((options.placement === 'top' || options.placement === 'bottom') && (options.align === 'top' || options.align === 'bottom')) options.align = 'left';
171 | if ((options.placement === 'left' || options.placement === 'right') && (options.align === 'left' || options.align === 'right')) options.align = 'top';
172 |
173 | popover.addClass(options.placement);
174 | popover.addClass('clockpicker-align-' + options.align);
175 |
176 | this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
177 | this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
178 |
179 | // Show or toggle
180 | input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
181 | addon.on('click.clockpicker', $.proxy(this.toggle, this));
182 |
183 | // Build ticks
184 | var tickTpl = $(''),
185 | i, tick, radian, radius;
186 |
187 | // Hours view
188 | if (options.twelvehour) {
189 | for (i = 1; i < 13; i += 1) {
190 | tick = tickTpl.clone();
191 | radian = i / 6 * Math.PI;
192 | radius = outerRadius;
193 | tick.css('font-size', '120%');
194 | tick.css({
195 | left: dialRadius + Math.sin(radian) * radius - tickRadius,
196 | top: dialRadius - Math.cos(radian) * radius - tickRadius
197 | });
198 | tick.html(i === 0 ? '00' : i);
199 | hoursView.append(tick);
200 | tick.on(mousedownEvent, mousedown);
201 | }
202 | } else {
203 | for (i = 0; i < 24; i += 1) {
204 | tick = tickTpl.clone();
205 | radian = i / 6 * Math.PI;
206 | var inner = i > 0 && i < 13;
207 | radius = inner ? innerRadius : outerRadius;
208 | tick.css({
209 | left: dialRadius + Math.sin(radian) * radius - tickRadius,
210 | top: dialRadius - Math.cos(radian) * radius - tickRadius
211 | });
212 | if (inner) {
213 | tick.css('font-size', '120%');
214 | }
215 | tick.html(i === 0 ? '00' : i);
216 | hoursView.append(tick);
217 | tick.on(mousedownEvent, mousedown);
218 | }
219 | }
220 |
221 | // Minutes view
222 | for (i = 0; i < 60; i += 5) {
223 | tick = tickTpl.clone();
224 | radian = i / 30 * Math.PI;
225 | tick.css({
226 | left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
227 | top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
228 | });
229 | tick.css('font-size', '120%');
230 | tick.html(leadingZero(i));
231 | minutesView.append(tick);
232 | tick.on(mousedownEvent, mousedown);
233 | }
234 |
235 | // Clicking on minutes view space
236 | plate.on(mousedownEvent, function(e){
237 | if ($(e.target).closest('.clockpicker-tick').length === 0) {
238 | mousedown(e, true);
239 | }
240 | });
241 |
242 | // Mousedown or touchstart
243 | function mousedown(e, space) {
244 | var offset = plate.offset(),
245 | isTouch = /^touch/.test(e.type),
246 | x0 = offset.left + dialRadius,
247 | y0 = offset.top + dialRadius,
248 | dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
249 | dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
250 | z = Math.sqrt(dx * dx + dy * dy),
251 | moved = false;
252 |
253 | // When clicking on minutes view space, check the mouse position
254 | if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
255 | return;
256 | }
257 | e.preventDefault();
258 |
259 | // Set cursor style of body after 200ms
260 | var movingTimer = setTimeout(function(){
261 | $body.addClass('clockpicker-moving');
262 | }, 200);
263 |
264 | // Place the canvas to top
265 | if (svgSupported) {
266 | plate.append(self.canvas);
267 | }
268 |
269 | // Clock
270 | self.setHand(dx, dy, ! space, true);
271 |
272 | // Mousemove on document
273 | $doc.off(mousemoveEvent).on(mousemoveEvent, function(e){
274 | e.preventDefault();
275 | var isTouch = /^touch/.test(e.type),
276 | x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
277 | y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
278 | if (! moved && x === dx && y === dy) {
279 | // Clicking in chrome on windows will trigger a mousemove event
280 | return;
281 | }
282 | moved = true;
283 | self.setHand(x, y, false, true);
284 | });
285 |
286 | // Mouseup on document
287 | $doc.off(mouseupEvent).on(mouseupEvent, function(e){
288 | $doc.off(mouseupEvent);
289 | e.preventDefault();
290 | var isTouch = /^touch/.test(e.type),
291 | x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
292 | y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
293 | if ((space || moved) && x === dx && y === dy) {
294 | self.setHand(x, y);
295 | }
296 | if (self.currentView === 'hours') {
297 | self.toggleView('minutes', duration / 2);
298 | } else {
299 | if (options.autoclose) {
300 | self.minutesView.addClass('clockpicker-dial-out');
301 | setTimeout(function(){
302 | self.done();
303 | }, duration / 2);
304 | }
305 | }
306 | plate.prepend(canvas);
307 |
308 | // Reset cursor style of body
309 | clearTimeout(movingTimer);
310 | $body.removeClass('clockpicker-moving');
311 |
312 | // Unbind mousemove event
313 | $doc.off(mousemoveEvent);
314 | });
315 | }
316 |
317 | if (svgSupported) {
318 | // Draw clock hands and others
319 | var canvas = popover.find('.clockpicker-canvas'),
320 | svg = createSvgElement('svg');
321 | svg.setAttribute('class', 'clockpicker-svg');
322 | svg.setAttribute('width', diameter);
323 | svg.setAttribute('height', diameter);
324 | var g = createSvgElement('g');
325 | g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
326 | var bearing = createSvgElement('circle');
327 | bearing.setAttribute('class', 'clockpicker-canvas-bearing');
328 | bearing.setAttribute('cx', 0);
329 | bearing.setAttribute('cy', 0);
330 | bearing.setAttribute('r', 2);
331 | var hand = createSvgElement('line');
332 | hand.setAttribute('x1', 0);
333 | hand.setAttribute('y1', 0);
334 | var bg = createSvgElement('circle');
335 | bg.setAttribute('class', 'clockpicker-canvas-bg');
336 | bg.setAttribute('r', tickRadius);
337 | var fg = createSvgElement('circle');
338 | fg.setAttribute('class', 'clockpicker-canvas-fg');
339 | fg.setAttribute('r', 3.5);
340 | g.appendChild(hand);
341 | g.appendChild(bg);
342 | g.appendChild(fg);
343 | g.appendChild(bearing);
344 | svg.appendChild(g);
345 | canvas.append(svg);
346 |
347 | this.hand = hand;
348 | this.bg = bg;
349 | this.fg = fg;
350 | this.bearing = bearing;
351 | this.g = g;
352 | this.canvas = canvas;
353 | }
354 |
355 | raiseCallback(this.options.init);
356 | }
357 |
358 | function raiseCallback(callbackFunction) {
359 | if (callbackFunction && typeof callbackFunction === "function") {
360 | callbackFunction();
361 | }
362 | }
363 |
364 | // Default options
365 | ClockPicker.DEFAULTS = {
366 | 'default': '', // default time, 'now' or '13:14' e.g.
367 | fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
368 | placement: 'bottom', // clock popover placement
369 | align: 'left', // popover arrow align
370 | donetext: '完成', // done button text
371 | autoclose: false, // auto close when minute is selected
372 | twelvehour: false, // change to 12 hour AM/PM clock from 24 hour
373 | vibrate: true // vibrate the device when dragging clock hand
374 | };
375 |
376 | // Show or hide popover
377 | ClockPicker.prototype.toggle = function(){
378 | this[this.isShown ? 'hide' : 'show']();
379 | };
380 |
381 | // Set popover position
382 | ClockPicker.prototype.locate = function(){
383 | var element = this.element,
384 | popover = this.popover,
385 | offset = element.offset(),
386 | width = element.outerWidth(),
387 | height = element.outerHeight(),
388 | placement = this.options.placement,
389 | align = this.options.align,
390 | styles = {},
391 | self = this;
392 |
393 | popover.show();
394 |
395 | // Place the popover
396 | switch (placement) {
397 | case 'bottom':
398 | styles.top = offset.top + height;
399 | break;
400 | case 'right':
401 | styles.left = offset.left + width;
402 | break;
403 | case 'top':
404 | styles.top = offset.top - popover.outerHeight();
405 | break;
406 | case 'left':
407 | styles.left = offset.left - popover.outerWidth();
408 | break;
409 | }
410 |
411 | // Align the popover arrow
412 | switch (align) {
413 | case 'left':
414 | styles.left = offset.left;
415 | break;
416 | case 'right':
417 | styles.left = offset.left + width - popover.outerWidth();
418 | break;
419 | case 'top':
420 | styles.top = offset.top;
421 | break;
422 | case 'bottom':
423 | styles.top = offset.top + height - popover.outerHeight();
424 | break;
425 | }
426 |
427 | popover.css(styles);
428 | };
429 |
430 | // Show popover
431 | ClockPicker.prototype.show = function(e){
432 | // Not show again
433 | if (this.isShown) {
434 | return;
435 | }
436 |
437 | raiseCallback(this.options.beforeShow);
438 |
439 | var self = this;
440 |
441 | // Initialize
442 | if (! this.isAppended) {
443 | // Append popover to body
444 | $body = $(document.body).append(this.popover);
445 |
446 | // Reset position when resize
447 | $win.on('resize.clockpicker' + this.id, function(){
448 | if (self.isShown) {
449 | self.locate();
450 | }
451 | });
452 |
453 | this.isAppended = true;
454 | }
455 |
456 | // Get the time
457 | var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
458 | if (value[0] === 'now') {
459 | var now = new Date(+ new Date() + this.options.fromnow);
460 | value = [
461 | now.getHours(),
462 | now.getMinutes()
463 | ];
464 | }
465 | this.hours = + value[0] || 0;
466 | this.minutes = + value[1] || 0;
467 | this.spanHours.html(leadingZero(this.hours));
468 | this.spanMinutes.html(leadingZero(this.minutes));
469 |
470 | // Toggle to hours view
471 | this.toggleView('hours');
472 |
473 | // Set position
474 | this.locate();
475 |
476 | this.isShown = true;
477 |
478 | // Hide when clicking or tabbing on any element except the clock, input and addon
479 | $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function(e){
480 | var target = $(e.target);
481 | if (target.closest(self.popover).length === 0 &&
482 | target.closest(self.addon).length === 0 &&
483 | target.closest(self.input).length === 0) {
484 | self.hide();
485 | }
486 | });
487 |
488 | // Hide when ESC is pressed
489 | $doc.on('keyup.clockpicker.' + this.id, function(e){
490 | if (e.keyCode === 27) {
491 | self.hide();
492 | }
493 | });
494 |
495 | raiseCallback(this.options.afterShow);
496 | };
497 |
498 | // Hide popover
499 | ClockPicker.prototype.hide = function(){
500 | raiseCallback(this.options.beforeHide);
501 |
502 | this.isShown = false;
503 |
504 | // Unbinding events on document
505 | $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
506 | $doc.off('keyup.clockpicker.' + this.id);
507 |
508 | this.popover.hide();
509 |
510 | raiseCallback(this.options.afterHide);
511 | };
512 |
513 | // Toggle to hours or minutes view
514 | ClockPicker.prototype.toggleView = function(view, delay){
515 | var raiseAfterHourSelect = false;
516 | if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
517 | raiseCallback(this.options.beforeHourSelect);
518 | raiseAfterHourSelect = true;
519 | }
520 | var isHours = view === 'hours',
521 | nextView = isHours ? this.hoursView : this.minutesView,
522 | hideView = isHours ? this.minutesView : this.hoursView;
523 |
524 | this.currentView = view;
525 |
526 | this.spanHours.toggleClass('text-primary', isHours);
527 | this.spanMinutes.toggleClass('text-primary', ! isHours);
528 |
529 | // Let's make transitions
530 | hideView.addClass('clockpicker-dial-out');
531 | nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
532 |
533 | // Reset clock hand
534 | this.resetClock(delay);
535 |
536 | // After transitions ended
537 | clearTimeout(this.toggleViewTimer);
538 | this.toggleViewTimer = setTimeout(function(){
539 | hideView.css('visibility', 'hidden');
540 | }, duration);
541 |
542 | if (raiseAfterHourSelect) {
543 | raiseCallback(this.options.afterHourSelect);
544 | }
545 | };
546 |
547 | // Reset clock hand
548 | ClockPicker.prototype.resetClock = function(delay){
549 | var view = this.currentView,
550 | value = this[view],
551 | isHours = view === 'hours',
552 | unit = Math.PI / (isHours ? 6 : 30),
553 | radian = value * unit,
554 | radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
555 | x = Math.sin(radian) * radius,
556 | y = - Math.cos(radian) * radius,
557 | self = this;
558 | if (svgSupported && delay) {
559 | self.canvas.addClass('clockpicker-canvas-out');
560 | setTimeout(function(){
561 | self.canvas.removeClass('clockpicker-canvas-out');
562 | self.setHand(x, y);
563 | }, delay);
564 | } else {
565 | this.setHand(x, y);
566 | }
567 | };
568 |
569 | // Set clock hand to (x, y)
570 | ClockPicker.prototype.setHand = function(x, y, roundBy5, dragging){
571 | var radian = Math.atan2(x, - y),
572 | isHours = this.currentView === 'hours',
573 | unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
574 | z = Math.sqrt(x * x + y * y),
575 | options = this.options,
576 | inner = isHours && z < (outerRadius + innerRadius) / 2,
577 | radius = inner ? innerRadius : outerRadius,
578 | value;
579 |
580 | if (options.twelvehour) {
581 | radius = outerRadius;
582 | }
583 |
584 | // Radian should in range [0, 2PI]
585 | if (radian < 0) {
586 | radian = Math.PI * 2 + radian;
587 | }
588 |
589 | // Get the round value
590 | value = Math.round(radian / unit);
591 |
592 | // Get the round radian
593 | radian = value * unit;
594 |
595 | // Correct the hours or minutes
596 | if (options.twelvehour) {
597 | if (isHours) {
598 | if (value === 0) {
599 | value = 12;
600 | }
601 | } else {
602 | if (roundBy5) {
603 | value *= 5;
604 | }
605 | if (value === 60) {
606 | value = 0;
607 | }
608 | }
609 | } else {
610 | if (isHours) {
611 | if (value === 12) {
612 | value = 0;
613 | }
614 | value = inner ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
615 | } else {
616 | if (roundBy5) {
617 | value *= 5;
618 | }
619 | if (value === 60) {
620 | value = 0;
621 | }
622 | }
623 | }
624 |
625 | // Once hours or minutes changed, vibrate the device
626 | if (this[this.currentView] !== value) {
627 | if (vibrate && this.options.vibrate) {
628 | // Do not vibrate too frequently
629 | if (! this.vibrateTimer) {
630 | navigator[vibrate](10);
631 | this.vibrateTimer = setTimeout($.proxy(function(){
632 | this.vibrateTimer = null;
633 | }, this), 100);
634 | }
635 | }
636 | }
637 |
638 | this[this.currentView] = value;
639 | this[isHours ? 'spanHours' : 'spanMinutes'].html(leadingZero(value));
640 |
641 | // If svg is not supported, just add an active class to the tick
642 | if (! svgSupported) {
643 | this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function(){
644 | var tick = $(this);
645 | tick.toggleClass('active', value === + tick.html());
646 | });
647 | return;
648 | }
649 |
650 | // Place clock hand at the top when dragging
651 | if (dragging || (! isHours && value % 5)) {
652 | this.g.insertBefore(this.hand, this.bearing);
653 | this.g.insertBefore(this.bg, this.fg);
654 | this.bg.setAttribute('class', 'clockpicker-canvas-bg clockpicker-canvas-bg-trans');
655 | } else {
656 | // Or place it at the bottom
657 | this.g.insertBefore(this.hand, this.bg);
658 | this.g.insertBefore(this.fg, this.bg);
659 | this.bg.setAttribute('class', 'clockpicker-canvas-bg');
660 | }
661 |
662 | // Set clock hand and others' position
663 | var cx = Math.sin(radian) * radius,
664 | cy = - Math.cos(radian) * radius;
665 | this.hand.setAttribute('x2', cx);
666 | this.hand.setAttribute('y2', cy);
667 | this.bg.setAttribute('cx', cx);
668 | this.bg.setAttribute('cy', cy);
669 | this.fg.setAttribute('cx', cx);
670 | this.fg.setAttribute('cy', cy);
671 | };
672 |
673 | // Hours and minutes are selected
674 | ClockPicker.prototype.done = function() {
675 | raiseCallback(this.options.beforeDone);
676 | this.hide();
677 | var last = this.input.prop('value'),
678 | value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
679 | if (this.options.twelvehour) {
680 | value = value + this.amOrPm;
681 | }
682 |
683 | this.input.prop('value', value);
684 | if (value !== last) {
685 | this.input.triggerHandler('change');
686 | if (! this.isInput) {
687 | this.element.trigger('change');
688 | }
689 | }
690 |
691 | if (this.options.autoclose) {
692 | this.input.trigger('blur');
693 | }
694 |
695 | raiseCallback(this.options.afterDone);
696 | };
697 |
698 | // Remove clockpicker from input
699 | ClockPicker.prototype.remove = function() {
700 | this.element.removeData('clockpicker');
701 | this.input.off('focus.clockpicker click.clockpicker');
702 | this.addon.off('click.clockpicker');
703 | if (this.isShown) {
704 | this.hide();
705 | }
706 | if (this.isAppended) {
707 | $win.off('resize.clockpicker' + this.id);
708 | this.popover.remove();
709 | }
710 | };
711 |
712 | // Extends $.fn.clockpicker
713 | $.fn.clockpicker = function(option){
714 | var args = Array.prototype.slice.call(arguments, 1);
715 | return this.each(function(){
716 | var $this = $(this),
717 | data = $this.data('clockpicker');
718 | if (! data) {
719 | var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
720 | $this.data('clockpicker', new ClockPicker($this, options));
721 | } else {
722 | // Manual operatsions. show, hide, remove, e.g.
723 | if (typeof data[option] === 'function') {
724 | data[option].apply(data, args);
725 | }
726 | }
727 | });
728 | };
729 | }());
730 |
--------------------------------------------------------------------------------
/js/jquery-3.1.1.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */
2 | !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),
3 | a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/