scrivito_gif_control_widget 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +4 -0
- data/README.md +35 -0
- data/Rakefile +18 -0
- data/app/assets/javascripts/scrivito_gif_control_widget.js +1 -0
- data/app/assets/javascripts/scrivito_gif_control_widget/gifffer.min.js +1 -0
- data/app/assets/javascripts/scrivito_gif_control_widget/script.js +9 -0
- data/app/assets/stylesheets/scrivito_gif_control_widget/application.css +15 -0
- data/app/models/gif_control_widget.rb +3 -0
- data/app/views/gif_control_widget/details.html.erb +3 -0
- data/app/views/gif_control_widget/show.html.erb +5 -0
- data/app/views/gif_control_widget/thumbnail.html.erb +3 -0
- data/lib/scrivito_gif_control_widget.rb +4 -0
- data/lib/scrivito_gif_control_widget/engine.rb +5 -0
- data/lib/scrivito_gif_control_widget/version.rb +3 -0
- data/lib/tasks/scrivito_gif_control_widget_tasks.rake +4 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b43bd5c13dd633356c0aa5c5ca543acb88050fe9
|
4
|
+
data.tar.gz: e7c530ba2eb11f6e604b4570113915deffd61a35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8bb52b66ab2938c6ad535a6179c4c1dd53cbdd24222e4318c45ae0ebca15acb3c8507c6ae3596e1ef2b85bdcc77d13ed22e3d4cbbfd99af93e6b46d8587a523
|
7
|
+
data.tar.gz: d56b8693c4eed2847bd416a434a41616f0fb9d02d63d208771a5529ae5c3ec7677f9a8416a74ab1528c91ead5acf908aa69755c534a5436f45396623c12cadef
|
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# ScrivitoGifControlWidget
|
2
|
+
|
3
|
+
Scrivito Widget for a gif with simple controll to start and stop
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'scrivito_gif_control_widget'
|
10
|
+
|
11
|
+
## Customization
|
12
|
+
|
13
|
+
Setting the image is only possible in your details view with the content browser. You will see all your filter. A filter_context is set in the details view. It is `image_gif`. Create a content browser filter for easier use:
|
14
|
+
|
15
|
+
```js
|
16
|
+
scrivito.content_browser.filters = function(filter) {
|
17
|
+
if (filter.image_gif) {
|
18
|
+
return {
|
19
|
+
_obj_class: {
|
20
|
+
field: '_obj_class',
|
21
|
+
options: {
|
22
|
+
Image: {
|
23
|
+
query: scrivito.obj_where('blob:content_type', 'equals', 'image/gif'),
|
24
|
+
icon: 'image',
|
25
|
+
title: 'Gifs'
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
... // standard filter goes here
|
33
|
+
}
|
34
|
+
};
|
35
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ScrivitoGifControlWidget'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
Bundler::GemHelper.install_tasks
|
18
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree ./scrivito_gif_control_widget
|
@@ -0,0 +1 @@
|
|
1
|
+
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define("Gifffer",[],factory);else if(typeof exports==="object")exports["Gifffer"]=factory();else root["Gifffer"]=factory()})(this,function(){var d=document;var playSize=60;var Gifffer=function(){var images,i=0;images=d.querySelectorAll("[data-gifffer]");for(;i<images.length;++i)process(images[i])};function formatUnit(v){return v+(v.toString().indexOf("%")>0?"":"px")}function createContainer(w,h,el){var con=d.createElement("DIV");var cls=el.getAttribute("class");var id=el.getAttribute("id");cls?con.setAttribute("class",el.getAttribute("class")):null;id?con.setAttribute("id",el.getAttribute("id")):null;con.setAttribute("style","position:relative;cursor:pointer;");var play=d.createElement("DIV");play.setAttribute("class","gifffer-play-button");play.setAttribute("style","width:"+playSize+"px;height:"+playSize+"px;border-radius:"+playSize/2+"px;background:rgba(255, 255, 255, 0.3);position:absolute;");var trngl=d.createElement("DIV");trngl.setAttribute("style","width:0;height: 0;border-top:14px solid transparent;border-bottom:14px solid transparent;border-left:14px solid rgba(0, 0, 0, 0.5);position:absolute;left:26px;top:16px;");play.appendChild(trngl);con.appendChild(play);el.parentNode.replaceChild(con,el);return{c:con,p:play}}function calculatePercentageDim(el,w,h,wOrig,hOrig){var parentDimW=el.parentNode.offsetWidth;var parentDimH=el.parentNode.offsetHeight;var ratio=wOrig/hOrig;if(w.toString().indexOf("%")>0){w=parseInt(w.toString().replace("%",""));w=w/100*parentDimW;h=w/ratio}return{w:w,h:h}}function process(el){var url,con,c,w,h,duration,play,gif,playing=false,cc,isC,durationTimeout,dims;url=el.getAttribute("data-gifffer");w=el.getAttribute("data-gifffer-width");h=el.getAttribute("data-gifffer-height");duration=el.getAttribute("data-gifffer-duration");el.style.display="block";c=document.createElement("canvas");isC=!!(c.getContext&&c.getContext("2d"));if(w&&h&&isC)cc=createContainer(w,h,el);el.onload=function(){if(!isC)return;w=w||el.width;h=h||el.height;if(!cc)cc=createContainer(w,h,el);con=cc.c;play=cc.p;dims=calculatePercentageDim(con,w,h,el.width,el.height);con.addEventListener("click",function(){clearTimeout(durationTimeout);if(!playing){playing=true;gif=document.createElement("IMG");gif.setAttribute("style","width:"+dims.w+"px;height:"+dims.h+"px;");gif.setAttribute("data-uri",Math.floor(Math.random()*1e5)+1);setTimeout(function(){gif.src=url},0);con.removeChild(play);con.removeChild(c);con.appendChild(gif);if(parseInt(duration)>0){durationTimeout=setTimeout(function(){playing=false;con.appendChild(play);con.removeChild(gif);con.appendChild(c);gif=null},duration)}}else{playing=false;con.appendChild(play);con.removeChild(gif);con.appendChild(c);gif=null}});c.width=dims.w;c.height=dims.h;c.getContext("2d").drawImage(el,0,0,dims.w,dims.h);con.appendChild(c);play.style.top=dims.h/2-playSize/2+"px";play.style.left=dims.w/2-playSize/2+"px";con.setAttribute("style","position:relative;cursor:pointer;width:"+dims.w+"px;height:"+dims.h+"px;")};el.src=url}return Gifffer});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scrivito_gif_control_widget
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scrivito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: scrivito_sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Scrivito Widget to add a gif with simple control to start and stop
|
42
|
+
email:
|
43
|
+
- support@scrivito.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/assets/javascripts/scrivito_gif_control_widget.js
|
52
|
+
- app/assets/javascripts/scrivito_gif_control_widget/gifffer.min.js
|
53
|
+
- app/assets/javascripts/scrivito_gif_control_widget/script.js
|
54
|
+
- app/assets/stylesheets/scrivito_gif_control_widget/application.css
|
55
|
+
- app/models/gif_control_widget.rb
|
56
|
+
- app/views/gif_control_widget/details.html.erb
|
57
|
+
- app/views/gif_control_widget/show.html.erb
|
58
|
+
- app/views/gif_control_widget/thumbnail.html.erb
|
59
|
+
- lib/scrivito_gif_control_widget.rb
|
60
|
+
- lib/scrivito_gif_control_widget/engine.rb
|
61
|
+
- lib/scrivito_gif_control_widget/version.rb
|
62
|
+
- lib/tasks/scrivito_gif_control_widget_tasks.rake
|
63
|
+
homepage: https://www.scrivito.com
|
64
|
+
licenses:
|
65
|
+
- LGPL-3.0
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.4.5
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Scrivito Widget for a gif with simple control to start and stop
|
87
|
+
test_files: []
|