sdk: drop polyfills, use jquery 3

This commit is contained in:
mappu 2023-05-17 17:38:32 +12:00
parent bf3339fec7
commit e8dd95a830
4 changed files with 6 additions and 32 deletions

View File

@ -38,7 +38,7 @@ button.again {
</div>
</div>
<script type="text/javascript" src="/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="/jquery-3.7.0.min.js"></script>
<script type="text/javascript" src="/sdk.js"></script>
<script type="text/javascript">
"use strict";

File diff suppressed because one or more lines are too long

2
static/jquery-3.7.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,27 +1,6 @@
;(function() {
"use strict";
var installPolyfills = function() {
// @ref https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
if (!HTMLCanvasElement.prototype.toBlob) {
Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {
value: function (callback, type, quality) {
var binStr = atob( this.toDataURL(type, quality).split(',')[1] ),
len = binStr.length,
arr = new Uint8Array(len);
for (var i = 0; i < len; i++ ) {
arr[i] = binStr.charCodeAt(i);
}
callback( new Blob( [arr], {type: type || 'image/png'} ) );
}
});
}
}
var getCurrentScriptPath = function () {
// Determine current script path
// @ref https://stackoverflow.com/a/26023176
@ -388,11 +367,9 @@
initArea(contented.__preInit[i][0], contented.__preInit[i][1], contented.__preInit[i][2]);
}
};
var init = function() {
installPolyfills();
var currentScriptPath = getCurrentScriptPath();
var baseURL = currentScriptPath.replace('sdk.js', '');
@ -451,7 +428,7 @@
// Load scripts
var needScripts = [];
if (typeof jQuery === "undefined") {
needScripts.push(contented.baseURL + "jquery-1.12.4.min.js");
needScripts.push(contented.baseURL + "jquery-3.7.0.min.js");
}
if (typeof DrawingBoard === "undefined") {
needScripts.push(contented.baseURL + "drawingboard-0.4.6.min.js");