-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra_fun.js
executable file
·162 lines (119 loc) · 3.6 KB
/
extra_fun.js
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// --------------------------------------------------------
function manipulate_menu(manip_ii) {
if ( manip_ii == -1 ) {
cookiename = 'list_'+input_list[choice_ind]
remlist = sokCookie(cookiename)
if (remlist == null ) { return }
remlist = unescape(remlist)
if (remlist == '' ) { return }
hej = remlist.split("##")
hej = hej[1].split(":")
for ( i=0 ; i < hej.length ; i++ ) {
if ( hej[i] != '' ) {
tmp = hej[i].split('_')
for ( j=0 ; j < tmp.length ; j++ ) {
adjustMenu(i,tmp[j],false)
}
}
pos[i] = 0
}
if ( you_menu.flip ) { you_menu.v[0] = 0 }
}
if ( manip_ii == 0 ) {
load_manip = true
goHome(choice_ind)
}
if ( manip_ii == 1 ) {
tmp = new Array() ;
for ( i=0 ; i < del_menu.length ; i++ ) {
tmp[i] = del_menu[i].join('_')
}
del_menu_name = tmp.join(':')
cookiename = 'list_'+input_list[choice_ind]
tmp = cok_menu.t.join(':') + '##' + del_menu_name
document.cookie = cookiename+"="+escape(tmp)+";expires="+expireDate(100);
you_menu.flip = true
you_menu.v[0] = 1
you_menu.v[2] = 1
you_menu.v[3] = 1
update_all('List','list')
}
if ( manip_ii == 2 || manip_ii == 3 ) {
you_menu.flip = true
del_menu_name = ""
cookiename = 'list_'+input_list[choice_ind]
if ( cok_menu.t.length > 0 ) {
tmp = cok_menu.t.join(':') + '##'
document.cookie = cookiename+"="+escape(tmp)+";expires="+expireDate(100);
} else {
deleteCookie(cookiename)
}
you_menu.v[0] = 0
you_menu.v[2] = 0
you_menu.v[3] = 0
you_menu.active = ( you_menu.v[1] == 1 && do_manip)
if ( manip_ii == 3 ) { goHome(choice_ind) } else { update_all('List','list') }
}
if ( manip_ii == 4 ) {
load_manip = false
goHome(choice_ind)
}
}
// --------------------------------------------------------
function flip(i) {
if ( i >= 0 ) {
mlist[i].t = mlist[i].t.reverse()
mlist[i].v = mlist[i].v.reverse()
mlist[i].flip = ( ! mlist[i].flip )
adjust_rem(0,rem_menu.t.length,false)
pos[i] = mlist[i].t.length - 1 - pos[i]
local_save = true
for ( ii = 0 ; ii < mlist.length ; ii++ ) {
local_save = ( local_save && ! mlist[ii].flip )
}
local_save = ( local_save && do_save )
if ( multi && mpos == i ) {
multi = false
getFig(i,-1)
return
}
getFig(i,pos[i])
} else {
if ( i == -1 ) {
rem_menu.t = rem_menu.t.reverse()
rem_menu.v = rem_menu.v.reverse()
rem_menu.pos = rem_menu.pos.reverse()
rem_menu.flip = ( ! rem_menu.flip )
if ( multi ) {
multi = false
getFig(i,-1)
}
}
}
}
// --------------------------------------------------------
function adjustMenu(i,j,flag) {
do_save = false
cok_menu.active = false
// Keep track of manipulation
delj = del_menu[i].length
del_menu[i][delj] = j
you_menu.active = do_manip
if ( you_menu.flip ) { you_menu.v[0] = 1 }
you_menu.v[1] = 1
you_menu.v[3] = 1
// Remove item
mlist[i].t.splice(j,1)
mlist[i].v.splice(j,1)
pos[i] = Math.max(0,j)
pos[i] = Math.min((mlist[i].t.length-1),j)
mlist[i].active = ( mlist[i].t.length > 1 )
adjust_rem(0,rem_menu.t.length,false)
if ( flag && multi && mpos == i ) {
multi = false
getFig(i,-1)
return
}
if ( flag ) { getFig(i,pos[i]) }
}
// --------------------------------------------------------