summaryrefslogtreecommitdiff
path: root/deps/diff.js
blob: b4141d90d0fbafa4f551e7e5565b0de4760479fa (plain)
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
95
96
97
98
99
100
101
102
103
$( document ).ready(function() {



  // selector cache
  var
    $showoriginal  = $('.menuoption#showoriginal'),
    $showmodified  = $('.menuoption#showmodified'),
    $codeprintmargin  = $('.menuoption#codeprintmargin'),
    $highlight  = $('.menuoption#highlight'),
    $dosyntaxhighlight  = $('.menuoption#dosyntaxhighlight');

  $showoriginal.state = true
  $showoriginal.on("click", function(){
    switch ($showoriginal.state) {
    case false:
       $('#leftcode').show()
       $('.right_diff_del').show()
       $('.lineno_rightdel').show()
       $showoriginal.state = true
        break;
    case true:
       $('#leftcode').hide()
       $('.right_diff_del').hide()
       $('.lineno_rightdel').hide()
       $showoriginal.state = false
        break;
      }
  });

  $showmodified.state = true
  $showmodified.on("click", function(){
    switch ($showmodified.state) {
    case false:
       $('#rightcode').show()
       $('.left_diff_add').show()
       $('.lineno_leftadd').show()
       $showmodified.state = true
        break;
    case true:
       $('#rightcode').hide()
       $('.left_diff_add').hide()
       $('.lineno_leftadd').hide()
       $showmodified.state = false
        break;
      }
  });


  $codeprintmargin.state = true
  $codeprintmargin.on("click", function(){
    switch ($codeprintmargin.state) {
    case false:
       $('.printmargin').show()
       $codeprintmargin.state = true
        break;
    case true:
       $('.printmargin').hide()
       $codeprintmargin.state = false
        break;
      }
  });


  $highlight.state = true
  $highlight.on("click", function(){
    switch ($highlight.state) {
    case false:
       $('.left_diff_change').removeClass('clearbg');
       $('.left_diff_del').removeClass('clearbg');

       $('.right_diff_add').removeClass('clearbg');
       $('.right_diff_change').removeClass('clearbg');
       $highlight.state = true
        break;
    case true:
       $('.left_diff_change').addClass('clearbg');
       $('.left_diff_del').addClass('clearbg');

       $('.right_diff_add').addClass('clearbg');
       $('.right_diff_change').addClass('clearbg');
       $highlight.state = false
        break;
      }
  });

  var originalStyle = $("link.syntaxdef").attr("href")
  $dosyntaxhighlight.state = true
  $dosyntaxhighlight.on("click", function(){
    switch ($dosyntaxhighlight.state) {
    case false:
       $("link.syntaxdef").attr("href", originalStyle);
       $dosyntaxhighlight.state = true
        break;
    case true:
       $("link.syntaxdef").attr("href","/deps/codeformats/bw.css");
       $dosyntaxhighlight.state = false
        break;
      }
  });


});