PageSourceSearch

https://naoussahistory.gr/js/tr-parsley.js?v=1

js naoussahistory.gr collected 2026-10-08 08:55:22 UTC 4,714 bytes, 111 lines download raw bytes

1Parsley.addMessages('el', {
2  defaultMessage: "Η τιμή φαίνεται να είναι μη έγκυρη.",
3  type: {
4    email:        "Η τιμή πρέπει να είναι ένα έγκυρο email.",
5    url:          "Η τιμή πρέπει να είναι ένα έγκυρο url.",
6    number:       "Η τιμή πρέπει να είναι ένας έγκυρος αριθμός.",
7    integer:      "Η τιμή πρέπει να είναι ένας έγκυρος ακέραιος.",
8    digits:       "Η τιμή πρέπει να είναι ψηφία.",
9    alphanum:     "Η τιμή πρέπει να είναι αλφαριθμητικό."
10  },
11  notblank:       "Η τιμή δεν πρέπει να είναι κενή.",
12  required:       "Η τιμή αυτή απαιτείται.",
13  pattern:        "Η τιμή φαίνεται να είναι μη έγκυρη.",
14  min:            "Η τιμή πρέπει να είναι μεγαλύτερη ή ίση με %s.",
15  max:            "Η τιμή πρέπει να είναι μικρότερη ή ίση με %s.",
16  range:          "Η τιμή πρέπει να είναι μεταξύ %s και %s.",
17  minlength:      "Το κείμενο είναι πολύ μικρό. Πρέπει να είναι %s ή και περισσότεροι χαρακτήρες.",
18  maxlength:      "Η κείμενο είναι πολύ μεγάλο. Πρέπει να είναι %s ή και λιγότεροι χαρακτήρες.",
19  length:         "Το μήκος του κειμένου είναι μη έγκυρο. Πρέπει να είναι μεταξύ %s και %s χαρακτήρων.",
20  mincheck:       "Πρέπει να επιλέξετε τουλάχιστον %s επιλογές.",
21  maxcheck:       "Πρέπει να επιλέξετε %s ή λιγότερες επιλογές.",
22  check:          "Πρέπει να επιλέξετε μεταξύ %s και %s επίλογων.",
23  equalto:        "Η τιμή πρέπει να είναι η ίδια."
24});
25
26Parsley.setLocale(app.lang);
27
28function validatorBindControls() {
29	$('form').each( function(){
30		$(this).parsley().on('field:validated', function() {
31			var ok = $('.parsley-error').length === 0;
32			return ok;
33//			$('.bs-callout-info').toggleClass('hidden', !ok);
34//			$('.bs-callout-warning').toggleClass('hidden', ok);
35		})
36		.on('form:submit', function() {
37//			return ($('.parsley-error').length === 0);
38//alert('errors: ' + $('.parsley-error').length);
39//return false;
40		});
41	})
42
43	// prepare controls for parsley
44	$('[data-constraints]').each( function(){
45		if($(this).data('constraints').indexOf('@Required')>-1){
46			$(this).prop('required', true);
47		}
48		if($(this).data('constraints').indexOf('@Unique')>-1){
49			$(this).attr('data-parsley-unique', $(this).data('source'));
50		}
51		if($(this).data('constraints').indexOf('@Checked')>-1){
52			$(this).attr('data-parsley-mincheck', '1');
53			$(this).attr('data-parsley-required', 'true');
54			$(this).attr('data-parsley-message', 'You need to agree to the terms and conditions to proceed');
55		}
56		if($(this).data('constraints').indexOf('@Length(')>-1){
57			var p = $(this).data('constraints').indexOf('@Length(');
58			var c = $(this).data('constraints').substr(p).replace('@Length(', '').replace('min=', '').replace('max=', '').replace(' ', '')
59			c = c.substr(0, c.indexOf(')')).split(',');
60			$(this).attr('data-parsley-minlength', c[0]);
61			$(this).attr('data-parsley-maxlength', c[1]);
62		}
63		if($('[name="password"]').length&&$('[name="password2"]').length) {
64			var el = $('[name="password2"]');
65			el.attr('data-parsley-equalto', '#password');
66		}
67	});
68}
69
70$(document).ready(function() {
71	validatorBindControls();
72});
73
74
75// Custom validators
76window.Parsley.addValidator('multipleOf', {
77	validateNumber: function(value, requirement) {
78		return value % requirement === 0;
79	},
80	requirementType: 'integer',
81	messages: {
82		en: 'This value should be a multiple of %s.',
83		fr: "Ce nombre n'est pas un multiple de %s."
84	}
85});
86
87
88// Unique
89window.Parsley.addValidator('unique', {
90	validateString: function(value, source) {
91		var result = false;
92		$.ajax({
93			method: 'POST',
94			async: false,
95			url: '/' + app.lang + '/ajax/ajaxValidate',
96			data: {constraint: 'unique', source: escape(source), value: escape(value)}
97		})
98		.done(function(ajaxResult){
99			result = true;
100		})
101		.fail(function(xhr){
102			result = false;
103		})
104		;
105		return result;
106	},
107	messages: {
108		en: 'The value should be unique within %s.',
109		el: "Η τιμή πρέπει να είναι μοναδική μεταξύ %s."
110	}
111});

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.