PageSourceSearch

https://www.onlineocr.net/scripts/uploaddrop.bootstrap_v1.1.js

js onlineocr.net collected 2026-10-01 10:39:47 UTC 11,059 bytes, 342 lines download raw bytes

1/*jslint unparam: true */
2/*global window, $ */
3
4
5
6function toggleCombo() {
7
8    var chkTranslate = document.getElementById('MainContent_chkTranslate');
9     var cmbTranslateLanguage = document.getElementById('MainContent_cmbTranslateLanguage');
10
11    if (chkTranslate != null) 
12    {
13        cmbTranslateLanguage.disabled = !chkTranslate.checked;
14
15        if (!chkTranslate.checked)
16       {
17            cmbTranslateLanguage.style.backgroundColor = "#eeeeee";
18            cmbTranslateLanguage.style.color = "#777777";
19            cmbTranslateLanguage.style.borderColor = "#777777";
20        }
21        else 
22        {
23            cmbTranslateLanguage.style.backgroundColor = "#ffffff";
24            cmbTranslateLanguage.style.color = "#000000";
25            cmbTranslateLanguage.style.borderColor = "#000000";
26        }
27    }
28}
29
30
31function startUploadAgain() {
32
33
34    var panelAgain = document.getElementById('MainContent_Panel_upload_again');
35    if (panelAgain != null) {
36        panelAgain.style.display = 'none';
37    }
38
39    var panelUpload = document.getElementById('MainContent_Panel_upload');
40    if (panelUpload != null) {
41        panelUpload.style.display = 'block';
42        panelUpload.style.visibility = 'visible';
43    }
44
45    var panelConvert = document.getElementById('MainContent_Panel_convert');
46    if (panelConvert != null) {
47        panelConvert.style.display = 'none';
48    }
49
50    var panelPanelOCRResult = document.getElementById('MainContent_PanelOCRResult');
51    if (panelPanelOCRResult != null) {
52        panelPanelOCRResult.style.display = 'none';
53    }
54
55    var panelPanelFileLink = document.getElementById('MainContent_PanelFileLink');
56    if (panelPanelFileLink != null) {
57        panelPanelFileLink.style.display = 'none';
58    }
59
60    var panelPanelInfo = document.getElementById('MainContent_PanelInfo');
61    if (panelPanelInfo != null) {
62        panelPanelInfo.style.display = 'none';
63    }
64
65    var panelProgress = document.getElementById('progress');
66    if (panelProgress != null) {
67        panelProgress.style.display = 'none';
68    }
69
70    var panelBar = document.getElementById('#progress .bar');
71    if (panelBar != null) {
72        panelBar.css('width', 0);
73    }
74
75
76    var PanelAlert = document.getElementById('MainContent_PanelAlert');
77    if (PanelAlert != null) {
78        PanelAlert.style.display = 'none';
79    }
80
81    $("#MainContent_lbProgressFile2").text(GetLocalisedMaxSize());
82    $("#MainContent_lbProgressFile2").style.color = "black";
83}
84
85
86async function copyText() {
87
88    var copyText = document.getElementById('MainContent_txtOCRResultText');
89
90    if (copyText != null) {
91
92
93  try {    
94
95	    await navigator.clipboard.writeText(copyText.value); 
96    	return true;  
97    } 
98    catch 
99    {    const textarea = document.createElement('textarea');    
100         textarea.value = copyText.value; 
101         document.body.appendChild(textarea); 
102         textarea.select();
103         const ok = document.execCommand('copy');
104         document.body.removeChild(textarea); 
105       return ok; 
106     }
107  
108 }}
109
110 async function copyTranslatedText() {
111
112    var copyText = document.getElementById('MainContent_txtTranslatedText');
113
114    if (copyText != null) 
115    {
116        try {    
117    	    await navigator.clipboard.writeText(copyText.value); 
118    	    return true;  
119        } 
120        catch 
121        {    const textarea = document.createElement('textarea');    
122             textarea.value = copyText.value; 
123             document.body.appendChild(textarea); 
124             textarea.select();
125             const ok = document.execCommand('copy');
126             document.body.removeChild(textarea); 
127           return ok; 
128         }
129 }}
130
131
132 function GetLocalisedMaxSize() {
133
134    const localurl = window.location.href;
135
136    if (window.location.href.includes("/de/")) {
137        return 'Maximale Dateigröße 15 mb.';
138    }
139    else if (localurl.includes("/es/")) {
140        return 'Tamaño máximo del archivo: 15 MB.';
141    }
142    else if (localurl.includes("/fr/")) {
143        return 'Taille maximale du fichier : 15 Mo.';
144    }
145    else if (localurl.includes("/hi/")) {
146        return 'अधिकतम फ़ाइल आकार 15 एमबी।';
147    }
148    else if (localurl.includes("/id/")) {
149        return 'Ukuran file maksimum 15 MB.';
150    }
151    else if (localurl.includes("/it/")) {
152        return 'Dimensione massima del file: 15 MB.';
153    }
154    else if (localurl.includes("/ja/")) {
155        return '最大ファイルサイズ 15 MB。';
156    }
157    else if (localurl.includes("/ko/")) {
158        return '최대 파일 크기 15MB.';
159    }
160    else if (localurl.includes("/pl/")) {
161        return 'Maksymalny rozmiar pliku: 15 MB.';
162    }
163    else if (localurl.includes("/pt/")) {
164        return 'Tamanho máximo do ficheiro: 15 MB.';
165    }
166    else if (localurl.includes("/ru/")) {
167        return 'Максимальный размер файла: 15 МБ.';
168    }
169    else if (localurl.includes("/tr/")) {
170        return 'Maksimum dosya boyutu 15 MB.';
171    }
172    else if (localurl.includes("/zh_hans/")) {
173        return '最大文件大小 15 MB。';
174    }
175    else if (localurl.includes("/zh_hant/")) {
176        return '最大檔案大小 15 MB。';
177    }
178    else
179        return 'Max file size 15 mb.';
180 }
181
182 function GetLocalisedUploadedFile() {
183
184    const localurl = window.location.href;
185
186    if (window.location.href.includes("/de/")) {
187        return 'Hochgeladene Datei: ';
188    }
189    else if (localurl.includes("/es/")) {
190        return 'Archivo subido: ';
191    }
192    else if (localurl.includes("/fr/")) {
193        return 'Fichier téléchargé: ';
194    }
195    else if (localurl.includes("/hi/")) {
196        return 'अपलोड की गई फ़ाइल: ';
197    }
198    else if (localurl.includes("/id/")) {
199        return 'File yang Diunggah: ';
200    }
201    else if (localurl.includes("/it/")) {
202        return 'File caricato: ';
203    }
204    else if (localurl.includes("/ja/")) {
205        return 'アップロードされたファイル:';
206    }
207    else if (localurl.includes("/ko/")) {
208        return '업로드된 파일: ';
209    }
210    else if (localurl.includes("/pl/")) {
211        return 'Przesłany plik: ';
212    }
213    else if (localurl.includes("/pt/")) {
214        return 'Ficheiro carregado: ';
215    }
216    else if (localurl.includes("/ru/")) {
217        return 'Загруженный файл: ';
218    }
219    else if (localurl.includes("/tr/")) {
220        return 'Yüklenen Dosya: ';
221    }
222    else if (localurl.includes("/zh_hans/")) {
223        return '已上传文件:';
224    }
225    else if (localurl.includes("/zh_hant/")) {
226        return '已上傳檔案:';
227    }
228    else
229        return 'Uploaded File: ';
230 }
231
232$(function () {
233    'use strict';
234
235
236    // We use the upload handler integrated into Backload:
237    var fileUploadUrl = "/FileHandler.ashx";
238
239    $('#fileupload').fileupload({
240        url: fileUploadUrl,
241        maxFileSize: 15050000,   //  15 mb
242        acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|pdf|tif)$/i,
243
244        dataType: 'json',
245        done: function (e, data) {
246
247            $.each(data.result.files, function (index, file) {
248                
249               
250                // Uploaded file name
251
252                $("#MainContent_lbFileName").text(GetLocalisedUploadedFile() + file.name); 
253               
254                document.getElementById('MainContent_lbProgressFile2').style.color = "#666666";
255
256
257                document.getElementById('MainContent_hdnFileName').setAttribute('value', file.name);
258                document.getElementById('MainContent_hdnFullPath').setAttribute('value', file.extra_info.original_name);
259                document.getElementById('MainContent_btnOCRConvert').removeAttribute("disabled");
260
261                var Panel_upload_again = document.getElementById('MainContent_Panel_upload_again');
262                if (Panel_upload_again != null) {
263                    Panel_upload_again.style.display = 'block';
264                    Panel_upload_again.style.visibility = 'visible';
265                }
266
267                var panelConvert = document.getElementById('MainContent_Panel_convert');
268                if (panelConvert != null) {
269                    panelConvert.style.display = 'block';
270                    panelConvert.style.visibility = 'visible';
271                }
272
273                var panelUpload = document.getElementById('MainContent_Panel_upload');
274                if (panelUpload != null) {
275                    panelUpload.style.display = 'none';
276                }
277
278            });
279        },
280        start: function (e, data) {
281
282            $('#alert').hide();
283
284            var tbxResult = document.getElementById('MainContent_txtOCRResultText');
285            if (tbxResult != null) {
286                tbxResult.value = "";
287            }
288
289            var outFile = document.getElementById('MainContent_PanelFileLink');
290            if (outFile != null) {
291                outFile.style.visibility = 'hidden';
292            }
293
294            var panelError = document.getElementById('MainContent_PanelAlert');
295            if (panelError != null) {
296              panelError.style.visibility = 'hidden';
297            }
298        },
299        progressall: function (e, data) {
300
301            var progress = parseInt(data.loaded / data.total * 100, 10);
302
303            $("#MainContent_lbProgressFile2").text(progress + " %");
304
305            $('#progress .bar').css('width', progress + '%');
306
307        },
308        submit: function (e, data) {
309
310
311            var currentdate = new Date();
312            var tbxHdnDate = document.getElementById('MainContent_hdnFileNameEx');
313            if (tbxHdnDate != null) {
314                tbxHdnDate.value = currentdate.format('yyyyMMddhhmmss');
315            }
316
317            var panellbProgressFile2 = document.getElementById('MainContent_lbProgressFile2');
318            if (panellbProgressFile2 != null) {
319                panellbProgressFile2.style.color = "black";
320            }
321
322            var panelBar = document.getElementById('progress');
323            if (panelBar != null) {
324                panelBar.style.display = 'block';
325                $('#progress .bar').css('width', 0);
326            }
327
328        },
329        fail: function (e, data) {
330
331            document.getElementById('MainContent_hdnFileName').setAttribute('value', '');
332            document.getElementById('progress').style.display = 'none';
333
334            $("#MainContent_lbProgressFile2").text(data.errorThrown);
335            document.getElementById('MainContent_lbProgressFile2').style.color = "red";
336
337            document.getElementById('MainContent_btnOCRConvert').disabled = true;
338
339            //   $('#alert').addClass("alert alert-danger alert-dismissible").show().children('#message').text(data.errorThrown);
340        }
341    });
342});

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.