summaryrefslogtreecommitdiff
path: root/bug/bug/skin.js
blob: a33de5993ef05a50a3ad37ffdc0710ec770f1a6f (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
//
//     Copyright (C) 2011 Loic Dachary <loic@dachary.org>
//
//     This program is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
//
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

(function($) {

  $.skin = function() {
      $('.skin').show();
      $.bug.frame();
      $.bug.compatibility();
      function component() {
          $.bug.state_component();
      }
      function subcomponent() {
          component();
          $('.state_component .choice:nth(0)').click();
      }
      function version() {
          subcomponent();
          $.bug.ajax = function(settings) {
              return $.Deferred().resolve('NUM,DESC\n100,"BUG 1"\n200,"BUG 2"\n');
          };
          $('.state_subcomponent .active_subcomponent .choice:nth(0)').click();
      }
      function description() {
          version();
          $('.state_version .choice:nth(0)').click();
          $('.state_description .short').val('12');
      }
      function submit() {
          description();
          $('.state_description .short').val('1234567890');
          $('.state_description .long').val('12345678901');
          $('.state_description .short').change();
      }

      if(location.search.indexOf('skin=login') >= 0) {
          $.bug.state_signin();
          $.bug.error_set("THIS IS AN ERROR MESSAGE");
      } else if(location.search.indexOf('skin=component') >= 0) {
          component();
      } else if(location.search.indexOf('skin=subcomponent') >= 0) {
          subcomponent();
      } else if(location.search.indexOf('skin=version') >= 0) {
          version();
      } else if(location.search.indexOf('skin=description') >= 0) {
          description();
      } else if(location.search.indexOf('skin=submit') >= 0) {
          submit();
      } else if(location.search.indexOf('skin=complete') >= 0) {
          $.bug.state_success();
      }
  };

})(jQuery);