Dump everything from SVN
This commit is contained in:
10
script/footable/footable.min.js
vendored
Normal file
10
script/footable/footable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
script/footable/footable.standalone.min.css
vendored
Normal file
1
script/footable/footable.standalone.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
109
script/script.js
Normal file
109
script/script.js
Normal file
@ -0,0 +1,109 @@
|
||||
/**
|
||||
* /script/script.js
|
||||
* @version 2.0
|
||||
* @desc Javascript for ajax and for fancy tables
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
function ask(q, togo){
|
||||
if(confirm(q)){
|
||||
window.location=togo;
|
||||
}
|
||||
}
|
||||
|
||||
function prompt_go(question, value, todo){
|
||||
var reply=prompt(question, value);
|
||||
if(reply){
|
||||
window.location=todo+reply;
|
||||
}
|
||||
}
|
||||
|
||||
function disposeMessageOverlay(){
|
||||
$("#messageOverlay").html("");
|
||||
$("#messageOverlay").css("display", "none");
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
//loading overlay
|
||||
$(document).ajaxStart(function(){
|
||||
$("#loadingOverlay").css("display", "block");
|
||||
});
|
||||
$(document).ajaxComplete(function(){
|
||||
$("#loadingOverlay").css("display", "none");
|
||||
});
|
||||
|
||||
|
||||
//footable
|
||||
$(".table").footable();
|
||||
|
||||
|
||||
//handle response
|
||||
function setResponse(response){
|
||||
$("#messageOverlay").html(response);
|
||||
$("#messageOverlay").css("display", "block");
|
||||
setTimeout(function(){
|
||||
$("#messageOverlay").html("");
|
||||
$("#messageOverlay").css("display", "none");
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
//handle form submits
|
||||
$(".ajaxform").submit(function(e){
|
||||
e.preventDefault(); //turn off default handler
|
||||
|
||||
//run ajax request
|
||||
$.ajax({
|
||||
url: e.target.action+"?backend",
|
||||
type: e.target.method,
|
||||
data: $(this).serialize(),
|
||||
success: function(response){
|
||||
setResponse(response);
|
||||
}
|
||||
});
|
||||
|
||||
//reset form if data-noreset not specified
|
||||
if($(this).data("noreset")==undefined){
|
||||
e.target.reset();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//handle button presses
|
||||
$(document).on("click", ".ajaxbutton", function(e){
|
||||
e.preventDefault(); //turn off default handler
|
||||
|
||||
if($(this).data("confirm")==undefined || confirm($(this).data("confirm"))){ //check if confirmation needed
|
||||
//prompt for input if needed
|
||||
var reply="";
|
||||
if($(this).data("prompt")!=undefined){
|
||||
reply=prompt($(this).data("prompt"), '');
|
||||
}
|
||||
|
||||
//build target url
|
||||
var targetUrl=$(this).data("url")+reply;
|
||||
if(targetUrl.indexOf("?")){
|
||||
targetUrl+="&backend";
|
||||
}
|
||||
else{
|
||||
targetUrl+="?backend";
|
||||
}
|
||||
|
||||
//run ajax request
|
||||
$.ajax({
|
||||
url: targetUrl,
|
||||
type: "GET",
|
||||
success: function(response){
|
||||
setResponse(response);
|
||||
}
|
||||
});
|
||||
|
||||
//delete caller button if data-kepp not specified
|
||||
if($(this).data("keep")==undefined){
|
||||
$(this).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user