aboutsummaryrefslogtreecommitdiffstats
path: root/web/nor.js
blob: 8021bf5c7d1ec18df2f70e15fe79f2b813597fc4 (plain) (blame)
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
104
105
106
107
108
109
110
111
var nor_userid;
var nor_usersec;

function nor_init(){
    $('div.nor_button').hover(
            function(e){
                $(this).addClass('nor_button_m');
            },
            function(e){
                $(this).removeClass('nor_button_m');
            }
    );
    $('div.nor_tab > div.button').hover(
            function(e){
                $(this).addClass('button_m');
            },
            function(e){
                $(this).removeClass('button_m');
            }
    );
    $('div.nor_mask_head > div.button').hover(
            function(e){
                $(this).addClass('button_m');
            },
            function(e){
                $(this).removeClass('button_m');
            }
    );
}
function nor_scoretolight(sumscore,summaxscore){
    var i;
    var part;
    var light;

    if(sumscore == null){
        return 0;
    }

    if(summaxscore == 0){
        light = 1;
    }else{
        ratio = Math.floor(sumscore / summaxscore * 100);
        if(ratio == 100){
            light = 4;
        }else if(ratio >= 80){
            light = 3;
        }else if(ratio >= 60){
            light = 2;
        }else{
            light = 1;
        }
    }

    return light;
}
function nor_expendheight(){
    var i;
    var es;
    var j_e;

    es = $('[expendheight=true]');
    for(i = 0;i < es.length;i++){
        j_e = $(es[i]);
        j_e.css('height',(window.innerHeight - parseInt(j_e.css('top').match(/(.+)px/)[1])) + 'px');
    }
}
function nor_new_chpgbutton(text,click){
    var j_a;

    j_a = $('<a></a>')
    j_a.addClass('nor_chpg');
    j_a.on('click',click);
    j_a.text(text)

    return j_a;
}

function nor_getparam(){
    var ret;
    var i;

    var part;
    var subpart;

    ret = new Object();
    part = location.href.match(/([^?&]+)/g);
    for(i = 1;i < part.length;i++){
        part[i] = part[i].replace(/\+/g,' ');
        subpart = part[i].split('=');
        ret[decodeURIComponent(subpart[0]).replace(/^\s+|\s$/,' ')] = decodeURIComponent(subpart[1]);
    }

    return ret;
}
function nor_getcookie(){
    var ret;
    var i;

    var part;
    var subpart;
    
    ret = new Object();
    part = document.cookie.split(';');
    for(i = 0;i < part.length;i++){
        part[i] = part[i].replace(/\+/g,' ');
        subpart = part[i].split('=');
        ret[decodeURIComponent(subpart[0])] = decodeURIComponent(subpart[1]);
    }

    return ret;
}