fotoramajs 4.3.0.1 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/Rakefile +69 -2
- data/lib/fotoramajs/version.rb +1 -1
- data/vendor/assets/javascripts/fotorama.js +225 -191
- data/vendor/assets/stylesheets/fotorama.css.scss +50 -19
- metadata +4 -5
- data/lib/fotoramajs/updater.rb +0 -78
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fotoramajs (4.3.
|
4
|
+
fotoramajs (4.3.3)
|
5
5
|
jquery-rails (>= 2.1.0)
|
6
6
|
sprockets (>= 2)
|
7
7
|
|
@@ -20,17 +20,17 @@ GEM
|
|
20
20
|
multi_json (~> 1.3)
|
21
21
|
thread_safe (~> 0.1)
|
22
22
|
tzinfo (~> 0.3.37)
|
23
|
-
atomic (1.1.
|
23
|
+
atomic (1.1.13)
|
24
24
|
builder (3.1.4)
|
25
25
|
erubis (2.7.0)
|
26
26
|
hike (1.2.3)
|
27
27
|
httpclient (2.3.4.1)
|
28
|
-
i18n (0.6.
|
28
|
+
i18n (0.6.5)
|
29
29
|
jquery-rails (3.0.4)
|
30
30
|
railties (>= 3.0, < 5.0)
|
31
31
|
thor (>= 0.14, < 2.0)
|
32
32
|
minitest (4.7.5)
|
33
|
-
multi_json (1.7.
|
33
|
+
multi_json (1.7.9)
|
34
34
|
rack (1.5.2)
|
35
35
|
rack-test (0.6.2)
|
36
36
|
rack (>= 1.0)
|
data/Rakefile
CHANGED
@@ -4,8 +4,75 @@ require "bundler/gem_tasks"
|
|
4
4
|
|
5
5
|
desc "Update assets from Fotorama repo"
|
6
6
|
task :update do
|
7
|
-
require
|
8
|
-
|
7
|
+
require "json"
|
8
|
+
require "httpclient"
|
9
|
+
|
10
|
+
def github_tags(repo)
|
11
|
+
http = HTTPClient.new
|
12
|
+
body = http.get("https://api.github.com/repos/#{repo}/tags").body
|
13
|
+
response = JSON.parse(body)
|
14
|
+
response.map { |tag| Gem::Version.new(tag['name']) }.sort
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(url, to)
|
18
|
+
to.open('w') do |io|
|
19
|
+
http = HTTPClient.new
|
20
|
+
http.transparent_gzip_decompression = true
|
21
|
+
io << http.get(url).body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def asset(file)
|
26
|
+
assets = Pathname(__FILE__).dirname.join('vendor/assets')
|
27
|
+
|
28
|
+
if file.end_with? '.css' or file.end_with? '.scss'
|
29
|
+
assets.join('stylesheets', file)
|
30
|
+
elsif file.end_with? '.js'
|
31
|
+
assets.join('javascripts', file)
|
32
|
+
else
|
33
|
+
assets.join('images', file)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def fetch(tag)
|
38
|
+
cdn = "http://fotorama.s3.amazonaws.com/#{tag}"
|
39
|
+
%w(fotorama.js fotorama.css fotorama.png fotorama@2x.png).each do |file|
|
40
|
+
from = "#{cdn}/#{file}".sub(/(.css|.js)$/, '.uncompressed\\1')
|
41
|
+
get from, asset(file)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def convert
|
46
|
+
css = asset('fotorama.css')
|
47
|
+
scss = asset('fotorama.css.scss')
|
48
|
+
|
49
|
+
scss.open('w') do |io|
|
50
|
+
io << css.read.gsub(/url\(/, 'image-url(')
|
51
|
+
end
|
52
|
+
|
53
|
+
css.delete
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_version(tag)
|
57
|
+
version_file = Pathname(__FILE__).dirname.join('lib/fotoramajs/version.rb')
|
58
|
+
version_file.open('w') do |io|
|
59
|
+
io << "module Fotoramajs\n VERSION = \"#{tag}\"\nend\n"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
puts "Fetching tags"
|
64
|
+
tag = github_tags('artpolikarpov/fotorama').last
|
65
|
+
|
66
|
+
puts "Load Fotorama #{tag}"
|
67
|
+
fetch(tag)
|
68
|
+
|
69
|
+
puts "Convert CSS to SCSS"
|
70
|
+
convert
|
71
|
+
|
72
|
+
puts "Update gem version"
|
73
|
+
update_version(tag)
|
74
|
+
|
75
|
+
puts "Done"
|
9
76
|
end
|
10
77
|
|
11
78
|
desc 'Delete all generated files'
|
data/lib/fotoramajs/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Fotorama 4.3.
|
2
|
+
* Fotorama 4.3.3 | http://fotorama.io/license/
|
3
3
|
*/
|
4
4
|
(function (window, document, $, undefined) {
|
5
5
|
"use strict";
|
@@ -450,9 +450,10 @@ var $WINDOW = $(window),
|
|
450
450
|
$HTML,
|
451
451
|
$BODY,
|
452
452
|
|
453
|
-
COMPAT = document.compatMode === 'CSS1Compat',
|
454
453
|
QUIRKS_FORCE = location.hash.replace('#', '') === 'quirks',
|
455
|
-
|
454
|
+
TRANSFORMS3D = Modernizr.csstransforms3d,
|
455
|
+
CSS3 = TRANSFORMS3D && !QUIRKS_FORCE,
|
456
|
+
COMPAT = TRANSFORMS3D || document.compatMode === 'CSS1Compat',
|
456
457
|
FULLSCREEN = fullScreenApi.ok,
|
457
458
|
|
458
459
|
MOBILE = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),
|
@@ -493,10 +494,10 @@ function readPosition ($el) {
|
|
493
494
|
}
|
494
495
|
}
|
495
496
|
|
496
|
-
function getTranslate (pos) {
|
497
|
+
function getTranslate (pos, _001) {
|
497
498
|
var obj = {};
|
498
499
|
if (CSS3) {
|
499
|
-
obj.transform = 'translate3d(' + pos + 'px,0,0)';
|
500
|
+
obj.transform = 'translate3d(' + (pos + (_001 ? 0.001 : 0)) + 'px,0,0)'; // 0.001 to remove Retina artifacts
|
500
501
|
} else {
|
501
502
|
obj.left = pos;
|
502
503
|
}
|
@@ -508,7 +509,7 @@ function getDuration (time) {
|
|
508
509
|
}
|
509
510
|
|
510
511
|
function numberFromMeasure (value, measure) {
|
511
|
-
return +String(value).replace(measure || 'px', '');
|
512
|
+
return +String(value).replace(measure || 'px', '') || undefined;
|
512
513
|
}
|
513
514
|
|
514
515
|
function numberFromPercent (value) {
|
@@ -570,7 +571,7 @@ function afterTransition ($el, property, fn, time) {
|
|
570
571
|
}
|
571
572
|
|
572
573
|
|
573
|
-
function stop ($el, left) {
|
574
|
+
function stop ($el, left, _001) {
|
574
575
|
if ($el.length) {
|
575
576
|
var elData = $el.data();
|
576
577
|
if (CSS3) {
|
@@ -584,7 +585,7 @@ function stop ($el, left) {
|
|
584
585
|
return readPosition($el);
|
585
586
|
});
|
586
587
|
|
587
|
-
$el.css(getTranslate(lockedLeft));//.width(); // `.width()` for reflow
|
588
|
+
$el.css(getTranslate(lockedLeft, _001));//.width(); // `.width()` for reflow
|
588
589
|
return lockedLeft;
|
589
590
|
}
|
590
591
|
}
|
@@ -649,7 +650,7 @@ function findVideoId (href, forceVideo) {
|
|
649
650
|
return id ? {id: id, type: type} : false;
|
650
651
|
}
|
651
652
|
|
652
|
-
function getVideoThumbs (dataFrame, data,
|
653
|
+
function getVideoThumbs (dataFrame, data, fotorama) {
|
653
654
|
var img, thumb, video = dataFrame.video;
|
654
655
|
if (video.type === 'youtube') {
|
655
656
|
thumb = getProtocol() + 'img.youtube.com/vi/' + video.id + '/default.jpg';
|
@@ -661,7 +662,7 @@ function getVideoThumbs (dataFrame, data, api) {
|
|
661
662
|
dataType: 'jsonp',
|
662
663
|
success: function (json) {
|
663
664
|
dataFrame.thumbsReady = true;
|
664
|
-
updateData(data, {img: json[0].thumbnail_large, thumb: json[0].thumbnail_small}, dataFrame.i,
|
665
|
+
updateData(data, {img: json[0].thumbnail_large, thumb: json[0].thumbnail_small}, dataFrame.i, fotorama);
|
665
666
|
}
|
666
667
|
});
|
667
668
|
} else {
|
@@ -674,7 +675,7 @@ function getVideoThumbs (dataFrame, data, api) {
|
|
674
675
|
}
|
675
676
|
}
|
676
677
|
|
677
|
-
function updateData (data, _dataFrame, i,
|
678
|
+
function updateData (data, _dataFrame, i, fotorama) {
|
678
679
|
for (var _i = 0, _l = data.length; _i < _l; _i++) {
|
679
680
|
var dataFrame = data[_i];
|
680
681
|
|
@@ -682,7 +683,7 @@ function updateData (data, _dataFrame, i, api) {
|
|
682
683
|
var clear = {videoReady: true};
|
683
684
|
clear[STAGE_FRAME_KEY] = clear[NAV_THUMB_FRAME_KEY] = clear[NAV_DOT_FRAME_KEY] = false;
|
684
685
|
|
685
|
-
|
686
|
+
fotorama.splice(_i, 1, $.extend(
|
686
687
|
{},
|
687
688
|
dataFrame,
|
688
689
|
clear,
|
@@ -697,9 +698,8 @@ function updateData (data, _dataFrame, i, api) {
|
|
697
698
|
function getDataFromHtml ($el) {
|
698
699
|
var data = [];
|
699
700
|
|
700
|
-
function getDataFromImg ($img, checkVideo) {
|
701
|
-
var
|
702
|
-
$child = $img.children('img').eq(0),
|
701
|
+
function getDataFromImg ($img, imgData, checkVideo) {
|
702
|
+
var $child = $img.children('img').eq(0),
|
703
703
|
_imgHref = $img.attr('href'),
|
704
704
|
_imgSrc = $img.attr('src'),
|
705
705
|
_thumbSrc = $child.attr('src'),
|
@@ -709,37 +709,40 @@ function getDataFromHtml ($el) {
|
|
709
709
|
if (video) {
|
710
710
|
_imgHref = false;
|
711
711
|
} else {
|
712
|
-
video =
|
712
|
+
video = _video;
|
713
713
|
}
|
714
714
|
|
715
|
-
|
716
|
-
thumb = imgData.thumb || _thumbSrc || _imgSrc || _imgHref,
|
717
|
-
separateThumbFLAG = img !== thumb,
|
718
|
-
width = numberFromMeasure(imgData.width || $img.attr('width')),
|
719
|
-
height = numberFromMeasure(imgData.height || $img.attr('height')),
|
720
|
-
thumbWidth = numberFromMeasure(imgData.thumbWidth || $child.attr('width') || separateThumbFLAG || width),
|
721
|
-
thumbHeight = numberFromMeasure(imgData.thumbHeight || $child.attr('height') || separateThumbFLAG || height);
|
722
|
-
|
723
|
-
return {
|
715
|
+
getDimensions($img, $child, $.extend(imgData, {
|
724
716
|
video: video,
|
725
|
-
img: img,
|
726
|
-
|
727
|
-
|
728
|
-
thumb: thumb,
|
729
|
-
thumbRatio: thumbWidth / thumbHeight || undefined
|
730
|
-
}
|
717
|
+
img: imgData.img || _imgHref || _imgSrc || _thumbSrc,
|
718
|
+
thumb: imgData.thumb || _thumbSrc || _imgSrc || _imgHref
|
719
|
+
}));
|
731
720
|
}
|
732
721
|
|
733
|
-
|
722
|
+
function getDimensions ($img, $child, imgData) {
|
723
|
+
var separateThumbFLAG = imgData.thumb && imgData.img !== imgData.thumb,
|
724
|
+
width = numberFromMeasure(imgData.width || $img.attr('width')),
|
725
|
+
height = numberFromMeasure(imgData.height || $img.attr('height'));
|
726
|
+
|
727
|
+
$.extend(imgData, {
|
728
|
+
width: width,
|
729
|
+
height: height,
|
730
|
+
thumbratio: getRatio(imgData.thumbratio
|
731
|
+
|| (numberFromMeasure(imgData.thumbwidth || ($child && $child.attr('width')) || separateThumbFLAG || width)
|
732
|
+
/ numberFromMeasure(imgData.thumbheight || ($child && $child.attr('height')) || separateThumbFLAG || height)))
|
733
|
+
});
|
734
|
+
}
|
735
|
+
|
736
|
+
$el.children().each(function () {
|
734
737
|
var $this = $(this),
|
735
|
-
dataFrame = $.extend($this.data(), {id: $this.attr('id')});
|
738
|
+
dataFrame = optionsToLowerCase($.extend($this.data(), {id: $this.attr('id')}));
|
736
739
|
if ($this.is('a, img')) {
|
737
|
-
|
740
|
+
getDataFromImg($this, dataFrame, true);
|
738
741
|
} else if (!$this.is(':empty')) {
|
739
|
-
$.extend(dataFrame, {
|
742
|
+
getDimensions($this, null, $.extend(dataFrame, {
|
740
743
|
html: this,
|
741
744
|
_html: $this.html() // Because of IE
|
742
|
-
});
|
745
|
+
}));
|
743
746
|
} else return;
|
744
747
|
|
745
748
|
data.push(dataFrame);
|
@@ -790,7 +793,7 @@ function fit ($el, measuresToFit, method) {
|
|
790
793
|
height = measures.height,
|
791
794
|
ratio = measuresToFit.w / measuresToFit.h,
|
792
795
|
biggerRatioFLAG = measures.ratio >= ratio,
|
793
|
-
fitFLAG = method === '
|
796
|
+
fitFLAG = method === 'scaledown',
|
794
797
|
containFLAG = method === 'contain',
|
795
798
|
coverFLAG = method === 'cover';
|
796
799
|
|
@@ -914,6 +917,28 @@ function lockScroll (left, top) {
|
|
914
917
|
.scrollLeft(left)
|
915
918
|
.scrollTop(top);
|
916
919
|
}
|
920
|
+
|
921
|
+
function optionsToLowerCase (options) {
|
922
|
+
if (options) {
|
923
|
+
var opts = {};
|
924
|
+
$.each(options, function (key, value) {
|
925
|
+
opts[key.toLowerCase()] = value;
|
926
|
+
});
|
927
|
+
|
928
|
+
return opts;
|
929
|
+
}
|
930
|
+
}
|
931
|
+
|
932
|
+
function getRatio (_ratio) {
|
933
|
+
if (!_ratio) return;
|
934
|
+
var ratio = +_ratio;
|
935
|
+
if (!isNaN(ratio)) {
|
936
|
+
return ratio;
|
937
|
+
} else {
|
938
|
+
ratio = _ratio.split('/');
|
939
|
+
return +ratio[0] / +ratio[1] || undefined;
|
940
|
+
}
|
941
|
+
}
|
917
942
|
function slide ($el, options) {
|
918
943
|
var elPos = Math.round(options.pos),
|
919
944
|
onEndFn = options.onEnd || noop;
|
@@ -925,7 +950,7 @@ function slide ($el, options) {
|
|
925
950
|
};
|
926
951
|
}
|
927
952
|
|
928
|
-
var translate = $.extend(getTranslate(elPos), {width: options.width});
|
953
|
+
var translate = $.extend(getTranslate(elPos, options._001), {width: options.width});
|
929
954
|
|
930
955
|
if (CSS3) {
|
931
956
|
$el.css($.extend(getDuration(options.time), translate));
|
@@ -939,55 +964,45 @@ function slide ($el, options) {
|
|
939
964
|
}
|
940
965
|
}
|
941
966
|
|
942
|
-
function fade ($el1, $el2, $frames, options) {
|
967
|
+
function fade ($el1, $el2, $frames, options, fadeStack, chain) {
|
968
|
+
var chainedFLAG = typeof chain !== 'undefined';
|
969
|
+
if (!chainedFLAG) {
|
970
|
+
fadeStack.push(arguments);
|
971
|
+
Array.prototype.push.call(arguments, fadeStack.length);
|
972
|
+
if (fadeStack.length > 1) return;
|
973
|
+
}
|
974
|
+
|
943
975
|
$el1 = $el1 || $($el1);
|
944
976
|
$el2 = $el2 || $($el2);
|
977
|
+
|
945
978
|
var _$el1 = $el1[0],
|
946
979
|
_$el2 = $el2[0],
|
947
980
|
crossfadeFLAG = options.method === 'crossfade',
|
948
981
|
onEndFn = function () {
|
949
982
|
if (!onEndFn.done) {
|
950
|
-
(options.onEnd || noop)();
|
951
983
|
onEndFn.done = true;
|
984
|
+
var args = (chainedFLAG || fadeStack.shift()) && fadeStack.shift();
|
985
|
+
args && fade.apply(this, args);
|
986
|
+
(options.onEnd || noop)(!!args);
|
952
987
|
}
|
953
988
|
},
|
954
|
-
|
955
|
-
duration0 = getDuration(0),
|
956
|
-
opacity0 = {opacity: 0},
|
957
|
-
opacity1 = {opacity: 1};
|
989
|
+
time = options.time / (chain || 1);
|
958
990
|
|
959
|
-
$frames
|
991
|
+
$frames
|
992
|
+
.not($el1.addClass(fadeRearClass).removeClass(fadeFrontClass))
|
993
|
+
.not($el2.addClass(fadeFrontClass).removeClass(fadeRearClass))
|
994
|
+
.removeClass(fadeRearClass + ' ' + fadeFrontClass);
|
960
995
|
|
961
|
-
$el1.addClass(fadeRearClass);
|
962
|
-
$el2.addClass(fadeFrontClass);
|
963
996
|
|
964
|
-
|
965
|
-
|
966
|
-
stop($el2);
|
997
|
+
$el1.stop();
|
998
|
+
$el2.stop();
|
967
999
|
|
968
|
-
|
1000
|
+
crossfadeFLAG && _$el2 && $el1.fadeTo(0, 0);
|
969
1001
|
|
970
|
-
|
971
|
-
|
1002
|
+
$el1.fadeTo(crossfadeFLAG ? time : 1, 1, crossfadeFLAG && onEndFn);
|
1003
|
+
$el2.fadeTo(time, 0, onEndFn);
|
972
1004
|
|
973
|
-
|
974
|
-
afterTransition($el1, 'opacity', onEndFn, options.time);
|
975
|
-
afterTransition($el2, 'opacity', onEndFn, options.time);
|
976
|
-
} else {
|
977
|
-
onEndFn();
|
978
|
-
}
|
979
|
-
|
980
|
-
} else {
|
981
|
-
$el1.stop();
|
982
|
-
$el2.stop();
|
983
|
-
|
984
|
-
crossfadeFLAG && _$el2 && $el1.fadeTo(0, 0);
|
985
|
-
|
986
|
-
$el1.fadeTo(crossfadeFLAG ? options.time : 1, 1, crossfadeFLAG && onEndFn);
|
987
|
-
$el2.fadeTo(options.time, 0, onEndFn);
|
988
|
-
|
989
|
-
(_$el1 && crossfadeFLAG) || _$el2 || onEndFn();
|
990
|
-
}
|
1005
|
+
(_$el1 && crossfadeFLAG) || _$el2 || onEndFn();
|
991
1006
|
}
|
992
1007
|
var lastEvent,
|
993
1008
|
moveEventType,
|
@@ -1056,7 +1071,7 @@ function touch ($el, options) {
|
|
1056
1071
|
var xDiff = Math.abs(e._x - startEvent._x), // opt _x → _pageX
|
1057
1072
|
yDiff = Math.abs(e._y - startEvent._y),
|
1058
1073
|
xyDiff = xDiff - yDiff,
|
1059
|
-
xWin = (tail.go || tail.x || xyDiff
|
1074
|
+
xWin = (tail.go || tail.x || xyDiff > 0) && !tail.noSwipe,
|
1060
1075
|
yWin = xyDiff < 0;
|
1061
1076
|
|
1062
1077
|
if (touchFLAG && !tail.checked) {
|
@@ -1160,7 +1175,7 @@ function moveOnTouch ($el, options) {
|
|
1160
1175
|
[startTime, startCoo]
|
1161
1176
|
];
|
1162
1177
|
|
1163
|
-
startElPos = moveElPos = stop($el, options.getPos && options.getPos());
|
1178
|
+
startElPos = moveElPos = tail.noMove ? 0 : stop($el, options.getPos && options.getPos(), options._001);
|
1164
1179
|
|
1165
1180
|
// startTime - endTime < TOUCH_TIMEOUT * 3 && e.preventDefault(); // double tap
|
1166
1181
|
|
@@ -1324,7 +1339,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1324
1339
|
$BODY = $BODY || $('body');
|
1325
1340
|
|
1326
1341
|
var that = this,
|
1327
|
-
index = _size,
|
1328
1342
|
stamp = $.now(),
|
1329
1343
|
stampClass = _fotoramaClass + stamp,
|
1330
1344
|
fotorama = $fotorama[0],
|
@@ -1339,6 +1353,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1339
1353
|
$wrap = $(div(wrapClass)),
|
1340
1354
|
$stage = $(div(stageClass)).appendTo($wrap),
|
1341
1355
|
stage = $stage[0],
|
1356
|
+
|
1342
1357
|
$stageShaft = $(div(stageShaftClass)).appendTo($stage),
|
1343
1358
|
$stageFrame = $(),
|
1344
1359
|
$arrPrev = $(div(arrClass + ' ' + arrPrevClass, div(arrArrClass))),
|
@@ -1410,7 +1425,9 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1410
1425
|
hoverFLAG,
|
1411
1426
|
|
1412
1427
|
navFrameKey,
|
1413
|
-
stageLeft = 0
|
1428
|
+
stageLeft = 0,
|
1429
|
+
|
1430
|
+
fadeStack = [];
|
1414
1431
|
|
1415
1432
|
$wrap[STAGE_FRAME_KEY] = $(div(stageFrameClass));
|
1416
1433
|
$wrap[NAV_THUMB_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameThumbClass, div(thumbClass)));
|
@@ -1421,13 +1438,13 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1421
1438
|
toDeactivate[NAV_DOT_FRAME_KEY] = [];
|
1422
1439
|
toDetach[STAGE_FRAME_KEY] = {};
|
1423
1440
|
|
1441
|
+
that.prevent = {};
|
1442
|
+
|
1424
1443
|
if (CSS3) {
|
1425
1444
|
$wrap.addClass(wrapCss3Class);
|
1426
1445
|
}
|
1427
1446
|
|
1428
1447
|
fotoramaData.fotorama = this;
|
1429
|
-
that.options = opts;
|
1430
|
-
_size++;
|
1431
1448
|
|
1432
1449
|
function checkForVideo () {
|
1433
1450
|
$.each(data, function (i, dataFrame) {
|
@@ -1448,6 +1465,46 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1448
1465
|
});
|
1449
1466
|
}
|
1450
1467
|
|
1468
|
+
function bindGlobalEvents (FLAG) {
|
1469
|
+
var keydownCommon = 'keydown.' + _fotoramaClass,
|
1470
|
+
keydownLocal = 'keydown.' + _fotoramaClass + stamp,
|
1471
|
+
resizeLocal = 'resize.' + _fotoramaClass + stamp;
|
1472
|
+
|
1473
|
+
if (FLAG) {
|
1474
|
+
$DOCUMENT
|
1475
|
+
.on(keydownLocal, function (e) {
|
1476
|
+
if ($videoPlaying && e.keyCode === 27) {
|
1477
|
+
e.preventDefault();
|
1478
|
+
unloadVideo($videoPlaying, true, true);
|
1479
|
+
} else if (that.fullScreen || (opts.keyboard && !that.index)) {
|
1480
|
+
if (e.keyCode === 27) {
|
1481
|
+
e.preventDefault();
|
1482
|
+
that.cancelFullScreen();
|
1483
|
+
} else if (e.keyCode === 39 || (e.keyCode === 40 && that.fullScreen)) {
|
1484
|
+
e.preventDefault();
|
1485
|
+
that.show({index: '>', slow: e.altKey, direct: true});
|
1486
|
+
} else if (e.keyCode === 37 || (e.keyCode === 38 && that.fullScreen)) {
|
1487
|
+
e.preventDefault();
|
1488
|
+
that.show({index: '<', slow: e.altKey, direct: true});
|
1489
|
+
}
|
1490
|
+
}
|
1491
|
+
});
|
1492
|
+
|
1493
|
+
if (!that.index) {
|
1494
|
+
$DOCUMENT
|
1495
|
+
.off(keydownCommon)
|
1496
|
+
.on(keydownCommon, 'textarea, input, select', function (e) {
|
1497
|
+
!$BODY.hasClass(_fullscreenClass) && e.stopPropagation();
|
1498
|
+
});
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
$WINDOW.on(resizeLocal, that.resize);
|
1502
|
+
} else {
|
1503
|
+
$DOCUMENT.off(keydownLocal);
|
1504
|
+
$WINDOW.off(resizeLocal);
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
|
1451
1508
|
function appendElements (FLAG) {
|
1452
1509
|
if (FLAG === appendElements.f) return;
|
1453
1510
|
|
@@ -1459,7 +1516,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1459
1516
|
.before($style)
|
1460
1517
|
.before($anchor);
|
1461
1518
|
|
1462
|
-
|
1519
|
+
addInstance(that);
|
1463
1520
|
} else {
|
1464
1521
|
$wrap.detach();
|
1465
1522
|
$style.detach();
|
@@ -1468,9 +1525,10 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1468
1525
|
.html(fotoramaData.urtext)
|
1469
1526
|
.removeClass(stampClass);
|
1470
1527
|
|
1471
|
-
|
1528
|
+
hideInstance(that);
|
1472
1529
|
}
|
1473
1530
|
|
1531
|
+
bindGlobalEvents(FLAG);
|
1474
1532
|
appendElements.f = FLAG;
|
1475
1533
|
}
|
1476
1534
|
|
@@ -1509,17 +1567,19 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1509
1567
|
* Options on the fly
|
1510
1568
|
* */
|
1511
1569
|
function setOptions () {
|
1570
|
+
that.options = opts = optionsToLowerCase(opts);
|
1571
|
+
|
1512
1572
|
o_fade = opts.transition === 'crossfade' || opts.transition === 'dissolve';
|
1513
1573
|
|
1514
1574
|
o_loop = opts.loop && (size > 2 || o_fade);
|
1515
1575
|
|
1516
|
-
o_transitionDuration = +opts.
|
1576
|
+
o_transitionDuration = +opts.transitionduration || TRANSITION_DURATION;
|
1517
1577
|
|
1518
1578
|
var classes = {add: [], remove: []};
|
1519
1579
|
|
1520
1580
|
if (size > 1) {
|
1521
1581
|
o_nav = opts.nav;
|
1522
|
-
o_navTop = opts.
|
1582
|
+
o_navTop = opts.navposition === 'top';
|
1523
1583
|
classes.remove.push(selectClass);
|
1524
1584
|
|
1525
1585
|
$arrs.toggle(opts.arrows);
|
@@ -1532,8 +1592,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1532
1592
|
|
1533
1593
|
if (opts.autoplay) setAutoplayInterval(opts.autoplay);
|
1534
1594
|
|
1535
|
-
o_thumbSide = numberFromMeasure(opts.
|
1536
|
-
o_thumbSide2 = numberFromMeasure(opts.
|
1595
|
+
o_thumbSide = numberFromMeasure(opts.thumbwidth) || THUMB_SIZE;
|
1596
|
+
o_thumbSide2 = numberFromMeasure(opts.thumbheight) || THUMB_SIZE;
|
1537
1597
|
|
1538
1598
|
stageNoMove();
|
1539
1599
|
|
@@ -1576,7 +1636,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1576
1636
|
frameAppend($navFrame, $navShaft, 'nav');
|
1577
1637
|
}
|
1578
1638
|
|
1579
|
-
o_allowFullScreen = opts.
|
1639
|
+
o_allowFullScreen = opts.allowfullscreen;
|
1580
1640
|
|
1581
1641
|
if (o_allowFullScreen) {
|
1582
1642
|
$fullscreenIcon.appendTo($stage);
|
@@ -1630,10 +1690,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1630
1690
|
function setNavShaftMinmax () {
|
1631
1691
|
navShaftData.min = Math.min(0, measures.w - $navShaft.width());
|
1632
1692
|
navShaftData.max = 0;
|
1633
|
-
|
1634
|
-
navShaftTouchTail.noMove = navShaftData.min === navShaftData.max;
|
1635
|
-
|
1636
|
-
$navShaft.toggleClass(grabClass, !navShaftTouchTail.noMove);
|
1693
|
+
$navShaft.toggleClass(grabClass, !(navShaftTouchTail.noMove = navShaftData.min === navShaftData.max));
|
1637
1694
|
}
|
1638
1695
|
|
1639
1696
|
function eachIndex (indexes, type, fn) {
|
@@ -1643,12 +1700,15 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1643
1700
|
}
|
1644
1701
|
return $.each(indexes, function (i, index) {
|
1645
1702
|
if (rangeFLAG) index = i;
|
1646
|
-
if (typeof
|
1647
|
-
var dataFrame = data[normalizeIndex(index)]
|
1648
|
-
|
1649
|
-
|
1703
|
+
if (typeof index === 'number') {
|
1704
|
+
var dataFrame = data[normalizeIndex(index)];
|
1705
|
+
|
1706
|
+
if (dataFrame) {
|
1707
|
+
var key = '$' + type + 'Frame',
|
1708
|
+
$frame = dataFrame[key];
|
1650
1709
|
|
1651
|
-
|
1710
|
+
fn.call(this, i, index, dataFrame, $frame, key, $frame && $frame.data());
|
1711
|
+
}
|
1652
1712
|
}
|
1653
1713
|
});
|
1654
1714
|
}
|
@@ -1930,18 +1990,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1930
1990
|
|
1931
1991
|
if (!thumbsFLAG) return;
|
1932
1992
|
|
1933
|
-
|
1934
|
-
|
1935
1993
|
var $this = $(this),
|
1936
1994
|
frameData = $this.data(),
|
1937
|
-
|
1995
|
+
thumbwidth = Math.round(o_thumbSide2 * frameData.data.thumbratio) || o_thumbSide;
|
1938
1996
|
|
1939
1997
|
frameData.l = left;
|
1940
|
-
frameData.w =
|
1998
|
+
frameData.w = thumbwidth;
|
1941
1999
|
|
1942
|
-
$this.css({width:
|
2000
|
+
$this.css({width: thumbwidth});
|
1943
2001
|
|
1944
|
-
left +=
|
2002
|
+
left += thumbwidth + MARGIN;
|
1945
2003
|
})
|
1946
2004
|
);
|
1947
2005
|
|
@@ -2032,7 +2090,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2032
2090
|
}
|
2033
2091
|
}
|
2034
2092
|
|
2035
|
-
|
2036
2093
|
function detachFrames (key) {
|
2037
2094
|
var _toDetach = toDetach[key];
|
2038
2095
|
|
@@ -2058,7 +2115,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2058
2115
|
toDeactivate[STAGE_FRAME_KEY].push($frame.addClass(activeClass));
|
2059
2116
|
|
2060
2117
|
skipOnEnd || that.show.onEnd(true);
|
2061
|
-
stop($stageShaft, 0);
|
2118
|
+
stop($stageShaft, 0, true);
|
2062
2119
|
|
2063
2120
|
detachFrames(STAGE_FRAME_KEY);
|
2064
2121
|
stageFramePosition(activeIndexes);
|
@@ -2071,41 +2128,37 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2071
2128
|
options && $.extend(measures, {
|
2072
2129
|
width: options.width || measures.width,
|
2073
2130
|
height: options.height,
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
ratio: (
|
2079
|
-
if (!_ratio) return;
|
2080
|
-
var ratio = Number(_ratio);
|
2081
|
-
if (!isNaN(ratio)) {
|
2082
|
-
return ratio;
|
2083
|
-
} else {
|
2084
|
-
ratio = _ratio.split('/');
|
2085
|
-
return Number(ratio[0] / ratio[1]) || undefined;
|
2086
|
-
}
|
2087
|
-
})(options.ratio)
|
2131
|
+
minwidth: options.minwidth,
|
2132
|
+
maxwidth: options.maxwidth,
|
2133
|
+
minheight: options.minheight,
|
2134
|
+
maxheight: options.maxheight,
|
2135
|
+
ratio: getRatio(options.ratio)
|
2088
2136
|
})
|
2089
2137
|
&& !optsLeave && $.extend(opts, {
|
2090
2138
|
width: measures.width,
|
2091
2139
|
height: measures.height,
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2140
|
+
minwidth: measures.minwidth,
|
2141
|
+
maxwidth: measures.maxwidth,
|
2142
|
+
minheight: measures.minheight,
|
2143
|
+
maxheight: measures.maxheight,
|
2096
2144
|
ratio: measures.ratio
|
2097
2145
|
});
|
2098
2146
|
}
|
2099
2147
|
|
2100
|
-
function triggerEvent (event, extra) {
|
2148
|
+
function triggerEvent (event, extra, fn) {
|
2101
2149
|
$fotorama.trigger(_fotoramaClass + ':' + event, [that, extra]);
|
2150
|
+
if (!that.prevent[event]) {
|
2151
|
+
(fn || noop)();
|
2152
|
+
} else {
|
2153
|
+
delete that.prevent[event];
|
2154
|
+
}
|
2102
2155
|
}
|
2103
2156
|
|
2104
2157
|
function onTouchStart () {
|
2105
2158
|
clearTimeout(onTouchEnd.t);
|
2106
2159
|
touchedFLAG = 1;
|
2107
2160
|
|
2108
|
-
if (opts.
|
2161
|
+
if (opts.stopautoplayontouch) {
|
2109
2162
|
that.stopAutoplay();
|
2110
2163
|
} else {
|
2111
2164
|
pausedAutoplayFLAG = true;
|
@@ -2151,7 +2204,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2151
2204
|
}, opts.autoplay);
|
2152
2205
|
}
|
2153
2206
|
|
2154
|
-
|
2155
2207
|
that.startAutoplay = function (interval) {
|
2156
2208
|
if (that.autoplay) return this;
|
2157
2209
|
pausedAutoplayFLAG = stoppedAutoplayFLAG = false;
|
@@ -2200,15 +2252,15 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2200
2252
|
|
2201
2253
|
that.activeFrame = activeFrame = data[activeIndex];
|
2202
2254
|
|
2203
|
-
unloadVideo(
|
2255
|
+
unloadVideo($videoPlaying, activeFrame.i !== data[normalizeIndex(repositionIndex)].i);
|
2204
2256
|
|
2205
2257
|
frameDraw(activeIndexes, 'stage');
|
2206
2258
|
stageFramePosition([dirtyIndex, getPrevIndex(dirtyIndex), getNextIndex(dirtyIndex)]);
|
2207
2259
|
|
2208
|
-
triggerEvent('show', options.direct);
|
2209
|
-
|
2210
2260
|
updateTouchTails('go', true);
|
2211
2261
|
|
2262
|
+
triggerEvent('show', options.direct);
|
2263
|
+
|
2212
2264
|
var onEnd = that.show.onEnd = function (skipReposition) {
|
2213
2265
|
if (onEnd.ok) return;
|
2214
2266
|
onEnd.ok = true;
|
@@ -2231,7 +2283,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2231
2283
|
pos: -getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex),
|
2232
2284
|
overPos: overPos,
|
2233
2285
|
time: time,
|
2234
|
-
onEnd: onEnd
|
2286
|
+
onEnd: onEnd,
|
2287
|
+
_001: true
|
2235
2288
|
});
|
2236
2289
|
} else {
|
2237
2290
|
var $activeFrame = activeFrame[STAGE_FRAME_KEY],
|
@@ -2241,7 +2294,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2241
2294
|
time: time,
|
2242
2295
|
method: opts.transition,
|
2243
2296
|
onEnd: onEnd
|
2244
|
-
});
|
2297
|
+
}, fadeStack);
|
2245
2298
|
}
|
2246
2299
|
|
2247
2300
|
arrsUpdate();
|
@@ -2339,42 +2392,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2339
2392
|
|
2340
2393
|
if (document.addEventListener) {
|
2341
2394
|
document.addEventListener(fullScreenApi.event, function () {
|
2342
|
-
if (!fullScreenApi.is() && !$videoPlaying) {
|
2395
|
+
if (data && !fullScreenApi.is() && !$videoPlaying) {
|
2343
2396
|
cancelFullScreen();
|
2344
2397
|
}
|
2345
2398
|
});
|
2346
2399
|
}
|
2347
2400
|
|
2348
|
-
$DOCUMENT.on('keydown', function (e) {
|
2349
|
-
if ($videoPlaying && e.keyCode === 27) {
|
2350
|
-
e.preventDefault();
|
2351
|
-
unloadVideo($videoPlaying, true, true);
|
2352
|
-
} else if (that.fullScreen || (opts.keyboard && !index)) {
|
2353
|
-
if (e.keyCode === 27) {
|
2354
|
-
e.preventDefault();
|
2355
|
-
that.cancelFullScreen();
|
2356
|
-
} else if (e.keyCode === 39 || (e.keyCode === 40 && that.fullScreen)) {
|
2357
|
-
e.preventDefault();
|
2358
|
-
that.show({index: '>', slow: e.altKey, direct: true});
|
2359
|
-
} else if (e.keyCode === 37 || (e.keyCode === 38 && that.fullScreen)) {
|
2360
|
-
e.preventDefault();
|
2361
|
-
that.show({index: '<', slow: e.altKey, direct: true});
|
2362
|
-
}
|
2363
|
-
}
|
2364
|
-
});
|
2365
|
-
|
2366
|
-
if (!index) {
|
2367
|
-
$DOCUMENT.on('keydown', 'textarea, input, select', function (e) {
|
2368
|
-
if (!that.fullScreen) {
|
2369
|
-
e.stopPropagation();
|
2370
|
-
}
|
2371
|
-
});
|
2372
|
-
}
|
2373
|
-
|
2374
2401
|
that.resize = function (options) {
|
2375
2402
|
if (!data) return this;
|
2376
2403
|
|
2377
|
-
extendMeasures(!that.fullScreen ? options : {width: '100%',
|
2404
|
+
extendMeasures(!that.fullScreen ? optionsToLowerCase(options) : {width: '100%', maxwidth: null, minwidth: null, height: '100%', maxheight: null, minheight: null}, that.fullScreen);
|
2378
2405
|
|
2379
2406
|
var time = arguments[1] || 0,
|
2380
2407
|
setFLAG = arguments[2],
|
@@ -2384,7 +2411,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2384
2411
|
windowHeight = $WINDOW.height() - (o_nav ? $nav.height() : 0);
|
2385
2412
|
|
2386
2413
|
if (measureIsValid(width)) {
|
2387
|
-
$wrap.css({width: width, minWidth: measures.
|
2414
|
+
$wrap.css({width: width, minWidth: measures.minwidth, maxWidth: measures.maxwidth});
|
2388
2415
|
|
2389
2416
|
width = measures.w = $wrap.width();
|
2390
2417
|
height = numberFromPercent(height) / 100 * windowHeight || numberFromMeasure(height);
|
@@ -2393,7 +2420,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2393
2420
|
|
2394
2421
|
if (height) {
|
2395
2422
|
width = Math.round(width);
|
2396
|
-
height = measures.h = Math.round(minMaxLimit(height, numberFromPercent(measures.
|
2423
|
+
height = measures.h = Math.round(minMaxLimit(height, numberFromPercent(measures.minheight) / 100 * windowHeight || numberFromMeasure(measures.minheight), numberFromPercent(measures.maxheight) / 100 * windowHeight || numberFromMeasure(measures.maxheight)));
|
2397
2424
|
|
2398
2425
|
stageShaftReposition();
|
2399
2426
|
|
@@ -2433,7 +2460,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2433
2460
|
return this;
|
2434
2461
|
};
|
2435
2462
|
|
2436
|
-
|
2437
2463
|
function setShadow ($el, edge) {
|
2438
2464
|
if (o_shadows) {
|
2439
2465
|
$el.removeClass(shadowsLeftClass + ' ' + shadowsRightClass);
|
@@ -2488,7 +2514,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2488
2514
|
return this;
|
2489
2515
|
};
|
2490
2516
|
|
2491
|
-
|
2492
2517
|
function unloadVideo ($video, unloadActiveFLAG, releaseAutoplayFLAG) {
|
2493
2518
|
if (unloadActiveFLAG) {
|
2494
2519
|
$wrap.removeClass(wrapVideoClass);
|
@@ -2539,11 +2564,13 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2539
2564
|
} else if ($videoPlaying) {
|
2540
2565
|
target === videoClose && unloadVideo($videoPlaying, true, true);
|
2541
2566
|
} else {
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2567
|
+
triggerEvent('stagetap', undefined, function () {
|
2568
|
+
if (toggleControlsFLAG) {
|
2569
|
+
toggleControlsClass();
|
2570
|
+
} else if (opts.click) {
|
2571
|
+
that.show({index: e.shiftKey || !getDirection(e._x) ? '<' : '>', slow: e.altKey, direct: true});
|
2572
|
+
}
|
2573
|
+
});
|
2547
2574
|
}
|
2548
2575
|
}
|
2549
2576
|
|
@@ -2576,8 +2603,9 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2576
2603
|
}
|
2577
2604
|
},
|
2578
2605
|
getPos: function () {
|
2579
|
-
return -
|
2606
|
+
return -getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex);
|
2580
2607
|
},
|
2608
|
+
_001: true,
|
2581
2609
|
timeLow: 1,
|
2582
2610
|
timeHigh: 1,
|
2583
2611
|
friction: 2,
|
@@ -2664,7 +2692,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2664
2692
|
if (!ready.ok) {
|
2665
2693
|
// Only first time
|
2666
2694
|
if (opts.hash && location.hash) {
|
2667
|
-
startIndex = getIndexFromHash(location.hash.replace(/^#/, ''), data, index === 0);
|
2695
|
+
startIndex = getIndexFromHash(location.hash.replace(/^#/, ''), data, that.index === 0);
|
2668
2696
|
}
|
2669
2697
|
activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;
|
2670
2698
|
}
|
@@ -2704,14 +2732,10 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2704
2732
|
}
|
2705
2733
|
}
|
2706
2734
|
|
2707
|
-
|
2708
|
-
|
2709
|
-
$WINDOW
|
2710
|
-
.on('resize', that.resize);
|
2711
|
-
|
2712
2735
|
reset();
|
2713
2736
|
};
|
2714
2737
|
|
2738
|
+
|
2715
2739
|
$.fn.fotorama = function (opts) {
|
2716
2740
|
return this.each(function () {
|
2717
2741
|
var that = this,
|
@@ -2734,36 +2758,36 @@ $.fn.fotorama = function (opts) {
|
|
2734
2758
|
{
|
2735
2759
|
// dimensions
|
2736
2760
|
width: null, // 500 || '100%'
|
2737
|
-
|
2738
|
-
|
2761
|
+
minwidth: null,
|
2762
|
+
maxwidth: '100%', // '100%'
|
2739
2763
|
height: null,
|
2740
|
-
|
2741
|
-
|
2764
|
+
minheight: null,
|
2765
|
+
maxheight: null,
|
2742
2766
|
ratio: null, // '16/9' || 500/333 || 1.5
|
2743
2767
|
|
2744
2768
|
// navigation, thumbs
|
2745
2769
|
nav: 'dots', // 'thumbs' || false
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2770
|
+
navposition: 'bottom', // 'top'
|
2771
|
+
thumbwidth: THUMB_SIZE,
|
2772
|
+
thumbheight: THUMB_SIZE,
|
2749
2773
|
|
2750
2774
|
arrows: true,
|
2751
2775
|
click: true,
|
2752
2776
|
swipe: true,
|
2753
2777
|
|
2754
|
-
|
2778
|
+
allowfullscreen: false, // true || 'native'
|
2755
2779
|
|
2756
|
-
fit: 'contain', // 'cover' || '
|
2780
|
+
fit: 'contain', // 'cover' || 'scaledown' || 'none'
|
2757
2781
|
|
2758
2782
|
transition: 'slide', // 'crossfade' || 'dissolve'
|
2759
|
-
|
2783
|
+
transitionduration: TRANSITION_DURATION,
|
2760
2784
|
|
2761
2785
|
captions: true,
|
2762
2786
|
|
2763
2787
|
hash: false,
|
2764
2788
|
|
2765
2789
|
autoplay: false,
|
2766
|
-
|
2790
|
+
stopautoplayontouch: true,
|
2767
2791
|
|
2768
2792
|
keyboard: false,
|
2769
2793
|
|
@@ -2783,16 +2807,24 @@ $.fn.fotorama = function (opts) {
|
|
2783
2807
|
}
|
2784
2808
|
});
|
2785
2809
|
};
|
2810
|
+
$.Fotorama.instances = [];
|
2786
2811
|
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2812
|
+
function calculateIndexes () {
|
2813
|
+
$.each($.Fotorama.instances, function (index, instance) {
|
2814
|
+
instance.index = index;
|
2815
|
+
});
|
2816
|
+
}
|
2791
2817
|
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2818
|
+
function addInstance (instance) {
|
2819
|
+
$.Fotorama.instances.push(instance);
|
2820
|
+
calculateIndexes();
|
2821
|
+
}
|
2795
2822
|
|
2823
|
+
function hideInstance (instance) {
|
2824
|
+
$.Fotorama.instances.splice(instance.index, 1);
|
2825
|
+
calculateIndexes();
|
2826
|
+
}
|
2827
|
+
$.Fotorama.cache = {};
|
2796
2828
|
$ = $ || {};
|
2797
2829
|
$.Fotorama = $.Fotorama || {};
|
2798
2830
|
$.Fotorama.jst = $.Fotorama.jst || {};
|
@@ -2825,5 +2857,7 @@ __p += '<div class="fotorama__video"><iframe src="';
|
|
2825
2857
|
__p += '" frameborder="0" allowfullscreen></iframe></div>';
|
2826
2858
|
return __p
|
2827
2859
|
};
|
2828
|
-
|
2829
|
-
(
|
2860
|
+
$(function () {
|
2861
|
+
$('.' + _fotoramaClass + ':not([data-auto="false"])').fotorama();
|
2862
|
+
});
|
2863
|
+
})(window, document, jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Fotorama 4.3.
|
2
|
+
* Fotorama 4.3.3 | http://fotorama.io/license/
|
3
3
|
*/
|
4
4
|
.fotorama__stage__shaft,
|
5
5
|
.fotorama__stage__frame,
|
@@ -14,6 +14,18 @@
|
|
14
14
|
bottom: 0;
|
15
15
|
}
|
16
16
|
|
17
|
+
.fotorama--fullscreen,
|
18
|
+
.fotorama__img {
|
19
|
+
max-width: 99999px !important;
|
20
|
+
max-height: 99999px !important;
|
21
|
+
min-width: 0 !important;
|
22
|
+
min-height: 0 !important;
|
23
|
+
border-radius: 0 !important;
|
24
|
+
box-shadow: none !important;
|
25
|
+
padding: 0;
|
26
|
+
margin: 0;
|
27
|
+
}
|
28
|
+
|
17
29
|
.fotorama__wrap .fotorama__grab {
|
18
30
|
cursor: move;
|
19
31
|
cursor: -webkit-grab;
|
@@ -72,9 +84,9 @@
|
|
72
84
|
.fotorama__wrap--css3 .fotorama__stage__shaft,
|
73
85
|
.fotorama__wrap--css3 .fotorama__nav__shaft,
|
74
86
|
.fotorama__wrap--css3 .fotorama__thumb-border {
|
75
|
-
-webkit-transition-property: -webkit-transform;
|
76
|
-
transition-property: -ms-transform;
|
77
|
-
transition-property: transform;
|
87
|
+
-webkit-transition-property: -webkit-transform, width;
|
88
|
+
transition-property: -ms-transform, width;
|
89
|
+
transition-property: transform, width;
|
78
90
|
-webkit-transition-timing-function: cubic-bezier(0.1, 0, 0.25, 1);
|
79
91
|
transition-timing-function: cubic-bezier(0.1, 0, 0.25, 1);
|
80
92
|
-webkit-transition-duration: 0ms;
|
@@ -190,24 +202,23 @@
|
|
190
202
|
height: 100% !important;
|
191
203
|
max-width: 100% !important;
|
192
204
|
max-height: 100% !important;
|
193
|
-
overflow: hidden !important;
|
194
205
|
margin: 0 !important;
|
195
206
|
padding: 0 !important;
|
207
|
+
overflow: hidden !important;
|
196
208
|
background: #000;
|
197
209
|
}
|
198
210
|
|
199
211
|
.fotorama--fullscreen {
|
200
|
-
position: absolute;
|
212
|
+
position: absolute !important;
|
201
213
|
top: 0 !important;
|
202
214
|
left: 0 !important;
|
203
215
|
right: 0 !important;
|
204
216
|
bottom: 0 !important;
|
205
|
-
float: none;
|
206
|
-
z-index: 2147483647;
|
217
|
+
float: none !important;
|
218
|
+
z-index: 2147483647 !important;
|
207
219
|
background: #000;
|
208
|
-
width:
|
209
|
-
height:
|
210
|
-
margin: 0 !important;
|
220
|
+
width: 100% !important;
|
221
|
+
height: 100% !important;
|
211
222
|
}
|
212
223
|
|
213
224
|
.fotorama--fullscreen .fotorama__stage,
|
@@ -243,10 +254,6 @@
|
|
243
254
|
-webkit-filter: alpha(opacity=0);
|
244
255
|
filter: alpha(opacity=0);
|
245
256
|
opacity: 0;
|
246
|
-
max-width: 99999px !important;
|
247
|
-
max-height: 99999px !important;
|
248
|
-
min-width: 0 !important;
|
249
|
-
min-height: 0 !important;
|
250
257
|
}
|
251
258
|
|
252
259
|
.fotorama__loaded .fotorama__img,
|
@@ -395,6 +402,11 @@
|
|
395
402
|
border: 1px solid;
|
396
403
|
}
|
397
404
|
|
405
|
+
.fotorama__nav__frame.fotorama__active {
|
406
|
+
pointer-events: none;
|
407
|
+
cursor: default;
|
408
|
+
}
|
409
|
+
|
398
410
|
.fotorama__nav__frame.fotorama__active .fotorama__dot {
|
399
411
|
width: 6px;
|
400
412
|
height: 6px;
|
@@ -454,6 +466,10 @@
|
|
454
466
|
border-color: rgba(51, 51, 51, 0.5);
|
455
467
|
}
|
456
468
|
|
469
|
+
.fotorama__wrap--video .fotorama__caption {
|
470
|
+
display: none;
|
471
|
+
}
|
472
|
+
|
457
473
|
.fotorama__oooo {
|
458
474
|
width: 6px;
|
459
475
|
height: 6px;
|
@@ -489,6 +505,17 @@
|
|
489
505
|
background-color: #7f7f7f;
|
490
506
|
}
|
491
507
|
|
508
|
+
.fotorama__wrap--css3 .fotorama__stage__shaft,
|
509
|
+
.fotorama__wrap--css3 .fotorama__nav__shaft,
|
510
|
+
.fotorama__wrap--css3 .fotorama__thumb-border,
|
511
|
+
.fotorama__wrap--css3 .fotorama__stage__frame,
|
512
|
+
.fotorama__wrap--css3 .fotorama__nav__frame,
|
513
|
+
.fotorama__wrap--css3 .fotorama__img,
|
514
|
+
.fotorama__wrap--css3 .fotorama__html,
|
515
|
+
.fotorama__wrap--css3 .fotorama__caption {
|
516
|
+
-webkit-backface-visibility: hidden;
|
517
|
+
}
|
518
|
+
|
492
519
|
.fotorama__wrap--css3 .fotorama__img,
|
493
520
|
.fotorama__wrap--css3 .fotorama__html,
|
494
521
|
.fotorama__wrap--css3.fotorama__wrap--fade .fotorama__stage__frame,
|
@@ -497,8 +524,8 @@
|
|
497
524
|
transition-property: opacity;
|
498
525
|
-webkit-transition-timing-function: linear;
|
499
526
|
transition-timing-function: linear;
|
500
|
-
-webkit-transition-duration:
|
501
|
-
transition-duration:
|
527
|
+
-webkit-transition-duration: 0.3s;
|
528
|
+
transition-duration: 0.3s;
|
502
529
|
}
|
503
530
|
|
504
531
|
.fotorama__select {
|
@@ -566,6 +593,7 @@
|
|
566
593
|
}
|
567
594
|
|
568
595
|
.fotorama__arr--disabled {
|
596
|
+
pointer-events: none;
|
569
597
|
cursor: default;
|
570
598
|
*display: none;
|
571
599
|
-webkit-filter: alpha(opacity=0);
|
@@ -675,8 +703,10 @@
|
|
675
703
|
.fotorama__wrap--css3 .fotorama__fullscreen-icon,
|
676
704
|
.fotorama__wrap--css3 .fotorama__video-play,
|
677
705
|
.fotorama__wrap--css3 .fotorama__video-close {
|
678
|
-
-webkit-transition:
|
679
|
-
transition:
|
706
|
+
-webkit-transition-property: top, right, left, opacity;
|
707
|
+
transition-property: top, right, left, opacity;
|
708
|
+
-webkit-transition-duration: 0.3s;
|
709
|
+
transition-duration: 0.3s;
|
680
710
|
}
|
681
711
|
|
682
712
|
.fotorama__stage:before,
|
@@ -692,6 +722,7 @@
|
|
692
722
|
width: 10px;
|
693
723
|
height: auto;
|
694
724
|
z-index: 10;
|
725
|
+
pointer-events: none;
|
695
726
|
background-repeat: no-repeat;
|
696
727
|
background-size: 1px 100%, 5px 100%;
|
697
728
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fotoramajs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- Rakefile
|
60
60
|
- fotoramajs.gemspec
|
61
61
|
- lib/fotoramajs.rb
|
62
|
-
- lib/fotoramajs/updater.rb
|
63
62
|
- lib/fotoramajs/version.rb
|
64
63
|
- vendor/assets/images/fotorama.png
|
65
64
|
- vendor/assets/images/fotorama@2x.png
|
@@ -80,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
79
|
version: '0'
|
81
80
|
segments:
|
82
81
|
- 0
|
83
|
-
hash: -
|
82
|
+
hash: -3717274209991928291
|
84
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
84
|
none: false
|
86
85
|
requirements:
|
@@ -89,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
88
|
version: '0'
|
90
89
|
segments:
|
91
90
|
- 0
|
92
|
-
hash: -
|
91
|
+
hash: -3717274209991928291
|
93
92
|
requirements: []
|
94
93
|
rubyforge_project:
|
95
94
|
rubygems_version: 1.8.23
|
data/lib/fotoramajs/updater.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
require "httpclient"
|
3
|
-
|
4
|
-
class Updater
|
5
|
-
def self.update
|
6
|
-
instance = new
|
7
|
-
|
8
|
-
puts "Fetching tags"
|
9
|
-
tag = instance.github_tags('artpolikarpov/fotorama').last
|
10
|
-
|
11
|
-
puts "Load Fotorama #{tag}"
|
12
|
-
instance.fetch(tag)
|
13
|
-
|
14
|
-
puts "Convert CSS to SCSS"
|
15
|
-
instance.convert
|
16
|
-
|
17
|
-
puts "Update gem version"
|
18
|
-
instance.update_version(tag)
|
19
|
-
|
20
|
-
puts "Done."
|
21
|
-
end
|
22
|
-
|
23
|
-
def fetch(tag)
|
24
|
-
cdn = "http://fotorama.s3.amazonaws.com/#{tag}"
|
25
|
-
%w(fotorama.js fotorama.css fotorama.png fotorama@2x.png).each do |file|
|
26
|
-
from = "#{cdn}/#{file}".sub(/(.css|.js)$/, '.uncompressed\\1')
|
27
|
-
get from, asset(file)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def update_version(tag)
|
32
|
-
version_file.open('w') do |io|
|
33
|
-
io << "module Fotoramajs\n VERSION = \"#{tag}\"\nend\n"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def convert
|
38
|
-
css = asset('fotorama.css')
|
39
|
-
scss = asset('fotorama.css.scss')
|
40
|
-
|
41
|
-
scss.open('w') do |io|
|
42
|
-
io << css.read.gsub(/url\(/, 'image-url(')
|
43
|
-
end
|
44
|
-
|
45
|
-
css.delete
|
46
|
-
end
|
47
|
-
|
48
|
-
def asset(file)
|
49
|
-
@assets ||= Pathname(__FILE__).dirname.join('../../vendor/assets')
|
50
|
-
|
51
|
-
if file.end_with? '.css' or file.end_with? '.scss'
|
52
|
-
@assets.join('stylesheets', file)
|
53
|
-
elsif file.end_with? '.js'
|
54
|
-
@assets.join('javascripts', file)
|
55
|
-
else
|
56
|
-
@assets.join('images', file)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def version_file
|
61
|
-
@version ||= Pathname(__FILE__).dirname.join('version.rb')
|
62
|
-
end
|
63
|
-
|
64
|
-
def github_tags(repo)
|
65
|
-
http = HTTPClient.new
|
66
|
-
body = http.get("https://api.github.com/repos/#{repo}/tags").body
|
67
|
-
response = JSON.parse(body)
|
68
|
-
response.map { |tag| Gem::Version.new(tag['name']) }.sort
|
69
|
-
end
|
70
|
-
|
71
|
-
def get(url, to)
|
72
|
-
to.open('w') do |io|
|
73
|
-
http = HTTPClient.new
|
74
|
-
http.transparent_gzip_decompression = true
|
75
|
-
io << http.get(url).body
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|