1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
<script type="text/javascript" src='{{"/bootstrap/js/bootstrap.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/post.js"|media}}'></script>
<script type="text/javascript">
// define reputation needs for comments
$(document).ready(function(){
$("#nav_questions").attr('className',"on");
$("#" + askbot['data']['answersSortTab']).attr('className',"on");
Vote.init(
askbot['data']['questionId'],
askbot['data']['threadSlug'],
askbot['data']['questionAuthorId'],
askbot['data']['userId']
);
if ((askbot['data']['threadIsClosed'] === false) && askbot['data']['userIsAuthenticated']) {
initEditor();
}
lanai.highlightSyntax();
$('#btLogin').bind('click', function(){
window.location.href='{{ settings.LOGIN_URL }}';
});
if (window.location.hash === 'fmanswer'){
$('#fmanswer textarea').focus();
}
if (askbot['settings']['enableSharingGoogle']) {
$.getScript("//apis.google.com/js/plusone.js");
}
if (askbot['data']['userId'] === askbot['data']['questionAuthorId']) {
$("#fmanswer_button").click(function() {
$("#fmanswer").show();
$("#fmanswer_button").hide();
});
}
if (askbot['data']['userIsAuthenticated']) {
var draftHandler = new DraftAnswer();
draftHandler.setThreadId({{ thread.id }});
draftHandler.decorate($(document));
}
});
$(window).bind('hashchange', animate_hashes);
function animate_hashes(){
var id_value = window.location.hash;
if (id_value != ""){
var previous_color = $(id_value).css('background-color');
$(id_value).css('backgroundColor', '#FFF8C6');
$(id_value).animate(
{backgroundColor: '#ff7f2a'}, 1000
).animate({backgroundColor: '#FFF8C6'}, 1000, function(){
$(id_value).css('backgroundColor', previous_color);
});
}
}
function initEditor(){
$('#editor').TextAreaResizer();
//highlight code synctax when editor has new text
$("#editor").typeWatch({highlight: false, wait: 3000,
captureLength: 5, callback: lanai.highlightSyntax});
var display = true;
var txt = "[{% trans %}hide preview{% endtrans %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
setupFormValidation(
$("#fmanswer"),
CPValidator.getAnswerFormRules(),
CPValidator.getAnswerFormMessages()
);
}
(function() {
var editorBox = $('.folded-editor');
if (editorBox.length) {
var foldedEditor = new FoldedEditor();
foldedEditor.decorate(editorBox);
}
})();
</script>
|