PageSourceSearch

https://tatshop.ru/components/com_virtuemart/assets/js/vmsite.js?vmver=8609

js tatshop.ru collected 2026-09-24 20:18:02 UTC 3,873 bytes, 124 lines download raw bytes

1/**
2 * list country.js: General Javascript Library for VirtueMart Administration
3 *
4 *
5 * @package	VirtueMart
6 * @subpackage Javascript Library
7 * @author Patrick Kohl
8 * @copyright Copyright (c) 2011VirtueMart Team. All rights reserved.
9 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
10 */
11
12(function($){
13	var undefined,
14	methods = {
15		list: function(options) {
16			var dest = options.dest;
17			var ids = options.ids;
18			var prefix = options.prefiks;
19            methods.update(this,dest,ids,prefix);
20			$(this).change( function() { methods.update(this,dest,ids,prefix)});
21
22		},
23		update: function(org,dest,ids,prefix) {
24			var opt = $(org),
25				optValues = opt.val() || [],
26				byAjax = [] ;
27			if (!$.isArray(optValues)) optValues = jQuery.makeArray(optValues);
28			if ( typeof  oldValues !== "undefined") {
29				//remove if not in optValues
30				$.each(oldValues, function(key, oldValue) {
31					if ( ($.inArray( oldValue, optValues )) < 0 ) $("#"+prefix+"group"+oldValue).remove();
32				});
33			}
34			//push in 'byAjax' values and do it in ajax
35			$.each(optValues, function(optkey, optValue) {
36				if( opt.data( 'd'+optValue) === undefined ) byAjax.push( optValue );
37			});
38
39			if (byAjax.length >0) {
40				$.getJSON('index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,
41						function(result){
42						
43						// Max Bitte Testen
44						var virtuemart_state_id = $('#'+prefix+'virtuemart_state_id');
45						var status = virtuemart_state_id.attr('required');
46						
47						if(status == 'required') {
48							if( result[byAjax].length > 0 ) {
49								virtuemart_state_id.attr('required','required');
50							} else {
51								virtuemart_state_id.removeAttr('required');
52							}
53						}
54						
55						// ENDE
56
57						$.each(result, function(key, value) {
58							if (value.length >0) {
59								opt.data( 'd'+key, value );	
60							} else { 
61								opt.data( 'd'+key, 0 );		
62							}
63						});
64						methods.addToList(opt,optValues,dest,prefix);
65						if ( typeof  ids !== "undefined") {
66							var states =  ids.length ? ids.split(',') : [] ;
67							$.each(states, function(k,id) {
68								$(dest).find('[value='+id+']').attr("selected","selected");
69							});
70						}
71						$(dest).trigger("liszt:updated");
72					}
73				);
74			} else {
75				methods.addToList(opt,optValues,dest,prefix)
76				$(dest).trigger("liszt:updated");
77			}
78			oldValues = optValues ;
79			
80		},
81		addToList: function(opt,values,dest,prefix) {
82			$.each(values, function(dataKey, dataValue) { 
83				var groupExist = $("#"+prefix+"group"+dataValue+"").size();
84				if ( ! groupExist ) {
85					var datas = opt.data( 'd'+dataValue );
86					if (datas.length >0) {
87					var label = opt.find("option[value='"+dataValue+"']").text();
88					var group ='<optgroup id="'+prefix+'group'+dataValue+'" label="'+label+'">';
89					$.each( datas  , function( key, value) {
90						if (value) group +='<option value="'+ value.virtuemart_state_id +'">'+ value.state_name +'</option>';
91					});
92					group += '</optgroup>';
93					$(dest).append(group);
94					
95					}
96				}
97			});
98		},
99        startVmLoading: function(msg) {
100            if (msg===undefined) {
101                msg='';
102            }
103            $("body").addClass("vmLoading");
104            $("body").append("<div class=\"vmLoadingDiv\"><div class=\"vmLoadingDivMsg\">"+msg+"</div></div>");
105        },
106        stopVmLoading: function() {
107           if( $("body").hasClass("vmLoading") ){
108               $("body").removeClass("vmLoading");
109           }
110        }
111	};
112
113	$.fn.vm2front = function( method ) {
114
115		if ( methods[method] ) {
116		  return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
117		} else if ( typeof method === 'object' || ! method ) {
118			return methods.init.apply( this, arguments );
119		} else {
120		  $.error( 'Method ' +  method + ' does not exist on Vm2 front jQuery library' );
121		}    
122	
123	};
124})(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.