Show More
@@ -0,0 +1,34 b'' | |||||
|
1 | function addMarkToMsg(start, end) { | |||
|
2 | var textarea = document.getElementById('id_text'); | |||
|
3 | if(!textarea) return; | |||
|
4 | if( document.selection ) { | |||
|
5 | textarea.focus(); | |||
|
6 | sel = document.selection.createRange(); | |||
|
7 | sel.text = start + sel.text + end; | |||
|
8 | } else if(textarea.selectionStart || textarea.selectionStart == '0') { | |||
|
9 | textarea.focus(); | |||
|
10 | var startPos = textarea.selectionStart; | |||
|
11 | var endPos = textarea.selectionEnd; | |||
|
12 | textarea.value = textarea.value.substring(0, startPos) + start + textarea.value.substring(startPos, endPos) + end + textarea.value.substring( endPos, textarea.value.length ); | |||
|
13 | } else { | |||
|
14 | textarea.value += start + end; | |||
|
15 | } | |||
|
16 | return false; | |||
|
17 | } | |||
|
18 | ||||
|
19 | function addMarkPanel() { | |||
|
20 | $('.mark_btn').on('click', function() { | |||
|
21 | switch($(this).attr('id')) { | |||
|
22 | case "italic": | |||
|
23 | return addMarkToMsg('_', '_'); | |||
|
24 | case "bold": | |||
|
25 | return addMarkToMsg('__', '__'); | |||
|
26 | case "spoiler": | |||
|
27 | return addMarkToMsg('%%', '%%'); | |||
|
28 | case "comment": | |||
|
29 | return addMarkToMsg('//', ''); | |||
|
30 | case "quote": | |||
|
31 | return addMarkToMsg('>', ''); | |||
|
32 | } | |||
|
33 | }); | |||
|
34 | } |
@@ -1,17 +1,18 b'' | |||||
1 | $( document ).ready(function() { |
|
1 | $( document ).ready(function() { | |
2 | $("a[href='#top']").click(function() { |
|
2 | $("a[href='#top']").click(function() { | |
3 | $("html, body").animate({ scrollTop: 0 }, "slow"); |
|
3 | $("html, body").animate({ scrollTop: 0 }, "slow"); | |
4 | return false; |
|
4 | return false; | |
5 | }); |
|
5 | }); | |
6 |
|
6 | |||
7 | $(".fancy").fancybox({ |
|
7 | $(".fancy").fancybox({ | |
8 | closeBtn: false, |
|
8 | closeBtn: false, | |
9 | closeClick: true, |
|
9 | closeClick: true, | |
10 | padding: 0, |
|
10 | padding: 0, | |
11 | openEffect: 'none', |
|
11 | openEffect: 'none', | |
12 | closeEffect: 'none' |
|
12 | closeEffect: 'none' | |
13 | }); |
|
13 | }); | |
14 |
|
14 | |||
15 | addRefLinkMap(); |
|
15 | addRefLinkMap(); | |
16 | addPopups(); |
|
16 | addPopups(); | |
17 | }) |
|
17 | addMarkPanel(); | |
|
18 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now