Fix certain Gifs not loading
https://burtrum.org/up/2529a1fc-29cc-47bf-a7a9-7bc081382c54/winkgrin.gif
This commit is contained in:
parent
210d4cb87d
commit
6c9f0400c8
2
package-lock.json
generated
2
package-lock.json
generated
@ -53,7 +53,7 @@
|
|||||||
"karma-jasmine": "^5.0.0",
|
"karma-jasmine": "^5.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.7.0",
|
"karma-jasmine-html-reporter": "^1.7.0",
|
||||||
"karma-webpack": "^5.0.0",
|
"karma-webpack": "^5.0.0",
|
||||||
"lerna": "^5.5.1",
|
"lerna": "^5.6.2",
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"po-loader": "0.6.1",
|
"po-loader": "0.6.1",
|
||||||
|
15
package.json
15
package.json
@ -87,7 +87,7 @@
|
|||||||
"karma-jasmine": "^5.0.0",
|
"karma-jasmine": "^5.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.7.0",
|
"karma-jasmine-html-reporter": "^1.7.0",
|
||||||
"karma-webpack": "^5.0.0",
|
"karma-webpack": "^5.0.0",
|
||||||
"lerna": "^5.5.1",
|
"lerna": "^5.6.2",
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"po-loader": "0.6.1",
|
"po-loader": "0.6.1",
|
||||||
@ -105,13 +105,24 @@
|
|||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@converse/openpromise": "^0.0.1",
|
||||||
|
"@converse/skeletor": "0.0.7",
|
||||||
"bootstrap": "^4.6.0",
|
"bootstrap": "^4.6.0",
|
||||||
"bootstrap.native": "^2.0.27",
|
"bootstrap.native": "^2.0.27",
|
||||||
"client-compress": "^2.2.2",
|
"client-compress": "^2.2.2",
|
||||||
|
"dayjs": "1.11.3",
|
||||||
"dompurify": "^2.3.1",
|
"dompurify": "^2.3.1",
|
||||||
"favico.js-slevomat": "^0.3.11",
|
"favico.js-slevomat": "^0.3.11",
|
||||||
|
"filesize": "^7.0.0",
|
||||||
"jed": "1.1.1",
|
"jed": "1.1.1",
|
||||||
"lit": "^2.4.0"
|
"lit": "^2.4.0",
|
||||||
|
"localforage-webextensionstorage-driver": "^3.0.0",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"pluggable.js": "3.0.1",
|
||||||
|
"sizzle": "^2.3.5",
|
||||||
|
"sprintf-js": "^1.1.2",
|
||||||
|
"strophe.js": "1.5.0",
|
||||||
|
"urijs": "^1.19.10"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"autoprefixer": "10.4.5"
|
"autoprefixer": "10.4.5"
|
||||||
|
@ -90,9 +90,11 @@ export default class ConverseGIFElement extends CustomElement {
|
|||||||
|
|
||||||
onControlsClicked (ev) {
|
onControlsClicked (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
|
|
||||||
if (this.supergif.playing) {
|
if (this.supergif.playing) {
|
||||||
this.supergif.pause();
|
this.supergif.pause();
|
||||||
} else {
|
} else if (this.supergif.frames.length > 0) {
|
||||||
// When the user manually clicks play, we turn on looping
|
// When the user manually clicks play, we turn on looping
|
||||||
this.supergif.options.loop = true;
|
this.supergif.options.loop = true;
|
||||||
this.supergif.play();
|
this.supergif.play();
|
||||||
|
@ -30,8 +30,7 @@ export default class ConverseGif {
|
|||||||
* @param { Number } [options.progress_bar_height=5]
|
* @param { Number } [options.progress_bar_height=5]
|
||||||
*/
|
*/
|
||||||
constructor (el, opts) {
|
constructor (el, opts) {
|
||||||
this.options = Object.assign(
|
this.options = Object.assign({
|
||||||
{
|
|
||||||
width: null,
|
width: null,
|
||||||
height: null,
|
height: null,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
@ -100,6 +99,9 @@ export default class ConverseGif {
|
|||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
getNextFrameNo () {
|
getNextFrameNo () {
|
||||||
|
if (this.frames.length === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return (this.frame_idx + 1 + this.frames.length) % this.frames.length;
|
return (this.frame_idx + 1 + this.frames.length) % this.frames.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,10 +288,6 @@ export default class ConverseGif {
|
|||||||
*/
|
*/
|
||||||
handleEOF (stream) {
|
handleEOF (stream) {
|
||||||
this.doDecodeProgress(stream, false);
|
this.doDecodeProgress(stream, false);
|
||||||
if (!(this.options.width && this.options.height)) {
|
|
||||||
this.canvas.width = this.hdr.width * this.getCanvasScale();
|
|
||||||
this.canvas.height = this.hdr.height * this.getCanvasScale();
|
|
||||||
}
|
|
||||||
this.initPlayer();
|
this.initPlayer();
|
||||||
!this.options.autoplay && this.drawPlayIcon();
|
!this.options.autoplay && this.drawPlayIcon();
|
||||||
}
|
}
|
||||||
@ -394,11 +392,10 @@ export default class ConverseGif {
|
|||||||
* @param { Number } i - The frame index
|
* @param { Number } i - The frame index
|
||||||
*/
|
*/
|
||||||
putFrame (i, show_pause_on_hover=true) {
|
putFrame (i, show_pause_on_hover=true) {
|
||||||
|
if (!this.frames.length) return
|
||||||
|
|
||||||
i = parseInt(i, 10);
|
i = parseInt(i, 10);
|
||||||
if (i > this.frames.length - 1) {
|
if (i > this.frames.length - 1 || i < 0) {
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
if (i < 0) {
|
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
const offset = this.frame_offsets[i];
|
const offset = this.frame_offsets[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user