mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	inventree.js
This commit is contained in:
		| @@ -1,5 +1,20 @@ | |||||||
| {% load inventree_extras %} | {% load inventree_extras %} | ||||||
|  |  | ||||||
|  | /* globals | ||||||
|  |     ClipboardJS, | ||||||
|  |     inventreeFormDataUpload, | ||||||
|  |     launchModalForm, | ||||||
|  |     user_settings, | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | /* exported | ||||||
|  |     attachClipboard, | ||||||
|  |     enableDragAndDrop, | ||||||
|  |     inventreeDocReady, | ||||||
|  |     inventreeLoad, | ||||||
|  |     inventreeSave, | ||||||
|  | */ | ||||||
|  |  | ||||||
| function attachClipboard(selector, containerselector, textElement) { | function attachClipboard(selector, containerselector, textElement) { | ||||||
|     // set container |     // set container | ||||||
|     if (containerselector){ |     if (containerselector){ | ||||||
| @@ -8,6 +23,8 @@ function attachClipboard(selector, containerselector, textElement) { | |||||||
|         containerselector = document.body; |         containerselector = document.body; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     var text = null; | ||||||
|  |  | ||||||
|     // set text-function |     // set text-function | ||||||
|     if (textElement){ |     if (textElement){ | ||||||
|         text = function() { |         text = function() { | ||||||
| @@ -21,6 +38,7 @@ function attachClipboard(selector, containerselector, textElement) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // create Clipboard |     // create Clipboard | ||||||
|  |     // eslint-disable-next-line no-unused-vars | ||||||
|     var cis = new ClipboardJS(selector, { |     var cis = new ClipboardJS(selector, { | ||||||
|         text: text, |         text: text, | ||||||
|         container: containerselector |         container: containerselector | ||||||
| @@ -51,12 +69,13 @@ function inventreeDocReady() { | |||||||
|         // TODO - Only indicate that a drop event will occur if a file is being dragged |         // TODO - Only indicate that a drop event will occur if a file is being dragged | ||||||
|         var transfer = event.originalEvent.dataTransfer; |         var transfer = event.originalEvent.dataTransfer; | ||||||
|  |  | ||||||
|  |         // eslint-disable-next-line no-constant-condition | ||||||
|         if (true || isFileTransfer(transfer)) { |         if (true || isFileTransfer(transfer)) { | ||||||
|             $(this).addClass('dragover'); |             $(this).addClass('dragover'); | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $('.dropzone').on('dragleave drop', function(event) { |     $('.dropzone').on('dragleave drop', function() { | ||||||
|         $(this).removeClass('dragover'); |         $(this).removeClass('dragover'); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| @@ -154,7 +173,7 @@ function enableDragAndDrop(element, url, options) { | |||||||
|             method - HTTP method |             method - HTTP method | ||||||
|     */ |     */ | ||||||
|  |  | ||||||
|     data = options.data || {}; |     var data = options.data || {}; | ||||||
|  |  | ||||||
|     $(element).on('drop', function(event) { |     $(element).on('drop', function(event) { | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user