mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-30 23:03:02 +00:00 
			
		
		
		
	Migrated some routes to POST
- shelf massadd - resetpassword - delete shelf - send to kindle
This commit is contained in:
		| @@ -62,7 +62,7 @@ $("#archived_cb").on("change", function() { | ||||
|     $("#shelf-actions").on("click", "[data-shelf-action]", function (e) { | ||||
|         e.preventDefault(); | ||||
|  | ||||
|         $.get(this.href) | ||||
|         $.post(this.href) | ||||
|             .done(function() { | ||||
|                 var $this = $(this); | ||||
|                 switch ($this.data("shelf-action")) { | ||||
|   | ||||
| @@ -20,6 +20,20 @@ function getPath() { | ||||
|     return jsFileLocation.substr(0, jsFileLocation.search("/static/js/libs/jquery.min.js"));  // the js folder path | ||||
| } | ||||
|  | ||||
| function postButton(event, action){ | ||||
|     event.preventDefault(); | ||||
|     var newForm = jQuery('<form>', { | ||||
|         "action": action, | ||||
|         'target': "_top", | ||||
|         'method': "post" | ||||
|     }).append(jQuery('<input>', { | ||||
|         'name': 'csrf_token', | ||||
|         'value': $("input[name=\'csrf_token\']").val(), | ||||
|         'type': 'hidden' | ||||
|     })).appendTo('body'); | ||||
|     newForm.submit(); | ||||
| } | ||||
|  | ||||
| function elementSorter(a, b) { | ||||
|     a = +a.slice(0, -2); | ||||
|     b = +b.slice(0, -2); | ||||
| @@ -71,6 +85,22 @@ $(document).on("change", "select[data-controlall]", function() { | ||||
|     } | ||||
| }); | ||||
|  | ||||
| /*$(document).on("click", "#sendbtn", function (event) { | ||||
|     postButton(event, $(this).data('action')); | ||||
| }); | ||||
|  | ||||
| $(document).on("click", ".sendbutton", function (event) { | ||||
|     // $(".sendbutton").on("click", "body", function(event) { | ||||
|     postButton(event, $(this).data('action')); | ||||
| });*/ | ||||
|  | ||||
| $(document).on("click", ".postAction", function (event) { | ||||
|     // $(".sendbutton").on("click", "body", function(event) { | ||||
|     postButton(event, $(this).data('action')); | ||||
| }); | ||||
|  | ||||
|  | ||||
|  | ||||
| // Syntax has to be bind not on, otherwise problems with firefox | ||||
| $(".container-fluid").bind("dragenter dragover", function () { | ||||
|     if($("#btn-upload").length && !$('body').hasClass('shelforder')) { | ||||
| @@ -685,13 +715,14 @@ $(function() { | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#delete_shelf").click(function() { | ||||
|     $("#delete_shelf").click(function(event) { | ||||
|         confirmDialog( | ||||
|             $(this).attr('id'), | ||||
|             "GeneralDeleteModal", | ||||
|             $(this).data('value'), | ||||
|             function(value){ | ||||
|                 $("#delete_shelf").closest("form").submit() | ||||
|                 postButton(event, $("#delete_shelf").data("action")); | ||||
|                 // $("#delete_shelf").closest("form").submit() | ||||
|             } | ||||
|         ); | ||||
|  | ||||
| @@ -775,4 +806,3 @@ $(function() { | ||||
|         }); | ||||
|     }); | ||||
| }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ozzieisaacs
					Ozzieisaacs