Subversion Repositories wpShopGermany4

Rev

Rev 4943 | Rev 5385 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1288 daniel 1
wpsg_number_format = function (number, decimals, dec_point, thousands_sep) {
2
 
3
	var n = !isFinite(+number) ? 0 : + number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
4
        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
5
        s = '',
6
        toFixedFix = function (n, prec) {
7
            var k = Math.pow(10, prec);
8
            return '' + Math.round(n * k) / k;        };
9
    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
10
    if (s[0].length > 3) {
11
        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);    }
12
    if ((s[1] || '').length < prec) {
13
        s[1] = s[1] || '';
14
        s[1] += new Array(prec - s[1].length + 1).join('0');
15
    }    return s.join(dec);
16
  };
17
 
3665 daniel 18
	var wpsg_Tablefix = function(e, ui) {
19
 
20
		ui.children().each(function() {
21
 
22
			jQuery(this).width(jQuery(this).width());
23
 
24
		} );
25
 
26
		return ui;
27
 
28
	};
29
 
2763 daniel 30
jQuery.fn.tipTip = function() {
31
 
3244 daniel 32
	if (jQuery(this).hasClass('tipTip')) return;
33
	jQuery(this).addClass('tipTip');
34
 
2763 daniel 35
	jQuery(this).cluetip( {
36
		width: '400px',
37
		height: '400px',
38
		activation: 'click',
39
		sticky: true,
2778 daniel 40
		/*mouseOutClose: 'both',*/
2763 daniel 41
		closePosition: 'title',
2888 daniel 42
		arrows: true,
43
		closeText: 'Schließen',
44
		onActivate: function() {
45
 
46
			jQuery('#cluetip').hide();
47
 
48
		},
49
		onShow: function() {
50
 
3580 daniel 51
			jQuery('.cluetip-title').prepend(jQuery('.cluetip-inner h1').first().text());
52
			jQuery('.cluetip-inner h1').first().remove();
2888 daniel 53
 
54
			jQuery('.cluetip-inner').css('overflow-y', 'show');
55
			jQuery('.cluetip-inner').css('height', 'auto');
56
 
57
			var height_content = jQuery('.cluetip-inner').outerHeight();
58
			var height_title = jQuery('.cluetip-title').outerHeight();
59
 
60
			if (height_content < 400)
61
			{
62
 
63
				jQuery('.cluetip-outer').height((height_content + height_title) + "px");
64
 
65
			}
66
			else
67
			{
68
 
69
				jQuery('.cluetip-outer').height("400px");
70
 
71
				jQuery('.cluetip-inner').css('overflow-y', 'scroll');
72
				jQuery('.cluetip-inner').css('height', '332px');
73
 
74
			}
75
 
76
		}
2763 daniel 77
	} );
78
 
79
};
80
 
2792 daniel 81
jQuery.fn.wpsg_adminbox = function(options) {
82
 
83
	return this.each(function() {
3244 daniel 84
 
2792 daniel 85
		var adminbox_id = jQuery(this).attr("id");
86
 
87
		jQuery(this).find('.title').bind('click', function() {
88
 
89
			var content = jQuery(this).next();
90
 
91
			if (content.is(':visible'))
92
			{
93
 
94
				content.hide();
95
				jQuery(this).css('border-bottom', '1px solid #AAAAAA');
96
				jQuery.cookie(adminbox_id, '0', { expires: 14000 } );
97
 
98
			}
99
			else
100
			{
101
 
102
				content.show();
103
				jQuery(this).css('border-bottom', '0px');
104
				jQuery.cookie(adminbox_id, '1', { expires: 14000 } );
105
 
106
			}
107
 
108
		} );
109
 
110
		if (jQuery.cookie(adminbox_id) == null || jQuery.cookie(adminbox_id) == 0)
111
		{
112
 
113
			jQuery(this).find('.title').click();
114
 
115
		}
116
 
117
	} );
118
 
119
}
120
 
1067 daniel 121
jQuery.fn.wpsg_tab = function(options) {
122
 
123
	return this.each(function() {
124
 
125
		var tab_obj = jQuery(this);
126
 
127
		// Init
128
		tab_obj.find('.tabcontent').hide();
129
		tab_obj.find('.tab').removeClass('akttab');
130
 
131
		var aktTab = 1;
132
 
133
		if (jQuery.cookie(options['cookiename']) != null && jQuery.cookie(options['cookiename']) > 0)
134
		{
135
			aktTab = jQuery.cookie(options['cookiename']);
136
		}
137
 
138
		jQuery('#tab' + aktTab).addClass('akttab');
139
		jQuery('#tabcontent' + aktTab).show();
140
 
141
		if (typeof options['tab' + aktTab] == 'function')
142
		{
143
			options['tab' + aktTab]();
144
		}
145
 
146
		tab_obj.find('.tab').bind('click', function() {
147
 
148
			tab_obj.find('.tab').removeClass('akttab');
149
			tab_obj.find('.tabcontent').hide();
150
 
151
			jQuery(this).addClass('akttab');
152
 
153
			var strID = jQuery(this).attr("id").replace(/tab/, '');
154
			jQuery.cookie(options['cookiename'], strID, { expires: 14000 } );
155
 
156
			jQuery('#tabcontent' + strID).show();
157
 
158
			if (typeof options['tab' + strID] == 'function')
159
			{
160
				options['tab' + strID]();
161
			}
162
 
163
		} );
164
 
165
	} );
166
 
1317 robert 167
};
168
 
169
/**
170
 * jPlot - Custom Formatter functions
171
 */
172
wpsg_statistics_number_format = function (formatString, value) {
173
	return wpsg_number_format(value, 2, ',', '.');
2335 robert 174
}
175
 
176
wpsg_statistics_integer_format = function (formatString, value) {
177
	return wpsg_number_format(value, 0, ',', '.');
178
}
3024 daniel 179
 
180
function wpsg_in_array(needle, haystack)
181
{
182
 
183
    var length = haystack.length;
184
 
185
    for(var i = 0; i < length; i++) {
186
 
187
        if (haystack[i] == needle) return true;
188
 
189
    }
190
 
191
    return false;
192
 
193
}