-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdynamsoft.webtwain.install.js
604 lines (492 loc) · 29.7 KB
/
dynamsoft.webtwain.install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
/*! 20240828181423453
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2024, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 18.5.1
*/
//Dynamsoft.On{actionName} It is a callback function called by Web-TWAIN product. The contents of this function are the default templates of the WebTWAIN. Users can modify the fucntions, but be aware that the function name itself cannot be modified
//Dynamsoft._{functionName} It is a private function used by Dynamsoft.On{actionName}. Users can modify and delete according to their needs.
(function () {
"use strict";
var promptDlgWidth = 620;
if(Dynamsoft.navInfoSync.bMobile) {
if(screen.width<620) {
promptDlgWidth = screen.width - 10;
}
}
//----------------------start Install Dialog---------------------------
//Web TWAIN Service is not detected dialogs
//Windows
Dynamsoft.OnWebTwainNotFoundOnWindowsCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) {
var _this = Dynamsoft,
objUrl = {
'default': InstallerUrl
};
_this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumWindow, bIE, bSafari, bSSL, strIEVersion, false);
};
//Linux
Dynamsoft.OnWebTwainNotFoundOnLinuxCallback = function (ProductName, strDebUrl, strRpmUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion, iPlatform) {
var _this = Dynamsoft,
objUrl = {
'default': strDebUrl,
'deb': strDebUrl,
'rpm': strRpmUrl
};
if (!iPlatform) iPlatform = Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux;
_this._show_install_dialog(ProductName, objUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, false);
};
//MacOS
Dynamsoft.OnWebTwainNotFoundOnMacCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) {
var _this = Dynamsoft,
objUrl = {
'default': InstallerUrl
};
_this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumMac, bIE, bSafari, bSSL, strIEVersion, false);
};
//Android
Dynamsoft.OnWebTwainNotFoundOnAndroidCallback = function (ProductName, InstallerUrl, bSSL, bUpgrade) {
var objUrl = {
'default': 'https://demo.dynamsoft.com/DWT/Resources/dist/DynamsoftServiceSetup.apk'
}, dt = Math.random();
var _path = Dynamsoft.DWT.ServiceInstallerLocation;
if (Dynamsoft.Lib.isString(_path) && _path.length > 0) {
var sep = '';
if (_path[_path.length - 1] != '/') {
sep = '/';
}
objUrl.default = [_path, sep, 'DynamsoftServiceSetup.apk'].join('');
}
objUrl.openService = "intent://dynamsoft.com/#Intent;scheme=http;package=com.dynamsoft.mobilescan;S.timestamp=" + dt + ";end";
Dynamsoft.DWT.Host = 'local.dynamsoft.com';
Dynamsoft._show_android_install_dialog(objUrl, bUpgrade);
};
//Web TWAIN Service is not supported dialogs
//Mobile Browsers
Dynamsoft.OnMobileNotSupportCallback = function () {
var ObjString = [];
if (Dynamsoft.DWT) {
ObjString.push('<div class="ds-dwt-ui-dlg-android" style="padding-bottom:30px">');
ObjString.push('Service Mode does not support your Operating System, please contact the site administrator.');
ObjString.push('</div>');
Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
width: 335,
headerStyle: 1,
backgroundStyle: 1
});
} else {
console.log("The Dynamsoft namespace is missing");
}
};
//Error Message - HTTPS is required to allow CORS to function. This error appears when HTTP is detected. (See: https://www.dynamsoft.com/web-twain/docs/faq/http-insecure-websites-in-chromium-browser.html?ver=latest)
Dynamsoft.OnHTTPCorsError = function (msg) {
var ObjString = [
"<div>", msg, "</div>",
'<div style="margin-top:10px">To fix the issue, please update your website to HTTPS or refer to <br /><a target="_blank" href="https://www.dynamsoft.com/web-twain/docs/faq/http-insecure-websites-in-chromium-browser.html?ver=latest">this article</a> for other workarounds.</div>'
].join('');
Dynamsoft.DWT.ShowMessage(ObjString, {
width: promptDlgWidth,
headerStyle: 2
});
};
Dynamsoft._show_install_dialog = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, bNeedUpgrade) {
var _this = Dynamsoft,
ObjString, title, browserActionNeeded,
EnumPlatform = Dynamsoft.DWT.EnumDWT_PlatformType,
bUnix = (iPlatform == EnumPlatform.enumLinux || iPlatform == EnumPlatform.enumEmbed ||
iPlatform == EnumPlatform.enumChromeOS || iPlatform == EnumPlatform.enumHarmonyOS),
imagesInBase64 = {
icn_download: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAABHNCSVQICAgIfAhkiAAABqxJREFUaEPlm01y2zYUxwHJe6cniHMCU7K7tnoCK8uuYp+gzglsn8DOCapuuo1ygsjr2hKz6jLKtpvY61pA/g8ARZDiBwiCnMyYM5omKQnih/fw8L7I2Qu7eNe8o9GvJ/QOKUU0GPBX+s9swrl8ZIzH9Hch5JrzwVrK/59iXF3OKThwFEUHjA1PBgM21WAa0vWSkuDZQgg+Z+z5DvxYmHBXMOAoOnoHuAtMNrKnB4AvkOQjJArJcTV5IdgCcn4Fiat7cQ8WieMnDzDG6yyenAP+Qxzf45n2V2tggE4BeYOJYsL6AsAn/CAhsYCE1k2mCQ2B6g8mUvIzjHmYjskWUj6/b6vy3sBRdAx1ZZf4TQzkN0BexfFy1gSw6l6wQwv2LrCE+PF9s5wzITbXTRcyeY8X8Hh8fIMBMAmF+gSjcxESNL8IKTi7NIv7iMWFtJsvbiNg/eLhn1jtqZnUtRDPt6ENS5nUySByPryFqp+ae66Wy/vrJhrlDKxftvdRGyWSKp+GMiRNJkz3jsdj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qRZyLbRN5RCSEnAQmGFhXLsJDEt8mAdB0Hi/rDIfogsYEQP3HkAmvQmmF0NeY4rFJPAYB0Ly3QyZcBhihI8USee4wkdYhptiFLhiERHHLaAbgLyaoKZJ4Wqx1mIivXokAl0gTcFHNC9lCVj1U90404FKaNq+E5AFDyb56p07qMK7TGTYJfZWcaEzEr4PL1wlwE3eJsVZMs3Fjc6nRJZjXBbB3Mc2YKFUuhftwgGB+1wWyqrR01Q6KZwrHYS9k7OKzGelgYqJS/fOZE54givkCPoKjXKodCtVlB1dudevACq2oUqI+hLmeYRoYVmPD9Vz5fq1VY6Hku/aWB71hKXY3DSqm10EJkaEbQPVrQlr8rlYtD3bqWusA+5/yorLf8pf7lGlfMnY/sKnFklpqf5iafglnlv9yYerVyr0lTee2TJMzcWfLFFREAI2OnuvFacPZt6b04ywXOQFXK/LtOlgviuvloh5rY2AI+8lWSqETcF28+X9oB+tFAK519i506yxb0xswJ6h1sLKnit3p3lp0HcCN2UQXrX2nwq8mZtcOAqwVRNHBaiYZwDl45RKlWLCmzosCWjLQc7Xr7A0GbLQim7QRzdAj01VDfOcrAC9jgTWNh1/MPi6Em3mV8g3O66CNdLUCbInSGrKL3ioVVhrgyci8fnPYluu6naLDd57gwCR4Y8YCTY4YdsZYiijABXD1Go+KX8scYked7hDgZoiR/quzkkZS8qwmclVb+j4r/NW+EZY58QFHr/g1nrr46aJaSo6wLUG9k9D2YkcRPtisDB1B61OMa+HwMlDGt1VZzeJVPIlmbh1c0Hba/pDiVTwJfGFvqoRs6v/IOTkNXX2kbQAAAABJRU5ErkJggg=='
};
// npm file mode
if (bNeedUpgrade)
title = 'Please update your document scanning service'; //'Please follow the steps below to upgrade your local document scanning service.';
else
title = 'Please download and install the Dynamic Web TWAIN service';
ObjString = [
'<div class="dynamsoft-dwt-dlg-title">',
title,
'</div><div class="dynamsoft-dwt-dlg-title-error" style="display:none"></div>'
];
if (_this.DWT) {
var bFirefox = Dynamsoft.navInfoSync.bFirefox;
if (bUnix || bFirefox) {
browserActionNeeded = 'RESTART';
} else {
browserActionNeeded = 'REFRESH';
}
ObjString.push('<div class="dynamsoft-dwt-installdlg-iconholder"> ');
var left = '134px';
ObjString.push('<div class="dynamsoft-dwt-installdlg-splitline" style="left: ' + left + '"></div>');
ObjString.push('<div class="dynamsoft-dwt-installdlg-splitline" style="left: 328px"></div>');
var marginRight = '133px';
ObjString.push('<img style="margin: 0px ' + marginRight + ' 0px 0px" src="' + imagesInBase64.icn_download + '" alt="download" />');
ObjString.push('<img style="margin: 2px ' + marginRight + ' 2px 0px" src="' + imagesInBase64.icn_install + '" alt="install" />');
ObjString.push('<img src="' + imagesInBase64.icn_scan + '" alt="scan" />');
ObjString.push('<div><span class="dynamsoft-dwt-installdlg-text" style="right: 160px">Download</span>');
ObjString.push('<span class="dynamsoft-dwt-installdlg-text" style="right: 18px">Install</span>');
ObjString.push('<span class="dynamsoft-dwt-installdlg-text" style="left: 140px">Scan</span>');
ObjString.push('</div>');
ObjString.push('</div>');
if (bHTML5 && bUnix) {
ObjString.push('<div style="margin:10px 0 0 60px;">');
ObjString.push('<div id="dwt-install-url-div">');
var arm64 = Dynamsoft.navInfo.bArm64,
mips64 = Dynamsoft.navInfo.bMips64,
chromeOS = Dynamsoft.navInfoSync.bChromeOS,
harmonyOS = Dynamsoft.navInfoSync.bHarmonyOS;
if (arm64 || mips64 || chromeOS || harmonyOS) { } else {
ObjString.push('<div><input id="dwt-install-url-deb" name="dwt-install-url" type="radio" onclick="Dynamsoft._dwt_change_install_url(\'' + objInstallerUrl.deb + '\')" checked="checked" /><label for="dwt-install-url-deb">64 bit .deb (For Ubuntu/Debian)</label></div>');
ObjString.push('<div><input id="dwt-install-url-rpm" name="dwt-install-url" type="radio" onclick="Dynamsoft._dwt_change_install_url(\'' + objInstallerUrl.rpm + '\')" /><label for="dwt-install-url-rpm">64 bit .rpm (For Fedora)</label></div>');
}
ObjString.push('</div></div>');
}
ObjString.push('<div><a id="dwt-btn-install" target="_blank" href="');
ObjString.push(objInstallerUrl['default']);
ObjString.push('"');
if (bHTML5) {
ObjString.push(' html5="1"');
} else {
ObjString.push(' html5="0"');
}
ObjString.push(' onclick="Dynamsoft._dcp_dwt_onclickDownloadButton()"><div class="dynamsoft-dwt-dlg-button">Download</div></a></div>');
if (bHTML5) {
if (bIE) {
ObjString.push('<div class="dynamsoft-dwt-dlg-tail" style="text-align:left; padding-left: 80px">');
ObjString.push('If you still see the dialog after installing the Dynamsoft Service, please<br />');
ObjString.push('1. Add the website to the zone of trusted sites.<br />');
ObjString.push('IE | Tools | Internet Options | Security | Trusted Sites.<br />');
ObjString.push('2. Refresh your browser.');
ObjString.push('</div>');
} else {
if (bUnix) {
ObjString.push('<div class="dynamsoft-dwt-dlg-tail">');
ObjString.push('<div class="dynamsoft-dwt-dlg-red">After the installation, please <strong>' + browserActionNeeded + '</strong> your browser.</div>');
ObjString.push('</div>');
} else {
ObjString.push('<div><br /></div>');
}
}
} else {
ObjString.push('<div class="dynamsoft-dwt-dlg-tail" style="text-align:left; padding-left: 80px">');
ObjString.push('After the installation, please<br />');
ObjString.push('1. Restart the browser<br />');
ObjString.push('2. Allow "DynamicWebTWAIN" add-on to run by right clicking on the Information Bar in the browser.');
ObjString.push('</div>');
}
_this.DWT.ShowMessage(ObjString.join(''), {
width: promptDlgWidth,
headerStyle: 1
});
} else {
console.log("The Dynamsoft namespace is missing");
}
if (Dynamsoft.DWT && Dynamsoft.DWT.OnWebTwainNotFound) {
Dynamsoft.DWT.OnWebTwainNotFound();
}
};
Dynamsoft._dwt_change_install_url = function (url) {
var install = document.getElementById('dwt-btn-install');
if (install)
install.href = url;
};
var reconnectTime = 0;
Dynamsoft._dcp_dwt_onclickDownloadButton = function() {
var install = document.getElementById('dwt-install-url-div');
if (install)
install.style.display = 'none';
var el = document.getElementById('dwt-btn-install');
if (el) {
if (el.getAttribute("html5") == "1") {
var pel = el.parentNode,
newDiv = document.createElement('div');
newDiv.id = 'dwt-btn-install';
newDiv.style.textAlign = "center";
newDiv.style.paddingBottom = '15px';
newDiv.style.fontSize = '14px';
newDiv.innerHTML = 'Please proceed with the installation. Once done, <a href="javascript:void(0)" onclick="Dynamsoft._dcp_dwt_onclickInstallButton()">click here to verify completion.</a>';
newDiv.setAttribute("html5", "1");
pel.removeChild(el);
pel.appendChild(newDiv);
} else {
var pel = el.parentNode;
pel.removeChild(el);
}
}
return true;
};
Dynamsoft._dcp_dwt_onclickInstallButton = function () {
var install = document.getElementById('dwt-install-url-div');
if (install)
install.style.display = 'none';
var divTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title');
if (divTitle) {
divTitle.style('display','');
}
var divTitleErr = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title-error');
if (divTitleErr) {
divTitleErr.style('display','none');
}
var el = document.getElementById('dwt-btn-install');
if (el) {
setTimeout(function () {
if (el.getAttribute("html5") == "1") {
var pel = el.parentNode,
newDiv = document.createElement('div');
newDiv.id = 'dwt-btn-install';
newDiv.style.textAlign = "center";
newDiv.style.paddingBottom = '15px';
newDiv.style.fontSize = '14px';
newDiv.innerHTML = 'Connecting to the service...';
newDiv.setAttribute("html5", "1");
pel.removeChild(el);
pel.appendChild(newDiv);
reconnectTime = new Date();
setTimeout(Dynamsoft._dwt_Reconnect, 10);
} else {
var pel = el.parentNode;
pel.removeChild(el);
}
}, 10);
}
return true;
};
Dynamsoft._dwt_Reconnect = function () {
var _this = Dynamsoft;
if (((new Date() - reconnectTime) / 1000) > 10) {
// change prompt
var el = document.getElementById('dwt-btn-install');
if (el) {
el.innerHTML = 'Please make sure your installation is successful. <a href="javascript:void(0)" onclick="Dynamsoft._dcp_dwt_onclickInstallButton()">Click here to try reconnecting</a>.';
}
var divTitle = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title');
if (divTitle) {
divTitle.style('display','none');
}
var divTitleErr = Dynamsoft.Lib.one('.dynamsoft-dwt-dlg-title-error');
if (divTitleErr) {
divTitleErr.html('Failed to connect to the service!');
divTitleErr.style('display','');
}
return;
}
if (_this.DWT) {
var _timeSpan = 500;
if (navigator.userAgent.indexOf("Safari") > -1) {
_timeSpan = 2000;
}
_this.DWT.CheckConnectToTheService(function () {
Dynamsoft.DWT.CloseDialog();
Dynamsoft.DWT.ConnectToTheService();
}, function () {
if (Dynamsoft.DWT.NeedCheckWebTwainBySocket()) {
Dynamsoft.DWT.CheckWebTwainBySocket(function () {
Dynamsoft.OnHTTPCorsError();
}, function () {
setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
}, function () {
setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
});
return;
}
setTimeout(Dynamsoft._dwt_Reconnect, _timeSpan);
});
} else {
console.log("The Dynamsoft namespace is missing");
}
};
Dynamsoft._show_android_install_dialog = function (objInstallerUrl, bUpgrade) {
var ObjString;
if (Dynamsoft.DWT.bNpm && Dynamsoft.navInfoSync.bFileSystem) {
return Dynamsoft._show_online_download_dialog(objInstallerUrl, bHTML5, iPlatform);
}
ObjString = [];
if (Dynamsoft.DWT) {
ObjString.push('<div class="ds-dwt-ui-dlg-android">');
ObjString.push('<div>Please download and ');
if(bUpgrade) {
ObjString.push('update');
} else {
ObjString.push('install');
}
ObjString.push(' the <strong>DYNAMSOFT SERVICE</strong> app via the </div>');
ObjString.push('<div><a target="_blank" href="');
ObjString.push(objInstallerUrl['default']);
ObjString.push('" onclick="Dynamsoft._dwt_ReconnectForAndroid()">direct APK download link</a>.</div>');
ObjString.push('</div>');
ObjString.push('<div class="dynamsoft-dwt-dlg-tail" style="text-align:left">');
ObjString.push('If you have ');
if(bUpgrade) {
ObjString.push('updated');
} else {
ObjString.push('installed');
}
ObjString.push(' it, please click on the button below to initiate the connection.');
ObjString.push('<a target="_blank" href="');
ObjString.push(objInstallerUrl.openService);
ObjString.push('" onclick="Dynamsoft._dwt_ReconnectForAndroid()"><div class="dynamsoft-dwt-dlg-button-android">Open Service</div></a>');
ObjString.push('</div>');
ObjString.push('</div>');
Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
width: 335,
headerStyle: 1,
backgroundStyle: 1
});
} else {
console.log("The Dynamsoft namespace is missing");
}
if (Dynamsoft.DWT && Dynamsoft.DWT.OnWebTwainNotFound) {
Dynamsoft.DWT.OnWebTwainNotFound();
}
};
Dynamsoft._dwt_ReconnectForAndroid = function () {
Dynamsoft.DWT.CheckConnectToTheService(function (bConnected) {
if (bConnected) {
Dynamsoft.DWT.CloseDialog();
Dynamsoft.DWT.ConnectToTheService();
} else {
setTimeout(Dynamsoft._dwt_ReconnectForAndroid, 500);
}
}, function () {
setTimeout(Dynamsoft._dwt_ReconnectForAndroid, 500);
});
}
//Dynamsoft.OnWebTwainNotFoundOnAndroidCallback = Dynamsoft.MobileNotSupportCallback;
//------------------------end Install Dilaog---------------------------
//----------------------start Upgrade Dialog---------------------------
Dynamsoft.OnWebTwainNeedUpgradeCallback = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion) {
Dynamsoft._show_install_dialog(ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, true, true);
};
Dynamsoft.OnWebTwainNeedUpgradeOnAndroidCallback = function (ProductName, InstallerUrl, bSSL) {
Dynamsoft.OnWebTwainNotFoundOnAndroidCallback(ProductName, InstallerUrl, bSSL, true);
};
//----------------------end Upgrade Dialog---------------------------
//----------------------start DLS License -----------------------
Dynamsoft.OnLTSLicenseError = function (message, code) {
var addMessage = '',
ObjString;
if (code == -2440 || // NetworkError
code == -2441 || // Timedout
code == -2443 || // CorsError
code == -2446 || // LtsJsLoadError
message.indexOf('Internet connection') > -1 ||
message.indexOf('Storage') > -1) {
var purchaseUrl = 'https://www.dynamsoft.com/customer/license/trialLicense?product=dwt&deploymenttype=js';
addMessage = '<div>You can register for a free 30-day trial <a href="' + purchaseUrl + '" target="_blank" class="dynamsoft-major-color">here</a>. Make sure to select the product Dynamic Web TWAIN.</div>';
}
ObjString = [
message,
addMessage
];
Dynamsoft.DWT.ShowMessage(ObjString.join(''), {
width: promptDlgWidth,
headerStyle: 2
});
};
Dynamsoft.OnLTSConnectionWarning = function () {
var ObjString = [
'Warning: You are seeing this dialog because Dynamic Web TWAIN has failed to connect to the License Tracking Server. ',
'A cached authorization is being used, and you can continue to use the software as usual. ',
'Please get connected to the network as soon as possible. ',
Dynamsoft.DWT.isPublicLicense() ? '<a class="dynamsoft-major-color" href="https://www.dynamsoft.com/company/contact/">Contact Dynamsoft</a> ' : 'Contact the site administrator ',
'for more information.'
].join('');
Dynamsoft.DWT.ShowMessage(ObjString, {
width: promptDlgWidth,
caption: 'Warning',
headerStyle: 2
});
};
Dynamsoft.OnLTSPublicLicenseWarning = function (message) {
Dynamsoft.DWT.ShowMessage(message, {
width: promptDlgWidth,
caption: 'Warning',
headerStyle: 2
});
};
//--------------------end DLS License-------------------------------
//----------------------start Product Key -----------------------
Dynamsoft.OnLicenseExpiredWarning = function (strExpiredDate, remain, trial) {
var ObjString, strCaption,
a_online_store = '<a target="_blank" href="https://www.dynamsoft.com/store/dynamic-web-twain/#DynamicWebTWAIN">online store</a>',
a_new_key_href = 'https://www.dynamsoft.com/customer/license/trialLicense?product=dwt&utm_source=in-product';
if (remain > 5 || !trial) {
} else {
if (remain > 0) { // 1~5
var strDays;
if (remain <= 1) {
strDays = '1 day';
} else {
strDays = parseInt(remain) + ' days';
}
strCaption = 'Warning';
ObjString = [
'<div style="padding:0 0 10px 0">Kindly note your trial key is expiring in ', strDays, '. Two quick steps to extend your trial:</div>',
'<div style="margin:0 0 0 10px">1. <a target="_blank" href="', a_new_key_href, '">Request a new trial key</a> and follow the instructions to set the new key</div>',
'<div style="margin:0 0 0 10px">2. Refresh your scan page and try again</div>',
'<div style="padding:0">If you are ready to purchase a full license, please go to the ', a_online_store, '.</div>'
].join('');
} else {
// Trial remain<=0 Expired
ObjString = [
'<div style="padding:0">Sorry. Your product key has expired on ', strExpiredDate, '. You can purchase a full license at the ', a_online_store, '.</div>',
'<div style="padding:0">Or, you can try requesting a new product key at <a target="_blank" href="', a_new_key_href, '">this page</a>.</div>'
].join('');
}
if (ObjString) {
Dynamsoft.DWT.ShowMessage(ObjString, {
width: promptDlgWidth,
caption: strCaption,
headerStyle: 2
});
}
}
};
Dynamsoft.OnLicenseError = Dynamsoft.OnLicenseError || function (message, errorCode) {
Dynamsoft.DWT.ShowMessage(Dynamsoft.ProcessLicenseErrorContent(message), {
width: promptDlgWidth,
headerStyle: 2
});
};
Dynamsoft.OnCorsConfigError = function (msg) {
var ObjString = [
msg, " Please contact the Administrator to configure 'Access-Control-Allow-Origin'.",
].join('');
Dynamsoft.DWT.ShowMessage(ObjString, {
width: promptDlgWidth,
headerStyle: 2
});
};
Dynamsoft.ProcessLicenseErrorContent = function (content) {
var el = [],
_content = content;
if (typeof(_content) != 'string') {
if (undefined === _content)
return '';
if (_content instanceof Error || 'message' in _content)
_content = _content.message;
else
_content = '' + _content;
}
var posLeftBracket = _content.indexOf("[");
var posRightBracket = _content.indexOf("]", posLeftBracket);
var posLeftParentheses = _content.indexOf("(", posRightBracket);
var posRightParentheses = _content.indexOf(")", posLeftParentheses);
if (-1 == posLeftBracket || -1 == posRightBracket || -1 == posLeftParentheses || -1 == posRightParentheses) {
return _content;
}
if (posLeftBracket > 0) {
el.push(_content.substring(0, posLeftBracket));
}
var linkText = _content.substring(posLeftBracket + 1, posRightBracket);
var linkAddr = _content.substring(posLeftParentheses + 1, posRightParentheses);
el.push(['<a href="', linkAddr, '" target="_blank" class="dynamsoft-major-color">', linkText, '</a>'].join(''));
el.push(_content.substring(posRightParentheses + 1));
return el.join('');
}
//--------------------end Product Key-------------------------------
})();