PageSourceSearch

https://pro-jazz.com/templates/default/js/content-bind.js?1789208782

js pro-jazz.com collected 2026-09-25 02:11:18 UTC 2,973 bytes, 139 lines download raw bytes

1var icms = icms || {};
2
3icms.contentBind = (function ($) {
4
5    var $form;
6    var mode, values = {}, valuesCount = 0, authors = 'own';
7
8    $form = $('#content_bind_form');
9    mode = $form.data('mode');
10
11    if (mode == 'childs' || mode == 'unbind'){
12        initModal();
13    }
14
15	this.start = function(options){
16
17        if (mode != 'childs' && mode != 'unbind'){
18            icms.modal.openAjax(options.url, {}, function(){
19                initModal(options);
20            }, options.modal_title);
21        }
22
23		return false;
24
25	};
26
27	function initModal(options){
28
29		$form = $('#content_bind_form');
30
31		var $input = $form.find('#item-find-input');
32		var $field = $form.find('#item-find-field');
33		var $button = $form.find('.find .button');
34		var $submitButton = $form.find('.buttons .button-submit');
35		var $resultPane = $form.find('.result-pane');
36		var $loading = $form.find('.spinner');
37
38		values = {}, valuesCount = 0;
39        mode = $form.data('mode');
40        authors = $form.find('.pills-menu .active a').data('mode');
41
42		$input.keyup(function(e){
43			if (e.keyCode == 13){
44				findItems();
45			}
46		});
47
48		$button.click(function(e){
49			e.preventDefault();
50			findItems();
51		});
52
53		$form.find('.pills-menu a').click(function(e){
54			e.preventDefault();
55			var $link = $(this);
56			authors = $link.data('mode');
57			$form.find('.pills-menu .active').removeClass('active');
58			$link.parent('li').addClass('active');
59			findItems();
60		});
61
62		$submitButton.click(function(e){
63
64			e.preventDefault();
65
66            if (mode == 'childs' || mode == 'unbind'){
67                var $postForm = $form.find('form');
68                $postForm.find('input.selected_ids').val(Object.keys(values).join(','));
69                $postForm.submit();
70                return;
71            }
72
73            if ('callback' in options){
74                options.callback(values);
75            }
76
77			icms.modal.close();
78
79		});
80
81		findItems();
82
83		function findItems(){
84
85			$loading.addClass('show');
86
87			var text = $input.val();
88
89            text = text ? text.trim() : '';
90
91			var query = {
92				field: $field.val(),
93				authors: authors,
94				text: text,
95				mode: mode
96			};
97
98			$.post($form.data('filter-url'), query, function(result){
99
100				$resultPane.find('ul').remove();
101				$resultPane.prepend(result);
102
103				$resultPane.find('ul li .button').click(function(){
104
105					var $item = $(this).parents('li');
106
107					var id = $item.data('id');
108					values[id] = $item.find('.title a').text();
109					valuesCount++;
110
111					$item.fadeOut(300, function(){
112						$item.remove();
113					});
114
115					$submitButton.val($submitButton.data('title') + ' (' + valuesCount + ')');
116
117					$form.find('.buttons').css({visibility: 'visible'});
118
119				});
120
121				$resultPane.find('ul li').each(function(){
122					var $item = $(this);
123					var id = $item.data('id');
124					if (id in values) {
125						$item.remove();
126					}
127				});
128
129				$loading.removeClass('show');
130
131			});
132
133		}
134
135    }
136
137	return this;
138
139}).call(icms.contentBind || {}, 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.