PageSourceSearch

https://lk.spacenet.ru/lbweb-client/assets/59f8a646/js/accounts.js

js spacenet.ru collected 2026-10-07 17:36:40 UTC 6,652 bytes, 202 lines download raw bytes

1$(document).ready(function() {
2
3    $('#popbox-account-show').bind('box:beforecloseout', function() {
4        var e = arguments[1];
5
6        if (e.getTarget().is('.vgroup_password_show')) {
7            e.preventClose();
8        }
9    });
10
11    App.Accounts = new function() {
12        var main = this;
13
14        this.id = function(el) {
15            var id = $(el).attr('id').split('-'),
16                result = {
17                    agrmid: id[id.length - 1]
18                };
19            result.id = '-' + result.agrmid;
20            return result;
21        };
22
23        this.crf = function(el) {
24            var crf = $(el).attr('crf');
25            return crf;
26        };
27
28        this.url = function(el) {
29            var url = $(el).attr('url');
30            return url;
31        };
32
33        this.Grids = new function() {
34            var grids = {},
35
36                exists = function(id) {
37                    var i;
38                    if (!id) { throw 'no id'; }
39                    for ( i in grids ) {
40                        if ( i == 'g-' + id ) {
41                            return grids[i];
42                        }
43                    }
44                    return false;
45                };
46
47            this.get = function(id) {
48                var grid = exists(id);
49                if (grid) { return grid; }
50                grids['g-' + id] = new App.Grid($('#vgroups-container' + id));
51                return grids['g-' + id];
52            };
53        }();
54
55        this.Grid = function(id) {
56
57            show = function(vgid, login, url) {
58                $.ajax({
59                    url: url,
60                    type: 'GET',
61                    data: {
62                        vgid: vgid,
63                        login: login
64                    },
65                    cache: false,
66                    success: function(html){
67                        if(html){
68                            $.popbox.show('popbox-account-show');
69                            $('#popbox-account-show').
70                                find('.popup_small-gray__title').
71                                html(html);
72                        } else {
73                            $.popbox.show('popbox-account-show');
74                            $('#popbox-account-show').
75                                find('.popup_small-gray__title').
76                                html('ERROR');
77                        }
78                    }
79                });
80            };
81
82            var grid = main.Grids.get(id),
83                strong = new App.Tpl('<strong>{val}</strong>');
84
85            var renderers = {
86                login: function(data) {
87                    var item = new App.Tpl(
88                            '<li>',
89                                '<a{first} {attrs}>{text}</a>',
90                            '</li>'
91                        ),
92                        i,
93                        actions = '',
94                        attrs,
95                        params,
96                        name,
97                        values;
98
99                    if (!data.actions.length) {
100                        return '<div>' + data.login + '</div>';
101                    }
102
103                    for ( i = 0; i < data.actions.length; i ++ ) {
104                        values = {};
105                        attrs = [];
106                        params = data.actions[i];
107                        values.text = params.text;
108
109                        delete(params.text);
110
111                        for (name in params) {
112                            attrs.push(name+'="'+params[name]+'"');
113                        }
114
115                        values.attrs = attrs.join(' ');
116
117                        if (i === 0) {
118                            values.first = ' class="account-menu-item-first"';
119                        } else {
120                            values.first = '';
121                        }
122                        actions = actions + item.render(values);
123                    }
124                    if(data.shape){
125                        var html = '',
126                            i,
127                            details = data.shape;
128                        for (i = 0; i < details.length; i ++) {
129                            html += new App.Tpl('<div><strong>{descr}:</strong> {value}</div>').render(details[i]);
130                        }
131
132                        actions = actions + html;
133                    };
134                    data.actions = actions;
135
136                    return (new Details({
137                        login: data.login,
138                        details: new App.Tpl('<ul>{actions}</ul>').render(data)
139                    })).run();
140                },
141
142                services: function(data) {
143                    return data.join('<br/>');
144                },
145
146                state: function(data) {
147                    if (data.link) {
148                        return new App.Tpl('<a href="{link}">{state}</a>').render(data);
149                    } else {
150                        return data.state;
151                    }
152                }
153            };
154
155            this.addRenderers = function() {
156                var i;
157                for (i in renderers) {
158                    grid.addColumnRenderer(i, renderers[i]);
159                }
160            };
161
162            this.bindLoadHandler = function() {
163                grid.bindLoadHandler(function() {
164                    $('.agreements-grid-row' + id).addClass('panel-grid-row-expanded');
165                });
166            };
167
168            this.load = function(params, crf, url) {
169                if (!grid.loading) {
170                    if ( grid.isHidden() ) {
171                        grid.load(url, function() {}, {}, {'agrmid': params.agrmid, 'YII_CSRF_TOKEN' : crf});
172                    } else {
173                        grid.hide();
174                        $('.agreements-grid-row' + id).removeClass('panel-grid-row-expanded');
175                    }
176                }
177            };
178        };
179
180        this.onAccountTypeLinkClick = function(link) {
181            var params = this.id(link),
182                crf = this.crf(link),
183                url = this.url(link),
184                grid = new this.Grid(params.id);
185            grid.addRenderers();
186            grid.bindLoadHandler();
187            grid.load(params, crf, url);
188        };
189
190        this.listenAccountTypeLinks = function() {
191            $('.show-vgroups').click(function() {
192                main.onAccountTypeLinkClick(this);
193            });
194            $('.show-vgroups').click();
195        };
196
197        this.run = function() {
198            this.listenAccountTypeLinks();
199        };
200    }();
201    App.Accounts.run();
202});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.