PageSourceSearch

https://www.zoner.cz/account/Scripts/za.dialog.users.js?fcd86033-94a7-46e3-87d0-fe37767719b6

js zoner.cz collected 2026-10-02 06:44:26 UTC 7,781 bytes, 235 lines download raw bytes

1(function ($) {
2	$(document).on('page:init', function () {
3		var $dialog = $('#dialog-users');
4
5		if ($dialog.size()) {
6
7			function resizeTable() {
8				var timer = window.setInterval(function () {
9					var height = Math.min(400, $('#dialog-users-table').height());
10					if (height) {
11						$('#dialog-users-scroll').height(height);
12						window.clearInterval(timer);
13					}
14				}, 50);
15			}
16			function reloadTable() {
17			    $.get('Part/Users', { licenseId: $dialog.attr('data-license-id')  }, function (html) {
18			        var $newTable = $('#dialog-users-table', html);
19			        $('#dialog-users-table').replaceWith($newTable);
20			        resizeTable();
21
22			        Sortable.init({ selector: '#dialog-users-table table' });
23
24			        //ZA.createObjects($('#dialog-users-table'));
25			    });
26			}
27
28			$(document).on('click', '[href="#dialog-users"]', function () {
29				var licenseId = $(this).parents('[data-license-id]').attr('data-license-id');
30				var leaseTo = $(this).parents('[data-license-id]').attr('data-license-LeaseTo');
31
32				$dialog
33                    .empty()
34					.attr('data-license-id', licenseId)
35					.attr('data-license-LeaseTo', leaseTo);
36
37				$.get('Part/Users', { licenseId: $dialog.attr('data-license-id') }, function (html) {
38				    $dialog.html(html);
39				    resizeTable();
40				    ZA.createObjects($dialog);
41
42				    Sortable.init({ selector: '#dialog-users-table table' });
43				});
44
45                /*
46				var url = $('#dialog-users').attr('data-ajax-url') + '/' + licenseId;
47				$('#dialog-users .modal-body').attr('data-url', url).empty().load(url, function () {
48					ZA.createObjects($('#dialog-users-form'));
49					resizeTable();
50				});*/
51			});
52
53			$dialog.on('keyup keydown keypress changed', '#dialog-users-search', function (e) {
54			    var email = $('#dialog-users-search').val();
55
56			    if (e.keyCode == 27) {
57			        $('#dialog-users-search').val('');
58			        e.preventDefault();
59			        e.stopPropagation();
60			        email = '';
61			    }
62
63			    if (email) {
64			        $('#dialog-users-table tbody tr').hide();
65			        $('#dialog-users-table tbody tr[data-email*="' + email + '"]').show();
66			    }
67			    else
68			        $('#dialog-users-table tbody tr').show();
69			});
70
71			$dialog.on('click', '#dialog-users-table [data-delete]', function () {
72			    var notify = !$('#dialog-users-disable-notify').checked();
73			    var $form = $('#dialog-users');
74				var $items = $('#dialog-users :checkbox:checked')
75                    .parents('tr')
76                    .add($(this).parents('tr'));
77
78				ZA.foreach($items, function (e) {
79				    var $delete = $('[data-delete]', this);
80				    var proposalId = $delete.attr('data-proposal-id');
81				    var usageId = $delete.attr('data-usage-id');
82				    var $row = $(this);
83
84				    $row.hide();
85				    resizeTable();
86
87				    $.post(ZA.appPath + '/WebApi/RevokeLicenseUsage', {
88				        licenseUsageId: usageId,
89				        proposalId: proposalId,
90				        notify: notify
91				    }, function (result) {
92				        if (result.Error) {
93				            ZA.handleResult(result, $form);
94				            $row.show();
95				            resizeTable();
96				            e.break();
97				        }
98				        else {
99				            $row.remove();
100				            e.next();
101				        }
102				    });
103				});
104			});
105
106			function foreachEmail(start, fn, callback) {
107			    var $form = $('#dialog-users form');
108			    var $input = $(':text, textarea', $form);
109
110			    var parsed = ZA.parseEmails($input.val());
111			    var text = '';
112
113			    if (parsed.invalid.length) {
114			        text = parsed.invalid.join('; ') + '\n\n';
115			        ZA.handleResult({ Error: 'Následující e-mailové adresy nejsou platne: ' + parsed.invalid.join('; ') }, $form);
116			    }
117
118			    text = text + parsed.valid.join('\r\n');
119			    $input.val(text);
120
121			    if (parsed.valid.length > 0 && parsed.invalid.length == 0) {
122			        start();
123
124			        var timer = window.setInterval(reloadTable, 1000);
125
126			        ZA.foreach(parsed.valid, fn, function () {
127			            window.clearInterval(timer);
128			            callback();
129			        });
130			    }
131			}
132
133			$dialog.on('submit', 'form', function () {
134				var $form = $('#dialog-users form');
135				var $input = $(':text, textarea', $form);
136				var $submit = $('[type="submit"]', $form);
137				var licenseId = $('#dialog-users').attr('data-license-id');
138				var ml = $(this).is('[data-ml]');
139				var activeTo = ($('#useLeaseTo').is(':checked')) ? $('#dialog-users').attr('data-license-LeaseTo') : null;
140
141				if (ml) {			    
142				    foreachEmail(function(){
143				            $submit.button('loading');
144				        },
145                        function (e) {
146						var email = this;
147
148						$.post(ZA.appPath + '/WebApi/GrantLicense', {
149							licenseId: licenseId,
150							email: email,
151							KeepInSourceAccount: true,
152							ActiveTo: activeTo
153						}, function (result) {
154							if (result.Error) {
155								ZA.handleResult(result, $form);
156								e.break();
157							}
158							else
159								e.next();
160						});
161					},
162					function () {
163						reloadTable();
164						$submit.button('reset');
165						ZA.handleResult({ Success: true }, $form);
166					});
167				}
168				else {
169					$.post(ZA.appPath + '/WebApi/GrantLicense', {
170						licenseId: licenseId,
171						email: $input.val().trim(),
172						KeepInSourceAccount: true
173					}, function (result) {
174						ZA.handleResult(result, $form);
175						if (result.Success) {
176						    reloadTable();
177						    $input.val('');
178						}
179					});
180				}
181			});
182
183			$dialog.on('click','#dialog-users-remove', function () {
184			    var $btn = $(this);
185			    var $form = $('#dialog-users form');
186
187			    foreachEmail(function () {
188			        $btn.button('loading');
189			        },
190                    function (e) {
191                        var email = this;
192                        var $row = $('#dialog-users tr[data-email="' + email + '"]');
193                        var proposalId = $('[data-proposal-id]', $row).attr('data-proposal-id');
194                        var usageId = $('[data-usage-id]',$row).attr('data-usage-id');
195                        var notify = !$('#dialog-users-disable-notify').checked();
196
197                        $.post(ZA.appPath + '/WebApi/RevokeLicenseUsage', {
198                            licenseUsageId: usageId,
199                            proposalId: proposalId,
200                            notify: notify
201                        }, function (result) {
202                            if (result.Error) {
203                                ZA.handleResult(result, $form);
204                                e.break();
205                            }
206                            else {
207                                $row.hide();
208                                e.next();
209                            }
210                        });
211                    },
212                function () {
213                    reloadTable();
214                    $btn.button('reset');
215                    ZA.handleResult({ Success: true }, $form);
216                });
217			});
218
219
220			var lastCheckbox = null;
221			$dialog.on('click', '#dialog-users-table :checkbox', function (e) {
222			    var value = $(this).checked();
223			    var index = $(this).parents('tr').index();
224
225			    if (e.shiftKey && lastCheckbox != null) {
226			        var chcks = $('#dialog-users-table :checkbox').toArray();
227			        for (var i = Math.min(lastCheckbox, index) ; i < Math.max(lastCheckbox, index) && i < chcks.length; i++)
228			            $(chcks[i]).checked(value);
229			    }
230
231			    lastCheckbox = index;
232			});
233		}
234	});
235})(jQuery);

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.