trans 0.5.2 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tocmd/translator_trans.rb +16 -5
- data/lib/tocmd/version.rb +1 -1
- data/template/README.md +16 -0
- data/template/demo.html +344 -0
- data/{vendor → template}/meta.js +0 -0
- data/{vendor → template}/toc/css/component.css +4 -1
- data/template/toc/css/demo.css +330 -0
- data/{vendor → template}/toc/css/glyphicons-halflings-white.png +0 -0
- data/{vendor → template}/toc/css/glyphicons-halflings.png +0 -0
- data/{vendor → template}/toc/css/icons.css +0 -0
- data/template/toc/css/normalize.css +1 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/1_close.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/1_open.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/2.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/3.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/4.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/5.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/6.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/7.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/8.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/diy/9.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/line_conn.gif +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/loading.gif +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/zTreeStandard.gif +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/img/zTreeStandard.png +0 -0
- data/{vendor → template}/toc/css/zTreeStyle/zTreeStyle.css +0 -0
- data/{vendor → template}/toc/fonts/codropsicons/codropsicons.eot +0 -0
- data/{vendor → template}/toc/fonts/codropsicons/codropsicons.svg +0 -0
- data/{vendor → template}/toc/fonts/codropsicons/codropsicons.ttf +0 -0
- data/{vendor → template}/toc/fonts/codropsicons/codropsicons.woff +0 -0
- data/{vendor → template}/toc/fonts/codropsicons/license.txt +0 -0
- data/vendor/toc/fonts/linecons/Read Me.txt b/data/template/toc/fonts/linecons/Read → Me.txt +0 -0
- data/{vendor → template}/toc/fonts/linecons/license.txt +0 -0
- data/{vendor → template}/toc/fonts/linecons/linecons.dev.svg +0 -0
- data/{vendor → template}/toc/fonts/linecons/linecons.eot +0 -0
- data/{vendor → template}/toc/fonts/linecons/linecons.svg +0 -0
- data/{vendor → template}/toc/fonts/linecons/linecons.ttf +0 -0
- data/{vendor → template}/toc/fonts/linecons/linecons.woff +0 -0
- data/{vendor → template}/toc/fonts/linecons/lte-ie7.js +0 -0
- data/{vendor → template}/toc/img/glyphicons-halflings-white.png +0 -0
- data/{vendor → template}/toc/img/glyphicons-halflings.png +0 -0
- data/{vendor → template}/toc/img/icon-cog-shadow.png +0 -0
- data/{vendor → template}/toc/img/icon-cog-small.png +0 -0
- data/{vendor → template}/toc/img/icon-cog.png +0 -0
- data/{vendor → template}/toc/img/pattern-2.png +0 -0
- data/{vendor → template}/toc/js/classie.js +0 -0
- data/{vendor → template}/toc/js/jquery-1.4.4.min.js +0 -0
- data/{vendor → template}/toc/js/jquery.js +0 -0
- data/template/toc/js/jquery.transtool.js +159 -0
- data/{vendor → template}/toc/js/jquery.ztree.all-3.5.min.js +0 -0
- data/{vendor → template}/toc/js/mlpushmenu.js +0 -0
- data/{vendor → template}/toc/js/modernizr.custom.js +0 -0
- data/{vendor → template}/toc/js/ztree_toc.js +74 -58
- data/template/toc/js/ztree_toc.min.js +4 -0
- data/vendor/toc/style/Clearness Dark.css b/data/template/toc/style/Clearness → Dark.css +0 -0
- data/{vendor → template}/toc/style/Clearness.css +0 -0
- data/{vendor → template}/toc/style/GitHub.css +0 -0
- data/{vendor → template}/toc/style/GitHub2.css +0 -0
- data/{vendor → template}/toc/style/github-bf51422f4bb36427d391e4b75a1daa083c2d840e.css +0 -0
- data/{vendor → template}/toc/style/github2-d731afd4f624c99a4b19ad69f3083cd6d02b81d5.css +0 -0
- data/{vendor → template}/toc/style/makedownpad.css +0 -0
- data/template/toc/toc_conf.js +54 -0
- metadata +62 -61
- data/vendor/template.html +0 -0
- data/vendor/toc/css/bootstrap.icons.css +0 -487
- data/vendor/toc/css/demo.css +0 -33
- data/vendor/toc/css/normalize.css +0 -1
- data/vendor/toc/js/ztree_toc.min.js +0 -4
- data/vendor/toc/toc_conf.js +0 -20
@@ -0,0 +1,330 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
|
2
|
+
margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
|
3
|
+
body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;}
|
4
|
+
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;}
|
5
|
+
|
6
|
+
a {color:#3C6E31;text-decoration: underline;}
|
7
|
+
a:hover {background-color:#3C6E31;color:white;}
|
8
|
+
input.radio {margin: 0 2px 0 8px;}
|
9
|
+
input.radio.first {margin-left:0;}
|
10
|
+
input.empty {color: lightgray;}
|
11
|
+
code {color: #2f332a;}
|
12
|
+
.highlight_red {color:#A60000;}
|
13
|
+
.highlight_green {color:#A7F43D;}
|
14
|
+
li {list-style: circle;font-size: 12px;}
|
15
|
+
li.title {list-style: none;}
|
16
|
+
ul.list {margin-left: 17px;}
|
17
|
+
|
18
|
+
div.content_wrap {width: 600px;height:380px;}
|
19
|
+
div.content_wrap div.left{float: left;width: 250px;}
|
20
|
+
div.content_wrap div.right{float: right;width: 340px;}
|
21
|
+
div.zTreeDemoBackground {width:250px;height:362px;text-align:left;}
|
22
|
+
|
23
|
+
ul.ztree {margin-top: 0px;border: 1px solid #617775;background: white;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
|
24
|
+
ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;}
|
25
|
+
ul.log.small {height:45px;}
|
26
|
+
ul.log li {color: #666666;list-style: none;padding-left: 10px;}
|
27
|
+
ul.log li.dark {background-color: #E3E3E3;}
|
28
|
+
|
29
|
+
/* ruler */
|
30
|
+
div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer}
|
31
|
+
div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}
|
32
|
+
|
33
|
+
|
34
|
+
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700);
|
35
|
+
@font-face {
|
36
|
+
font-weight: normal;
|
37
|
+
font-style: normal;
|
38
|
+
font-family: 'codropsicons';
|
39
|
+
src:url('../fonts/codropsicons/codropsicons.eot');
|
40
|
+
src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),
|
41
|
+
url('../fonts/codropsicons/codropsicons.woff') format('woff'),
|
42
|
+
url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),
|
43
|
+
url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');
|
44
|
+
}
|
45
|
+
|
46
|
+
/*body {
|
47
|
+
background: #34495e;
|
48
|
+
color: #fff;
|
49
|
+
font-weight: 300;
|
50
|
+
font-family: 'Lato', Calibri, Arial, sans-serif;
|
51
|
+
}*/
|
52
|
+
|
53
|
+
a {
|
54
|
+
text-decoration: none;
|
55
|
+
color: #f7f7f7;
|
56
|
+
outline: none;
|
57
|
+
}
|
58
|
+
|
59
|
+
a:hover, a:focus {
|
60
|
+
color: #fff;
|
61
|
+
outline: none;
|
62
|
+
}
|
63
|
+
|
64
|
+
/* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */
|
65
|
+
.clearfix:before,
|
66
|
+
.clearfix:after {
|
67
|
+
display: table;
|
68
|
+
content: " ";
|
69
|
+
}
|
70
|
+
|
71
|
+
.clearfix:after {
|
72
|
+
clear: both;
|
73
|
+
}
|
74
|
+
|
75
|
+
.codrops-header,
|
76
|
+
.codrops-top {
|
77
|
+
font-family: 'Lato', Arial, sans-serif;
|
78
|
+
}
|
79
|
+
|
80
|
+
.codrops-header {
|
81
|
+
margin: 0 auto;
|
82
|
+
padding: 2em;
|
83
|
+
background: rgba(0,0,0,0.01);
|
84
|
+
text-align: center;
|
85
|
+
}
|
86
|
+
|
87
|
+
.codrops-header h1 {
|
88
|
+
margin: 0;
|
89
|
+
font-weight: 300;
|
90
|
+
font-size: 2.625em;
|
91
|
+
line-height: 1.3;
|
92
|
+
}
|
93
|
+
|
94
|
+
.codrops-header span {
|
95
|
+
display: block;
|
96
|
+
padding: 0 0 0.6em 0.1em;
|
97
|
+
font-size: 60%;
|
98
|
+
opacity: 0.7;
|
99
|
+
}
|
100
|
+
|
101
|
+
/* To Navigation Style */
|
102
|
+
.codrops-top {
|
103
|
+
width: 100%;
|
104
|
+
background: #91cfa1;
|
105
|
+
background: rgba(255, 255, 255, 0.1);
|
106
|
+
text-transform: uppercase;
|
107
|
+
font-size: 0.69em;
|
108
|
+
line-height: 2.2;
|
109
|
+
}
|
110
|
+
|
111
|
+
.codrops-top a {
|
112
|
+
display: inline-block;
|
113
|
+
padding: 0 1em;
|
114
|
+
color: #fff;
|
115
|
+
text-decoration: none;
|
116
|
+
letter-spacing: 0.1em;
|
117
|
+
}
|
118
|
+
|
119
|
+
.codrops-top a:hover {
|
120
|
+
background: rgba(255,255,255,0.95);
|
121
|
+
color: #333;
|
122
|
+
}
|
123
|
+
|
124
|
+
.codrops-top span.right {
|
125
|
+
float: right;
|
126
|
+
}
|
127
|
+
|
128
|
+
.codrops-top span.right a {
|
129
|
+
display: block;
|
130
|
+
float: left;
|
131
|
+
}
|
132
|
+
|
133
|
+
.codrops-icon:before {
|
134
|
+
margin: 0 4px;
|
135
|
+
text-transform: none;
|
136
|
+
font-weight: normal;
|
137
|
+
font-style: normal;
|
138
|
+
font-variant: normal;
|
139
|
+
font-family: 'codropsicons';
|
140
|
+
line-height: 1;
|
141
|
+
speak: none;
|
142
|
+
-webkit-font-smoothing: antialiased;
|
143
|
+
}
|
144
|
+
|
145
|
+
.codrops-icon-drop:before {
|
146
|
+
content: "\e001";
|
147
|
+
}
|
148
|
+
|
149
|
+
.codrops-icon-prev:before {
|
150
|
+
content: "\e004";
|
151
|
+
}
|
152
|
+
|
153
|
+
/* Demo Buttons Style */
|
154
|
+
.codrops-demos {
|
155
|
+
padding-top: 1em;
|
156
|
+
font-size: 1.1em;
|
157
|
+
}
|
158
|
+
|
159
|
+
.codrops-demos a {
|
160
|
+
display: block;
|
161
|
+
float: left;
|
162
|
+
clear: both;
|
163
|
+
margin: 0.5em 0.5em 0.5em 1.9em;
|
164
|
+
padding: 1em 1.1em;
|
165
|
+
width: 280px;
|
166
|
+
outline: none;
|
167
|
+
color: #fff;
|
168
|
+
background: #336ca6;
|
169
|
+
text-align: center;
|
170
|
+
text-decoration: none;
|
171
|
+
font-weight: 700;
|
172
|
+
}
|
173
|
+
|
174
|
+
.codrops-demos a:hover,
|
175
|
+
.codrops-demos a.current-demo,
|
176
|
+
.codrops-demos a.current-demo:hover {
|
177
|
+
opacity: 0.6;
|
178
|
+
}
|
179
|
+
|
180
|
+
.content {
|
181
|
+
padding: 4em 2em;
|
182
|
+
max-width: 1200px;
|
183
|
+
margin: 0 auto;
|
184
|
+
}
|
185
|
+
|
186
|
+
.block {
|
187
|
+
float: left;
|
188
|
+
padding: 1em 3em;
|
189
|
+
}
|
190
|
+
|
191
|
+
.block-40 {
|
192
|
+
width: 40%;
|
193
|
+
}
|
194
|
+
|
195
|
+
.block-60 {
|
196
|
+
width: 60%;
|
197
|
+
}
|
198
|
+
|
199
|
+
.block p {
|
200
|
+
margin: 0;
|
201
|
+
padding: 0 1em 0.6em;
|
202
|
+
font-size: 1.8em;
|
203
|
+
line-height: 1.5;
|
204
|
+
}
|
205
|
+
|
206
|
+
.info {
|
207
|
+
text-align: center;
|
208
|
+
font-size: 1.5em;
|
209
|
+
margin-top: 3em;
|
210
|
+
clear: both;
|
211
|
+
padding-top: 3em;
|
212
|
+
color: rgba(255,255,255,0.5);
|
213
|
+
}
|
214
|
+
|
215
|
+
.info a {
|
216
|
+
font-weight: 700;
|
217
|
+
font-size: 0.9em;
|
218
|
+
}
|
219
|
+
|
220
|
+
.info a:hover {
|
221
|
+
color: #336ca6;
|
222
|
+
}
|
223
|
+
|
224
|
+
@media screen and (max-width: 69em) {
|
225
|
+
.block {
|
226
|
+
float: none;
|
227
|
+
width: 100% !important;
|
228
|
+
padding: 1em;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
@media screen and (max-width: 25em) {
|
233
|
+
|
234
|
+
body {
|
235
|
+
font-size: 80%;
|
236
|
+
}
|
237
|
+
|
238
|
+
.codrops-icon span {
|
239
|
+
display: none;
|
240
|
+
}
|
241
|
+
|
242
|
+
}
|
243
|
+
|
244
|
+
/*-------------- for page --------------*/
|
245
|
+
|
246
|
+
.settings-button {
|
247
|
+
/*width: 36px;
|
248
|
+
height: 28px;
|
249
|
+
border-radius: 5px;
|
250
|
+
border: 1px solid #161615;
|
251
|
+
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
|
252
|
+
background-color: #343433;*/
|
253
|
+
opacity: 0.7;
|
254
|
+
z-index: 2;
|
255
|
+
display: block;
|
256
|
+
margin: 20px 290px;
|
257
|
+
position:fixed;
|
258
|
+
bottom:0px;
|
259
|
+
}
|
260
|
+
|
261
|
+
.settings-button:hover, .pressed {
|
262
|
+
background-color: transparent;
|
263
|
+
opacity: 1;
|
264
|
+
cursor: pointer;
|
265
|
+
z-index: 2;
|
266
|
+
}
|
267
|
+
|
268
|
+
.settings-button img {
|
269
|
+
margin: 5px auto 0px auto;
|
270
|
+
display: block;
|
271
|
+
z-index: -1;
|
272
|
+
}
|
273
|
+
|
274
|
+
.settings-button span {
|
275
|
+
background: transparent url('../img/icon-cog-small.png') no-repeat top left;
|
276
|
+
width: 19px;
|
277
|
+
height: 18px;
|
278
|
+
display: block;
|
279
|
+
margin: 5px auto 0px auto;
|
280
|
+
}
|
281
|
+
|
282
|
+
|
283
|
+
pre {
|
284
|
+
counter-reset: line-numbering;
|
285
|
+
border: solid 1px #d9d9d9;
|
286
|
+
border-radius: 0;
|
287
|
+
background: #fff;
|
288
|
+
padding: 0;
|
289
|
+
line-height: 23px;
|
290
|
+
margin-bottom: 30px;
|
291
|
+
white-space: pre;
|
292
|
+
overflow-x: auto;
|
293
|
+
word-break: inherit;
|
294
|
+
word-wrap: inherit;
|
295
|
+
}
|
296
|
+
|
297
|
+
pre a::before {
|
298
|
+
content: counter(line-numbering);
|
299
|
+
counter-increment: line-numbering;
|
300
|
+
padding-right: 1em; /* space after numbers */
|
301
|
+
width: 25px;
|
302
|
+
text-align: right;
|
303
|
+
opacity: 0.7;
|
304
|
+
display: inline-block;
|
305
|
+
color: #aaa;
|
306
|
+
background: #eee;
|
307
|
+
margin-right: 16px;
|
308
|
+
padding: 2px 10px;
|
309
|
+
font-size: 13px;
|
310
|
+
-webkit-touch-callout: none;
|
311
|
+
-webkit-user-select: none;
|
312
|
+
-khtml-user-select: none;
|
313
|
+
-moz-user-select: none;
|
314
|
+
-ms-user-select: none;
|
315
|
+
user-select: none;
|
316
|
+
}
|
317
|
+
|
318
|
+
pre a:first-of-type::before {
|
319
|
+
padding-top: 10px;
|
320
|
+
}
|
321
|
+
|
322
|
+
pre a:last-of-type::before {
|
323
|
+
padding-bottom: 10px;
|
324
|
+
}
|
325
|
+
|
326
|
+
pre a:only-of-type::before {
|
327
|
+
padding: 10px;
|
328
|
+
}
|
329
|
+
|
330
|
+
.highlight { background-color: #ffffcc } /* RIGHT */
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
/*article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;}*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,159 @@
|
|
1
|
+
/*
|
2
|
+
* transtool
|
3
|
+
* https://github.com/i5ting/toolbar
|
4
|
+
*
|
5
|
+
* Copyright (c) 2014 alfred sang
|
6
|
+
* Licensed under the MIT license.
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function($) {
|
10
|
+
|
11
|
+
/**
|
12
|
+
* 创建tooltip‘s options html
|
13
|
+
*/
|
14
|
+
function create_tip_opts(opts){
|
15
|
+
|
16
|
+
if(opts.mp_title && opts.mp_title.length > 0){
|
17
|
+
$('#mp_title').html(opts.mp_title);
|
18
|
+
}
|
19
|
+
|
20
|
+
// <li id='all'><a class="icon icon-world" href="#">show all</a></li>
|
21
|
+
var optsion_html = "";
|
22
|
+
|
23
|
+
$.each(opts.states,function(){
|
24
|
+
$.each(this,function(key,value){
|
25
|
+
optsion_html += "<li id='" + key + "'><a class='icon "+ value.icon +"' href='#1'>" + value.display + "</a></li>";
|
26
|
+
$('#'+key).on('click',value.click);
|
27
|
+
});
|
28
|
+
|
29
|
+
});
|
30
|
+
|
31
|
+
$(opts.toolbarselector).find('ul').append(optsion_html);
|
32
|
+
|
33
|
+
log(optsion_html);
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* 绑定事件
|
38
|
+
*/
|
39
|
+
function bind_click_event(opts){
|
40
|
+
$.each(opts.states,function(){
|
41
|
+
$.each(this,function(key,value){
|
42
|
+
//$('#'+key).on('click',value.click);
|
43
|
+
var $this = this;
|
44
|
+
$('#' + key).on('click',function(){
|
45
|
+
show_preview_info_wity_type(opts, key);
|
46
|
+
});
|
47
|
+
});
|
48
|
+
});
|
49
|
+
|
50
|
+
|
51
|
+
$('#all').click(function(){
|
52
|
+
$.each(opts.states,function(){
|
53
|
+
$.each(this,function(key,value){
|
54
|
+
$('.' + key).show();
|
55
|
+
});
|
56
|
+
});
|
57
|
+
|
58
|
+
//$('#normal-button').trigger('click');
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* 处理按钮事件
|
64
|
+
*/
|
65
|
+
function show_preview_info_wity_type(opts, type){
|
66
|
+
$.each(opts.states,function(){
|
67
|
+
$.each(this,function(key,value){
|
68
|
+
$('.' + key ).hide();
|
69
|
+
|
70
|
+
});
|
71
|
+
});
|
72
|
+
|
73
|
+
$('.' + type).show();
|
74
|
+
|
75
|
+
$(opts.menu_trigger_selector).trigger('click');
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* 初始化默认state
|
80
|
+
*/
|
81
|
+
function init_with_default_state(opts){
|
82
|
+
var key = opts.default_state;
|
83
|
+
if(key === 'all'){
|
84
|
+
$.each(opts.states,function(){
|
85
|
+
$.each(this,function(key,value){
|
86
|
+
$('.' + key).show();
|
87
|
+
});
|
88
|
+
});
|
89
|
+
$(opts.menu_trigger_selector).trigger('click');
|
90
|
+
}else{
|
91
|
+
show_preview_info_wity_type(opts, key);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Static method.
|
96
|
+
$.transtool = function(options) {
|
97
|
+
// Override default options with passed-in options.
|
98
|
+
var opts = $.extend({}, $.transtool.options, options);
|
99
|
+
|
100
|
+
// 创建tooltip‘s options html
|
101
|
+
create_tip_opts(opts);
|
102
|
+
|
103
|
+
// 给每个tooltip上的按钮绑定click事件
|
104
|
+
bind_click_event(opts);
|
105
|
+
|
106
|
+
// 初始化默认state
|
107
|
+
init_with_default_state(opts);
|
108
|
+
|
109
|
+
};
|
110
|
+
|
111
|
+
// left menu html
|
112
|
+
// <li id='todo'><a class="icon icon-shop" href="#">todo</a></li>
|
113
|
+
// <li id='review'><a class="icon icon-cloud" href="#">review</a></li>
|
114
|
+
// <li id='ok'><a class="icon icon-diamond" href="#">ok</a></li>
|
115
|
+
// <li id='zh'><a class="icon icon-photo" href="#">中文</a></li>
|
116
|
+
// <li id='en'><a class="icon icon-wallet" href="#">英文</a></li>
|
117
|
+
// <li id='all'><a class="icon icon-shop" href="#">show all</a></li>
|
118
|
+
|
119
|
+
// Static method default options.
|
120
|
+
$.transtool.options = {
|
121
|
+
debug: false,
|
122
|
+
mp_title:"请配置mp_title",
|
123
|
+
toolbarselector: "#user-toolbar",
|
124
|
+
menu_trigger_selector:'#normal-button',
|
125
|
+
punctuation: '.',
|
126
|
+
states:[
|
127
|
+
{
|
128
|
+
'zh':{
|
129
|
+
'icon':'icon-edit',
|
130
|
+
click:function(){
|
131
|
+
alert('zh');
|
132
|
+
}
|
133
|
+
},
|
134
|
+
'en':{
|
135
|
+
'icon':'icon-user',
|
136
|
+
click:function(){
|
137
|
+
alert('en');
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
]
|
142
|
+
};
|
143
|
+
|
144
|
+
/**
|
145
|
+
* 日志方法
|
146
|
+
*/
|
147
|
+
function log(text){
|
148
|
+
if($.transtool.options.debug === true){
|
149
|
+
console.log(text);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
// Custom selector.
|
154
|
+
$.expr[':'].transtool = function(elem) {
|
155
|
+
// Is this element awesome?
|
156
|
+
return $(elem).text().indexOf('awesome') !== -1;
|
157
|
+
};
|
158
|
+
|
159
|
+
}(jQuery));
|