[minor] removed unnecessary css, js files, commonified template for checkbox and comment section
|
|
@ -222,7 +222,9 @@
|
|||
|
||||
"public/js/frappe/list/blueimp-gallery.html",
|
||||
"public/js/frappe/list/image_view_item_row.html",
|
||||
"public/js/frappe/list/image_view_item_main_head.html"
|
||||
"public/js/frappe/list/image_view_item_main_head.html",
|
||||
"public/js/frappe/list/header_select_all_like_filter.html",
|
||||
"public/js/frappe/list/item_assigned_to_comment_count.html"
|
||||
],
|
||||
"css/report.min.css": [
|
||||
"public/css/report.css",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
{% if (_checkbox) { %}
|
||||
<input class="list-select-all" type="checkbox" style="margin-right: 7px; margin-top: 2px;"
|
||||
title="{%= __("Select All") %}">
|
||||
{% } %}
|
||||
|
||||
<i class="icon-fixed-width octicon octicon-heart text-extra-muted not-liked like-action list-liked-by-me"
|
||||
title="{%= __("Likes") %}"></i>
|
||||
|
|
@ -1,11 +1,5 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
{% if (_checkbox) { %}
|
||||
<input class="list-select-all" type="checkbox" style="margin-right: 7px; margin-top: 2px;"
|
||||
title="{%= __("Select All") %}">
|
||||
{% } %}
|
||||
|
||||
<i class="icon-fixed-width octicon octicon-heart text-extra-muted not-liked like-action list-liked-by-me"
|
||||
title="{%= __("Likes") %}"></i>
|
||||
{%= frappe.render_template("header_select_all_like_filter", { _checkbox: _checkbox }) %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -30,23 +30,8 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-4">{%= list.get_indicator(data) %}</div>
|
||||
<div class="col-xs-8 text-right">
|
||||
<div class="hidden-xs">
|
||||
<span class="list-row-modified text-muted">
|
||||
{%= comment_when(data.modified, true) %}
|
||||
</span>
|
||||
{% if (data._assign_list.length) { %}
|
||||
<span class="filterable"
|
||||
data-filter="_assign,like,%{%= data._assign_list[data._assign_list.length - 1] %}%">
|
||||
{%= frappe.avatar(data._assign_list[data._assign_list.length - 1]) %}</span>
|
||||
{% } else { %}
|
||||
<span class="avatar avatar-small avatar-empty"></span>
|
||||
{% } %}
|
||||
<span class="list-comment-count small
|
||||
{% if(!data._comment_count) { %} text-extra-muted {% } else { %} text-muted {% } %}">
|
||||
<i class="octicon octicon-comment-discussion"></i>
|
||||
{%= (data._comment_count > 99 ? "99+" : data._comment_count) || 0 %}
|
||||
</span>
|
||||
</div>
|
||||
<!-- comments count and assigned to section -->
|
||||
{%= frappe.render_template("item_assigned_to_comment_count", { data: data }) %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ frappe.views.ImageView = Class.extend({
|
|||
doctype: "File",
|
||||
fields: [
|
||||
"file_name as title", "file_url as href",
|
||||
"'image/*' as type", "ifnull(thumbnail_url, '') as thumbnail"
|
||||
"'image/*' as type", "ifnull(thumbnail_url, file_url) as thumbnail"
|
||||
],
|
||||
filters: [
|
||||
["File", "attached_to_doctype", "=", this.doctype],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<div class="hidden-xs">
|
||||
<span class="list-row-modified text-muted">
|
||||
{%= comment_when(data.modified, true) %}
|
||||
</span>
|
||||
{% if (data._assign_list.length) { %}
|
||||
<span class="filterable"
|
||||
data-filter="_assign,like,%{%= data._assign_list[data._assign_list.length - 1] %}%">
|
||||
{%= frappe.avatar(data._assign_list[data._assign_list.length - 1]) %}</span>
|
||||
{% } else { %}
|
||||
<span class="avatar avatar-small avatar-empty"></span>
|
||||
{% } %}
|
||||
<span class="list-comment-count small
|
||||
{% if(!data._comment_count) { %} text-extra-muted {% } else { %} text-muted {% } %}">
|
||||
<i class="octicon octicon-comment-discussion"></i>
|
||||
{%= (data._comment_count > 99 ? "99+" : data._comment_count) || 0 %}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -17,15 +17,7 @@
|
|||
{% if(col.df && ["Int", "Float", "Currency", "Percent"].indexOf(col.df.fieldtype)!==-1) { %}text-right{% } %}">
|
||||
|
||||
{% if (col.type==="Subject") { %}
|
||||
|
||||
{% if (_checkbox) { %}
|
||||
<input class="list-select-all" type="checkbox" style="margin-right: 7px; margin-top: 2px;"
|
||||
title="{%= __("Select All") %}">
|
||||
{% } %}
|
||||
|
||||
<i class="icon-fixed-width octicon octicon-heart text-extra-muted not-liked like-action list-liked-by-me"
|
||||
title="{%= __("Likes") %}"></i>
|
||||
|
||||
{%= frappe.render_template("header_select_all_like_filter", { _checkbox: _checkbox }) %}
|
||||
{% } %}
|
||||
|
||||
<span class="list-value">{%= __(col.title) || __(col.label) || "" %}</span>
|
||||
|
|
|
|||
|
|
@ -25,22 +25,7 @@
|
|||
<div class="list-col col-sm-2 col-xs-2
|
||||
text-right list-row-right" style="padding-left:0px">
|
||||
<div class="visible-xs list-row-indicator">{%= list.get_indicator_dot(data) %}</div>
|
||||
<div class="hidden-xs">
|
||||
<span class="list-row-modified text-muted">
|
||||
{%= comment_when(data.modified, true) %}
|
||||
</span>
|
||||
{% if (data._assign_list.length) { %}
|
||||
<span class="filterable"
|
||||
data-filter="_assign,like,%{%= data._assign_list[data._assign_list.length - 1] %}%">
|
||||
{%= frappe.avatar(data._assign_list[data._assign_list.length - 1]) %}</span>
|
||||
{% } else { %}
|
||||
<span class="avatar avatar-small avatar-empty"></span>
|
||||
{% } %}
|
||||
<span class="list-comment-count small
|
||||
{% if(!data._comment_count) { %} text-extra-muted {% } else { %} text-muted {% } %}">
|
||||
<i class="octicon octicon-comment-discussion"></i>
|
||||
{%= (data._comment_count > 99 ? "99+" : data._comment_count) || 0 %}
|
||||
</span>
|
||||
</div>
|
||||
<!-- comments count and assigned to section -->
|
||||
{%= frappe.render_template("item_assigned_to_comment_count", { data: data }) %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
@charset "UTF-8";
|
||||
/*
|
||||
* blueimp Gallery Video Factory CSS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.blueimp-gallery > .slides > .slide > .video-content > img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
width: auto;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
/* Prevent artifacts in Mozilla Firefox: */
|
||||
-moz-backface-visibility: hidden;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-content > video {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-content > iframe {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-playing > iframe {
|
||||
top: 0;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-content > a {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
left: 0;
|
||||
margin: -64px auto 0;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
background: url(../img/video-play.png) center no-repeat;
|
||||
opacity: 0.8;
|
||||
cursor: pointer;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-content > a:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-playing > a,
|
||||
.blueimp-gallery > .slides > .slide > .video-playing > img {
|
||||
display: none;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-content > video {
|
||||
display: none;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-playing > video {
|
||||
display: block;
|
||||
}
|
||||
.blueimp-gallery > .slides > .slide > .video-loading > a {
|
||||
background: url(../img/loading.gif) center no-repeat;
|
||||
background-size: 64px 64px;
|
||||
}
|
||||
|
||||
/* Replace PNGs with SVGs for capable browsers (excluding IE<9) */
|
||||
body:last-child .blueimp-gallery > .slides > .slide > .video-content:not(.video-loading) > a {
|
||||
background-image: url(../img/video-play.svg);
|
||||
}
|
||||
|
||||
/* IE7 fixes */
|
||||
*+html .blueimp-gallery > .slides > .slide > .video-content {
|
||||
height: 100%;
|
||||
}
|
||||
*+html .blueimp-gallery > .slides > .slide > .video-content > a {
|
||||
left: 50%;
|
||||
margin-left: -64px;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
@import (inline) 'blueimp-gallery.css';
|
||||
@import (inline) 'blueimp-gallery-indicator.css';
|
||||
@import (inline) 'blueimp-gallery-video.css';
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"sources":["blueimp-gallery.css","blueimp-gallery-indicator.css","blueimp-gallery-video.css"],"names":[],"mappings":"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"}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery Demo CSS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body {
|
||||
max-width: 750px;
|
||||
margin: 0 auto;
|
||||
padding: 1em;
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 1.4em;
|
||||
background: #222;
|
||||
color: #fff;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
a {
|
||||
color: orange;
|
||||
text-decoration: none;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
h1 {
|
||||
line-height: 1em;
|
||||
}
|
||||
h2,
|
||||
.links {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 481px) {
|
||||
.navigation {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.navigation li {
|
||||
display: inline-block;
|
||||
}
|
||||
.navigation li:not(:first-child):before {
|
||||
content: '| ';
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="64" height="64">
|
||||
<circle cx="32" cy="32" r="25" stroke="red" stroke-width="7" fill="black" fill-opacity="0.2"/>
|
||||
<rect x="28" y="7" width="8" height="50" fill="red" transform="rotate(45, 32, 32)"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 306 B |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 606 B |
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="30" height="15">
|
||||
<polygon points="2,1 2,14 13,7" stroke="black" stroke-width="1" fill="white"/>
|
||||
<rect x="17" y="2" width="4" height="11" stroke="black" stroke-width="1" fill="white"/>
|
||||
<rect x="24" y="2" width="4" height="11" stroke="black" stroke-width="1" fill="white"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 2.7 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="64" height="64">
|
||||
<circle cx="32" cy="32" r="25" stroke="white" stroke-width="7" fill="black" fill-opacity="0.2"/>
|
||||
<polygon points="26,22 26,42 43,32" fill="white"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 274 B |
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery Fullscreen JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document */
|
||||
|
||||
;(function (factory) {
|
||||
'use strict'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'./blueimp-helper',
|
||||
'./blueimp-gallery'
|
||||
], factory)
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.blueimp.helper || window.jQuery,
|
||||
window.blueimp.Gallery
|
||||
)
|
||||
}
|
||||
}(function ($, Gallery) {
|
||||
'use strict'
|
||||
|
||||
$.extend(Gallery.prototype.options, {
|
||||
// Defines if the gallery should open in fullscreen mode:
|
||||
fullScreen: false
|
||||
})
|
||||
|
||||
var initialize = Gallery.prototype.initialize
|
||||
var close = Gallery.prototype.close
|
||||
|
||||
$.extend(Gallery.prototype, {
|
||||
getFullScreenElement: function () {
|
||||
return document.fullscreenElement ||
|
||||
document.webkitFullscreenElement ||
|
||||
document.mozFullScreenElement ||
|
||||
document.msFullscreenElement
|
||||
},
|
||||
|
||||
requestFullScreen: function (element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen()
|
||||
} else if (element.webkitRequestFullscreen) {
|
||||
element.webkitRequestFullscreen()
|
||||
} else if (element.mozRequestFullScreen) {
|
||||
element.mozRequestFullScreen()
|
||||
} else if (element.msRequestFullscreen) {
|
||||
element.msRequestFullscreen()
|
||||
}
|
||||
},
|
||||
|
||||
exitFullScreen: function () {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen()
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen()
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen()
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen()
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
initialize.call(this)
|
||||
if (this.options.fullScreen && !this.getFullScreenElement()) {
|
||||
this.requestFullScreen(this.container[0])
|
||||
}
|
||||
},
|
||||
|
||||
close: function () {
|
||||
if (this.getFullScreenElement() === this.container[0]) {
|
||||
this.exitFullScreen()
|
||||
}
|
||||
close.call(this)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return Gallery
|
||||
}))
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery Video Factory JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document */
|
||||
|
||||
;(function (factory) {
|
||||
'use strict'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'./blueimp-helper',
|
||||
'./blueimp-gallery'
|
||||
], factory)
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.blueimp.helper || window.jQuery,
|
||||
window.blueimp.Gallery
|
||||
)
|
||||
}
|
||||
}(function ($, Gallery) {
|
||||
'use strict'
|
||||
|
||||
$.extend(Gallery.prototype.options, {
|
||||
// The class for video content elements:
|
||||
videoContentClass: 'video-content',
|
||||
// The class for video when it is loading:
|
||||
videoLoadingClass: 'video-loading',
|
||||
// The class for video when it is playing:
|
||||
videoPlayingClass: 'video-playing',
|
||||
// The list object property (or data attribute) for the video poster URL:
|
||||
videoPosterProperty: 'poster',
|
||||
// The list object property (or data attribute) for the video sources array:
|
||||
videoSourcesProperty: 'sources'
|
||||
})
|
||||
|
||||
var handleSlide = Gallery.prototype.handleSlide
|
||||
|
||||
$.extend(Gallery.prototype, {
|
||||
handleSlide: function (index) {
|
||||
handleSlide.call(this, index)
|
||||
if (this.playingVideo) {
|
||||
this.playingVideo.pause()
|
||||
}
|
||||
},
|
||||
|
||||
videoFactory: function (obj, callback, videoInterface) {
|
||||
var that = this
|
||||
var options = this.options
|
||||
var videoContainerNode = this.elementPrototype.cloneNode(false)
|
||||
var videoContainer = $(videoContainerNode)
|
||||
var errorArgs = [{
|
||||
type: 'error',
|
||||
target: videoContainerNode
|
||||
}]
|
||||
var video = videoInterface || document.createElement('video')
|
||||
var url = this.getItemProperty(obj, options.urlProperty)
|
||||
var type = this.getItemProperty(obj, options.typeProperty)
|
||||
var title = this.getItemProperty(obj, options.titleProperty)
|
||||
var posterUrl = this.getItemProperty(obj, options.videoPosterProperty)
|
||||
var posterImage
|
||||
var sources = this.getItemProperty(
|
||||
obj,
|
||||
options.videoSourcesProperty
|
||||
)
|
||||
var source
|
||||
var playMediaControl
|
||||
var isLoading
|
||||
var hasControls
|
||||
videoContainer.addClass(options.videoContentClass)
|
||||
if (title) {
|
||||
videoContainerNode.title = title
|
||||
}
|
||||
if (video.canPlayType) {
|
||||
if (url && type && video.canPlayType(type)) {
|
||||
video.src = url
|
||||
} else {
|
||||
while (sources && sources.length) {
|
||||
source = sources.shift()
|
||||
url = this.getItemProperty(source, options.urlProperty)
|
||||
type = this.getItemProperty(source, options.typeProperty)
|
||||
if (url && type && video.canPlayType(type)) {
|
||||
video.src = url
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (posterUrl) {
|
||||
video.poster = posterUrl
|
||||
posterImage = this.imagePrototype.cloneNode(false)
|
||||
$(posterImage).addClass(options.toggleClass)
|
||||
posterImage.src = posterUrl
|
||||
posterImage.draggable = false
|
||||
videoContainerNode.appendChild(posterImage)
|
||||
}
|
||||
playMediaControl = document.createElement('a')
|
||||
playMediaControl.setAttribute('target', '_blank')
|
||||
if (!videoInterface) {
|
||||
playMediaControl.setAttribute('download', title)
|
||||
}
|
||||
playMediaControl.href = url
|
||||
if (video.src) {
|
||||
video.controls = true
|
||||
;(videoInterface || $(video))
|
||||
.on('error', function () {
|
||||
that.setTimeout(callback, errorArgs)
|
||||
})
|
||||
.on('pause', function () {
|
||||
isLoading = false
|
||||
videoContainer
|
||||
.removeClass(that.options.videoLoadingClass)
|
||||
.removeClass(that.options.videoPlayingClass)
|
||||
if (hasControls) {
|
||||
that.container.addClass(that.options.controlsClass)
|
||||
}
|
||||
delete that.playingVideo
|
||||
if (that.interval) {
|
||||
that.play()
|
||||
}
|
||||
})
|
||||
.on('playing', function () {
|
||||
isLoading = false
|
||||
videoContainer
|
||||
.removeClass(that.options.videoLoadingClass)
|
||||
.addClass(that.options.videoPlayingClass)
|
||||
if (that.container.hasClass(that.options.controlsClass)) {
|
||||
hasControls = true
|
||||
that.container.removeClass(that.options.controlsClass)
|
||||
} else {
|
||||
hasControls = false
|
||||
}
|
||||
})
|
||||
.on('play', function () {
|
||||
window.clearTimeout(that.timeout)
|
||||
isLoading = true
|
||||
videoContainer.addClass(that.options.videoLoadingClass)
|
||||
that.playingVideo = video
|
||||
})
|
||||
$(playMediaControl).on('click', function (event) {
|
||||
that.preventDefault(event)
|
||||
if (isLoading) {
|
||||
video.pause()
|
||||
} else {
|
||||
video.play()
|
||||
}
|
||||
})
|
||||
videoContainerNode.appendChild(
|
||||
(videoInterface && videoInterface.element) || video
|
||||
)
|
||||
}
|
||||
videoContainerNode.appendChild(playMediaControl)
|
||||
this.setTimeout(callback, [{
|
||||
type: 'load',
|
||||
target: videoContainerNode
|
||||
}])
|
||||
return videoContainerNode
|
||||
}
|
||||
})
|
||||
|
||||
return Gallery
|
||||
}))
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery Vimeo Video Factory JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document, $f */
|
||||
|
||||
;(function (factory) {
|
||||
'use strict'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'./blueimp-helper',
|
||||
'./blueimp-gallery-video'
|
||||
], factory)
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.blueimp.helper || window.jQuery,
|
||||
window.blueimp.Gallery
|
||||
)
|
||||
}
|
||||
}(function ($, Gallery) {
|
||||
'use strict'
|
||||
|
||||
if (!window.postMessage) {
|
||||
return Gallery
|
||||
}
|
||||
|
||||
$.extend(Gallery.prototype.options, {
|
||||
// The list object property (or data attribute) with the Vimeo video id:
|
||||
vimeoVideoIdProperty: 'vimeo',
|
||||
// The URL for the Vimeo video player, can be extended with custom parameters:
|
||||
// https://developer.vimeo.com/player/embedding
|
||||
vimeoPlayerUrl: '//player.vimeo.com/video/VIDEO_ID?api=1&player_id=PLAYER_ID',
|
||||
// The prefix for the Vimeo video player ID:
|
||||
vimeoPlayerIdPrefix: 'vimeo-player-',
|
||||
// Require a click on the native Vimeo player for the initial playback:
|
||||
vimeoClickToPlay: true
|
||||
})
|
||||
|
||||
var textFactory = Gallery.prototype.textFactory ||
|
||||
Gallery.prototype.imageFactory
|
||||
var VimeoPlayer = function (url, videoId, playerId, clickToPlay) {
|
||||
this.url = url
|
||||
this.videoId = videoId
|
||||
this.playerId = playerId
|
||||
this.clickToPlay = clickToPlay
|
||||
this.element = document.createElement('div')
|
||||
this.listeners = {}
|
||||
}
|
||||
var counter = 0
|
||||
|
||||
$.extend(VimeoPlayer.prototype, {
|
||||
canPlayType: function () {
|
||||
return true
|
||||
},
|
||||
|
||||
on: function (type, func) {
|
||||
this.listeners[type] = func
|
||||
return this
|
||||
},
|
||||
|
||||
loadAPI: function () {
|
||||
var that = this
|
||||
var apiUrl = '//f.vimeocdn.com/js/froogaloop2.min.js'
|
||||
var scriptTags = document.getElementsByTagName('script')
|
||||
var i = scriptTags.length
|
||||
var scriptTag
|
||||
var called
|
||||
function callback () {
|
||||
if (!called && that.playOnReady) {
|
||||
that.play()
|
||||
}
|
||||
called = true
|
||||
}
|
||||
while (i) {
|
||||
i -= 1
|
||||
if (scriptTags[i].src === apiUrl) {
|
||||
scriptTag = scriptTags[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!scriptTag) {
|
||||
scriptTag = document.createElement('script')
|
||||
scriptTag.src = apiUrl
|
||||
}
|
||||
$(scriptTag).on('load', callback)
|
||||
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0])
|
||||
// Fix for cached scripts on IE 8:
|
||||
if (/loaded|complete/.test(scriptTag.readyState)) {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
|
||||
onReady: function () {
|
||||
var that = this
|
||||
this.ready = true
|
||||
this.player.addEvent('play', function () {
|
||||
that.hasPlayed = true
|
||||
that.onPlaying()
|
||||
})
|
||||
this.player.addEvent('pause', function () {
|
||||
that.onPause()
|
||||
})
|
||||
this.player.addEvent('finish', function () {
|
||||
that.onPause()
|
||||
})
|
||||
if (this.playOnReady) {
|
||||
this.play()
|
||||
}
|
||||
},
|
||||
|
||||
onPlaying: function () {
|
||||
if (this.playStatus < 2) {
|
||||
this.listeners.playing()
|
||||
this.playStatus = 2
|
||||
}
|
||||
},
|
||||
|
||||
onPause: function () {
|
||||
this.listeners.pause()
|
||||
delete this.playStatus
|
||||
},
|
||||
|
||||
insertIframe: function () {
|
||||
var iframe = document.createElement('iframe')
|
||||
iframe.src = this.url
|
||||
.replace('VIDEO_ID', this.videoId)
|
||||
.replace('PLAYER_ID', this.playerId)
|
||||
iframe.id = this.playerId
|
||||
this.element.parentNode.replaceChild(iframe, this.element)
|
||||
this.element = iframe
|
||||
},
|
||||
|
||||
play: function () {
|
||||
var that = this
|
||||
if (!this.playStatus) {
|
||||
this.listeners.play()
|
||||
this.playStatus = 1
|
||||
}
|
||||
if (this.ready) {
|
||||
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
|
||||
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
||||
// Manually trigger the playing callback if clickToPlay
|
||||
// is enabled and to workaround a limitation in iOS,
|
||||
// which requires synchronous user interaction to start
|
||||
// the video playback:
|
||||
this.onPlaying()
|
||||
} else {
|
||||
this.player.api('play')
|
||||
}
|
||||
} else {
|
||||
this.playOnReady = true
|
||||
if (!window.$f) {
|
||||
this.loadAPI()
|
||||
} else if (!this.player) {
|
||||
this.insertIframe()
|
||||
this.player = $f(this.element)
|
||||
this.player.addEvent('ready', function () {
|
||||
that.onReady()
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
pause: function () {
|
||||
if (this.ready) {
|
||||
this.player.api('pause')
|
||||
} else if (this.playStatus) {
|
||||
delete this.playOnReady
|
||||
this.listeners.pause()
|
||||
delete this.playStatus
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$.extend(Gallery.prototype, {
|
||||
VimeoPlayer: VimeoPlayer,
|
||||
|
||||
textFactory: function (obj, callback) {
|
||||
var options = this.options
|
||||
var videoId = this.getItemProperty(obj, options.vimeoVideoIdProperty)
|
||||
if (videoId) {
|
||||
if (this.getItemProperty(obj, options.urlProperty) === undefined) {
|
||||
obj[options.urlProperty] = '//vimeo.com/' + videoId
|
||||
}
|
||||
counter += 1
|
||||
return this.videoFactory(
|
||||
obj,
|
||||
callback,
|
||||
new VimeoPlayer(
|
||||
options.vimeoPlayerUrl,
|
||||
videoId,
|
||||
options.vimeoPlayerIdPrefix + counter,
|
||||
options.vimeoClickToPlay
|
||||
)
|
||||
)
|
||||
}
|
||||
return textFactory.call(this, obj, callback)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return Gallery
|
||||
}))
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery YouTube Video Factory JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document, YT */
|
||||
|
||||
;(function (factory) {
|
||||
'use strict'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'./blueimp-helper',
|
||||
'./blueimp-gallery-video'
|
||||
], factory)
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.blueimp.helper || window.jQuery,
|
||||
window.blueimp.Gallery
|
||||
)
|
||||
}
|
||||
}(function ($, Gallery) {
|
||||
'use strict'
|
||||
|
||||
if (!window.postMessage) {
|
||||
return Gallery
|
||||
}
|
||||
|
||||
$.extend(Gallery.prototype.options, {
|
||||
// The list object property (or data attribute) with the YouTube video id:
|
||||
youTubeVideoIdProperty: 'youtube',
|
||||
// Optional object with parameters passed to the YouTube video player:
|
||||
// https://developers.google.com/youtube/player_parameters
|
||||
youTubePlayerVars: {
|
||||
wmode: 'transparent'
|
||||
},
|
||||
// Require a click on the native YouTube player for the initial playback:
|
||||
youTubeClickToPlay: true
|
||||
})
|
||||
|
||||
var textFactory = Gallery.prototype.textFactory ||
|
||||
Gallery.prototype.imageFactory
|
||||
var YouTubePlayer = function (videoId, playerVars, clickToPlay) {
|
||||
this.videoId = videoId
|
||||
this.playerVars = playerVars
|
||||
this.clickToPlay = clickToPlay
|
||||
this.element = document.createElement('div')
|
||||
this.listeners = {}
|
||||
}
|
||||
|
||||
$.extend(YouTubePlayer.prototype, {
|
||||
canPlayType: function () {
|
||||
return true
|
||||
},
|
||||
|
||||
on: function (type, func) {
|
||||
this.listeners[type] = func
|
||||
return this
|
||||
},
|
||||
|
||||
loadAPI: function () {
|
||||
var that = this
|
||||
var onYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady
|
||||
var apiUrl = '//www.youtube.com/iframe_api'
|
||||
var scriptTags = document.getElementsByTagName('script')
|
||||
var i = scriptTags.length
|
||||
var scriptTag
|
||||
window.onYouTubeIframeAPIReady = function () {
|
||||
if (onYouTubeIframeAPIReady) {
|
||||
onYouTubeIframeAPIReady.apply(this)
|
||||
}
|
||||
if (that.playOnReady) {
|
||||
that.play()
|
||||
}
|
||||
}
|
||||
while (i) {
|
||||
i -= 1
|
||||
if (scriptTags[i].src === apiUrl) {
|
||||
return
|
||||
}
|
||||
}
|
||||
scriptTag = document.createElement('script')
|
||||
scriptTag.src = apiUrl
|
||||
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0])
|
||||
},
|
||||
|
||||
onReady: function () {
|
||||
this.ready = true
|
||||
if (this.playOnReady) {
|
||||
this.play()
|
||||
}
|
||||
},
|
||||
|
||||
onPlaying: function () {
|
||||
if (this.playStatus < 2) {
|
||||
this.listeners.playing()
|
||||
this.playStatus = 2
|
||||
}
|
||||
},
|
||||
|
||||
onPause: function () {
|
||||
Gallery.prototype.setTimeout.call(
|
||||
this,
|
||||
this.checkSeek,
|
||||
null,
|
||||
2000
|
||||
)
|
||||
},
|
||||
|
||||
checkSeek: function () {
|
||||
if (this.stateChange === YT.PlayerState.PAUSED ||
|
||||
this.stateChange === YT.PlayerState.ENDED) {
|
||||
// check if current state change is actually paused
|
||||
this.listeners.pause()
|
||||
delete this.playStatus
|
||||
}
|
||||
},
|
||||
|
||||
onStateChange: function (event) {
|
||||
switch (event.data) {
|
||||
case YT.PlayerState.PLAYING:
|
||||
this.hasPlayed = true
|
||||
this.onPlaying()
|
||||
break
|
||||
case YT.PlayerState.PAUSED:
|
||||
case YT.PlayerState.ENDED:
|
||||
this.onPause()
|
||||
break
|
||||
}
|
||||
// Save most recent state change to this.stateChange
|
||||
this.stateChange = event.data
|
||||
},
|
||||
|
||||
onError: function (event) {
|
||||
this.listeners.error(event)
|
||||
},
|
||||
|
||||
play: function () {
|
||||
var that = this
|
||||
if (!this.playStatus) {
|
||||
this.listeners.play()
|
||||
this.playStatus = 1
|
||||
}
|
||||
if (this.ready) {
|
||||
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
|
||||
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
||||
// Manually trigger the playing callback if clickToPlay
|
||||
// is enabled and to workaround a limitation in iOS,
|
||||
// which requires synchronous user interaction to start
|
||||
// the video playback:
|
||||
this.onPlaying()
|
||||
} else {
|
||||
this.player.playVideo()
|
||||
}
|
||||
} else {
|
||||
this.playOnReady = true
|
||||
if (!(window.YT && YT.Player)) {
|
||||
this.loadAPI()
|
||||
} else if (!this.player) {
|
||||
this.player = new YT.Player(this.element, {
|
||||
videoId: this.videoId,
|
||||
playerVars: this.playerVars,
|
||||
events: {
|
||||
onReady: function () {
|
||||
that.onReady()
|
||||
},
|
||||
onStateChange: function (event) {
|
||||
that.onStateChange(event)
|
||||
},
|
||||
onError: function (event) {
|
||||
that.onError(event)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
pause: function () {
|
||||
if (this.ready) {
|
||||
this.player.pauseVideo()
|
||||
} else if (this.playStatus) {
|
||||
delete this.playOnReady
|
||||
this.listeners.pause()
|
||||
delete this.playStatus
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$.extend(Gallery.prototype, {
|
||||
YouTubePlayer: YouTubePlayer,
|
||||
|
||||
textFactory: function (obj, callback) {
|
||||
var options = this.options
|
||||
var videoId = this.getItemProperty(obj, options.youTubeVideoIdProperty)
|
||||
if (videoId) {
|
||||
if (this.getItemProperty(obj, options.urlProperty) === undefined) {
|
||||
obj[options.urlProperty] = '//www.youtube.com/watch?v=' + videoId
|
||||
}
|
||||
if (this.getItemProperty(obj, options.videoPosterProperty) === undefined) {
|
||||
obj[options.videoPosterProperty] = '//img.youtube.com/vi/' + videoId +
|
||||
'/maxresdefault.jpg'
|
||||
}
|
||||
return this.videoFactory(
|
||||
obj,
|
||||
callback,
|
||||
new YouTubePlayer(
|
||||
videoId,
|
||||
options.youTubePlayerVars,
|
||||
options.youTubeClickToPlay
|
||||
)
|
||||
)
|
||||
}
|
||||
return textFactory.call(this, obj, callback)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return Gallery
|
||||
}))
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
/*
|
||||
* blueimp helper JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document */
|
||||
|
||||
;(function () {
|
||||
'use strict'
|
||||
|
||||
function extend (obj1, obj2) {
|
||||
var prop
|
||||
for (prop in obj2) {
|
||||
if (obj2.hasOwnProperty(prop)) {
|
||||
obj1[prop] = obj2[prop]
|
||||
}
|
||||
}
|
||||
return obj1
|
||||
}
|
||||
|
||||
function Helper (query) {
|
||||
if (!this || this.find !== Helper.prototype.find) {
|
||||
// Called as function instead of as constructor,
|
||||
// so we simply return a new instance:
|
||||
return new Helper(query)
|
||||
}
|
||||
this.length = 0
|
||||
if (query) {
|
||||
if (typeof query === 'string') {
|
||||
query = this.find(query)
|
||||
}
|
||||
if (query.nodeType || query === query.window) {
|
||||
// Single HTML element
|
||||
this.length = 1
|
||||
this[0] = query
|
||||
} else {
|
||||
// HTML element collection
|
||||
var i = query.length
|
||||
this.length = i
|
||||
while (i) {
|
||||
i -= 1
|
||||
this[i] = query[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.extend = extend
|
||||
|
||||
Helper.contains = function (container, element) {
|
||||
do {
|
||||
element = element.parentNode
|
||||
if (element === container) {
|
||||
return true
|
||||
}
|
||||
} while (element)
|
||||
return false
|
||||
}
|
||||
|
||||
Helper.parseJSON = function (string) {
|
||||
return window.JSON && JSON.parse(string)
|
||||
}
|
||||
|
||||
extend(Helper.prototype, {
|
||||
find: function (query) {
|
||||
var container = this[0] || document
|
||||
if (typeof query === 'string') {
|
||||
if (container.querySelectorAll) {
|
||||
query = container.querySelectorAll(query)
|
||||
} else if (query.charAt(0) === '#') {
|
||||
query = container.getElementById(query.slice(1))
|
||||
} else {
|
||||
query = container.getElementsByTagName(query)
|
||||
}
|
||||
}
|
||||
return new Helper(query)
|
||||
},
|
||||
|
||||
hasClass: function (className) {
|
||||
if (!this[0]) {
|
||||
return false
|
||||
}
|
||||
return new RegExp('(^|\\s+)' + className +
|
||||
'(\\s+|$)').test(this[0].className)
|
||||
},
|
||||
|
||||
addClass: function (className) {
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (!element.className) {
|
||||
element.className = className
|
||||
return this
|
||||
}
|
||||
if (this.hasClass(className)) {
|
||||
return this
|
||||
}
|
||||
element.className += ' ' + className
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
removeClass: function (className) {
|
||||
var regexp = new RegExp('(^|\\s+)' + className + '(\\s+|$)')
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
element.className = element.className.replace(regexp, ' ')
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
on: function (eventName, handler) {
|
||||
var eventNames = eventName.split(/\s+/)
|
||||
var i
|
||||
var element
|
||||
while (eventNames.length) {
|
||||
eventName = eventNames.shift()
|
||||
i = this.length
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(eventName, handler, false)
|
||||
} else if (element.attachEvent) {
|
||||
element.attachEvent('on' + eventName, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
off: function (eventName, handler) {
|
||||
var eventNames = eventName.split(/\s+/)
|
||||
var i
|
||||
var element
|
||||
while (eventNames.length) {
|
||||
eventName = eventNames.shift()
|
||||
i = this.length
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(eventName, handler, false)
|
||||
} else if (element.detachEvent) {
|
||||
element.detachEvent('on' + eventName, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
empty: function () {
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
while (element.hasChildNodes()) {
|
||||
element.removeChild(element.lastChild)
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
first: function () {
|
||||
return new Helper(this[0])
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return Helper
|
||||
})
|
||||
} else {
|
||||
window.blueimp = window.blueimp || {}
|
||||
window.blueimp.helper = Helper
|
||||
}
|
||||
}())
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery Demo JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global blueimp, $ */
|
||||
|
||||
$(function () {
|
||||
'use strict'
|
||||
|
||||
// Load demo images from flickr:
|
||||
$.ajax({
|
||||
// Flickr API is SSL only:
|
||||
// https://code.flickr.net/2014/04/30/flickr-api-going-ssl-only-on-june-27th-2014/
|
||||
url: 'https://api.flickr.com/services/rest/',
|
||||
data: {
|
||||
format: 'json',
|
||||
method: 'flickr.interestingness.getList',
|
||||
api_key: '7617adae70159d09ba78cfec73c13be3' // jshint ignore:line
|
||||
},
|
||||
dataType: 'jsonp',
|
||||
jsonp: 'jsoncallback'
|
||||
}).done(function (result) {
|
||||
var carouselLinks = []
|
||||
var linksContainer = $('#links')
|
||||
var baseUrl
|
||||
// Add the demo images as links with thumbnails to the page:
|
||||
$.each(result.photos.photo, function (index, photo) {
|
||||
baseUrl = 'https://farm' + photo.farm + '.static.flickr.com/' +
|
||||
photo.server + '/' + photo.id + '_' + photo.secret
|
||||
$('<a/>')
|
||||
.append($('<img>').prop('src', baseUrl + '_s.jpg'))
|
||||
.prop('href', baseUrl + '_b.jpg')
|
||||
.prop('title', photo.title)
|
||||
.attr('data-gallery', '')
|
||||
.appendTo(linksContainer)
|
||||
carouselLinks.push({
|
||||
href: baseUrl + '_c.jpg',
|
||||
title: photo.title
|
||||
})
|
||||
})
|
||||
// Initialize the Gallery as image carousel:
|
||||
blueimp.Gallery(carouselLinks, {
|
||||
container: '#blueimp-image-carousel',
|
||||
carousel: true
|
||||
})
|
||||
})
|
||||
|
||||
// Initialize the Gallery as video carousel:
|
||||
blueimp.Gallery([
|
||||
{
|
||||
title: 'Sintel',
|
||||
href: 'https://archive.org/download/Sintel/sintel-2048-surround_512kb.mp4',
|
||||
type: 'video/mp4',
|
||||
poster: 'https://i.imgur.com/MUSw4Zu.jpg'
|
||||
},
|
||||
{
|
||||
title: 'Big Buck Bunny',
|
||||
href: 'https://upload.wikimedia.org/wikipedia/commons/7/75/' +
|
||||
'Big_Buck_Bunny_Trailer_400p.ogg',
|
||||
type: 'video/ogg',
|
||||
poster: 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/' +
|
||||
'Big.Buck.Bunny.-.Opening.Screen.png/' +
|
||||
'800px-Big.Buck.Bunny.-.Opening.Screen.png'
|
||||
},
|
||||
{
|
||||
title: 'Elephants Dream',
|
||||
href: 'https://upload.wikimedia.org/wikipedia/commons/transcoded/8/83/' +
|
||||
'Elephants_Dream_%28high_quality%29.ogv/' +
|
||||
'Elephants_Dream_%28high_quality%29.ogv.360p.webm',
|
||||
type: 'video/webm',
|
||||
poster: 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/' +
|
||||
'Elephants_Dream_s1_proog.jpg/800px-Elephants_Dream_s1_proog.jpg'
|
||||
},
|
||||
{
|
||||
title: 'LES TWINS - An Industry Ahead',
|
||||
type: 'text/html',
|
||||
youtube: 'zi4CIXpx7Bg'
|
||||
},
|
||||
{
|
||||
title: 'KN1GHT - Last Moon',
|
||||
type: 'text/html',
|
||||
vimeo: '73686146',
|
||||
poster: 'https://secure-a.vimeocdn.com/ts/448/835/448835699_960.jpg'
|
||||
}
|
||||
], {
|
||||
container: '#blueimp-video-carousel',
|
||||
carousel: true
|
||||
})
|
||||
})
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* blueimp Gallery jQuery plugin
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document */
|
||||
|
||||
;(function (factory) {
|
||||
'use strict'
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([
|
||||
'jquery',
|
||||
'./blueimp-gallery'
|
||||
], factory)
|
||||
} else {
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.blueimp.Gallery
|
||||
)
|
||||
}
|
||||
}(function ($, Gallery) {
|
||||
'use strict'
|
||||
|
||||
// Global click handler to open links with data-gallery attribute
|
||||
// in the Gallery lightbox:
|
||||
$(document).on('click', '[data-gallery]', function (event) {
|
||||
// Get the container id from the data-gallery attribute:
|
||||
var id = $(this).data('gallery')
|
||||
var widget = $(id)
|
||||
var container = (widget.length && widget) ||
|
||||
$(Gallery.prototype.options.container)
|
||||
var callbacks = {
|
||||
onopen: function () {
|
||||
container
|
||||
.data('gallery', this)
|
||||
.trigger('open')
|
||||
},
|
||||
onopened: function () {
|
||||
container.trigger('opened')
|
||||
},
|
||||
onslide: function () {
|
||||
container.trigger('slide', arguments)
|
||||
},
|
||||
onslideend: function () {
|
||||
container.trigger('slideend', arguments)
|
||||
},
|
||||
onslidecomplete: function () {
|
||||
container.trigger('slidecomplete', arguments)
|
||||
},
|
||||
onclose: function () {
|
||||
container.trigger('close')
|
||||
},
|
||||
onclosed: function () {
|
||||
container
|
||||
.trigger('closed')
|
||||
.removeData('gallery')
|
||||
}
|
||||
}
|
||||
var options = $.extend(
|
||||
// Retrieve custom options from data-attributes
|
||||
// on the Gallery widget:
|
||||
container.data(),
|
||||
{
|
||||
container: container[0],
|
||||
index: this,
|
||||
event: event
|
||||
},
|
||||
callbacks
|
||||
)
|
||||
// Select all links with the same data-gallery attribute:
|
||||
var links = $('[data-gallery="' + id + '"]')
|
||||
if (options.filter) {
|
||||
links = links.filter(options.filter)
|
||||
}
|
||||
return new Gallery(links, options)
|
||||
})
|
||||
}))
|
||||