shinmun 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +18 -0
- data/README.md +249 -0
- data/Rakefile +60 -0
- data/bin/shinmun +12 -0
- data/example/posts/2008/9/example.md +19 -0
- data/example/posts/blog.yml +10 -0
- data/example/posts/uuid.state +3 -0
- data/example/public/controllers/comments.php +56 -0
- data/example/public/images/loading.gif +0 -0
- data/example/public/javascripts/comments.js +60 -0
- data/example/public/javascripts/highlight.js +505 -0
- data/example/public/javascripts/images/bg-fill.png +0 -0
- data/example/public/javascripts/images/bg.png +0 -0
- data/example/public/javascripts/images/blockquote.png +0 -0
- data/example/public/javascripts/images/bold.png +0 -0
- data/example/public/javascripts/images/code.png +0 -0
- data/example/public/javascripts/images/h1.png +0 -0
- data/example/public/javascripts/images/hr.png +0 -0
- data/example/public/javascripts/images/img.png +0 -0
- data/example/public/javascripts/images/italic.png +0 -0
- data/example/public/javascripts/images/link.png +0 -0
- data/example/public/javascripts/images/ol.png +0 -0
- data/example/public/javascripts/images/redo.png +0 -0
- data/example/public/javascripts/images/separator.png +0 -0
- data/example/public/javascripts/images/ul.png +0 -0
- data/example/public/javascripts/images/undo.png +0 -0
- data/example/public/javascripts/images/wmd-on.png +0 -0
- data/example/public/javascripts/images/wmd.png +0 -0
- data/example/public/javascripts/jquery-form.js +869 -0
- data/example/public/javascripts/jquery.js +3383 -0
- data/example/public/javascripts/languages/1c.js +82 -0
- data/example/public/javascripts/languages/axapta.js +52 -0
- data/example/public/javascripts/languages/bash.js +80 -0
- data/example/public/javascripts/languages/diff.js +64 -0
- data/example/public/javascripts/languages/dos.js +33 -0
- data/example/public/javascripts/languages/dynamic.js +460 -0
- data/example/public/javascripts/languages/ini.js +36 -0
- data/example/public/javascripts/languages/javascript.js +38 -0
- data/example/public/javascripts/languages/lisp.js +86 -0
- data/example/public/javascripts/languages/mel.js +50 -0
- data/example/public/javascripts/languages/profile.js +50 -0
- data/example/public/javascripts/languages/renderman.js +71 -0
- data/example/public/javascripts/languages/smalltalk.js +53 -0
- data/example/public/javascripts/languages/sql.js +50 -0
- data/example/public/javascripts/languages/static.js +175 -0
- data/example/public/javascripts/languages/vbscript.js +25 -0
- data/example/public/javascripts/languages/www.js +245 -0
- data/example/public/javascripts/prettyDate.js +36 -0
- data/example/public/javascripts/showdown.js +421 -0
- data/example/public/javascripts/template.js +165 -0
- data/example/public/javascripts/wmd-base.js +1799 -0
- data/example/public/javascripts/wmd-plus.js +311 -0
- data/example/public/javascripts/wmd.js +73 -0
- data/example/public/stylesheets/grid.css +243 -0
- data/example/public/stylesheets/grid.png +0 -0
- data/example/public/stylesheets/highlight/ascetic.css +38 -0
- data/example/public/stylesheets/highlight/dark.css +96 -0
- data/example/public/stylesheets/highlight/default.css +91 -0
- data/example/public/stylesheets/highlight/far.css +95 -0
- data/example/public/stylesheets/highlight/idea.css +75 -0
- data/example/public/stylesheets/highlight/sunburst.css +112 -0
- data/example/public/stylesheets/highlight/zenburn.css +108 -0
- data/example/public/stylesheets/print.css +76 -0
- data/example/public/stylesheets/reset.css +45 -0
- data/example/public/stylesheets/style.css +141 -0
- data/example/public/stylesheets/typography.css +59 -0
- data/example/templates/feed.rxml +21 -0
- data/example/templates/layout.rhtml +54 -0
- data/example/templates/page.rhtml +4 -0
- data/example/templates/post.rhtml +57 -0
- data/example/templates/posts.rhtml +10 -0
- data/lib/shinmun.rb +420 -0
- metadata +151 -0
@@ -0,0 +1,1799 @@
|
|
1
|
+
var Attacklab=Attacklab||{};
|
2
|
+
Attacklab.wmdBase=function(){
|
3
|
+
var _1=top;
|
4
|
+
var _2=_1["Attacklab"];
|
5
|
+
var _3=_1["document"];
|
6
|
+
var _4=_1["RegExp"];
|
7
|
+
var _5=_1["navigator"];
|
8
|
+
_2.Util={};
|
9
|
+
_2.Position={};
|
10
|
+
_2.Command={};
|
11
|
+
var _6=_2.Util;
|
12
|
+
var _7=_2.Position;
|
13
|
+
var _8=_2.Command;
|
14
|
+
_2.Util.IE=(_5.userAgent.indexOf("MSIE")!=-1);
|
15
|
+
_2.Util.oldIE=(_5.userAgent.indexOf("MSIE 6.")!=-1||_5.userAgent.indexOf("MSIE 5.")!=-1);
|
16
|
+
_2.Util.newIE=!_2.Util.oldIE&&(_5.userAgent.indexOf("MSIE")!=-1);
|
17
|
+
_6.makeElement=function(_9,_a){
|
18
|
+
var _b=_3.createElement(_9);
|
19
|
+
if(!_a){
|
20
|
+
var _c=_b.style;
|
21
|
+
_c.margin="0";
|
22
|
+
_c.padding="0";
|
23
|
+
_c.clear="none";
|
24
|
+
_c.cssFloat="none";
|
25
|
+
_c.textAlign="left";
|
26
|
+
_c.position="relative";
|
27
|
+
_c.lineHeight="1em";
|
28
|
+
_c.border="none";
|
29
|
+
_c.color="black";
|
30
|
+
_c.backgroundRepeat="no-repeat";
|
31
|
+
_c.backgroundImage="none";
|
32
|
+
_c.minWidth=_c.minHeight="0";
|
33
|
+
_c.maxWidth=_c.maxHeight="90000px";
|
34
|
+
}
|
35
|
+
return _b;
|
36
|
+
};
|
37
|
+
_6.getStyle=function(_d,_e){
|
38
|
+
var _f=function(_10){
|
39
|
+
return _10.replace(/-(\S)/g,function(_11,_12){
|
40
|
+
return _12.toUpperCase();
|
41
|
+
});
|
42
|
+
};
|
43
|
+
if(_d.currentStyle){
|
44
|
+
_e=_f(_e);
|
45
|
+
return _d.currentStyle[_e];
|
46
|
+
}else{
|
47
|
+
if(_1.getComputedStyle){
|
48
|
+
return _3.defaultView.getComputedStyle(_d,null).getPropertyValue(_e);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return "";
|
52
|
+
};
|
53
|
+
_6.getElementsByClass=function(_13,_14,_15){
|
54
|
+
var _16=[];
|
55
|
+
if(_14==null){
|
56
|
+
_14=_3;
|
57
|
+
}
|
58
|
+
if(_15==null){
|
59
|
+
_15="*";
|
60
|
+
}
|
61
|
+
var _17=_14.getElementsByTagName(_15);
|
62
|
+
var _18=_17.length;
|
63
|
+
var _19=new _4("(^|\\s)"+_13+"(\\s|$)");
|
64
|
+
for(var i=0,j=0;i<_18;i++){
|
65
|
+
if(_19.test(_17[i].className.toLowerCase())){
|
66
|
+
_16[j]=_17[i];
|
67
|
+
j++;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return _16;
|
71
|
+
};
|
72
|
+
_6.addEvent=function(_1c,_1d,_1e){
|
73
|
+
if(_1c.attachEvent){
|
74
|
+
_1c.attachEvent("on"+_1d,_1e);
|
75
|
+
}else{
|
76
|
+
_1c.addEventListener(_1d,_1e,false);
|
77
|
+
}
|
78
|
+
};
|
79
|
+
_6.removeEvent=function(_1f,_20,_21){
|
80
|
+
if(_1f.detachEvent){
|
81
|
+
_1f.detachEvent("on"+_20,_21);
|
82
|
+
}else{
|
83
|
+
_1f.removeEventListener(_20,_21,false);
|
84
|
+
}
|
85
|
+
};
|
86
|
+
_6.regexToString=function(_22){
|
87
|
+
var _23={};
|
88
|
+
var _24=_22.toString();
|
89
|
+
_23.expression=_24.replace(/\/([gim]*)$/,"");
|
90
|
+
_23.flags=_4.$1;
|
91
|
+
_23.expression=_23.expression.replace(/(^\/|\/$)/g,"");
|
92
|
+
return _23;
|
93
|
+
};
|
94
|
+
_6.stringToRegex=function(_25){
|
95
|
+
return new _4(_25.expression,_25.flags);
|
96
|
+
};
|
97
|
+
_6.elementOk=function(_26){
|
98
|
+
if(!_26||!_26.parentNode){
|
99
|
+
return false;
|
100
|
+
}
|
101
|
+
if(_6.getStyle(_26,"display")=="none"){
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
return true;
|
105
|
+
};
|
106
|
+
_6.skin=function(_27,_28,_29,_2a){
|
107
|
+
var _2b;
|
108
|
+
var _2c=(_5.userAgent.indexOf("MSIE")!=-1);
|
109
|
+
if(_2c){
|
110
|
+
_6.fillers=[];
|
111
|
+
}
|
112
|
+
var _2d=_29/2;
|
113
|
+
for(var _2e=0;_2e<4;_2e++){
|
114
|
+
var _2f=_6.makeElement("div");
|
115
|
+
_2b=_2f.style;
|
116
|
+
_2b.overflow="hidden";
|
117
|
+
_2b.padding="0";
|
118
|
+
_2b.margin="0";
|
119
|
+
_2b.lineHeight="0px";
|
120
|
+
_2b.height=_2d+"px";
|
121
|
+
_2b.width="50%";
|
122
|
+
_2b.maxHeight=_2d+"px";
|
123
|
+
_2b.position="absolute";
|
124
|
+
if(_2e&1){
|
125
|
+
_2b.top="0";
|
126
|
+
}else{
|
127
|
+
_2b.bottom=-_29+"px";
|
128
|
+
}
|
129
|
+
_2b.zIndex="-1000";
|
130
|
+
if(_2e&2){
|
131
|
+
_2b.left="0";
|
132
|
+
}else{
|
133
|
+
_2b.marginLeft="50%";
|
134
|
+
}
|
135
|
+
if(_2c){
|
136
|
+
var _30=_6.makeElement("span");
|
137
|
+
_2b=_30.style;
|
138
|
+
_2b.height="100%";
|
139
|
+
_2b.width=_2a;
|
140
|
+
_2b.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_2.basePath+"images/bg.png')";
|
141
|
+
_2b.position="absolute";
|
142
|
+
if(_2e&1){
|
143
|
+
_2b.top="0";
|
144
|
+
}else{
|
145
|
+
_2b.bottom="0";
|
146
|
+
}
|
147
|
+
if(_2e&2){
|
148
|
+
_2b.left="0";
|
149
|
+
}else{
|
150
|
+
_2b.right="0";
|
151
|
+
}
|
152
|
+
_2f.appendChild(_30);
|
153
|
+
}else{
|
154
|
+
_2b.backgroundImage="url("+_28+")";
|
155
|
+
_2b.backgroundPosition=(_2e&2?"left":"right")+" "+(_2e&1?"top":"bottom");
|
156
|
+
}
|
157
|
+
_27.appendChild(_2f);
|
158
|
+
}
|
159
|
+
var _31=function(_32){
|
160
|
+
var _33=_6.makeElement("div");
|
161
|
+
if(_6.fillers){
|
162
|
+
_6.fillers.push(_33);
|
163
|
+
}
|
164
|
+
_2b=_33.style;
|
165
|
+
_2b.overflow="hidden";
|
166
|
+
_2b.padding="0";
|
167
|
+
_2b.margin="0";
|
168
|
+
_2b.marginTop=_2d+"px";
|
169
|
+
_2b.lineHeight="0px";
|
170
|
+
_2b.height="100%";
|
171
|
+
_2b.width="50%";
|
172
|
+
_2b.position="absolute";
|
173
|
+
_2b.zIndex="-1000";
|
174
|
+
if(_2c){
|
175
|
+
var _34=_6.makeElement("span");
|
176
|
+
_2b=_34.style;
|
177
|
+
_2b.height="100%";
|
178
|
+
_2b.width=_2a;
|
179
|
+
_2b.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_2.basePath+"images/bg-fill.png',sizingMethod='scale')";
|
180
|
+
_2b.position="absolute";
|
181
|
+
_33.appendChild(_34);
|
182
|
+
if(_32){
|
183
|
+
_2b.left="0";
|
184
|
+
}
|
185
|
+
if(!_32){
|
186
|
+
_2b.right="0";
|
187
|
+
}
|
188
|
+
}
|
189
|
+
if(!_2c){
|
190
|
+
_2b.backgroundImage="url("+_2.basePath+"images/bg-fill.png)";
|
191
|
+
_2b.backgroundRepeat="repeat-y";
|
192
|
+
if(_32){
|
193
|
+
_2b.backgroundPosition="left top";
|
194
|
+
}
|
195
|
+
if(!_32){
|
196
|
+
_2b.backgroundPosition="right top";
|
197
|
+
}
|
198
|
+
}
|
199
|
+
if(!_32){
|
200
|
+
_33.style.marginLeft="50%";
|
201
|
+
}
|
202
|
+
return _33;
|
203
|
+
};
|
204
|
+
_27.appendChild(_31(true));
|
205
|
+
_27.appendChild(_31(false));
|
206
|
+
};
|
207
|
+
_6.setImage=function(_35,_36,_37,_38){
|
208
|
+
_36=_2.basePath+_36;
|
209
|
+
if(_5.userAgent.indexOf("MSIE")!=-1){
|
210
|
+
var _39=_35.firstChild;
|
211
|
+
var _3a=_39.style;
|
212
|
+
_3a.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_36+"')";
|
213
|
+
}else{
|
214
|
+
_35.src=_36;
|
215
|
+
}
|
216
|
+
return _35;
|
217
|
+
};
|
218
|
+
_6.createImage=function(_3b,_3c,_3d){
|
219
|
+
_3b=_2.basePath+_3b;
|
220
|
+
if(_5.userAgent.indexOf("MSIE")!=-1){
|
221
|
+
var _3e=_6.makeElement("span");
|
222
|
+
var _3f=_3e.style;
|
223
|
+
_3f.display="inline-block";
|
224
|
+
_3f.height="1px";
|
225
|
+
_3f.width="1px";
|
226
|
+
_3e.unselectable="on";
|
227
|
+
var _40=_6.makeElement("span");
|
228
|
+
_3f=_40.style;
|
229
|
+
_3f.display="inline-block";
|
230
|
+
_3f.height="1px";
|
231
|
+
_3f.width="1px";
|
232
|
+
_3f.filter="progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+_3b+"')";
|
233
|
+
_40.unselectable="on";
|
234
|
+
_3e.appendChild(_40);
|
235
|
+
}else{
|
236
|
+
var _3e=_6.makeElement("img");
|
237
|
+
_3e.style.display="inline";
|
238
|
+
_3e.src=_3b;
|
239
|
+
}
|
240
|
+
_3e.style.border="none";
|
241
|
+
_3e.border="0";
|
242
|
+
if(_3c&&_3d){
|
243
|
+
_3e.style.width=_3c+"px";
|
244
|
+
_3e.style.height=_3d+"px";
|
245
|
+
}
|
246
|
+
return _3e;
|
247
|
+
};
|
248
|
+
_6.prompt=function(_41,_42,_43){
|
249
|
+
var _44;
|
250
|
+
var _45,_46,_47;
|
251
|
+
var _48=function(_49){
|
252
|
+
var _4a=(_49.charCode||_49.keyCode);
|
253
|
+
if(_4a==27){
|
254
|
+
_4b(true);
|
255
|
+
}
|
256
|
+
};
|
257
|
+
var _4b=function(_4c){
|
258
|
+
_6.removeEvent(_3.body,"keydown",_48);
|
259
|
+
var _4d=_47.value;
|
260
|
+
if(_4c){
|
261
|
+
_4d=null;
|
262
|
+
}
|
263
|
+
_45.parentNode.removeChild(_45);
|
264
|
+
_46.parentNode.removeChild(_46);
|
265
|
+
_43(_4d);
|
266
|
+
return false;
|
267
|
+
};
|
268
|
+
if(_42==undefined){
|
269
|
+
_42="";
|
270
|
+
}
|
271
|
+
var _4e=function(){
|
272
|
+
_46=_6.makeElement("div");
|
273
|
+
_44=_46.style;
|
274
|
+
_3.body.appendChild(_46);
|
275
|
+
_44.position="absolute";
|
276
|
+
_44.top="0";
|
277
|
+
_44.left="0";
|
278
|
+
_44.backgroundColor="#000";
|
279
|
+
_44.zIndex="1000";
|
280
|
+
var _4f=/konqueror/.test(_5.userAgent.toLowerCase());
|
281
|
+
if(_4f){
|
282
|
+
_44.backgroundColor="transparent";
|
283
|
+
}else{
|
284
|
+
_44.opacity="0.5";
|
285
|
+
_44.filter="alpha(opacity=50)";
|
286
|
+
}
|
287
|
+
var _50=_7.getPageSize();
|
288
|
+
_44.width="100%";
|
289
|
+
_44.height=_50[1]+"px";
|
290
|
+
};
|
291
|
+
var _51=function(){
|
292
|
+
_45=_3.createElement("div");
|
293
|
+
_45.style.border="3px solid #333";
|
294
|
+
_45.style.backgroundColor="#ccc";
|
295
|
+
_45.style.padding="10px;";
|
296
|
+
_45.style.borderTop="3px solid white";
|
297
|
+
_45.style.borderLeft="3px solid white";
|
298
|
+
_45.style.position="fixed";
|
299
|
+
_45.style.width="400px";
|
300
|
+
_45.style.zIndex="1001";
|
301
|
+
var _52=_6.makeElement("div");
|
302
|
+
_44=_52.style;
|
303
|
+
_44.fontSize="14px";
|
304
|
+
_44.fontFamily="Helvetica, Arial, Verdana, sans-serif";
|
305
|
+
_44.padding="5px";
|
306
|
+
_52.innerHTML=_41;
|
307
|
+
_45.appendChild(_52);
|
308
|
+
var _53=_6.makeElement("form");
|
309
|
+
_53.onsubmit=function(){
|
310
|
+
return _4b();
|
311
|
+
};
|
312
|
+
_44=_53.style;
|
313
|
+
_44.padding="0";
|
314
|
+
_44.margin="0";
|
315
|
+
_44.cssFloat="left";
|
316
|
+
_44.width="100%";
|
317
|
+
_44.textAlign="center";
|
318
|
+
_44.position="relative";
|
319
|
+
_45.appendChild(_53);
|
320
|
+
_47=_3.createElement("input");
|
321
|
+
_47.value=_42;
|
322
|
+
_44=_47.style;
|
323
|
+
_44.display="block";
|
324
|
+
_44.width="80%";
|
325
|
+
_44.marginLeft=_44.marginRight="auto";
|
326
|
+
_44.backgroundColor="white";
|
327
|
+
_44.color="black";
|
328
|
+
_53.appendChild(_47);
|
329
|
+
var _54=_3.createElement("input");
|
330
|
+
_54.type="button";
|
331
|
+
_54.onclick=function(){
|
332
|
+
return _4b();
|
333
|
+
};
|
334
|
+
_54.value="OK";
|
335
|
+
_44=_54.style;
|
336
|
+
_44.margin="10px";
|
337
|
+
_44.display="inline";
|
338
|
+
_44.width="7em";
|
339
|
+
var _55=_3.createElement("input");
|
340
|
+
_55.type="button";
|
341
|
+
_55.onclick=function(){
|
342
|
+
return _4b(true);
|
343
|
+
};
|
344
|
+
_55.value="Cancel";
|
345
|
+
_44=_55.style;
|
346
|
+
_44.margin="10px";
|
347
|
+
_44.display="inline";
|
348
|
+
_44.width="7em";
|
349
|
+
if(/mac/.test(_5.platform.toLowerCase())){
|
350
|
+
_53.appendChild(_55);
|
351
|
+
_53.appendChild(_54);
|
352
|
+
}else{
|
353
|
+
_53.appendChild(_54);
|
354
|
+
_53.appendChild(_55);
|
355
|
+
}
|
356
|
+
_6.addEvent(_3.body,"keydown",_48);
|
357
|
+
_45.style.top="50%";
|
358
|
+
_45.style.left="50%";
|
359
|
+
_45.style.display="block";
|
360
|
+
if(_2.Util.oldIE){
|
361
|
+
var _56=_7.getPageSize();
|
362
|
+
_45.style.position="absolute";
|
363
|
+
_45.style.top=_3.documentElement.scrollTop+200+"px";
|
364
|
+
_45.style.left="50%";
|
365
|
+
}
|
366
|
+
_3.body.appendChild(_45);
|
367
|
+
_45.style.marginTop=-(_7.getHeight(_45)/2)+"px";
|
368
|
+
_45.style.marginLeft=-(_7.getWidth(_45)/2)+"px";
|
369
|
+
};
|
370
|
+
_4e();
|
371
|
+
_1.setTimeout(function(){
|
372
|
+
_51();
|
373
|
+
var _57=_42.length;
|
374
|
+
if(_47.selectionStart!=undefined){
|
375
|
+
_47.selectionStart=0;
|
376
|
+
_47.selectionEnd=_57;
|
377
|
+
}else{
|
378
|
+
if(_47.createTextRange){
|
379
|
+
var _58=_47.createTextRange();
|
380
|
+
_58.collapse(false);
|
381
|
+
_58.moveStart("character",-_57);
|
382
|
+
_58.moveEnd("character",_57);
|
383
|
+
_58.select();
|
384
|
+
}
|
385
|
+
}
|
386
|
+
_47.focus();
|
387
|
+
},0);
|
388
|
+
};
|
389
|
+
_6.objectsEqual=function(_59,_5a){
|
390
|
+
for(var _5b in _59){
|
391
|
+
if(_59[_5b]!=_5a[_5b]){
|
392
|
+
return false;
|
393
|
+
}
|
394
|
+
}
|
395
|
+
for(_5b in _5a){
|
396
|
+
if(_59[_5b]!=_5a[_5b]){
|
397
|
+
return false;
|
398
|
+
}
|
399
|
+
}
|
400
|
+
return true;
|
401
|
+
};
|
402
|
+
_6.cloneObject=function(_5c){
|
403
|
+
var _5d={};
|
404
|
+
for(var _5e in _5c){
|
405
|
+
_5d[_5e]=_5c[_5e];
|
406
|
+
}
|
407
|
+
return _5d;
|
408
|
+
};
|
409
|
+
_6.escapeUnderscores=function(_5f){
|
410
|
+
_5f=_5f.replace(/(\S)(_+)(\S)/g,function(_60,_61,_62,_63){
|
411
|
+
_62=_62.replace(/_/g,"_");
|
412
|
+
return _61+_62+_63;
|
413
|
+
});
|
414
|
+
return _5f;
|
415
|
+
};
|
416
|
+
_7.getPageSize=function(){
|
417
|
+
var _64,_65;
|
418
|
+
var _66,_67;
|
419
|
+
if(_1.innerHeight&&_1.scrollMaxY){
|
420
|
+
_64=_3.body.scrollWidth;
|
421
|
+
_65=_1.innerHeight+_1.scrollMaxY;
|
422
|
+
}else{
|
423
|
+
if(_3.body.scrollHeight>_3.body.offsetHeight){
|
424
|
+
_64=_3.body.scrollWidth;
|
425
|
+
_65=_3.body.scrollHeight;
|
426
|
+
}else{
|
427
|
+
_64=_3.body.offsetWidth;
|
428
|
+
_65=_3.body.offsetHeight;
|
429
|
+
}
|
430
|
+
}
|
431
|
+
var _68,_69;
|
432
|
+
if(self.innerHeight){
|
433
|
+
_68=self.innerWidth;
|
434
|
+
_69=self.innerHeight;
|
435
|
+
}else{
|
436
|
+
if(_3.documentElement&&_3.documentElement.clientHeight){
|
437
|
+
_68=_3.documentElement.clientWidth;
|
438
|
+
_69=_3.documentElement.clientHeight;
|
439
|
+
}else{
|
440
|
+
if(_3.body){
|
441
|
+
_68=_3.body.clientWidth;
|
442
|
+
_69=_3.body.clientHeight;
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
446
|
+
if(_65<_69){
|
447
|
+
_67=_69;
|
448
|
+
}else{
|
449
|
+
_67=_65;
|
450
|
+
}
|
451
|
+
if(_64<_68){
|
452
|
+
_66=_68;
|
453
|
+
}else{
|
454
|
+
_66=_64;
|
455
|
+
}
|
456
|
+
var _6a=[_66,_67,_68,_69];
|
457
|
+
return _6a;
|
458
|
+
};
|
459
|
+
_7.getPixelVal=function(_6b){
|
460
|
+
if(_6b&&/^(-?\d+(\.\d*)?)px$/.test(_6b)){
|
461
|
+
return _4.$1;
|
462
|
+
}
|
463
|
+
return undefined;
|
464
|
+
};
|
465
|
+
_7.getTop=function(_6c,_6d){
|
466
|
+
var _6e=_6c.offsetTop;
|
467
|
+
if(!_6d){
|
468
|
+
while(_6c=_6c.offsetParent){
|
469
|
+
_6e+=_6c.offsetTop;
|
470
|
+
}
|
471
|
+
}
|
472
|
+
return _6e;
|
473
|
+
};
|
474
|
+
_7.setTop=function(_6f,_70,_71){
|
475
|
+
var _72=_7.getPixelVal(_6f.style.top);
|
476
|
+
if(_72==undefined){
|
477
|
+
_6f.style.top=_70+"px";
|
478
|
+
_72=_70;
|
479
|
+
}
|
480
|
+
var _73=_7.getTop(_6f,_71)-_72;
|
481
|
+
_6f.style.top=(_70-_73)+"px";
|
482
|
+
};
|
483
|
+
_7.getLeft=function(_74,_75){
|
484
|
+
var _76=_74.offsetLeft;
|
485
|
+
if(!_75){
|
486
|
+
while(_74=_74.offsetParent){
|
487
|
+
_76+=_74.offsetLeft;
|
488
|
+
}
|
489
|
+
}
|
490
|
+
return _76;
|
491
|
+
};
|
492
|
+
_7.setLeft=function(_77,_78,_79){
|
493
|
+
var _7a=_7.getPixelVal(_77.style.left);
|
494
|
+
if(_7a==undefined){
|
495
|
+
_77.style.left=_78+"px";
|
496
|
+
_7a=_78;
|
497
|
+
}
|
498
|
+
var _7b=_7.getLeft(_77,_79)-_7a;
|
499
|
+
_77.style.left=(_78-_7b)+"px";
|
500
|
+
};
|
501
|
+
_7.getHeight=function(_7c){
|
502
|
+
var _7d=_7c.offsetHeight;
|
503
|
+
if(!_7d){
|
504
|
+
_7d=_7c.scrollHeight;
|
505
|
+
}
|
506
|
+
return _7d;
|
507
|
+
};
|
508
|
+
_7.setHeight=function(_7e,_7f){
|
509
|
+
var _80=_7.getPixelVal(_7e.style.height);
|
510
|
+
if(_80==undefined){
|
511
|
+
_7e.style.height=_7f+"px";
|
512
|
+
_80=_7f;
|
513
|
+
}
|
514
|
+
var _81=_7.getHeight(_7e)-_80;
|
515
|
+
if(_81>_7f){
|
516
|
+
_81=_7f;
|
517
|
+
}
|
518
|
+
_7e.style.height=(_7f-_81)+"px";
|
519
|
+
};
|
520
|
+
_7.getWidth=function(_82){
|
521
|
+
var _83=_82.offsetWidth;
|
522
|
+
if(!_83){
|
523
|
+
_83=_82.scrollWidth;
|
524
|
+
}
|
525
|
+
return _83;
|
526
|
+
};
|
527
|
+
_7.setWidth=function(_84,_85){
|
528
|
+
var _86=_7.getPixelVal(_84.style.width);
|
529
|
+
if(_86==undefined){
|
530
|
+
_84.style.width=_85+"px";
|
531
|
+
_86=_85;
|
532
|
+
}
|
533
|
+
var _87=_7.getWidth(_84)-_86;
|
534
|
+
if(_87>_85){
|
535
|
+
_87=_85;
|
536
|
+
}
|
537
|
+
_84.style.width=(_85-_87)+"px";
|
538
|
+
};
|
539
|
+
_7.getWindowHeight=function(){
|
540
|
+
if(_1.innerHeight){
|
541
|
+
return _1.innerHeight;
|
542
|
+
}else{
|
543
|
+
if(_3.documentElement&&_3.documentElement.clientHeight){
|
544
|
+
return _3.documentElement.clientHeight;
|
545
|
+
}else{
|
546
|
+
if(_3.body){
|
547
|
+
return _3.body.clientHeight;
|
548
|
+
}
|
549
|
+
}
|
550
|
+
}
|
551
|
+
};
|
552
|
+
_2.inputPoller=function(_88,_89,_8a){
|
553
|
+
var _8b=this;
|
554
|
+
var _8c;
|
555
|
+
var _8d;
|
556
|
+
var _8e,_8f;
|
557
|
+
this.tick=function(){
|
558
|
+
if(!_6.elementOk(_88)){
|
559
|
+
return;
|
560
|
+
}
|
561
|
+
if(_88.selectionStart||_88.selectionStart==0){
|
562
|
+
var _90=_88.selectionStart;
|
563
|
+
var _91=_88.selectionEnd;
|
564
|
+
if(_90!=_8c||_91!=_8d){
|
565
|
+
_8c=_90;
|
566
|
+
_8d=_91;
|
567
|
+
if(_8e!=_88.value){
|
568
|
+
_8e=_88.value;
|
569
|
+
return true;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
}
|
573
|
+
return false;
|
574
|
+
};
|
575
|
+
var _92=function(){
|
576
|
+
if(_6.getStyle(_88,"display")=="none"){
|
577
|
+
return;
|
578
|
+
}
|
579
|
+
if(_8b.tick()){
|
580
|
+
_89();
|
581
|
+
}
|
582
|
+
};
|
583
|
+
var _93=function(){
|
584
|
+
if(_8a==undefined){
|
585
|
+
_8a=500;
|
586
|
+
}
|
587
|
+
_8f=_1.setInterval(_92,_8a);
|
588
|
+
};
|
589
|
+
this.destroy=function(){
|
590
|
+
_1.clearInterval(_8f);
|
591
|
+
};
|
592
|
+
_93();
|
593
|
+
};
|
594
|
+
_2.undoManager=function(_94,_95){
|
595
|
+
var _96=this;
|
596
|
+
var _97=[];
|
597
|
+
var _98=0;
|
598
|
+
var _99="none";
|
599
|
+
var _9a;
|
600
|
+
var _9b;
|
601
|
+
var _9c;
|
602
|
+
var _9d;
|
603
|
+
var _9e=function(_9f,_a0){
|
604
|
+
if(_99!=_9f){
|
605
|
+
_99=_9f;
|
606
|
+
if(!_a0){
|
607
|
+
_a1();
|
608
|
+
}
|
609
|
+
}
|
610
|
+
if(!_2.Util.IE||_99!="moving"){
|
611
|
+
_9c=_1.setTimeout(_a2,1);
|
612
|
+
}else{
|
613
|
+
_9d=null;
|
614
|
+
}
|
615
|
+
};
|
616
|
+
var _a2=function(){
|
617
|
+
_9d=new _2.textareaState(_94);
|
618
|
+
_9b.tick();
|
619
|
+
_9c=undefined;
|
620
|
+
};
|
621
|
+
this.setCommandMode=function(){
|
622
|
+
_99="command";
|
623
|
+
_a1();
|
624
|
+
_9c=_1.setTimeout(_a2,0);
|
625
|
+
};
|
626
|
+
this.canUndo=function(){
|
627
|
+
return _98>1;
|
628
|
+
};
|
629
|
+
this.canRedo=function(){
|
630
|
+
if(_97[_98+1]){
|
631
|
+
return true;
|
632
|
+
}
|
633
|
+
return false;
|
634
|
+
};
|
635
|
+
this.undo=function(){
|
636
|
+
if(_96.canUndo()){
|
637
|
+
if(_9a){
|
638
|
+
_9a.restore();
|
639
|
+
_9a=null;
|
640
|
+
}else{
|
641
|
+
_97[_98]=new _2.textareaState(_94);
|
642
|
+
_97[--_98].restore();
|
643
|
+
if(_95){
|
644
|
+
_95();
|
645
|
+
}
|
646
|
+
}
|
647
|
+
}
|
648
|
+
_99="none";
|
649
|
+
_94.focus();
|
650
|
+
_a2();
|
651
|
+
};
|
652
|
+
this.redo=function(){
|
653
|
+
if(_96.canRedo()){
|
654
|
+
_97[++_98].restore();
|
655
|
+
if(_95){
|
656
|
+
_95();
|
657
|
+
}
|
658
|
+
}
|
659
|
+
_99="none";
|
660
|
+
_94.focus();
|
661
|
+
_a2();
|
662
|
+
};
|
663
|
+
var _a1=function(){
|
664
|
+
var _a3=_9d||new _2.textareaState(_94);
|
665
|
+
if(!_a3){
|
666
|
+
return false;
|
667
|
+
}
|
668
|
+
if(_99=="moving"){
|
669
|
+
if(!_9a){
|
670
|
+
_9a=_a3;
|
671
|
+
}
|
672
|
+
return;
|
673
|
+
}
|
674
|
+
if(_9a){
|
675
|
+
if(_97[_98-1].text!=_9a.text){
|
676
|
+
_97[_98++]=_9a;
|
677
|
+
}
|
678
|
+
_9a=null;
|
679
|
+
}
|
680
|
+
_97[_98++]=_a3;
|
681
|
+
_97[_98+1]=null;
|
682
|
+
if(_95){
|
683
|
+
_95();
|
684
|
+
}
|
685
|
+
};
|
686
|
+
var _a4=function(_a5){
|
687
|
+
var _a6=false;
|
688
|
+
if(_a5.ctrlKey||_a5.metaKey){
|
689
|
+
var _a7=(_a5.charCode||_a5.keyCode)|96;
|
690
|
+
var _a8=String.fromCharCode(_a7);
|
691
|
+
switch(_a8){
|
692
|
+
case "y":
|
693
|
+
_96.redo();
|
694
|
+
_a6=true;
|
695
|
+
break;
|
696
|
+
case "z":
|
697
|
+
if(!_a5.shiftKey){
|
698
|
+
_96.undo();
|
699
|
+
}else{
|
700
|
+
_96.redo();
|
701
|
+
}
|
702
|
+
_a6=true;
|
703
|
+
break;
|
704
|
+
}
|
705
|
+
}
|
706
|
+
if(_a6){
|
707
|
+
if(_a5.preventDefault){
|
708
|
+
_a5.preventDefault();
|
709
|
+
}
|
710
|
+
if(_1.event){
|
711
|
+
_1.event.returnValue=false;
|
712
|
+
}
|
713
|
+
return;
|
714
|
+
}
|
715
|
+
};
|
716
|
+
var _a9=function(_aa){
|
717
|
+
if(!_aa.ctrlKey&&!_aa.metaKey){
|
718
|
+
var _ab=_aa.keyCode;
|
719
|
+
if((_ab>=33&&_ab<=40)||(_ab>=63232&&_ab<=63235)){
|
720
|
+
_9e("moving");
|
721
|
+
}else{
|
722
|
+
if(_ab==8||_ab==46||_ab==127){
|
723
|
+
_9e("deleting");
|
724
|
+
}else{
|
725
|
+
if(_ab==13){
|
726
|
+
_9e("newlines");
|
727
|
+
}else{
|
728
|
+
if(_ab==27){
|
729
|
+
_9e("escape");
|
730
|
+
}else{
|
731
|
+
if((_ab<16||_ab>20)&&_ab!=91){
|
732
|
+
_9e("typing");
|
733
|
+
}
|
734
|
+
}
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}
|
738
|
+
}
|
739
|
+
};
|
740
|
+
var _ac=function(){
|
741
|
+
_6.addEvent(_94,"keypress",function(_ad){
|
742
|
+
if((_ad.ctrlKey||_ad.metaKey)&&(_ad.keyCode==89||_ad.keyCode==90)){
|
743
|
+
_ad.preventDefault();
|
744
|
+
}
|
745
|
+
});
|
746
|
+
var _ae=function(){
|
747
|
+
if(_2.Util.IE||(_9d&&_9d.text!=_94.value)){
|
748
|
+
if(_9c==undefined){
|
749
|
+
_99="paste";
|
750
|
+
_a1();
|
751
|
+
_a2();
|
752
|
+
}
|
753
|
+
}
|
754
|
+
};
|
755
|
+
_9b=new _2.inputPoller(_94,_ae,100);
|
756
|
+
_6.addEvent(_94,"keydown",_a4);
|
757
|
+
_6.addEvent(_94,"keydown",_a9);
|
758
|
+
_6.addEvent(_94,"mousedown",function(){
|
759
|
+
_9e("moving");
|
760
|
+
});
|
761
|
+
_94.onpaste=_ae;
|
762
|
+
_94.ondrop=_ae;
|
763
|
+
};
|
764
|
+
var _af=function(){
|
765
|
+
_ac();
|
766
|
+
_a2();
|
767
|
+
_a1();
|
768
|
+
};
|
769
|
+
this.destroy=function(){
|
770
|
+
if(_9b){
|
771
|
+
_9b.destroy();
|
772
|
+
}
|
773
|
+
};
|
774
|
+
_af();
|
775
|
+
};
|
776
|
+
_2.editor=function(_b0,_b1){
|
777
|
+
if(!_b1){
|
778
|
+
_b1=function(){
|
779
|
+
};
|
780
|
+
}
|
781
|
+
var _b2=28;
|
782
|
+
var _b3=4076;
|
783
|
+
var _b4=0;
|
784
|
+
var _b5,_b6;
|
785
|
+
var _b7=this;
|
786
|
+
var _b8,_b9;
|
787
|
+
var _ba,_bb,_bc;
|
788
|
+
var _bd,_be,_bf;
|
789
|
+
var _c0=[];
|
790
|
+
var _c1=function(_c2){
|
791
|
+
if(_bd){
|
792
|
+
_bd.setCommandMode();
|
793
|
+
}
|
794
|
+
var _c3=new _2.textareaState(_b0);
|
795
|
+
if(!_c3){
|
796
|
+
return;
|
797
|
+
}
|
798
|
+
var _c4=_c3.getChunks();
|
799
|
+
var _c5=function(){
|
800
|
+
_b0.focus();
|
801
|
+
if(_c4){
|
802
|
+
_c3.setChunks(_c4);
|
803
|
+
}
|
804
|
+
_c3.restore();
|
805
|
+
_b1();
|
806
|
+
};
|
807
|
+
var _c6=_c2(_c4,_c5);
|
808
|
+
if(!_c6){
|
809
|
+
_c5();
|
810
|
+
}
|
811
|
+
};
|
812
|
+
var _c7=function(_c8){
|
813
|
+
_b0.focus();
|
814
|
+
if(_c8.textOp){
|
815
|
+
_c1(_c8.textOp);
|
816
|
+
}
|
817
|
+
if(_c8.execute){
|
818
|
+
_c8.execute(_b7);
|
819
|
+
}
|
820
|
+
};
|
821
|
+
var _c9=function(_ca,_cb){
|
822
|
+
var _cc=_ca.style;
|
823
|
+
if(_cb){
|
824
|
+
_cc.opacity="1.0";
|
825
|
+
_cc.KHTMLOpacity="1.0";
|
826
|
+
if(_2.Util.newIE){
|
827
|
+
_cc.filter="";
|
828
|
+
}
|
829
|
+
if(_2.Util.oldIE){
|
830
|
+
_cc.filter="chroma(color=fuchsia)";
|
831
|
+
}
|
832
|
+
_cc.cursor="pointer";
|
833
|
+
_ca.onmouseover=function(){
|
834
|
+
_cc.backgroundColor="lightblue";
|
835
|
+
_cc.border="1px solid blue";
|
836
|
+
};
|
837
|
+
_ca.onmouseout=function(){
|
838
|
+
_cc.backgroundColor="";
|
839
|
+
_cc.border="1px solid transparent";
|
840
|
+
if(_2.Util.oldIE){
|
841
|
+
_cc.borderColor="fuchsia";
|
842
|
+
_cc.filter="chroma(color=fuchsia)"+_cc.filter;
|
843
|
+
}
|
844
|
+
};
|
845
|
+
}else{
|
846
|
+
_cc.opacity="0.4";
|
847
|
+
_cc.KHTMLOpacity="0.4";
|
848
|
+
if(_2.Util.oldIE){
|
849
|
+
_cc.filter="chroma(color=fuchsia) alpha(opacity=40)";
|
850
|
+
}
|
851
|
+
if(_2.Util.newIE){
|
852
|
+
_cc.filter="alpha(opacity=40)";
|
853
|
+
}
|
854
|
+
_cc.cursor="";
|
855
|
+
_cc.backgroundColor="";
|
856
|
+
if(_ca.onmouseout){
|
857
|
+
_ca.onmouseout();
|
858
|
+
}
|
859
|
+
_ca.onmouseover=_ca.onmouseout=null;
|
860
|
+
}
|
861
|
+
};
|
862
|
+
var _cd=function(_ce){
|
863
|
+
_ce&&_c0.push(_ce);
|
864
|
+
};
|
865
|
+
var _cf=function(){
|
866
|
+
_c0.push("|");
|
867
|
+
};
|
868
|
+
var _d0=function(){
|
869
|
+
var _d1=_6.createImage("images/separator.png",20,20);
|
870
|
+
_d1.style.padding="4px";
|
871
|
+
_d1.style.paddingTop="0px";
|
872
|
+
_b9.appendChild(_d1);
|
873
|
+
};
|
874
|
+
var _d2=function(_d3){
|
875
|
+
if(_d3.image){
|
876
|
+
var _d4=_6.createImage(_d3.image,16,16);
|
877
|
+
_d4.border=0;
|
878
|
+
if(_d3.description){
|
879
|
+
var _d5=_d3.description;
|
880
|
+
if(_d3.key){
|
881
|
+
var _d6=" Ctrl+";
|
882
|
+
_d5+=_d6+_d3.key.toUpperCase();
|
883
|
+
}
|
884
|
+
_d4.title=_d5;
|
885
|
+
}
|
886
|
+
_c9(_d4,true);
|
887
|
+
var _d7=_d4.style;
|
888
|
+
_d7.margin="0px";
|
889
|
+
_d7.padding="1px";
|
890
|
+
_d7.marginTop="7px";
|
891
|
+
_d7.marginBottom="5px";
|
892
|
+
_d4.onmouseout();
|
893
|
+
var _d8=_d4;
|
894
|
+
_d8.onclick=function(){
|
895
|
+
if(_d8.onmouseout){
|
896
|
+
_d8.onmouseout();
|
897
|
+
}
|
898
|
+
_c7(_d3);
|
899
|
+
return false;
|
900
|
+
};
|
901
|
+
_b9.appendChild(_d8);
|
902
|
+
return _d8;
|
903
|
+
}
|
904
|
+
return;
|
905
|
+
};
|
906
|
+
var _d9=function(){
|
907
|
+
for(var _da in _c0){
|
908
|
+
if(_c0[_da]=="|"){
|
909
|
+
_d0();
|
910
|
+
}else{
|
911
|
+
_d2(_c0[_da]);
|
912
|
+
}
|
913
|
+
}
|
914
|
+
};
|
915
|
+
var _db=function(){
|
916
|
+
if(_bd){
|
917
|
+
_c9(_be,_bd.canUndo());
|
918
|
+
_c9(_bf,_bd.canRedo());
|
919
|
+
}
|
920
|
+
};
|
921
|
+
var _dc=function(){
|
922
|
+
if(_b0.offsetParent){
|
923
|
+
_ba=_6.makeElement("div");
|
924
|
+
var _dd=_ba.style;
|
925
|
+
_dd.visibility="hidden";
|
926
|
+
_dd.top=_dd.left=_dd.width="0px";
|
927
|
+
_dd.display="inline";
|
928
|
+
_dd.cssFloat="left";
|
929
|
+
_dd.overflow="visible";
|
930
|
+
_dd.opacity="0.999";
|
931
|
+
_b8.style.position="absolute";
|
932
|
+
_ba.appendChild(_b8);
|
933
|
+
_b0.style.marginTop="";
|
934
|
+
var _de=_7.getTop(_b0);
|
935
|
+
_b0.style.marginTop="0";
|
936
|
+
var _df=_7.getTop(_b0);
|
937
|
+
_b4=_de-_df;
|
938
|
+
_e0();
|
939
|
+
_b0.parentNode.insertBefore(_ba,_b0);
|
940
|
+
_e1();
|
941
|
+
_6.skin(_b8,_2.basePath+"images/bg.png",_b2,_b3);
|
942
|
+
_dd.visibility="visible";
|
943
|
+
return true;
|
944
|
+
}
|
945
|
+
return false;
|
946
|
+
};
|
947
|
+
var _e2=function(){
|
948
|
+
var _e3=_2.wmd_env.buttons.split(/\s+/);
|
949
|
+
for(var _e4 in _e3){
|
950
|
+
switch(_e3[_e4]){
|
951
|
+
case "|":
|
952
|
+
_cf();
|
953
|
+
break;
|
954
|
+
case "bold":
|
955
|
+
_cd(_8.bold);
|
956
|
+
break;
|
957
|
+
case "italic":
|
958
|
+
_cd(_8.italic);
|
959
|
+
break;
|
960
|
+
case "link":
|
961
|
+
_cd(_8.link);
|
962
|
+
break;
|
963
|
+
}
|
964
|
+
if(_2.full){
|
965
|
+
switch(_e3[_e4]){
|
966
|
+
case "blockquote":
|
967
|
+
_cd(_8.blockquote);
|
968
|
+
break;
|
969
|
+
case "code":
|
970
|
+
_cd(_8.code);
|
971
|
+
break;
|
972
|
+
case "image":
|
973
|
+
_cd(_8.img);
|
974
|
+
break;
|
975
|
+
case "ol":
|
976
|
+
_cd(_8.ol);
|
977
|
+
break;
|
978
|
+
case "ul":
|
979
|
+
_cd(_8.ul);
|
980
|
+
break;
|
981
|
+
case "heading":
|
982
|
+
_cd(_8.h1);
|
983
|
+
break;
|
984
|
+
case "hr":
|
985
|
+
_cd(_8.hr);
|
986
|
+
break;
|
987
|
+
}
|
988
|
+
}
|
989
|
+
}
|
990
|
+
return;
|
991
|
+
};
|
992
|
+
var _e5=function(){
|
993
|
+
if(/\?noundo/.test(_3.location.href)){
|
994
|
+
_2.nativeUndo=true;
|
995
|
+
}
|
996
|
+
if(!_2.nativeUndo){
|
997
|
+
_bd=new _2.undoManager(_b0,function(){
|
998
|
+
_b1();
|
999
|
+
_db();
|
1000
|
+
});
|
1001
|
+
}
|
1002
|
+
var _e6=_b0.parentNode;
|
1003
|
+
_b8=_6.makeElement("div");
|
1004
|
+
_b8.style.display="block";
|
1005
|
+
_b8.style.zIndex=100;
|
1006
|
+
if(!_2.full){
|
1007
|
+
_b8.title+="\n(Free Version)";
|
1008
|
+
}
|
1009
|
+
_b8.unselectable="on";
|
1010
|
+
_b8.onclick=function(){
|
1011
|
+
_b0.focus();
|
1012
|
+
};
|
1013
|
+
_b9=_6.makeElement("span");
|
1014
|
+
var _e7=_b9.style;
|
1015
|
+
_e7.height="auto";
|
1016
|
+
_e7.paddingBottom="2px";
|
1017
|
+
_e7.lineHeight="0";
|
1018
|
+
_e7.paddingLeft="15px";
|
1019
|
+
_e7.paddingRight="65px";
|
1020
|
+
_e7.display="block";
|
1021
|
+
_e7.position="absolute";
|
1022
|
+
_b9.unselectable="on";
|
1023
|
+
_b8.appendChild(_b9);
|
1024
|
+
_cd(_8.autoindent);
|
1025
|
+
var _e8=_6.createImage("images/bg.png");
|
1026
|
+
var _e9=_6.createImage("images/bg-fill.png");
|
1027
|
+
_e2();
|
1028
|
+
_d9();
|
1029
|
+
if(_bd){
|
1030
|
+
_d0();
|
1031
|
+
_be=_d2(_8.undo);
|
1032
|
+
_bf=_d2(_8.redo);
|
1033
|
+
var _ea=_5.platform.toLowerCase();
|
1034
|
+
if(/win/.test(_ea)){
|
1035
|
+
_be.title+=" - Ctrl+Z";
|
1036
|
+
_bf.title+=" - Ctrl+Y";
|
1037
|
+
}else{
|
1038
|
+
if(/mac/.test(_ea)){
|
1039
|
+
_be.title+=" - Ctrl+Z";
|
1040
|
+
_bf.title+=" - Ctrl+Shift+Z";
|
1041
|
+
}else{
|
1042
|
+
_be.title+=" - Ctrl+Z";
|
1043
|
+
_bf.title+=" - Ctrl+Shift+Z";
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
}
|
1047
|
+
var _eb="keydown";
|
1048
|
+
if(_5.userAgent.indexOf("Opera")!=-1){
|
1049
|
+
_eb="keypress";
|
1050
|
+
}
|
1051
|
+
_6.addEvent(_b0,_eb,function(_ec){
|
1052
|
+
var _ed=false;
|
1053
|
+
if(_ec.ctrlKey||_ec.metaKey){
|
1054
|
+
var _ee=(_ec.charCode||_ec.keyCode);
|
1055
|
+
var _ef=String.fromCharCode(_ee).toLowerCase();
|
1056
|
+
for(var _f0 in _c0){
|
1057
|
+
var _f1=_c0[_f0];
|
1058
|
+
if(_f1.key&&_ef==_f1.key||_f1.keyCode&&_ec.keyCode==_f1.keyCode){
|
1059
|
+
_c7(_f1);
|
1060
|
+
_ed=true;
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
if(_ed){
|
1065
|
+
if(_ec.preventDefault){
|
1066
|
+
_ec.preventDefault();
|
1067
|
+
}
|
1068
|
+
if(_1.event){
|
1069
|
+
_1.event.returnValue=false;
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
});
|
1073
|
+
_6.addEvent(_b0,"keyup",function(_f2){
|
1074
|
+
if(_f2.shiftKey&&!_f2.ctrlKey&&!_f2.metaKey){
|
1075
|
+
var _f3=(_f2.charCode||_f2.keyCode);
|
1076
|
+
switch(_f3){
|
1077
|
+
case 13:
|
1078
|
+
_c7(_8.autoindent);
|
1079
|
+
break;
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
});
|
1083
|
+
if(!_dc()){
|
1084
|
+
_bc=_1.setInterval(function(){
|
1085
|
+
if(_dc()){
|
1086
|
+
_1.clearInterval(_bc);
|
1087
|
+
}
|
1088
|
+
},100);
|
1089
|
+
}
|
1090
|
+
_6.addEvent(_1,"resize",_e1);
|
1091
|
+
_bb=_1.setInterval(_e1,100);
|
1092
|
+
if(_b0.form){
|
1093
|
+
var _f4=_b0.form.onsubmit;
|
1094
|
+
_b0.form.onsubmit=function(){
|
1095
|
+
_f5();
|
1096
|
+
if(_f4){
|
1097
|
+
return _f4.apply(this,arguments);
|
1098
|
+
}
|
1099
|
+
};
|
1100
|
+
}
|
1101
|
+
_db();
|
1102
|
+
};
|
1103
|
+
var _f5=function(){
|
1104
|
+
if(_2.showdown){
|
1105
|
+
var _f6=new _2.showdown.converter();
|
1106
|
+
}
|
1107
|
+
var _f7=_b0.value;
|
1108
|
+
var _f8=function(){
|
1109
|
+
_b0.value=_f7;
|
1110
|
+
};
|
1111
|
+
_f7=_6.escapeUnderscores(_f7);
|
1112
|
+
if(!/markdown/.test(_2.wmd_env.output.toLowerCase())){
|
1113
|
+
if(_f6){
|
1114
|
+
_b0.value=_f6.makeHtml(_f7);
|
1115
|
+
_1.setTimeout(_f8,0);
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
return true;
|
1119
|
+
};
|
1120
|
+
var _e0=function(){
|
1121
|
+
var _f9=_6.makeElement("div");
|
1122
|
+
var _fa=_f9.style;
|
1123
|
+
_fa.paddingRight="15px";
|
1124
|
+
_fa.height="100%";
|
1125
|
+
_fa.display="block";
|
1126
|
+
_fa.position="absolute";
|
1127
|
+
_fa.right="0";
|
1128
|
+
_f9.unselectable="on";
|
1129
|
+
var _fb=_6.makeElement("a");
|
1130
|
+
_fa=_fb.style;
|
1131
|
+
_fa.position="absolute";
|
1132
|
+
_fa.right="10px";
|
1133
|
+
_fa.top="5px";
|
1134
|
+
_fa.display="inline";
|
1135
|
+
_fa.width="50px";
|
1136
|
+
_fa.height="25px";
|
1137
|
+
_fb.href="http://www.wmd-editor.com/";
|
1138
|
+
_fb.target="_blank";
|
1139
|
+
_fb.title="WMD: The Wysiwym Markdown Editor";
|
1140
|
+
var _fc=_6.createImage("images/wmd.png");
|
1141
|
+
var _fd=_6.createImage("images/wmd-on.png");
|
1142
|
+
_fb.appendChild(_fc);
|
1143
|
+
_fb.onmouseover=function(){
|
1144
|
+
_6.setImage(_fc,"images/wmd-on.png");
|
1145
|
+
_fb.style.cursor="pointer";
|
1146
|
+
};
|
1147
|
+
_fb.onmouseout=function(){
|
1148
|
+
_6.setImage(_fc,"images/wmd.png");
|
1149
|
+
};
|
1150
|
+
_b8.appendChild(_fb);
|
1151
|
+
};
|
1152
|
+
var _e1=function(){
|
1153
|
+
if(!_6.elementOk(_b0)){
|
1154
|
+
_b8.style.display="none";
|
1155
|
+
return;
|
1156
|
+
}
|
1157
|
+
if(_b8.style.display=="none"){
|
1158
|
+
_b8.style.display="block";
|
1159
|
+
}
|
1160
|
+
var _fe=_7.getWidth(_b0);
|
1161
|
+
var _ff=_7.getHeight(_b0);
|
1162
|
+
var _100=_7.getLeft(_b0);
|
1163
|
+
if(_b8.style.width==_fe+"px"&&_b5==_ff&&_b6==_100){
|
1164
|
+
if(_7.getTop(_b8)<_7.getTop(_b0)){
|
1165
|
+
return;
|
1166
|
+
}
|
1167
|
+
}
|
1168
|
+
_b5=_ff;
|
1169
|
+
_b6=_100;
|
1170
|
+
var _101=100;
|
1171
|
+
_b8.style.width=Math.max(_fe,_101)+"px";
|
1172
|
+
var root=_b8.offsetParent;
|
1173
|
+
var _103=_7.getHeight(_b9);
|
1174
|
+
var _104=_103-_b2+"px";
|
1175
|
+
_b8.style.height=_104;
|
1176
|
+
if(_6.fillers){
|
1177
|
+
_6.fillers[0].style.height=_6.fillers[1].style.height=_104;
|
1178
|
+
}
|
1179
|
+
var _105=3;
|
1180
|
+
_b0.style.marginTop=_103+_105+_b4+"px";
|
1181
|
+
var _106=_7.getTop(_b0);
|
1182
|
+
var _100=_7.getLeft(_b0);
|
1183
|
+
_7.setTop(root,_106-_103-_105);
|
1184
|
+
_7.setLeft(root,_100);
|
1185
|
+
_b8.style.opacity=_b8.style.opacity||0.999;
|
1186
|
+
return;
|
1187
|
+
};
|
1188
|
+
this.undo=function(){
|
1189
|
+
if(_bd){
|
1190
|
+
_bd.undo();
|
1191
|
+
}
|
1192
|
+
};
|
1193
|
+
this.redo=function(){
|
1194
|
+
if(_bd){
|
1195
|
+
_bd.redo();
|
1196
|
+
}
|
1197
|
+
};
|
1198
|
+
var init=function(){
|
1199
|
+
_e5();
|
1200
|
+
};
|
1201
|
+
this.destroy=function(){
|
1202
|
+
if(_bd){
|
1203
|
+
_bd.destroy();
|
1204
|
+
}
|
1205
|
+
if(_ba.parentNode){
|
1206
|
+
_ba.parentNode.removeChild(_ba);
|
1207
|
+
}
|
1208
|
+
if(_b0){
|
1209
|
+
_b0.style.marginTop="";
|
1210
|
+
}
|
1211
|
+
_1.clearInterval(_bb);
|
1212
|
+
_1.clearInterval(_bc);
|
1213
|
+
};
|
1214
|
+
init();
|
1215
|
+
};
|
1216
|
+
_2.textareaState=function(_108){
|
1217
|
+
var _109=this;
|
1218
|
+
var _10a=function(_10b){
|
1219
|
+
if(_6.getStyle(_108,"display")=="none"){
|
1220
|
+
return;
|
1221
|
+
}
|
1222
|
+
var _10c=_5.userAgent.indexOf("Opera")!=-1;
|
1223
|
+
if(_10b.selectionStart!=undefined&&!_10c){
|
1224
|
+
_10b.focus();
|
1225
|
+
_10b.selectionStart=_109.start;
|
1226
|
+
_10b.selectionEnd=_109.end;
|
1227
|
+
_10b.scrollTop=_109.scrollTop;
|
1228
|
+
}else{
|
1229
|
+
if(_3.selection){
|
1230
|
+
if(_3.activeElement&&_3.activeElement!=_108){
|
1231
|
+
return;
|
1232
|
+
}
|
1233
|
+
_10b.focus();
|
1234
|
+
var _10d=_10b.createTextRange();
|
1235
|
+
_10d.moveStart("character",-_10b.value.length);
|
1236
|
+
_10d.moveEnd("character",-_10b.value.length);
|
1237
|
+
_10d.moveEnd("character",_109.end);
|
1238
|
+
_10d.moveStart("character",_109.start);
|
1239
|
+
_10d.select();
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
};
|
1243
|
+
this.init=function(_10e){
|
1244
|
+
if(_10e){
|
1245
|
+
_108=_10e;
|
1246
|
+
}
|
1247
|
+
if(_6.getStyle(_108,"display")=="none"){
|
1248
|
+
return;
|
1249
|
+
}
|
1250
|
+
_10f(_108);
|
1251
|
+
_109.scrollTop=_108.scrollTop;
|
1252
|
+
if(!_109.text&&_108.selectionStart||_108.selectionStart=="0"){
|
1253
|
+
_109.text=_108.value;
|
1254
|
+
}
|
1255
|
+
};
|
1256
|
+
var _110=function(_111){
|
1257
|
+
_111=_111.replace(/\r\n/g,"\n");
|
1258
|
+
_111=_111.replace(/\r/g,"\n");
|
1259
|
+
return _111;
|
1260
|
+
};
|
1261
|
+
var _10f=function(){
|
1262
|
+
if(_108.selectionStart||_108.selectionStart=="0"){
|
1263
|
+
_109.start=_108.selectionStart;
|
1264
|
+
_109.end=_108.selectionEnd;
|
1265
|
+
}else{
|
1266
|
+
if(_3.selection){
|
1267
|
+
_109.text=_110(_108.value);
|
1268
|
+
var _112=_3.selection.createRange();
|
1269
|
+
var _113=_110(_112.text);
|
1270
|
+
var _114="\x07";
|
1271
|
+
var _115=_114+_113+_114;
|
1272
|
+
_112.text=_115;
|
1273
|
+
var _116=_110(_108.value);
|
1274
|
+
_112.moveStart("character",-_115.length);
|
1275
|
+
_112.text=_113;
|
1276
|
+
_109.start=_116.indexOf(_114);
|
1277
|
+
_109.end=_116.lastIndexOf(_114)-_114.length;
|
1278
|
+
var _117=_109.text.length-_110(_108.value).length;
|
1279
|
+
if(_117){
|
1280
|
+
_112.moveStart("character",-_113.length);
|
1281
|
+
while(_117--){
|
1282
|
+
_113+="\n";
|
1283
|
+
_109.end+=1;
|
1284
|
+
}
|
1285
|
+
_112.text=_113;
|
1286
|
+
}
|
1287
|
+
_10a(_108);
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
return _109;
|
1291
|
+
};
|
1292
|
+
this.restore=function(_118){
|
1293
|
+
if(!_118){
|
1294
|
+
_118=_108;
|
1295
|
+
}
|
1296
|
+
if(_109.text!=undefined&&_109.text!=_118.value){
|
1297
|
+
_118.value=_109.text;
|
1298
|
+
}
|
1299
|
+
_10a(_118,_109);
|
1300
|
+
_118.scrollTop=_109.scrollTop;
|
1301
|
+
};
|
1302
|
+
this.getChunks=function(){
|
1303
|
+
var _119=new _2.Chunks();
|
1304
|
+
_119.before=_110(_109.text.substring(0,_109.start));
|
1305
|
+
_119.startTag="";
|
1306
|
+
_119.selection=_110(_109.text.substring(_109.start,_109.end));
|
1307
|
+
_119.endTag="";
|
1308
|
+
_119.after=_110(_109.text.substring(_109.end));
|
1309
|
+
_119.scrollTop=_109.scrollTop;
|
1310
|
+
return _119;
|
1311
|
+
};
|
1312
|
+
this.setChunks=function(_11a){
|
1313
|
+
_11a.before=_11a.before+_11a.startTag;
|
1314
|
+
_11a.after=_11a.endTag+_11a.after;
|
1315
|
+
var _11b=_5.userAgent.indexOf("Opera")!=-1;
|
1316
|
+
if(_11b){
|
1317
|
+
_11a.before=_11a.before.replace(/\n/g,"\r\n");
|
1318
|
+
_11a.selection=_11a.selection.replace(/\n/g,"\r\n");
|
1319
|
+
_11a.after=_11a.after.replace(/\n/g,"\r\n");
|
1320
|
+
}
|
1321
|
+
_109.start=_11a.before.length;
|
1322
|
+
_109.end=_11a.before.length+_11a.selection.length;
|
1323
|
+
_109.text=_11a.before+_11a.selection+_11a.after;
|
1324
|
+
_109.scrollTop=_11a.scrollTop;
|
1325
|
+
};
|
1326
|
+
this.init();
|
1327
|
+
};
|
1328
|
+
_2.Chunks=function(){
|
1329
|
+
};
|
1330
|
+
_2.Chunks.prototype.findTags=function(_11c,_11d){
|
1331
|
+
var _11e,_11f;
|
1332
|
+
var _120=this;
|
1333
|
+
if(_11c){
|
1334
|
+
_11f=_6.regexToString(_11c);
|
1335
|
+
_11e=new _4(_11f.expression+"$",_11f.flags);
|
1336
|
+
this.before=this.before.replace(_11e,function(_121){
|
1337
|
+
_120.startTag=_120.startTag+_121;
|
1338
|
+
return "";
|
1339
|
+
});
|
1340
|
+
_11e=new _4("^"+_11f.expression,_11f.flags);
|
1341
|
+
this.selection=this.selection.replace(_11e,function(_122){
|
1342
|
+
_120.startTag=_120.startTag+_122;
|
1343
|
+
return "";
|
1344
|
+
});
|
1345
|
+
}
|
1346
|
+
if(_11d){
|
1347
|
+
_11f=_6.regexToString(_11d);
|
1348
|
+
_11e=new _4(_11f.expression+"$",_11f.flags);
|
1349
|
+
this.selection=this.selection.replace(_11e,function(_123){
|
1350
|
+
_120.endTag=_123+_120.endTag;
|
1351
|
+
return "";
|
1352
|
+
});
|
1353
|
+
_11e=new _4("^"+_11f.expression,_11f.flags);
|
1354
|
+
this.after=this.after.replace(_11e,function(_124){
|
1355
|
+
_120.endTag=_124+_120.endTag;
|
1356
|
+
return "";
|
1357
|
+
});
|
1358
|
+
}
|
1359
|
+
};
|
1360
|
+
_2.Chunks.prototype.trimWhitespace=function(_125){
|
1361
|
+
this.selection=this.selection.replace(/^(\s*)/,"");
|
1362
|
+
if(!_125){
|
1363
|
+
this.before+=_4.$1;
|
1364
|
+
}
|
1365
|
+
this.selection=this.selection.replace(/(\s*)$/,"");
|
1366
|
+
if(!_125){
|
1367
|
+
this.after=_4.$1+this.after;
|
1368
|
+
}
|
1369
|
+
};
|
1370
|
+
_2.Chunks.prototype.skipLines=function(_126,_127,_128){
|
1371
|
+
if(_126==undefined){
|
1372
|
+
_126=1;
|
1373
|
+
}
|
1374
|
+
if(_127==undefined){
|
1375
|
+
_127=1;
|
1376
|
+
}
|
1377
|
+
_126++;
|
1378
|
+
_127++;
|
1379
|
+
var _129,_12a;
|
1380
|
+
this.selection=this.selection.replace(/(^\n*)/,"");
|
1381
|
+
this.startTag=this.startTag+_4.$1;
|
1382
|
+
this.selection=this.selection.replace(/(\n*$)/,"");
|
1383
|
+
this.endTag=this.endTag+_4.$1;
|
1384
|
+
this.startTag=this.startTag.replace(/(^\n*)/,"");
|
1385
|
+
this.before=this.before+_4.$1;
|
1386
|
+
this.endTag=this.endTag.replace(/(\n*$)/,"");
|
1387
|
+
this.after=this.after+_4.$1;
|
1388
|
+
if(this.before){
|
1389
|
+
_129=_12a="";
|
1390
|
+
while(_126--){
|
1391
|
+
_129+="\\n?";
|
1392
|
+
_12a+="\n";
|
1393
|
+
}
|
1394
|
+
if(_128){
|
1395
|
+
_129="\\n*";
|
1396
|
+
}
|
1397
|
+
this.before=this.before.replace(new _4(_129+"$",""),_12a);
|
1398
|
+
}
|
1399
|
+
if(this.after){
|
1400
|
+
_129=_12a="";
|
1401
|
+
while(_127--){
|
1402
|
+
_129+="\\n?";
|
1403
|
+
_12a+="\n";
|
1404
|
+
}
|
1405
|
+
if(_128){
|
1406
|
+
_129="\\n*";
|
1407
|
+
}
|
1408
|
+
this.after=this.after.replace(new _4(_129,""),_12a);
|
1409
|
+
}
|
1410
|
+
};
|
1411
|
+
_8.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)";
|
1412
|
+
_8.unwrap=function(_12b){
|
1413
|
+
var _12c=new _4("([^\\n])\\n(?!(\\n|"+_8.prefixes+"))","g");
|
1414
|
+
_12b.selection=_12b.selection.replace(_12c,"$1 $2");
|
1415
|
+
};
|
1416
|
+
_8.wrap=function(_12d,len){
|
1417
|
+
_8.unwrap(_12d);
|
1418
|
+
var _12f=new _4("(.{1,"+len+"})( +|$\\n?)","gm");
|
1419
|
+
_12d.selection=_12d.selection.replace(_12f,function(_130,line){
|
1420
|
+
if(new _4("^"+_8.prefixes,"").test(_130)){
|
1421
|
+
return _130;
|
1422
|
+
}
|
1423
|
+
return line+"\n";
|
1424
|
+
});
|
1425
|
+
_12d.selection=_12d.selection.replace(/\s+$/,"");
|
1426
|
+
};
|
1427
|
+
_8.doBold=function(_132){
|
1428
|
+
return _8.doBorI(_132,2,"strong text");
|
1429
|
+
};
|
1430
|
+
_8.doItalic=function(_133){
|
1431
|
+
return _8.doBorI(_133,1,"emphasized text");
|
1432
|
+
};
|
1433
|
+
_8.doBorI=function(_134,_135,_136){
|
1434
|
+
_134.trimWhitespace();
|
1435
|
+
_134.selection=_134.selection.replace(/\n{2,}/g,"\n");
|
1436
|
+
_134.before.search(/(\**$)/);
|
1437
|
+
var _137=_4.$1;
|
1438
|
+
_134.after.search(/(^\**)/);
|
1439
|
+
var _138=_4.$1;
|
1440
|
+
var _139=Math.min(_137.length,_138.length);
|
1441
|
+
if((_139>=_135)&&(_139!=2||_135!=1)){
|
1442
|
+
_134.before=_134.before.replace(_4("[*]{"+_135+"}$",""),"");
|
1443
|
+
_134.after=_134.after.replace(_4("^[*]{"+_135+"}",""),"");
|
1444
|
+
return;
|
1445
|
+
}
|
1446
|
+
if(!_134.selection&&_138){
|
1447
|
+
_134.after=_134.after.replace(/^([*_]*)/,"");
|
1448
|
+
_134.before=_134.before.replace(/(\s?)$/,"");
|
1449
|
+
var _13a=_4.$1;
|
1450
|
+
_134.before=_134.before+_138+_13a;
|
1451
|
+
return;
|
1452
|
+
}
|
1453
|
+
if(!_134.selection&&!_138){
|
1454
|
+
_134.selection=_136;
|
1455
|
+
}
|
1456
|
+
var _13b=_135<=1?"*":"**";
|
1457
|
+
_134.before=_134.before+_13b;
|
1458
|
+
_134.after=_13b+_134.after;
|
1459
|
+
};
|
1460
|
+
_8.stripLinkDefs=function(_13c,_13d){
|
1461
|
+
_13c=_13c.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(_13e,id,_140,_141,_142){
|
1462
|
+
_13d[id]=_13e.replace(/\s*$/,"");
|
1463
|
+
if(_141){
|
1464
|
+
_13d[id]=_13e.replace(/["(](.+?)[")]$/,"");
|
1465
|
+
return _141+_142;
|
1466
|
+
}
|
1467
|
+
return "";
|
1468
|
+
});
|
1469
|
+
return _13c;
|
1470
|
+
};
|
1471
|
+
_8.addLinkDef=function(_143,_144){
|
1472
|
+
var _145=0;
|
1473
|
+
var _146={};
|
1474
|
+
_143.before=_8.stripLinkDefs(_143.before,_146);
|
1475
|
+
_143.selection=_8.stripLinkDefs(_143.selection,_146);
|
1476
|
+
_143.after=_8.stripLinkDefs(_143.after,_146);
|
1477
|
+
var _147="";
|
1478
|
+
var _148=/(\[(?:\[[^\]]*\]|[^\[\]])*\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g;
|
1479
|
+
var _149=function(def){
|
1480
|
+
_145++;
|
1481
|
+
def=def.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+_145+"]:");
|
1482
|
+
_147+="\n"+def;
|
1483
|
+
};
|
1484
|
+
var _14b=function(_14c,_14d,id,end){
|
1485
|
+
if(_146[id]){
|
1486
|
+
_149(_146[id]);
|
1487
|
+
return _14d+_145+end;
|
1488
|
+
}
|
1489
|
+
return _14c;
|
1490
|
+
};
|
1491
|
+
_143.before=_143.before.replace(_148,_14b);
|
1492
|
+
if(_144){
|
1493
|
+
_149(_144);
|
1494
|
+
}else{
|
1495
|
+
_143.selection=_143.selection.replace(_148,_14b);
|
1496
|
+
}
|
1497
|
+
var _150=_145;
|
1498
|
+
_143.after=_143.after.replace(_148,_14b);
|
1499
|
+
if(_143.after){
|
1500
|
+
_143.after=_143.after.replace(/\n*$/,"");
|
1501
|
+
}
|
1502
|
+
if(!_143.after){
|
1503
|
+
_143.selection=_143.selection.replace(/\n*$/,"");
|
1504
|
+
}
|
1505
|
+
_143.after+="\n\n"+_147;
|
1506
|
+
return _150;
|
1507
|
+
};
|
1508
|
+
_8.doLinkOrImage=function(_151,_152,_153){
|
1509
|
+
_151.trimWhitespace();
|
1510
|
+
_151.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);
|
1511
|
+
if(_151.endTag.length>1){
|
1512
|
+
_151.startTag=_151.startTag.replace(/!?\[/,"");
|
1513
|
+
_151.endTag="";
|
1514
|
+
_8.addLinkDef(_151,null);
|
1515
|
+
}else{
|
1516
|
+
if(/\n\n/.test(_151.selection)){
|
1517
|
+
_8.addLinkDef(_151,null);
|
1518
|
+
return;
|
1519
|
+
}
|
1520
|
+
var _154;
|
1521
|
+
var _155=function(_156){
|
1522
|
+
if(_156!=null){
|
1523
|
+
_151.startTag=_151.endTag="";
|
1524
|
+
var _157=" [999]: "+_156;
|
1525
|
+
var num=_8.addLinkDef(_151,_157);
|
1526
|
+
_151.startTag=_152?"![":"[";
|
1527
|
+
_151.endTag="]["+num+"]";
|
1528
|
+
if(!_151.selection){
|
1529
|
+
if(_152){
|
1530
|
+
_151.selection="alt text";
|
1531
|
+
}else{
|
1532
|
+
_151.selection="link text";
|
1533
|
+
}
|
1534
|
+
}
|
1535
|
+
}
|
1536
|
+
_153();
|
1537
|
+
};
|
1538
|
+
if(_152){
|
1539
|
+
_154=_6.prompt("<p style='margin-top: 0px'><b>Enter the image URL.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/images/cloud1.jpg \"Optional title\"</p>","http://",_155);
|
1540
|
+
}else{
|
1541
|
+
_154=_6.prompt("<p style='margin-top: 0px'><b>Enter the web address.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/ \"Optional title\"</p>","http://",_155);
|
1542
|
+
}
|
1543
|
+
return true;
|
1544
|
+
}
|
1545
|
+
};
|
1546
|
+
_8.bold={};
|
1547
|
+
_8.bold.description="Strong <strong>";
|
1548
|
+
_8.bold.image="images/bold.png";
|
1549
|
+
_8.bold.key="b";
|
1550
|
+
_8.bold.textOp=_8.doBold;
|
1551
|
+
_8.italic={};
|
1552
|
+
_8.italic.description="Emphasis <em>";
|
1553
|
+
_8.italic.image="images/italic.png";
|
1554
|
+
_8.italic.key="i";
|
1555
|
+
_8.italic.textOp=_8.doItalic;
|
1556
|
+
_8.link={};
|
1557
|
+
_8.link.description="Hyperlink <a>";
|
1558
|
+
_8.link.image="images/link.png";
|
1559
|
+
_8.link.key="l";
|
1560
|
+
_8.link.textOp=function(_159,_15a){
|
1561
|
+
return _8.doLinkOrImage(_159,false,_15a);
|
1562
|
+
};
|
1563
|
+
_8.undo={};
|
1564
|
+
_8.undo.description="Undo";
|
1565
|
+
_8.undo.image="images/undo.png";
|
1566
|
+
_8.undo.execute=function(_15b){
|
1567
|
+
_15b.undo();
|
1568
|
+
};
|
1569
|
+
_8.redo={};
|
1570
|
+
_8.redo.description="Redo";
|
1571
|
+
_8.redo.image="images/redo.png";
|
1572
|
+
_8.redo.execute=function(_15c){
|
1573
|
+
_15c.redo();
|
1574
|
+
};
|
1575
|
+
_6.findPanes=function(_15d){
|
1576
|
+
_15d.preview=_15d.preview||_6.getElementsByClass("wmd-preview",null,"div")[0];
|
1577
|
+
_15d.output=_15d.output||_6.getElementsByClass("wmd-output",null,"textarea")[0];
|
1578
|
+
_15d.output=_15d.output||_6.getElementsByClass("wmd-output",null,"div")[0];
|
1579
|
+
if(!_15d.input){
|
1580
|
+
var _15e=-1;
|
1581
|
+
var _15f=_3.getElementsByTagName("textarea");
|
1582
|
+
for(var _160=0;_160<_15f.length;_160++){
|
1583
|
+
var _161=_15f[_160];
|
1584
|
+
if(_161!=_15d.output&&!/wmd-ignore/.test(_161.className.toLowerCase())){
|
1585
|
+
_15d.input=_161;
|
1586
|
+
break;
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
}
|
1590
|
+
return _15d;
|
1591
|
+
};
|
1592
|
+
_6.makeAPI=function(){
|
1593
|
+
_2.wmd={};
|
1594
|
+
_2.wmd.editor=_2.editor;
|
1595
|
+
_2.wmd.previewManager=_2.previewManager;
|
1596
|
+
};
|
1597
|
+
_6.startEditor=function(){
|
1598
|
+
if(_2.wmd_env.autostart==false){
|
1599
|
+
_2.editorInit();
|
1600
|
+
_6.makeAPI();
|
1601
|
+
return;
|
1602
|
+
}
|
1603
|
+
var _162={};
|
1604
|
+
var _163,_164;
|
1605
|
+
var _165=function(){
|
1606
|
+
try{
|
1607
|
+
var _166=_6.cloneObject(_162);
|
1608
|
+
_6.findPanes(_162);
|
1609
|
+
if(!_6.objectsEqual(_166,_162)&&_162.input){
|
1610
|
+
if(!_163){
|
1611
|
+
_2.editorInit();
|
1612
|
+
var _167;
|
1613
|
+
if(_2.previewManager!=undefined){
|
1614
|
+
_164=new _2.previewManager(_162);
|
1615
|
+
_167=_164.refresh;
|
1616
|
+
}
|
1617
|
+
_163=new _2.editor(_162.input,_167);
|
1618
|
+
}else{
|
1619
|
+
if(_164){
|
1620
|
+
_164.refresh(true);
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
}
|
1624
|
+
}
|
1625
|
+
catch(e){
|
1626
|
+
}
|
1627
|
+
};
|
1628
|
+
_6.addEvent(_1,"load",_165);
|
1629
|
+
var _168=_1.setInterval(_165,100);
|
1630
|
+
};
|
1631
|
+
_2.previewManager=function(_169){
|
1632
|
+
var _16a=this;
|
1633
|
+
var _16b,_16c;
|
1634
|
+
var _16d,_16e;
|
1635
|
+
var _16f,_170;
|
1636
|
+
var _171=3000;
|
1637
|
+
var _172="delayed";
|
1638
|
+
var _173=function(_174,_175){
|
1639
|
+
_6.addEvent(_174,"input",_175);
|
1640
|
+
_174.onpaste=_175;
|
1641
|
+
_174.ondrop=_175;
|
1642
|
+
_6.addEvent(_1,"keypress",_175);
|
1643
|
+
_6.addEvent(_174,"keypress",_175);
|
1644
|
+
_6.addEvent(_174,"keydown",_175);
|
1645
|
+
_16c=new _2.inputPoller(_174,_175);
|
1646
|
+
};
|
1647
|
+
var _176=function(){
|
1648
|
+
var _177=0;
|
1649
|
+
if(_1.innerHeight){
|
1650
|
+
_177=_1.pageYOffset;
|
1651
|
+
}else{
|
1652
|
+
if(_3.documentElement&&_3.documentElement.scrollTop){
|
1653
|
+
_177=_3.documentElement.scrollTop;
|
1654
|
+
}else{
|
1655
|
+
if(_3.body){
|
1656
|
+
_177=_3.body.scrollTop;
|
1657
|
+
}
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
return _177;
|
1661
|
+
};
|
1662
|
+
var _178=function(){
|
1663
|
+
if(!_169.preview&&!_169.output){
|
1664
|
+
return;
|
1665
|
+
}
|
1666
|
+
var text=_169.input.value;
|
1667
|
+
if(text&&text==_16f){
|
1668
|
+
return;
|
1669
|
+
}else{
|
1670
|
+
_16f=text;
|
1671
|
+
}
|
1672
|
+
var _17a=new Date().getTime();
|
1673
|
+
if(!_16b&&_2.showdown){
|
1674
|
+
_16b=new _2.showdown.converter();
|
1675
|
+
}
|
1676
|
+
text=_6.escapeUnderscores(text);
|
1677
|
+
if(_16b){
|
1678
|
+
text=_16b.makeHtml(text);
|
1679
|
+
}
|
1680
|
+
var _17b=new Date().getTime();
|
1681
|
+
_16e=_17b-_17a;
|
1682
|
+
_17c(text);
|
1683
|
+
_170=text;
|
1684
|
+
};
|
1685
|
+
var _17d=function(){
|
1686
|
+
if(_16d){
|
1687
|
+
_1.clearTimeout(_16d);
|
1688
|
+
_16d=undefined;
|
1689
|
+
}
|
1690
|
+
if(_172!="manual"){
|
1691
|
+
var _17e=0;
|
1692
|
+
if(_172=="delayed"){
|
1693
|
+
_17e=_16e;
|
1694
|
+
}
|
1695
|
+
if(_17e>_171){
|
1696
|
+
_17e=_171;
|
1697
|
+
}
|
1698
|
+
_16d=_1.setTimeout(_178,_17e);
|
1699
|
+
}
|
1700
|
+
};
|
1701
|
+
var _17f;
|
1702
|
+
var _180;
|
1703
|
+
var _181=function(_182){
|
1704
|
+
if(_182.scrollHeight<=_182.clientHeight){
|
1705
|
+
return 1;
|
1706
|
+
}
|
1707
|
+
return _182.scrollTop/(_182.scrollHeight-_182.clientHeight);
|
1708
|
+
};
|
1709
|
+
var _183=function(_184,_185){
|
1710
|
+
_184.scrollTop=(_184.scrollHeight-_184.clientHeight)*_185;
|
1711
|
+
};
|
1712
|
+
var _186=function(){
|
1713
|
+
if(_169.preview){
|
1714
|
+
_17f=_181(_169.preview);
|
1715
|
+
}
|
1716
|
+
if(_169.output){
|
1717
|
+
_180=_181(_169.output);
|
1718
|
+
}
|
1719
|
+
};
|
1720
|
+
var _187=function(){
|
1721
|
+
if(_169.preview){
|
1722
|
+
_169.preview.scrollTop=_169.preview.scrollTop;
|
1723
|
+
_183(_169.preview,_17f);
|
1724
|
+
}
|
1725
|
+
if(_169.output){
|
1726
|
+
_183(_169.output,_180);
|
1727
|
+
}
|
1728
|
+
};
|
1729
|
+
this.refresh=function(_188){
|
1730
|
+
if(_188){
|
1731
|
+
_16f="";
|
1732
|
+
_178();
|
1733
|
+
}else{
|
1734
|
+
_17d();
|
1735
|
+
}
|
1736
|
+
};
|
1737
|
+
this.processingTime=function(){
|
1738
|
+
return _16e;
|
1739
|
+
};
|
1740
|
+
this.output=function(){
|
1741
|
+
return _170;
|
1742
|
+
};
|
1743
|
+
this.setUpdateMode=function(_189){
|
1744
|
+
_172=_189;
|
1745
|
+
_16a.refresh();
|
1746
|
+
};
|
1747
|
+
var _18a=true;
|
1748
|
+
var _17c=function(text){
|
1749
|
+
_186();
|
1750
|
+
var _18c=_7.getTop(_169.input)-_176();
|
1751
|
+
if(_169.output){
|
1752
|
+
if(_169.output.value!=undefined){
|
1753
|
+
_169.output.value=text;
|
1754
|
+
_169.output.readOnly=true;
|
1755
|
+
}else{
|
1756
|
+
var _18d=text.replace(/&/g,"&");
|
1757
|
+
_18d=_18d.replace(/</g,"<");
|
1758
|
+
_169.output.innerHTML="<pre><code>"+_18d+"</code></pre>";
|
1759
|
+
}
|
1760
|
+
}
|
1761
|
+
if(_169.preview){
|
1762
|
+
_169.preview.innerHTML=text;
|
1763
|
+
}
|
1764
|
+
_187();
|
1765
|
+
if(_18a){
|
1766
|
+
_18a=false;
|
1767
|
+
return;
|
1768
|
+
}
|
1769
|
+
var _18e=_7.getTop(_169.input)-_176();
|
1770
|
+
if(_5.userAgent.indexOf("MSIE")!=-1){
|
1771
|
+
_1.setTimeout(function(){
|
1772
|
+
_1.scrollBy(0,_18e-_18c);
|
1773
|
+
},0);
|
1774
|
+
}else{
|
1775
|
+
_1.scrollBy(0,_18e-_18c);
|
1776
|
+
}
|
1777
|
+
};
|
1778
|
+
var init=function(){
|
1779
|
+
_173(_169.input,_17d);
|
1780
|
+
_178();
|
1781
|
+
if(_169.preview){
|
1782
|
+
_169.preview.scrollTop=0;
|
1783
|
+
}
|
1784
|
+
if(_169.output){
|
1785
|
+
_169.output.scrollTop=0;
|
1786
|
+
}
|
1787
|
+
};
|
1788
|
+
this.destroy=function(){
|
1789
|
+
if(_16c){
|
1790
|
+
_16c.destroy();
|
1791
|
+
}
|
1792
|
+
};
|
1793
|
+
init();
|
1794
|
+
};
|
1795
|
+
};
|
1796
|
+
if(Attacklab.fileLoaded){
|
1797
|
+
Attacklab.fileLoaded("wmd-base.js");
|
1798
|
+
}
|
1799
|
+
|