PageSourceSearch

https://kestava.fi/MyJs/tilt.fileUpload.js?v=80

js kestava.fi collected 2026-10-02 01:54:36 UTC 5,231 bytes, 145 lines download raw bytes

1//JS uploading files drag and drop
2
3var tiltFileUpload = new function () {
4
5    var url = '/MyTraining/UploadImage.ashx';
6
7
8
9    var initializeProductImageFileUploader = function (productId, selector, currentModalSelectorToHide, dataFileSuccessFunction) {
10
11        url = '/MyAthletes/FileUpload.ashx?productId=' + productId;
12        initializeUploaderBasic(dataFileSuccessFunction, selector, currentModalSelectorToHide, true);
13    }
14
15
16
17    var openLogoUploader = function () {
18        initializeLogoUploader();
19        $('#logoUpload').modal('show');
20    }
21
22    var closeLogoUploader = function () {
23        $('#logoUpload').modal('hide');
24        $('#fileupload').fileupload('destroy');
25    }
26
27    var logoUploadSuccess = function (selector, result) {
28
29        if (result.result.toString().indexOf('Error:') === -1) {
30            contentService.bindContent('46259d50-0a21-4e20-a762-e4e4b8e39930', $('#46259d50-0a21-4e20-a762-e4e4b8e39930'))
31            $('#logoUpload').modal('hide');
32            $('#fileupload').fileupload('destroy');
33            notificationService.ShowSpecificSuccessReplace("Logo");
34        }
35        else {
36            notificationService.ShowSpecificError(result.result);
37        }
38        
39    }
40
41    var initializeLogoUploader = function ()
42    {
43        url = '/MyTraining/UploadImage.ashx?Logo=true';
44        initializeUploaderBasic(logoUploadSuccess, '#fileupload', '#logoUpload', false);
45    }
46
47
48    var initializeDataFileUploader = function (athleteWorkoutId, selector, currentModalSelectorToHide, dataFileSuccessFunction) {
49        
50        url = '/MyTraining/UploadDataFile.ashx?AthleteWorkoutId=' + athleteWorkoutId;
51        initializeUploaderBasic(dataFileSuccessFunction, selector, currentModalSelectorToHide, true);
52    }
53
54    var initializeStandardImageFileUploader = function (selector, currentModalSelectorToHide, dataFileSuccessFunction) {
55
56        url =  '/MyTraining/UploadImage.ashx';
57        initializeUploaderBasic(dataFileSuccessFunction, selector, currentModalSelectorToHide, true);
58    }
59
60    
61
62    var openImageUploader = function () {
63        initializeImageUploader();
64        $('#imageUpload').modal('show');
65    }
66
67    var closeImageUploader = function () {
68        $('#imageUpload').modal('hide');
69        $('#fileupload').fileupload('destroy');
70    }
71
72    var imageUploadSuccess = function (selector, result) {
73        if (result.result.toString().indexOf('Error:') === -1) {
74            $('#imageUpload').modal('hide');
75            $('#fileupload').fileupload('destroy');
76            RefreshBannerImagesConfiguration();
77        }
78        else {
79            notificationService.ShowSpecificError(result.result);
80        }
81
82    }
83
84    var dataFileUploadProgress = function (currentModalSelectorToHide) {
85        //hide the current model while we are waiting. If there is one
86        if (currentModalSelectorToHide != null) {
87            $(currentModalSelectorToHide).modal('hide');
88        }
89        $('#dataFileLoading').modal({
90            backdrop: 'static',
91            keyboard: false
92        })
93    }
94
95    var sharedSuccessFunction = function (currentModalSelectorToShow, showModalAgainAfterSuccess) {
96        $('#dataFileLoading').modal('hide');
97        //now show the modal again
98        if (currentModalSelectorToShow != null && showModalAgainAfterSuccess == true) {
99            $(currentModalSelectorToShow).modal('show');
100        }
101    }
102
103    var initializeImageUploader = function () {
104        url = '/MyTraining/UploadImage.ashx?BannerImage=true';
105        initializeUploaderBasic(imageUploadSuccess, '#fileupload', '#imageUpload', false);
106    }
107
108    var initializeUploaderBasic = function (callBackFunction, selector, currentModalSelectorToHide, showModalAgainAfterSuccess) {
109        'use strict';
110        // Change this to the location of your server-side upload handler:
111        $(selector).fileupload({
112            url: url,
113            done: function (e, data) {
114                sharedSuccessFunction(currentModalSelectorToHide, showModalAgainAfterSuccess);
115                callBackFunction(selector, data);
116            },
117            progressall: function (e, data) {
118                if (dataFileUploadProgress) {
119                    dataFileUploadProgress(currentModalSelectorToHide);
120                }
121            }
122        }
122).prop('disabled', !$.support.fileInput)
123            .parent().addClass($.support.fileInput ? undefined : 'disabled');
124        
125    }
126
127  
128
129    //expose the functions we want to expose
130    return {
131        initializeUploaderBasic: initializeUploaderBasic,
132        initializeLogoUploader: initializeLogoUploader,
133        openLogoUploader: openLogoUploader,
134        closeLogoUploader: closeLogoUploader,
135        initializeImageUploader: initializeImageUploader,
136        openImageUploader: openImageUploader,
137        closeImageUploader: closeImageUploader,
138        initializeStandardImageFileUploader: initializeStandardImageFileUploader,
139        initializeDataFileUploader: initializeDataFileUploader,
140        initializeProductImageFileUploader: initializeProductImageFileUploader
141    };
142
143}
144
145

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.