Version Notes
remove validation-4min.js - requires Magento 1.4+
Download this release
Release Info
Developer | Magento Core Team |
Extension | Fooman_Speedster |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.2.0
- app/code/community/Fooman/Speedster/etc/config.xml +1 -1
- app/etc/modules/Fooman_Speedster.xml +1 -1
- js/prototype/validation-4min.js +0 -773
- lib/minify/m.php +0 -3
- package.xml +6 -6
app/code/community/Fooman/Speedster/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fooman_Speedster>
|
5 |
-
<version>1.
|
6 |
<depends>
|
7 |
<Mage_Page />
|
8 |
<Mage_Adminhtml />
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fooman_Speedster>
|
5 |
+
<version>1.2.0</version>
|
6 |
<depends>
|
7 |
<Mage_Page />
|
8 |
<Mage_Adminhtml />
|
app/etc/modules/Fooman_Speedster.xml
CHANGED
@@ -6,4 +6,4 @@
|
|
6 |
<codePool>community</codePool>
|
7 |
</Fooman_Speedster>
|
8 |
</modules>
|
9 |
-
</config>
|
6 |
<codePool>community</codePool>
|
7 |
</Fooman_Speedster>
|
8 |
</modules>
|
9 |
+
</config>
|
js/prototype/validation-4min.js
DELETED
@@ -1,773 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Really easy field validation with Prototype
|
3 |
-
* http://tetlaw.id.au/view/javascript/really-easy-field-validation
|
4 |
-
* Andrew Tetlaw
|
5 |
-
* Version 1.5.4.1 (2007-01-05)
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007 Andrew Tetlaw
|
8 |
-
* Permission is hereby granted, free of charge, to any person
|
9 |
-
* obtaining a copy of this software and associated documentation
|
10 |
-
* files (the "Software"), to deal in the Software without
|
11 |
-
* restriction, including without limitation the rights to use, copy,
|
12 |
-
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
13 |
-
* of the Software, and to permit persons to whom the Software is
|
14 |
-
* furnished to do so, subject to the following conditions:
|
15 |
-
*
|
16 |
-
* The above copyright notice and this permission notice shall be
|
17 |
-
* included in all copies or substantial portions of the Software.
|
18 |
-
*
|
19 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20 |
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21 |
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22 |
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
23 |
-
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
24 |
-
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
25 |
-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26 |
-
* SOFTWARE.
|
27 |
-
*
|
28 |
-
*/
|
29 |
-
var Validator = Class.create();
|
30 |
-
|
31 |
-
Validator.prototype = {
|
32 |
-
initialize : function(className, error, test, options) {
|
33 |
-
if(typeof test == 'function'){
|
34 |
-
this.options = $H(options);
|
35 |
-
this._test = test;
|
36 |
-
} else {
|
37 |
-
this.options = $H(test);
|
38 |
-
this._test = function(){return true};
|
39 |
-
}
|
40 |
-
this.error = error || 'Validation failed.';
|
41 |
-
this.className = className;
|
42 |
-
},
|
43 |
-
test : function(v, elm) {
|
44 |
-
return (this._test(v,elm) && this.options.all(function(p){
|
45 |
-
return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
|
46 |
-
}));
|
47 |
-
}
|
48 |
-
}
|
49 |
-
Validator.methods = {
|
50 |
-
pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
|
51 |
-
minLength : function(v,elm,opt) {return v.length >= opt},
|
52 |
-
maxLength : function(v,elm,opt) {return v.length <= opt},
|
53 |
-
min : function(v,elm,opt) {return v >= parseFloat(opt)},
|
54 |
-
max : function(v,elm,opt) {return v <= parseFloat(opt)},
|
55 |
-
notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
|
56 |
-
return v != value;
|
57 |
-
})},
|
58 |
-
oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
|
59 |
-
return v == value;
|
60 |
-
})},
|
61 |
-
is : function(v,elm,opt) {return v == opt},
|
62 |
-
isNot : function(v,elm,opt) {return v != opt},
|
63 |
-
equalToField : function(v,elm,opt) {return v == $F(opt)},
|
64 |
-
notEqualToField : function(v,elm,opt) {return v != $F(opt)},
|
65 |
-
include : function(v,elm,opt) {return $A(opt).all(function(value) {
|
66 |
-
return Validation.get(value).test(v,elm);
|
67 |
-
})}
|
68 |
-
}
|
69 |
-
|
70 |
-
var Validation = Class.create();
|
71 |
-
Validation.defaultOptions = {
|
72 |
-
onSubmit : true,
|
73 |
-
stopOnFirst : false,
|
74 |
-
immediate : false,
|
75 |
-
focusOnError : true,
|
76 |
-
useTitles : false,
|
77 |
-
addClassNameToContainer: false,
|
78 |
-
containerClassName: '.input-box',
|
79 |
-
onFormValidate : function(result, form) {},
|
80 |
-
onElementValidate : function(result, elm) {}
|
81 |
-
};
|
82 |
-
|
83 |
-
Validation.prototype = {
|
84 |
-
initialize : function(form, options){
|
85 |
-
this.form = $(form);
|
86 |
-
if (!this.form) {
|
87 |
-
return;
|
88 |
-
}
|
89 |
-
this.options = Object.extend({
|
90 |
-
onSubmit : Validation.defaultOptions.onSubmit,
|
91 |
-
stopOnFirst : Validation.defaultOptions.stopOnFirst,
|
92 |
-
immediate : Validation.defaultOptions.immediate,
|
93 |
-
focusOnError : Validation.defaultOptions.focusOnError,
|
94 |
-
useTitles : Validation.defaultOptions.useTitles,
|
95 |
-
onFormValidate : Validation.defaultOptions.onFormValidate,
|
96 |
-
onElementValidate : Validation.defaultOptions.onElementValidate
|
97 |
-
}, options || {});
|
98 |
-
if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
|
99 |
-
if(this.options.immediate) {
|
100 |
-
Form.getElements(this.form).each(function(input) { // Thanks Mike!
|
101 |
-
if (input.tagName.toLowerCase() == 'select') {
|
102 |
-
Event.observe(input, 'blur', this.onChange.bindAsEventListener(this));
|
103 |
-
}
|
104 |
-
if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') {
|
105 |
-
Event.observe(input, 'click', this.onChange.bindAsEventListener(this));
|
106 |
-
} else {
|
107 |
-
Event.observe(input, 'change', this.onChange.bindAsEventListener(this));
|
108 |
-
}
|
109 |
-
}, this);
|
110 |
-
}
|
111 |
-
},
|
112 |
-
onChange : function (ev) {
|
113 |
-
Validation.isOnChange = true;
|
114 |
-
Validation.validate(Event.element(ev),{
|
115 |
-
useTitle : this.options.useTitles,
|
116 |
-
onElementValidate : this.options.onElementValidate
|
117 |
-
});
|
118 |
-
Validation.isOnChange = false;
|
119 |
-
},
|
120 |
-
onSubmit : function(ev){
|
121 |
-
if(!this.validate()) Event.stop(ev);
|
122 |
-
},
|
123 |
-
validate : function() {
|
124 |
-
var result = false;
|
125 |
-
var useTitles = this.options.useTitles;
|
126 |
-
var callback = this.options.onElementValidate;
|
127 |
-
try {
|
128 |
-
if(this.options.stopOnFirst) {
|
129 |
-
result = Form.getElements(this.form).all(function(elm) {
|
130 |
-
if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
|
131 |
-
return true;
|
132 |
-
}
|
133 |
-
return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
|
134 |
-
}, this);
|
135 |
-
} else {
|
136 |
-
result = Form.getElements(this.form).collect(function(elm) {
|
137 |
-
if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
|
141 |
-
}, this).all();
|
142 |
-
}
|
143 |
-
} catch (e) {
|
144 |
-
|
145 |
-
}
|
146 |
-
if(!result && this.options.focusOnError) {
|
147 |
-
try{
|
148 |
-
Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()
|
149 |
-
}
|
150 |
-
catch(e){
|
151 |
-
|
152 |
-
}
|
153 |
-
}
|
154 |
-
this.options.onFormValidate(result, this.form);
|
155 |
-
return result;
|
156 |
-
},
|
157 |
-
reset : function() {
|
158 |
-
Form.getElements(this.form).each(Validation.reset);
|
159 |
-
},
|
160 |
-
isElementInForm : function(elm, form) {
|
161 |
-
var domForm = elm.up('form');
|
162 |
-
if (domForm == form) {
|
163 |
-
return true;
|
164 |
-
}
|
165 |
-
return false;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
Object.extend(Validation, {
|
170 |
-
validate : function(elm, options){
|
171 |
-
options = Object.extend({
|
172 |
-
useTitle : false,
|
173 |
-
onElementValidate : function(result, elm) {}
|
174 |
-
}, options || {});
|
175 |
-
elm = $(elm);
|
176 |
-
|
177 |
-
var cn = $w(elm.className);
|
178 |
-
return result = cn.all(function(value) {
|
179 |
-
var test = Validation.test(value,elm,options.useTitle);
|
180 |
-
options.onElementValidate(test, elm);
|
181 |
-
return test;
|
182 |
-
});
|
183 |
-
},
|
184 |
-
insertAdvice : function(elm, advice){
|
185 |
-
var container = $(elm).up('.field-row');
|
186 |
-
if(container){
|
187 |
-
Element.insert(container, {after: advice});
|
188 |
-
} else if (elm.up('td.value')) {
|
189 |
-
elm.up('td.value').insert({bottom: advice});
|
190 |
-
} else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
|
191 |
-
$(elm.advaiceContainer).update(advice);
|
192 |
-
}
|
193 |
-
else {
|
194 |
-
switch (elm.type.toLowerCase()) {
|
195 |
-
case 'checkbox':
|
196 |
-
case 'radio':
|
197 |
-
var p = elm.parentNode;
|
198 |
-
if(p) {
|
199 |
-
Element.insert(p, {'bottom': advice});
|
200 |
-
} else {
|
201 |
-
Element.insert(elm, {'after': advice});
|
202 |
-
}
|
203 |
-
break;
|
204 |
-
default:
|
205 |
-
Element.insert(elm, {'after': advice});
|
206 |
-
}
|
207 |
-
}
|
208 |
-
},
|
209 |
-
showAdvice : function(elm, advice, adviceName){
|
210 |
-
if(!elm.advices){
|
211 |
-
elm.advices = new Hash();
|
212 |
-
}
|
213 |
-
else{
|
214 |
-
elm.advices.each(function(pair){
|
215 |
-
this.hideAdvice(elm, pair.value);
|
216 |
-
}.bind(this));
|
217 |
-
}
|
218 |
-
elm.advices.set(adviceName, advice);
|
219 |
-
if(typeof Effect == 'undefined') {
|
220 |
-
advice.style.display = 'block';
|
221 |
-
} else {
|
222 |
-
if(!advice._adviceAbsolutize) {
|
223 |
-
new Effect.Appear(advice, {duration : 1 });
|
224 |
-
} else {
|
225 |
-
Position.absolutize(advice);
|
226 |
-
advice.show();
|
227 |
-
advice.setStyle({
|
228 |
-
'top':advice._adviceTop,
|
229 |
-
'left': advice._adviceLeft,
|
230 |
-
'width': advice._adviceWidth,
|
231 |
-
'z-index': 1000
|
232 |
-
});
|
233 |
-
advice.addClassName('advice-absolute');
|
234 |
-
}
|
235 |
-
}
|
236 |
-
},
|
237 |
-
hideAdvice : function(elm, advice){
|
238 |
-
if(advice != null) advice.hide();
|
239 |
-
},
|
240 |
-
updateCallback : function(elm, status) {
|
241 |
-
if (typeof elm.callbackFunction != 'undefined') {
|
242 |
-
eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');
|
243 |
-
}
|
244 |
-
},
|
245 |
-
ajaxError : function(elm, errorMsg) {
|
246 |
-
var name = 'validate-ajax';
|
247 |
-
var advice = Validation.getAdvice(name, elm);
|
248 |
-
if (advice == null) {
|
249 |
-
advice = this.createAdvice(name, elm, false, errorMsg);
|
250 |
-
}
|
251 |
-
this.showAdvice(elm, advice, 'validate-ajax');
|
252 |
-
this.updateCallback(elm, 'failed');
|
253 |
-
|
254 |
-
elm.addClassName('validation-failed');
|
255 |
-
elm.addClassName('validate-ajax');
|
256 |
-
if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
|
257 |
-
var container = elm.up(Validation.defaultOptions.containerClassName);
|
258 |
-
if (container && this.allowContainerClassName(elm)) {
|
259 |
-
container.removeClassName('validation-passed');
|
260 |
-
container.addClassName('validation-error');
|
261 |
-
}
|
262 |
-
}
|
263 |
-
},
|
264 |
-
allowContainerClassName: function (elm) {
|
265 |
-
if (elm.type == 'radio' || elm.type == 'checkbox') {
|
266 |
-
return elm.hasClassName('change-container-classname');
|
267 |
-
}
|
268 |
-
|
269 |
-
return true;
|
270 |
-
},
|
271 |
-
test : function(name, elm, useTitle) {
|
272 |
-
var v = Validation.get(name);
|
273 |
-
var prop = '__advice'+name.camelize();
|
274 |
-
try {
|
275 |
-
if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
|
276 |
-
//if(!elm[prop]) {
|
277 |
-
var advice = Validation.getAdvice(name, elm);
|
278 |
-
if (advice == null) {
|
279 |
-
advice = this.createAdvice(name, elm, useTitle);
|
280 |
-
}
|
281 |
-
this.showAdvice(elm, advice, name);
|
282 |
-
this.updateCallback(elm, 'failed');
|
283 |
-
//}
|
284 |
-
elm[prop] = 1;
|
285 |
-
if (!elm.advaiceContainer) {
|
286 |
-
elm.removeClassName('validation-passed');
|
287 |
-
elm.addClassName('validation-failed');
|
288 |
-
}
|
289 |
-
|
290 |
-
if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
|
291 |
-
var container = elm.up(Validation.defaultOptions.containerClassName);
|
292 |
-
if (container && this.allowContainerClassName(elm)) {
|
293 |
-
container.removeClassName('validation-passed');
|
294 |
-
container.addClassName('validation-error');
|
295 |
-
}
|
296 |
-
}
|
297 |
-
return false;
|
298 |
-
} else {
|
299 |
-
var advice = Validation.getAdvice(name, elm);
|
300 |
-
this.hideAdvice(elm, advice);
|
301 |
-
this.updateCallback(elm, 'passed');
|
302 |
-
elm[prop] = '';
|
303 |
-
elm.removeClassName('validation-failed');
|
304 |
-
elm.addClassName('validation-passed');
|
305 |
-
if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
|
306 |
-
var container = elm.up(Validation.defaultOptions.containerClassName);
|
307 |
-
if (container && !container.down('.validation-failed') && this.allowContainerClassName(elm)) {
|
308 |
-
if (!Validation.get('IsEmpty').test(elm.value) || !this.isVisible(elm)) {
|
309 |
-
container.addClassName('validation-passed');
|
310 |
-
} else {
|
311 |
-
container.removeClassName('validation-passed');
|
312 |
-
}
|
313 |
-
container.removeClassName('validation-error');
|
314 |
-
}
|
315 |
-
}
|
316 |
-
return true;
|
317 |
-
}
|
318 |
-
} catch(e) {
|
319 |
-
throw(e)
|
320 |
-
}
|
321 |
-
},
|
322 |
-
isVisible : function(elm) {
|
323 |
-
while(elm.tagName != 'BODY') {
|
324 |
-
if(!$(elm).visible()) return false;
|
325 |
-
elm = elm.parentNode;
|
326 |
-
}
|
327 |
-
return true;
|
328 |
-
},
|
329 |
-
getAdvice : function(name, elm) {
|
330 |
-
return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
|
331 |
-
},
|
332 |
-
createAdvice : function(name, elm, useTitle, customError) {
|
333 |
-
var v = Validation.get(name);
|
334 |
-
var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
|
335 |
-
if (customError) {
|
336 |
-
errorMsg = customError;
|
337 |
-
}
|
338 |
-
try {
|
339 |
-
if (Translator){
|
340 |
-
errorMsg = Translator.translate(errorMsg);
|
341 |
-
}
|
342 |
-
}
|
343 |
-
catch(e){}
|
344 |
-
|
345 |
-
advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
|
346 |
-
|
347 |
-
|
348 |
-
Validation.insertAdvice(elm, advice);
|
349 |
-
advice = Validation.getAdvice(name, elm);
|
350 |
-
if($(elm).hasClassName('absolute-advice')) {
|
351 |
-
var dimensions = $(elm).getDimensions();
|
352 |
-
var originalPosition = Position.cumulativeOffset(elm);
|
353 |
-
|
354 |
-
advice._adviceTop = (originalPosition[1] + dimensions.height) + 'px';
|
355 |
-
advice._adviceLeft = (originalPosition[0]) + 'px';
|
356 |
-
advice._adviceWidth = (dimensions.width) + 'px';
|
357 |
-
advice._adviceAbsolutize = true;
|
358 |
-
}
|
359 |
-
return advice;
|
360 |
-
},
|
361 |
-
getElmID : function(elm) {
|
362 |
-
return elm.id ? elm.id : elm.name;
|
363 |
-
},
|
364 |
-
reset : function(elm) {
|
365 |
-
elm = $(elm);
|
366 |
-
var cn = $w(elm.className);
|
367 |
-
cn.each(function(value) {
|
368 |
-
var prop = '__advice'+value.camelize();
|
369 |
-
if(elm[prop]) {
|
370 |
-
var advice = Validation.getAdvice(value, elm);
|
371 |
-
if (advice) {
|
372 |
-
advice.hide();
|
373 |
-
}
|
374 |
-
elm[prop] = '';
|
375 |
-
}
|
376 |
-
elm.removeClassName('validation-failed');
|
377 |
-
elm.removeClassName('validation-passed');
|
378 |
-
if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
|
379 |
-
var container = elm.up(Validation.defaultOptions.containerClassName);
|
380 |
-
if (container) {
|
381 |
-
container.removeClassName('validation-passed');
|
382 |
-
container.removeClassName('validation-error');
|
383 |
-
}
|
384 |
-
}
|
385 |
-
});
|
386 |
-
},
|
387 |
-
add : function(className, error, test, options) {
|
388 |
-
var nv = {};
|
389 |
-
nv[className] = new Validator(className, error, test, options);
|
390 |
-
Object.extend(Validation.methods, nv);
|
391 |
-
},
|
392 |
-
addAllThese : function(validators) {
|
393 |
-
var nv = {};
|
394 |
-
$A(validators).each(function(value) {
|
395 |
-
nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
|
396 |
-
});
|
397 |
-
Object.extend(Validation.methods, nv);
|
398 |
-
},
|
399 |
-
get : function(name) {
|
400 |
-
return Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
|
401 |
-
},
|
402 |
-
methods : {
|
403 |
-
'_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
|
404 |
-
}
|
405 |
-
});
|
406 |
-
|
407 |
-
Validation.add('IsEmpty', '', function(v) {
|
408 |
-
return (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v)); // || /^\s+$/.test(v));
|
409 |
-
});
|
410 |
-
|
411 |
-
Validation.addAllThese([
|
412 |
-
['validate-select', 'Please select an option.', function(v) {
|
413 |
-
return ((v != "none") && (v != null) && (v.length != 0));
|
414 |
-
}],
|
415 |
-
['required-entry', 'This is a required field.', function(v) {
|
416 |
-
return !Validation.get('IsEmpty').test(v);
|
417 |
-
}],
|
418 |
-
['validate-number', 'Please enter a valid number in this field.', function(v) {
|
419 |
-
return Validation.get('IsEmpty').test(v) || (!isNaN(parseNumber(v)) && !/^\s+$/.test(parseNumber(v)));
|
420 |
-
}],
|
421 |
-
['validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.', function(v) {
|
422 |
-
return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v);
|
423 |
-
}],
|
424 |
-
['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) {
|
425 |
-
return Validation.get('IsEmpty').test(v) || /^[a-zA-Z]+$/.test(v)
|
426 |
-
}],
|
427 |
-
['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
|
428 |
-
return Validation.get('IsEmpty').test(v) || /^[a-z]+[a-z0-9_]+$/.test(v)
|
429 |
-
}],
|
430 |
-
['validate-alphanum', 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
|
431 |
-
return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v) /*!/\W/.test(v)*/
|
432 |
-
}],
|
433 |
-
['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) {
|
434 |
-
return Validation.get('IsEmpty').test(v) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)
|
435 |
-
}],
|
436 |
-
['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
|
437 |
-
return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
|
438 |
-
}],
|
439 |
-
['validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
|
440 |
-
return Validation.get('IsEmpty').test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);
|
441 |
-
}],
|
442 |
-
['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) {
|
443 |
-
return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
|
444 |
-
}],
|
445 |
-
['validate-date', 'Please enter a valid date.', function(v) {
|
446 |
-
var test = new Date(v);
|
447 |
-
return Validation.get('IsEmpty').test(v) || !isNaN(test);
|
448 |
-
}],
|
449 |
-
['validate-email', 'Please enter a valid email address. For example johndoe@domain.com.', function (v) {
|
450 |
-
//return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
|
451 |
-
//return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v)
|
452 |
-
return Validation.get('IsEmpty').test(v) || /^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})/i.test(v)
|
453 |
-
}],
|
454 |
-
['validate-emailSender', 'Please use only visible characters and spaces.', function (v) {
|
455 |
-
return Validation.get('IsEmpty').test(v) || /^[\S ]+$/.test(v)
|
456 |
-
}],
|
457 |
-
['validate-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
|
458 |
-
var pass=v.strip(); /*strip leading and trailing spaces*/
|
459 |
-
return !(pass.length>0 && pass.length < 6);
|
460 |
-
}],
|
461 |
-
['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) {
|
462 |
-
var pass=v.strip();
|
463 |
-
if (0 == pass.length) {
|
464 |
-
return true;
|
465 |
-
}
|
466 |
-
if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) {
|
467 |
-
return false;
|
468 |
-
}
|
469 |
-
return !(pass.length < 7);
|
470 |
-
}],
|
471 |
-
['validate-cpassword', 'Please make sure your passwords match.', function(v) {
|
472 |
-
var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
|
473 |
-
var pass = false;
|
474 |
-
if ($('password')) {
|
475 |
-
pass = $('password');
|
476 |
-
}
|
477 |
-
var passwordElements = $$('.validate-password');
|
478 |
-
for (var i = 0; i < passwordElements.size(); i++) {
|
479 |
-
var passwordElement = passwordElements[i];
|
480 |
-
if (passwordElement.up('form').id == conf.up('form').id) {
|
481 |
-
pass = passwordElement;
|
482 |
-
}
|
483 |
-
}
|
484 |
-
if ($$('.validate-admin-password').size()) {
|
485 |
-
pass = $$('.validate-admin-password')[0];
|
486 |
-
}
|
487 |
-
return (pass.value == conf.value);
|
488 |
-
}],
|
489 |
-
['validate-url', 'Please enter a valid URL. http:// is required', function (v) {
|
490 |
-
return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
|
491 |
-
}],
|
492 |
-
['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) {
|
493 |
-
return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)
|
494 |
-
}],
|
495 |
-
['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page"', function (v) {
|
496 |
-
return Validation.get('IsEmpty').test(v) || /^[A-Z0-9][A-Z0-9_\/-]+(\.[A-Z0-9_-]+)*$/i.test(v)
|
497 |
-
}],
|
498 |
-
['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4', function (v) {
|
499 |
-
return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v)
|
500 |
-
}],
|
501 |
-
['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) {
|
502 |
-
return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v);
|
503 |
-
}],
|
504 |
-
['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) {
|
505 |
-
return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);
|
506 |
-
}],
|
507 |
-
['validate-zip-international', 'Please enter a valid zip code.', function(v) {
|
508 |
-
//return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v);
|
509 |
-
return true;
|
510 |
-
}],
|
511 |
-
['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
|
512 |
-
if(Validation.get('IsEmpty').test(v)) return true;
|
513 |
-
var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
|
514 |
-
if(!regex.test(v)) return false;
|
515 |
-
var d = new Date(v.replace(regex, '$2/$1/$3'));
|
516 |
-
return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
|
517 |
-
(parseInt(RegExp.$1, 10) == d.getDate()) &&
|
518 |
-
(parseInt(RegExp.$3, 10) == d.getFullYear() );
|
519 |
-
}],
|
520 |
-
['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) {
|
521 |
-
// [$]1[##][,###]+[.##]
|
522 |
-
// [$]1###+[.##]
|
523 |
-
// [$]0.##
|
524 |
-
// [$].##
|
525 |
-
return Validation.get('IsEmpty').test(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
|
526 |
-
}],
|
527 |
-
['validate-one-required', 'Please select one of the above options.', function (v,elm) {
|
528 |
-
var p = elm.parentNode;
|
529 |
-
var options = p.getElementsByTagName('INPUT');
|
530 |
-
return $A(options).any(function(elm) {
|
531 |
-
return $F(elm);
|
532 |
-
});
|
533 |
-
}],
|
534 |
-
['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) {
|
535 |
-
var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]');
|
536 |
-
|
537 |
-
var error = 1;
|
538 |
-
for(var i=0;i<inputs.length;i++) {
|
539 |
-
if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) {
|
540 |
-
error = 0;
|
541 |
-
}
|
542 |
-
|
543 |
-
if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) {
|
544 |
-
Validation.reset(inputs[i]);
|
545 |
-
}
|
546 |
-
}
|
547 |
-
|
548 |
-
if( error == 0 ) {
|
549 |
-
return true;
|
550 |
-
} else {
|
551 |
-
return false;
|
552 |
-
}
|
553 |
-
}],
|
554 |
-
['validate-not-negative-number', 'Please enter a valid number in this field.', function(v) {
|
555 |
-
v = parseNumber(v);
|
556 |
-
return (!isNaN(v) && v>=0);
|
557 |
-
}],
|
558 |
-
['validate-state', 'Please select State/Province.', function(v) {
|
559 |
-
return (v!=0 || v == '');
|
560 |
-
}],
|
561 |
-
|
562 |
-
['validate-new-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
|
563 |
-
if (!Validation.get('validate-password').test(v)) return false;
|
564 |
-
if (Validation.get('IsEmpty').test(v) && v != '') return false;
|
565 |
-
return true;
|
566 |
-
}],
|
567 |
-
['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) {
|
568 |
-
if(v.length)
|
569 |
-
return parseFloat(v) > 0;
|
570 |
-
else
|
571 |
-
return true;
|
572 |
-
}],
|
573 |
-
['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) {
|
574 |
-
if(v.length)
|
575 |
-
return parseFloat(v) >= 0;
|
576 |
-
else
|
577 |
-
return true;
|
578 |
-
}],
|
579 |
-
['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) {
|
580 |
-
// remove non-numerics
|
581 |
-
var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
|
582 |
-
if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined'
|
583 |
-
&& Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) {
|
584 |
-
if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) {
|
585 |
-
return true;
|
586 |
-
} else {
|
587 |
-
return false;
|
588 |
-
}
|
589 |
-
}
|
590 |
-
return validateCreditCard(v);
|
591 |
-
}],
|
592 |
-
['validate-cc-type', 'Credit card number doesn\'t match credit card type', function(v, elm) {
|
593 |
-
// remove credit card number delimiters such as "-" and space
|
594 |
-
elm.value = removeDelimiters(elm.value);
|
595 |
-
v = removeDelimiters(v);
|
596 |
-
|
597 |
-
var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
|
598 |
-
if (!ccTypeContainer) {
|
599 |
-
return true;
|
600 |
-
}
|
601 |
-
var ccType = ccTypeContainer.value;
|
602 |
-
|
603 |
-
if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
|
604 |
-
return false;
|
605 |
-
}
|
606 |
-
|
607 |
-
// Other card type or switch or solo card
|
608 |
-
if (Validation.creditCartTypes.get(ccType)[0]==false) {
|
609 |
-
return true;
|
610 |
-
}
|
611 |
-
|
612 |
-
// Matched credit card type
|
613 |
-
var ccMatchedType = '';
|
614 |
-
|
615 |
-
Validation.creditCartTypes.each(function (pair) {
|
616 |
-
if (pair.value[0] && v.match(pair.value[0])) {
|
617 |
-
ccMatchedType = pair.key;
|
618 |
-
throw $break;
|
619 |
-
}
|
620 |
-
});
|
621 |
-
|
622 |
-
if(ccMatchedType != ccType) {
|
623 |
-
return false;
|
624 |
-
}
|
625 |
-
|
626 |
-
if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) {
|
627 |
-
Validation.validate(ccTypeContainer);
|
628 |
-
}
|
629 |
-
|
630 |
-
return true;
|
631 |
-
}],
|
632 |
-
['validate-cc-type-select', 'Card type doesn\'t match credit card number', function(v, elm) {
|
633 |
-
var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number');
|
634 |
-
if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) {
|
635 |
-
return true;
|
636 |
-
}
|
637 |
-
if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) {
|
638 |
-
Validation.validate(ccNumberContainer);
|
639 |
-
}
|
640 |
-
return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer);
|
641 |
-
}],
|
642 |
-
['validate-cc-exp', 'Incorrect credit card expiration date', function(v, elm) {
|
643 |
-
var ccExpMonth = v;
|
644 |
-
var ccExpYear = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value;
|
645 |
-
var currentTime = new Date();
|
646 |
-
var currentMonth = currentTime.getMonth() + 1;
|
647 |
-
var currentYear = currentTime.getFullYear();
|
648 |
-
if (ccExpMonth < currentMonth && ccExpYear == currentYear) {
|
649 |
-
return false;
|
650 |
-
}
|
651 |
-
return true;
|
652 |
-
}],
|
653 |
-
['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) {
|
654 |
-
var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type');
|
655 |
-
if (!ccTypeContainer) {
|
656 |
-
return true;
|
657 |
-
}
|
658 |
-
var ccType = ccTypeContainer.value;
|
659 |
-
|
660 |
-
if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
|
661 |
-
return false;
|
662 |
-
}
|
663 |
-
|
664 |
-
var re = Validation.creditCartTypes.get(ccType)[1];
|
665 |
-
|
666 |
-
if (v.match(re)) {
|
667 |
-
return true;
|
668 |
-
}
|
669 |
-
|
670 |
-
return false;
|
671 |
-
}],
|
672 |
-
['validate-ajax', '', function(v, elm) { return true; }],
|
673 |
-
['validate-data', 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
|
674 |
-
if(v != '' && v) {
|
675 |
-
return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);
|
676 |
-
}
|
677 |
-
return true;
|
678 |
-
}],
|
679 |
-
['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%', function (v) {
|
680 |
-
if (v != '' && v) {
|
681 |
-
return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v));
|
682 |
-
}
|
683 |
-
return true;
|
684 |
-
}],
|
685 |
-
['validate-length', 'Maximum length exceeded.', function (v, elm) {
|
686 |
-
var re = new RegExp(/^maximum-length-[0-9]+$/);
|
687 |
-
var result = true;
|
688 |
-
$w(elm.className).each(function(name, index) {
|
689 |
-
if (name.match(re) && result) {
|
690 |
-
var length = name.split('-')[2];
|
691 |
-
result = (v.length <= length);
|
692 |
-
}
|
693 |
-
});
|
694 |
-
return result;
|
695 |
-
}],
|
696 |
-
['validate-percents', 'Please enter a number lower than 100', {max:100}]
|
697 |
-
|
698 |
-
]);
|
699 |
-
|
700 |
-
// Credit Card Validation Javascript
|
701 |
-
// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd
|
702 |
-
|
703 |
-
// You have permission to copy and use this javascript provided that
|
704 |
-
// the content of the script is not changed in any way.
|
705 |
-
|
706 |
-
function validateCreditCard(s) {
|
707 |
-
// remove non-numerics
|
708 |
-
var v = "0123456789";
|
709 |
-
var w = "";
|
710 |
-
for (i=0; i < s.length; i++) {
|
711 |
-
x = s.charAt(i);
|
712 |
-
if (v.indexOf(x,0) != -1)
|
713 |
-
w += x;
|
714 |
-
}
|
715 |
-
// validate number
|
716 |
-
j = w.length / 2;
|
717 |
-
k = Math.floor(j);
|
718 |
-
m = Math.ceil(j) - k;
|
719 |
-
c = 0;
|
720 |
-
for (i=0; i<k; i++) {
|
721 |
-
a = w.charAt(i*2+m) * 2;
|
722 |
-
c += a > 9 ? Math.floor(a/10 + a%10) : a;
|
723 |
-
}
|
724 |
-
for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
|
725 |
-
return (c%10 == 0);
|
726 |
-
}
|
727 |
-
|
728 |
-
function removeDelimiters (v) {
|
729 |
-
v = v.replace(/\s/g, '');
|
730 |
-
v = v.replace(/\-/g, '');
|
731 |
-
return v;
|
732 |
-
}
|
733 |
-
|
734 |
-
function parseNumber(v)
|
735 |
-
{
|
736 |
-
if (typeof v != 'string') {
|
737 |
-
return parseFloat(v);
|
738 |
-
}
|
739 |
-
|
740 |
-
var isDot = v.indexOf('.');
|
741 |
-
var isComa = v.indexOf(',');
|
742 |
-
|
743 |
-
if (isDot != -1 && isComa != -1) {
|
744 |
-
if (isComa > isDot) {
|
745 |
-
v = v.replace('.', '').replace(',', '.');
|
746 |
-
}
|
747 |
-
else {
|
748 |
-
v = v.replace(',', '');
|
749 |
-
}
|
750 |
-
}
|
751 |
-
else if (isComa != -1) {
|
752 |
-
v = v.replace(',', '.');
|
753 |
-
}
|
754 |
-
|
755 |
-
return parseFloat(v);
|
756 |
-
}
|
757 |
-
|
758 |
-
/**
|
759 |
-
* Hash with credit card types wich can be simply extended in payment modules
|
760 |
-
* 0 - regexp for card number
|
761 |
-
* 1 - regexp for cvn
|
762 |
-
* 2 - check or not credit card number trough Luhn algorithm by
|
763 |
-
* function validateCreditCard wich you can find above in this file
|
764 |
-
*/
|
765 |
-
Validation.creditCartTypes = $H({
|
766 |
-
'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
|
767 |
-
'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
|
768 |
-
'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
|
769 |
-
'DI': [new RegExp('^6011[0-9]{12}$'), new RegExp('^[0-9]{3}$'), true],
|
770 |
-
'SS': [new RegExp('^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
|
771 |
-
'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]
|
772 |
-
});
|
773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/minify/m.php
CHANGED
@@ -75,9 +75,6 @@ if (isset($_GET['f'])) {
|
|
75 |
foreach ($filenames as $filename) {
|
76 |
if (preg_match($filenamePattern, $filename)
|
77 |
&& file_exists(BP . $filename)) {
|
78 |
-
//Minify can't handle the regex for the email addresses - change to file with less demanding regex for email validation
|
79 |
-
//fixed in Magento 1.4 (keep this workaround in place until support for versions below 1.4 is removed)
|
80 |
-
$filename = str_replace("js".DS."prototype".DS."validation.js", "js".DS."prototype".DS."validation-4min.js", $filename);
|
81 |
$servefiles[]=BP . $filename;
|
82 |
}
|
83 |
}
|
75 |
foreach ($filenames as $filename) {
|
76 |
if (preg_match($filenamePattern, $filename)
|
77 |
&& file_exists(BP . $filename)) {
|
|
|
|
|
|
|
78 |
$servefiles[]=BP . $filename;
|
79 |
}
|
80 |
}
|
package.xml
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fooman_Speedster</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0 / BSD see files</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Speed up your store by combining, compressing and caching JS and CSS.</summary>
|
10 |
-
<description><p>FOOMAN Speedster 1.
|
11 |
<p>Speed up your store by combining, compressing and caching JS and CSS.</p>
|
12 |
<p>Please read the installation instructions and latest changes <a href="http://www.magentocommerce.com/extension/457/fooman-speedster">here.</a></p></description>
|
13 |
-
<notes>remove
|
14 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
|
15 |
-
<date>2010-
|
16 |
-
<time>
|
17 |
-
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_Speedster.xml" hash="
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fooman_Speedster</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0 / BSD see files</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Speed up your store by combining, compressing and caching JS and CSS.</summary>
|
10 |
+
<description><p>FOOMAN Speedster 1.2</p>
|
11 |
<p>Speed up your store by combining, compressing and caching JS and CSS.</p>
|
12 |
<p>Please read the installation instructions and latest changes <a href="http://www.magentocommerce.com/extension/457/fooman-speedster">here.</a></p></description>
|
13 |
+
<notes>remove validation-4min.js - requires Magento 1.4+</notes>
|
14 |
<authors><author><name>Kristof Ringleff</name><user>auto-converted</user><email>kristof@fooman.co.nz</email></author></authors>
|
15 |
+
<date>2010-06-23</date>
|
16 |
+
<time>04:08:59</time>
|
17 |
+
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fooman_Speedster.xml" hash="94d303cd2552119381411068d2e7809b"/></dir></dir></dir><dir name="lib"><dir name="minify"><file name=".htaccess" hash="4d6b8833e4ccae2d2393dfeba369b894"/></dir></dir><dir name="var"><dir name="minifycache"><file name="cache.txt" hash="5709c1d6a6f85fb7b7ea2eef23086b46"/></dir></dir></target><target name="magecommunity"><dir name="Fooman"><dir name="Speedster"><dir name="Block"><dir name="Adminhtml"><dir name="Page"><file name="Head.php" hash="d850197d05af7b972eda1ef6bf3da2ed"/></dir></dir><dir name="Page"><dir name="Html"><file name="Head.php" hash="c5e51230c68eee557f5305d99d656243"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="1eaee1408326b0eec8b8614a40e7db37"/></dir></dir></dir></target><target name="magelib"><dir name="minify"><dir name="lib"><dir name="HTTP"><file name="ConditionalGet.php" hash="f9760a41a6688eca78c27e4afd760a02"/><file name="Encoder.php" hash="71d0651830bbf9153191f1749bf54e62"/></dir><dir name="Minify"><dir name="Cache"><file name="APC.php" hash="2766ccf5e1e4d6e38d3ec128dbc4bc6f"/><file name="File.php" hash="26d02518b2035f1b1ae49da001baa26a"/><file name="Memcache.php" hash="fa208d979196d0479e3aacec853502c8"/></dir><dir name="Controller"><file name="Base.php" hash="766127568874bfa7e2a9985bb028321c"/><file name="Files.php" hash="18a48dde08afee8620d3a79b36addb9d"/><file name="Groups.php" hash="12c1e6818e7a7115e38eeb9492970019"/><file name="MinApp.php" hash="88a6eb77b74178d0e29a099e0e6ccc63"/><file name="Page.php" hash="02bc8325362e435d4af75a6ec138c2d4"/><file name="Version1.php" hash="4369c8793be1d5cf061a99651b16da26"/></dir><dir name="CSS"><file name="Compressor.php" hash="b514fdc1f7c010031631994c77a18bf6"/><file name="UriRewriter.php" hash="5ab5dfdb489e28a39a4e9d6ad70117d6"/></dir><file name="Build.php" hash="6e329c2acc80b72cfde52be6918940bb"/><file name="BuildSpeedster.php" hash="b93d3e802e2bf7b31eecf9537d3e92f9"/><file name="CommentPreserver.php" hash="86bab05265083b57935503bdd735ce74"/><file name="CSS.php" hash="cdeb49c0f35a6cef166c6cfee7f1dd95"/><file name="HTML.php" hash="e774a70491041048fef690d4b162e0ce"/><file name="ImportProcessor.php" hash="5ce5f2c30830af408d82d4d1511e0c8a"/><file name="Javascript.php" hash="1baa1a43818fcecb89c2a08b40a544da"/><file name="Lines.php" hash="80b2932320c98d1e84aa7f48fceb35e8"/><file name="Logger.php" hash="b2844a8c35e028b9ee725be05adbcf7e"/><file name="Packer.php" hash="25e6f213205f060853db918c2d67ef06"/><file name="Source.php" hash="f7055f963f00e5ae9f5b0005d5e4a5ec"/><file name="YUICompressor.php" hash="13840856d6340e70e7289035827b8b7d"/></dir><dir name="Solar"><file name="Dir.php" hash="6c88f363f6830ac4dc3917eac3c9d78c"/></dir><file name="FirePHP.php" hash="f619b5a77fee4b21e4397e98d858fbf4"/><file name="JSMin.php" hash="5716028656e1d402c98a43ee18648dd3"/><file name="JSMinPlus.php" hash="9d982f55fe9526105eaf9c0fc661263e"/><file name="Minify.php" hash="091d6a6c852610303b405bcfa363b21f"/></dir><file name="HISTORY.txt" hash="72bf6c9ceb63bab5fc35aff334a79bd2"/><file name="LICENSE.txt" hash="911d374696c0a5e9e6e848e7f20d0ee1"/><file name="m.php" hash="eca34750b8633adb59a1853a4d225d5e"/><file name="README.txt" hash="6e961a626ae6814c72fab53bcad4a4a7"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|