Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update gifplayer plugin to v0.3.4#117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Undin wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromundin/update-gifplayer-plugin
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletionsassets/gifplayer/jquery.gifplayer.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
/*
* Gifplayer v0.3.2
* Gifplayer v0.3.4
* Customizable jquery plugin to play and stop animated gifs. Similar to 9gag's
* (c)2014 Rubén Torres - rubentdlh@gmail.com
* Released under the MIT license
*/

(function ($) {
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
}
}(function ($) {

function GifPlayer(preview, options) {
this.previewElement = preview;
this.options = options;
this.animationLoaded = false;
}

GifPlayer.scopes =[];
GifPlayer.scopes =new Array();

GifPlayer.prototype = {

Expand DownExpand Up@@ -75,10 +81,14 @@
gp.previewElement.trigger('click');
});
gp.previewElement.on('click', function (e) {
// Fire event onClick
gp.getOption('onClick').call(gp.previewElement, e);

gp.loadAnimation();
e.preventDefault();
e.stopPropagation();
});

break;
case 'hover':
gp.previewElement.on('click mouseover', function (e) {
Expand All@@ -96,7 +106,7 @@
},

processScope: function () {
scope = this.getOption('scope');
varscope = this.getOption('scope');
if (scope) {
if (GifPlayer.scopes[scope]) {
GifPlayer.scopes[scope].stopGif();
Expand DownExpand Up@@ -166,13 +176,15 @@
var wait = this.getOption('wait');
if (wait) {
//Wait until gif loads
this.gifElement.on('load', function () {
gp.animationLoaded = true;
gp.resetEvents();
gp.previewElement.hide();
gp.wrapper.append(gp.gifElement);
gp.spinnerElement.hide();
gp.getOption('onLoadComplete').call(gp.previewElement);
this.gifElement.on({
load: function () {
gp.animationLoaded = true;
gp.resetEvents();
gp.previewElement.hide();
gp.wrapper.append(gp.gifElement);
gp.spinnerElement.hide();
gp.getOption('onLoadComplete').call(gp.previewElement);
}
});
} else {
//Try to show gif instantly
Expand All@@ -188,6 +200,9 @@
this.gifElement.css('left', '0');
this.gifElement.attr('src', gifSrc);
this.gifElement.click(function (e) {
// Fire event onClick
gp.getOption('onClick').call(gp.previewElement, e);

$(this).remove();
gp.stopGif();
e.preventDefault();
Expand DownExpand Up@@ -358,10 +373,14 @@
},
onStop: function () {
},
onClick: function () {
},
onLoad: function () {
},
onLoadComplete: function () {
}
};

})(jQuery);
return GifPlayer;

}));

[8]ページ先頭

©2009-2025 Movatter.jp