68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
$(function(){
|
|
$('#message').map(function(){
|
|
var message = $(this);
|
|
var dialog = $('<div id="dialog"/>');
|
|
dialog.append('<p><span class="ui-icon ui-icon-info"></span></p>');
|
|
dialog.attr('title', message.attr('title'));
|
|
dialog.children('p').append(message.html());
|
|
if($.isFunction(dialog.dialog)){
|
|
test = dialog.dialog({
|
|
bgiframe: true,
|
|
modal: true,
|
|
resizable: false,
|
|
buttons: {
|
|
Ok: function () {$(this).dialog("close");}
|
|
}
|
|
})
|
|
}
|
|
else{
|
|
alert(message.text());
|
|
}
|
|
});
|
|
|
|
$('.confirm').click(function(event){
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
var obj = $(this);
|
|
var dialog = $('<div id="dialog"/>');
|
|
dialog.append('<p><span class="ui-icon ui-icon-help"></span></p>');
|
|
dialog.attr('title', 'Pytanie');
|
|
dialog.children('p').append(obj.attr('question'));
|
|
if($.isFunction(dialog.dialog)){
|
|
dialog.dialog({
|
|
bgiframe: true,
|
|
modal: true,
|
|
resizable: false,
|
|
buttons: {
|
|
Ok: function(){
|
|
location.href=obj.attr('href');
|
|
},
|
|
Anuluj: function(){
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
})
|
|
}
|
|
else{
|
|
if(confirm(obj.attr('question'))){
|
|
location.href=obj.attr('href');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
function validation(fields) {
|
|
//$(".form_error").remove();
|
|
for (var i=0; i<fields.length; i++) {
|
|
var field = fields[i];
|
|
var obj = $('#'+field[0]);
|
|
obj.parent().find(".form_error").remove();
|
|
if (obj.val().match(field[1]) == null) {
|
|
var error_obj = obj.parent().prepend('<div class="form_error">↓ '+ field[2] + ' ↓</div>');
|
|
$('html,body').animate({scrollTop: error_obj.offset().top - 100}, 700);
|
|
obj.focus();
|
|
return false;
|
|
}
|
|
}
|
|
}
|