PageSourceSearch

https://hostingkartinok.com/scripts/uploader.js?ver=40

js hostingkartinok.com collected 2026-10-02 02:32:13 UTC 9,027 bytes, 283 lines download raw bytes

1jQuery(document).ready(function(){
2	
3	/* --- MULTI UPLOAD start --- */
4	
5	jQuery('#multi-files').swfupload({
6		upload_url: '/multiupload.php',
7		flash_url : 'scripts/jquery_swfupload/swfupload.swf',
8		button_image_url : '/images/buttons_upload.png',
9		button_width : 73,
10		button_height : 28,
11		button_placeholder : $('#button')[0],
12		file_types : '*.jpeg;*.jpg;*.gif;*.png;*.bmp',
13		file_types_description : 'Изображения',
14		file_size_limit : '0',
15		file_queue_limit : '0',
16		debug: false,
17		post_params: {
18			'ruid': ruid,
19			'guid': guid
20		},
21		custom_settings : {fileInfo : []}
22	})
23	
24	.bind('swfuploadLoaded', function(event, stats){
25		jQuery(this).find('.message').fadeOut('fast');
26		if(!jQuery('#multi-queue').length){
27			jQuery(this).prepend('<div id="multi-queue"></div>');
28		}
29	})
30	
31	.bind('fileQueued', function(event, file){
32		queue_div = jQuery(this).find('#multi-queue');
33		name = (file.name.length < 25) ? file.name : file.name.substr(0, 25) + '...';
34		if(!isDuplicate(file)){
35			if(getQueueSize() <= maxuploadmulti){
36				if(file.size <= maxfilesize){
37					if(!jQuery('#queue-item-' + file.index).length){
38						queue_div.append('<div id="queue-item-' + file.index + '" class="hidden queue-item"><div class="cancel-upload"><a href="#" rel="' + file.id + '"></a></div><span class="file-name">' + name + ' (' + (file.size/1024/1024).toFixed(2) + ' MB)</span><span class="upload-status"></span><div class="upload-progress"><div class="progress-bar"></div></div></div>');
39						jQuery('.queue-item').fadeIn('fast');
40					}
41				} else {
42					queue_div.append('<div class="message notice"><span>Размер файла ' + file.name + ' превышает максимально допустимый. Файл не будет загружен.</span></div>');
43					jQuery(this).swfupload('cancelUpload', file.id);
44				}
45			} else {
46				jQuery(this).swfupload('cancelUpload', file.id);
47				var message = '<div id="too-many" class="hidden message notice"><span>Количество выбранных файлов превышает максимально допустимое. Будут загружены только первые ' + maxuploadmulti + '.</span></div>';
48				if(!jQuery('#too-many').length){ 
49					jQuery('#multiupload-files').before(message);
50				}
51				jQuery('#too-many').slideDown('fast');
52			}
53		}			
54	})
55	
56	.bind('uploadStart', function(event, file){
57		status_span = jQuery('#queue-item-' + file.index).find('.upload-status');
58		status_span.html(' - 0%');
59		swfu = jQuery.swfupload.getInstance('#multi-files');
60		jQuery('#multi-options input').each(function(){
61			name = jQuery(this).attr('name');
62			type = jQuery(this).attr('type');
63			if(type == 'text'){
64				value = jQuery(this).val();
65			} else {
66				value = jQuery(this).is(':checked') ? jQuery(this).val() : '';
67			}
68			swfu.addPostParam(name, value);
69		});
70	})
71	
72	.bind('uploadProgress', function(event, file, bytesLoaded){
73		percent = Math.floor(bytesLoaded * 100 / file.size);
74		status_span = jQuery('#queue-item-' + file.index).find('.upload-status');
75		status = (percent == 100) ? ' - Обработка' : ' - '+ percent + '%'
76		status_span.html(status);
77		bar = jQuery('#queue-item-' + file.index).find('.progress-bar');
78		bar.stop().animate({'width': percent + '%'});
79	})
80	
81	.bind('uploadSuccess', function(event, file, serverData){
82		status_span = jQuery('#queue-item-' + file.index).find('.upload-status');
83		status_span.html(' - Готово');
84		jQuery('#uploaded-results').append(serverData);
85	})
86	
87	.bind('uploadComplete', function(event, file){
88		jQuery('#queue-item-' + file.index).animate({opacity: 0}, 'fast', function(){
89			jQuery(this).slideUp('fast', function(){ 
90				jQuery(this).remove();
91				if(getQueueSize() == 0) {
92					getBulkCode();
93					jQuery('body').css('cursor', 'default');
94					jQuery('#panel-outer-wrap').fadeOut('slow', function(){
95						jQuery('#uploaded-results').fadeIn('slow');
96					});
97				}
98				
99			});
100		});
101		jQuery(this).swfupload('startUpload');
102	});
103	
104	jQuery('.cancel-upload a').live('click', function(){
105		fileID = jQuery(this).attr('rel');
106		jQuery('#multi-files').swfupload('cancelUpload', fileID);
107		jQuery(this).closest('.queue-item').animate({opacity:0}
107, 'fast', function(){
108			jQuery(this).slideUp('fast', function(){ 
109				jQuery(this).remove();
110				jQuery('#too-many').slideUp('fast');
111			});
112		});
113		return false;
114	});
115	
116	jQuery('#multiupload-files').click(function(){
117		if(getQueueSize() > 0){
118			jQuery('#multi-files').swfupload('startUpload');
119			jQuery('body').css('cursor', 'progress');
120			jQuery('html, body').animate({scrollTop:0}, 'slow');
121		}
122		return false;
123	});
124	
125	/* --- MULTI UPLOAD end --- */
126	
127
128	/* --- STANDARD UPLOAD start --- */
129	jQuery('.file-wrap input[type=file]').live('change focus click', customFileInput);
130	jQuery('.file-wrap input[type=file]').live('change', addInput);
131	
132	jQuery('.upload-item').live({
133		mouseenter:
134			function(){
135				if(!jQuery(this).hasClass('empty')){
136					jQuery(this).find('.delete-upload-item').show();
137				}
138			},
139		mouseleave:
140			function(){
141				jQuery(this).find('.delete-upload-item').hide();
142			}
143	});
144
145	jQuery('#standard-upload').click(function(){
146		if(jQuery(this).hasClass('active')){
147			jQuery(this).closest('form').submit();
148		}
149		return false;
150	});
151		
152	jQuery('.delete-upload-item').live('click', function(){
153		wrap = jQuery(this).closest('.upload-item');
154		wrap.slideUp('fast', function(){
155			jQuery(this).remove();
156			addInput();
157			updateIndexes();
158		});
159		return false;
160	});
161	/* --- STANDARD UPLOAD end --- */
162	
163	
164	/* --- URL UPLOAD start ---*/
165	jQuery('#url-upload').click(function(){
166		var val = jQuery(this).closest('form').find('textarea').val();
167		if(val != ''){
168			jQuery(this).closest('form').submit();
169		}
170		return false;
171	});
172	/* --- URL UPLOAD end ---*/
173	
174	
175	/* --- UPLOAD SETTINGS start --- */
176	
177	jQuery('.the-tags').each(function(){
178		jQuery(this).autocomplete({
179			serviceUrl: '/actions.php',
180			delimiter: /(,)\s*/,
181			width: 386,
182			maxHeight: 114,
183			params: {ruid: ruid}
184		});
185	});
186	
187	jQuery('.slider-jpeg-quality').slider({
188		range:'min',
189		value:70,
190		min:10,
191		max:100,
192		step:10,
193		slide: function(event, ui){
194			type = jQuery(this).closest('ul').attr('class');
195			jQuery('#' + type + '-jpeg-quality').val(ui.value + '%').change();
196			if(type == 'multi'){
197				
198			}
199		} 
200	});
201	
202	jQuery('.slider-resize-to').slider({
203		range:'min',
204		value:500,
205		min:150,
206		max:1200,
207		step:10,
208		slide: function(event, ui){
209			type = jQuery(this).closest('ul').attr('class');
210			jQuery('#' + type + '-resize-to').val(ui.value + 'px');
211		} 
212	});
213	
214	jQuery('.upload-options').each(function(){
215		type = jQuery(this).find('ul').attr('class');
216		jQuery('#' + type + '-jpeg-quality').val(jQuery('#' + type + '-jpeg-quality-slider').slider('value')  + '%');
217		jQuery('#' + type + '-resize-to').val(jQuery('#' + type + '-resize-to-slider').slider('value')  + 'px');
218	});
219	/* --- UPLOAD SETTINGS end --- */
220	
221});
222
223// Replace browser file input + some magic
224function customFileInput() {
225	file = jQuery(this);
226	wrap = file.closest('.upload-item');
227	val = file.val();
228    valArray = val.split('\\');
229	newVal = valArray[valArray.length-1];
230    nameHolder = wrap.find('.name-holder');
231	if(newVal !== '') {
232		nameHolder.text(newVal);
233		wrap.removeClass('empty');
234    }
235	if(val.length != 0){
236		file.closest('form').find('#standard-upload').addClass('active');
237	}
238}
239
240function addInput(){
241	wrap = jQuery('#standard-files');
242	qty = wrap.children('.upload-item').size();
243	if(qty < maxupload){
244		if(wrap.children('.empty').size() < 1){
245			index = qty + 1;
246			clone = wrap.children('.upload-item:first-child').clone();
247			clone.addClass('empty');
248			clone.find('.file-wrap').html('<input class="standard_upload" type="file" name="image_' + index + '"><span class="btn-browse">Обзор</span>');
249			clone.find('.name-holder').text('').after('<a class="right hidden delete-upload-item" href="#"></a>');
250			wrap.append(clone);
251			clone.hide().slideDown('fast');
252		}
253	}
254}
255
256function updateIndexes(){
257	jQuery('.upload-item').each(function(){
258		index = jQuery(this).index() + 1;
259		jQuery(this).find('input[type="file"]').attr('name', 'image_' + index);
260	});
261	
262}
263
264function isDuplicate(file){
265	var swfu = jQuery.swfupload.getInstance('#multi-files');
266	duplicate = false;
267	the_length = swfu.settings.custom_settings.fileInfo.length;
268	for (i = 0; i < the_length; i++){
269		compare = swfu.settings.custom_settings.fileInfo[i];
270		if(compare.name === file.name && compare.size === file.size){
271			swfu.cancelUpload(file.id);
272			duplicate = true;
273			break;
274		}
275	}
276	swfu.settings.custom_settings.fileInfo.push(file);
277	return duplicate;
278}
279
280function getQueueSize(){
281	stats = jQuery.swfupload.getInstance('#multi-files').getStats();
282	return stats.files_queued;
283}

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.