cloudinary 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/CHANGELOG.md +31 -0
- data/CONTRIBUTING.md +136 -0
- data/README.md +46 -1
- data/Rakefile +2 -1
- data/lib/cloudinary/api.rb +1 -1
- data/lib/cloudinary/carrier_wave/process.rb +1 -1
- data/lib/cloudinary/migrator.rb +1 -1
- data/lib/cloudinary/uploader.rb +2 -1
- data/lib/cloudinary/utils.rb +3 -0
- data/lib/cloudinary/version.rb +1 -1
- data/lib/tasks/cloudinary.rake +2 -2
- data/spec/api_spec.rb +120 -151
- data/spec/archive_spec.rb +10 -8
- data/spec/spec_helper.rb +58 -4
- data/spec/uploader_spec.rb +80 -47
- data/spec/utils_spec.rb +15 -11
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.coffee +2841 -0
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +395 -27
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js.map +10 -0
- metadata +6 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/**
|
3
|
-
* Cloudinary's JavaScript library - Version 2.0.
|
3
|
+
* Cloudinary's JavaScript library - Version 2.0.9
|
4
4
|
* Copyright Cloudinary
|
5
5
|
* see https://github.com/cloudinary/cloudinary_js
|
6
6
|
*
|
@@ -9,13 +9,20 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
9
9
|
hasProp = {}.hasOwnProperty;
|
10
10
|
|
11
11
|
(function(root, factory) {
|
12
|
+
var name, ref, results, value;
|
12
13
|
if ((typeof define === 'function') && define.amd) {
|
13
14
|
return define(['jquery'], factory);
|
14
15
|
} else if (typeof exports === 'object') {
|
15
16
|
return module.exports = factory(require('jquery'));
|
16
17
|
} else {
|
17
18
|
root.cloudinary || (root.cloudinary = {});
|
18
|
-
|
19
|
+
ref = factory(jQuery);
|
20
|
+
results = [];
|
21
|
+
for (name in ref) {
|
22
|
+
value = ref[name];
|
23
|
+
results.push(root.cloudinary[name] = value);
|
24
|
+
}
|
25
|
+
return results;
|
19
26
|
}
|
20
27
|
})(this, function(jQuery) {
|
21
28
|
|
@@ -32,7 +39,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
32
39
|
* @returns the value associated with the `name`
|
33
40
|
* @function Util.getData
|
34
41
|
*/
|
35
|
-
var ArrayParam, Cloudinary, CloudinaryJQuery, Condition, Configuration, HtmlTag, ImageTag, Param, RangeParam, RawParam, Transformation, TransformationBase, TransformationParam, Util, VideoTag, addClass, allStrings, camelCase, cloneDeep, cloudinary, compact, contains, crc32, defaults, difference, functions, getAttribute, getData, hasClass, identity, isEmpty, isString, merge, parameters, reWords, removeAttribute, setAttribute, setAttributes, setData, snakeCase, utf8_encode, webp, width, without;
|
42
|
+
var ArrayParam, Cloudinary, CloudinaryJQuery, Condition, Configuration, HtmlTag, ImageTag, Layer, LayerParam, Param, RangeParam, RawParam, SubtitlesLayer, TextLayer, Transformation, TransformationBase, TransformationParam, Util, VideoTag, addClass, allStrings, camelCase, cloneDeep, cloudinary, compact, contains, crc32, defaults, difference, functions, getAttribute, getData, hasClass, identity, isEmpty, isString, merge, parameters, reWords, removeAttribute, setAttribute, setAttributes, setData, snakeCase, utf8_encode, webp, width, without;
|
36
43
|
getData = function(element, name) {
|
37
44
|
return jQuery(element).data(name);
|
38
45
|
};
|
@@ -445,12 +452,12 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
445
452
|
* @param {string} name - The name of the parameter in snake_case
|
446
453
|
* @param {string} short - The name of the serialized form of the parameter.
|
447
454
|
* If a value is not provided, the parameter will not be serialized.
|
448
|
-
* @param {function} [process=Util.identity ] - Manipulate origValue when value is called
|
455
|
+
* @param {function} [process=cloudinary.Util.identity ] - Manipulate origValue when value is called
|
449
456
|
* @ignore
|
450
457
|
*/
|
451
458
|
function Param(name, short, process) {
|
452
459
|
if (process == null) {
|
453
|
-
process = Util.identity;
|
460
|
+
process = cloudinary.Util.identity;
|
454
461
|
}
|
455
462
|
|
456
463
|
/**
|
@@ -495,7 +502,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
495
502
|
Param.prototype.serialize = function() {
|
496
503
|
var val, valid;
|
497
504
|
val = this.value();
|
498
|
-
valid = Util.isArray(val) || Util.isPlainObject(val) || Util.isString(val) ? !Util.isEmpty(val) : val != null;
|
505
|
+
valid = cloudinary.Util.isArray(val) || cloudinary.Util.isPlainObject(val) || cloudinary.Util.isString(val) ? !cloudinary.Util.isEmpty(val) : val != null;
|
499
506
|
if ((this.short != null) && valid) {
|
500
507
|
return this.short + "_" + val;
|
501
508
|
} else {
|
@@ -521,7 +528,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
521
528
|
if (arg == null) {
|
522
529
|
arg = [];
|
523
530
|
}
|
524
|
-
if (Util.isArray(arg)) {
|
531
|
+
if (cloudinary.Util.isArray(arg)) {
|
525
532
|
return arg;
|
526
533
|
} else {
|
527
534
|
return [arg];
|
@@ -577,7 +584,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
577
584
|
* @param {string} short - The name of the serialized form of the parameter
|
578
585
|
* If a value is not provided, the parameter will not be serialized.
|
579
586
|
* @param {string} [sep='.'] - The separator to use when joining the array elements together
|
580
|
-
* @param {function} [process=Util.identity ] - Manipulate origValue when value is called
|
587
|
+
* @param {function} [process=cloudinary.Util.identity ] - Manipulate origValue when value is called
|
581
588
|
* @class ArrayParam
|
582
589
|
* @extends Param
|
583
590
|
* @ignore
|
@@ -595,7 +602,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
595
602
|
var array, flat, t;
|
596
603
|
if (this.short != null) {
|
597
604
|
array = this.value();
|
598
|
-
if (Util.isEmpty(array)) {
|
605
|
+
if (cloudinary.Util.isEmpty(array)) {
|
599
606
|
return '';
|
600
607
|
} else {
|
601
608
|
flat = (function() {
|
@@ -604,7 +611,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
604
611
|
results = [];
|
605
612
|
for (j = 0, len = ref.length; j < len; j++) {
|
606
613
|
t = ref[j];
|
607
|
-
if (Util.isFunction(t.serialize)) {
|
614
|
+
if (cloudinary.Util.isFunction(t.serialize)) {
|
608
615
|
results.push(t.serialize());
|
609
616
|
} else {
|
610
617
|
results.push(t);
|
@@ -620,7 +627,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
620
627
|
};
|
621
628
|
|
622
629
|
ArrayParam.prototype.set = function(origValue) {
|
623
|
-
if ((origValue == null) || Util.isArray(origValue)) {
|
630
|
+
if ((origValue == null) || cloudinary.Util.isArray(origValue)) {
|
624
631
|
return ArrayParam.__super__.set.call(this, origValue);
|
625
632
|
} else {
|
626
633
|
return ArrayParam.__super__.set.call(this, [origValue]);
|
@@ -639,7 +646,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
639
646
|
* @param {string} name - The name of the parameter in snake_case
|
640
647
|
* @param {string} [short='t'] - The name of the serialized form of the parameter
|
641
648
|
* @param {string} [sep='.'] - The separator to use when joining the array elements together
|
642
|
-
* @param {function} [process=Util.identity ] - Manipulate origValue when value is called
|
649
|
+
* @param {function} [process=cloudinary.Util.identity ] - Manipulate origValue when value is called
|
643
650
|
* @class TransformationParam
|
644
651
|
* @extends Param
|
645
652
|
* @ignore
|
@@ -658,11 +665,11 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
658
665
|
|
659
666
|
TransformationParam.prototype.serialize = function() {
|
660
667
|
var joined, result, t;
|
661
|
-
if (Util.isEmpty(this.value())) {
|
668
|
+
if (cloudinary.Util.isEmpty(this.value())) {
|
662
669
|
return '';
|
663
|
-
} else if (Util.allStrings(this.value())) {
|
670
|
+
} else if (cloudinary.Util.allStrings(this.value())) {
|
664
671
|
joined = this.value().join(this.sep);
|
665
|
-
if (!Util.isEmpty(joined)) {
|
672
|
+
if (!cloudinary.Util.isEmpty(joined)) {
|
666
673
|
return this.short + "_" + joined;
|
667
674
|
} else {
|
668
675
|
return '';
|
@@ -675,11 +682,11 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
675
682
|
for (j = 0, len = ref.length; j < len; j++) {
|
676
683
|
t = ref[j];
|
677
684
|
if (t != null) {
|
678
|
-
if (Util.isString(t) && !Util.isEmpty(t)) {
|
685
|
+
if (cloudinary.Util.isString(t) && !cloudinary.Util.isEmpty(t)) {
|
679
686
|
results.push(this.short + "_" + t);
|
680
|
-
} else if (Util.isFunction(t.serialize)) {
|
687
|
+
} else if (cloudinary.Util.isFunction(t.serialize)) {
|
681
688
|
results.push(t.serialize());
|
682
|
-
} else if (Util.isPlainObject(t) && !Util.isEmpty(t)) {
|
689
|
+
} else if (cloudinary.Util.isPlainObject(t) && !cloudinary.Util.isEmpty(t)) {
|
683
690
|
results.push(new Transformation(t).serialize());
|
684
691
|
} else {
|
685
692
|
results.push(void 0);
|
@@ -688,13 +695,13 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
688
695
|
}
|
689
696
|
return results;
|
690
697
|
}).call(this);
|
691
|
-
return Util.compact(result);
|
698
|
+
return cloudinary.Util.compact(result);
|
692
699
|
}
|
693
700
|
};
|
694
701
|
|
695
702
|
TransformationParam.prototype.set = function(origValue1) {
|
696
703
|
this.origValue = origValue1;
|
697
|
-
if (Util.isArray(this.origValue)) {
|
704
|
+
if (cloudinary.Util.isArray(this.origValue)) {
|
698
705
|
return TransformationParam.__super__.set.call(this, this.origValue);
|
699
706
|
} else {
|
700
707
|
return TransformationParam.__super__.set.call(this, [this.origValue]);
|
@@ -744,7 +751,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
744
751
|
|
745
752
|
function RawParam(name, short, process) {
|
746
753
|
if (process == null) {
|
747
|
-
process = Util.identity;
|
754
|
+
process = cloudinary.Util.identity;
|
748
755
|
}
|
749
756
|
RawParam.__super__.constructor.call(this, name, short, process);
|
750
757
|
}
|
@@ -755,6 +762,105 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
755
762
|
|
756
763
|
return RawParam;
|
757
764
|
|
765
|
+
})(Param);
|
766
|
+
LayerParam = (function(superClass) {
|
767
|
+
var LAYER_KEYWORD_PARAMS;
|
768
|
+
|
769
|
+
extend(LayerParam, superClass);
|
770
|
+
|
771
|
+
function LayerParam() {
|
772
|
+
return LayerParam.__super__.constructor.apply(this, arguments);
|
773
|
+
}
|
774
|
+
|
775
|
+
LayerParam.prototype.value = function() {
|
776
|
+
var components, format, layer, publicId, resourceType, text, textStyle, type;
|
777
|
+
layer = this.origValue;
|
778
|
+
if (cloudinary.Util.isPlainObject(layer)) {
|
779
|
+
publicId = layer.public_id;
|
780
|
+
format = layer.format;
|
781
|
+
resourceType = layer.resource_type || "image";
|
782
|
+
type = layer.type || "upload";
|
783
|
+
text = layer.text;
|
784
|
+
textStyle = null;
|
785
|
+
components = [];
|
786
|
+
if (publicId != null) {
|
787
|
+
publicId = publicId.replace(/\//g, ":");
|
788
|
+
if (format != null) {
|
789
|
+
publicId = publicId + "." + format;
|
790
|
+
}
|
791
|
+
}
|
792
|
+
if ((text == null) && resourceType !== "text") {
|
793
|
+
if (cloudinary.Util.isEmpty(publicId)) {
|
794
|
+
throw "Must supply public_id for resource_type layer_parameter";
|
795
|
+
}
|
796
|
+
if (resourceType === "subtitles") {
|
797
|
+
textStyle = this.textStyle(layer);
|
798
|
+
}
|
799
|
+
} else {
|
800
|
+
resourceType = "text";
|
801
|
+
type = null;
|
802
|
+
textStyle = this.textStyle(layer);
|
803
|
+
if (text != null) {
|
804
|
+
if (!((publicId != null) ^ (textStyle != null))) {
|
805
|
+
throw "Must supply either style parameters or a public_id when providing text parameter in a text overlay/underlay";
|
806
|
+
}
|
807
|
+
text = cloudinary.Util.smart_escape(cloudinary.Util.smart_escape(text, /([,\/])/));
|
808
|
+
}
|
809
|
+
}
|
810
|
+
if (resourceType !== "image") {
|
811
|
+
components.push(resourceType);
|
812
|
+
}
|
813
|
+
if (type !== "upload") {
|
814
|
+
components.push(type);
|
815
|
+
}
|
816
|
+
components.push(textStyle);
|
817
|
+
components.push(publicId);
|
818
|
+
components.push(text);
|
819
|
+
layer = cloudinary.Util.compact(components).join(":");
|
820
|
+
}
|
821
|
+
return layer;
|
822
|
+
};
|
823
|
+
|
824
|
+
LAYER_KEYWORD_PARAMS = [["font_weight", "normal"], ["font_style", "normal"], ["text_decoration", "none"], ["text_align", null], ["stroke", "none"]];
|
825
|
+
|
826
|
+
LayerParam.prototype.textStyle = function(layer) {
|
827
|
+
var attr, defaultValue, fontFamily, fontSize, keywords, letterSpacing, lineSpacing;
|
828
|
+
fontFamily = layer.font_family;
|
829
|
+
fontSize = layer.font_size;
|
830
|
+
keywords = (function() {
|
831
|
+
var j, len, ref, results;
|
832
|
+
results = [];
|
833
|
+
for (j = 0, len = LAYER_KEYWORD_PARAMS.length; j < len; j++) {
|
834
|
+
ref = LAYER_KEYWORD_PARAMS[j], attr = ref[0], defaultValue = ref[1];
|
835
|
+
if (layer[attr] !== defaultValue) {
|
836
|
+
results.push(layer[attr]);
|
837
|
+
}
|
838
|
+
}
|
839
|
+
return results;
|
840
|
+
})();
|
841
|
+
letterSpacing = layer.letter_spacing;
|
842
|
+
if (!cloudinary.Util.isEmpty(letterSpacing)) {
|
843
|
+
keywords.push("letter_spacing_" + letterSpacing);
|
844
|
+
}
|
845
|
+
lineSpacing = layer.line_spacing;
|
846
|
+
if (!cloudinary.Util.isEmpty(lineSpacing)) {
|
847
|
+
keywords.push("line_spacing_" + lineSpacing);
|
848
|
+
}
|
849
|
+
if (!cloudinary.Util.isEmpty(fontSize) || !cloudinary.Util.isEmpty(fontFamily) || !cloudinary.Util.isEmpty(keywords)) {
|
850
|
+
if (cloudinary.Util.isEmpty(fontFamily)) {
|
851
|
+
throw "Must supply font_family for text in overlay/underlay";
|
852
|
+
}
|
853
|
+
if (cloudinary.Util.isEmpty(fontSize)) {
|
854
|
+
throw "Must supply font_size for text in overlay/underlay";
|
855
|
+
}
|
856
|
+
keywords.unshift(fontSize);
|
857
|
+
keywords.unshift(fontFamily);
|
858
|
+
return cloudinary.Util.compact(keywords).join("_");
|
859
|
+
}
|
860
|
+
};
|
861
|
+
|
862
|
+
return LayerParam;
|
863
|
+
|
758
864
|
})(Param);
|
759
865
|
parameters = {};
|
760
866
|
parameters.Param = Param;
|
@@ -762,6 +868,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
762
868
|
parameters.RangeParam = RangeParam;
|
763
869
|
parameters.RawParam = RawParam;
|
764
870
|
parameters.TransformationParam = TransformationParam;
|
871
|
+
parameters.LayerParam = LayerParam;
|
765
872
|
Condition = (function() {
|
766
873
|
|
767
874
|
/**
|
@@ -1160,6 +1267,10 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
1160
1267
|
trans[name] = new TransformationParam(name, abbr, sep, process).set(value);
|
1161
1268
|
return this;
|
1162
1269
|
});
|
1270
|
+
this.layerParam || (this.layerParam = function(value, name, abbr) {
|
1271
|
+
trans[name] = new LayerParam(name, abbr).set(value);
|
1272
|
+
return this;
|
1273
|
+
});
|
1163
1274
|
|
1164
1275
|
/**
|
1165
1276
|
* Get the value associated with the given name.
|
@@ -1740,6 +1851,10 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
1740
1851
|
}
|
1741
1852
|
};
|
1742
1853
|
|
1854
|
+
Transformation.prototype.keyframeInterval = function(value) {
|
1855
|
+
return this.param(value, "keyframe_interval", "ki");
|
1856
|
+
};
|
1857
|
+
|
1743
1858
|
Transformation.prototype.offset = function(value) {
|
1744
1859
|
var end_o, ref, start_o;
|
1745
1860
|
ref = Util.isFunction(value != null ? value.split : void 0) ? value.split('..') : Util.isArray(value) ? value : [null, null], start_o = ref[0], end_o = ref[1];
|
@@ -1756,7 +1871,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
1756
1871
|
};
|
1757
1872
|
|
1758
1873
|
Transformation.prototype.overlay = function(value) {
|
1759
|
-
return this.
|
1874
|
+
return this.layerParam(value, "overlay", "l");
|
1760
1875
|
};
|
1761
1876
|
|
1762
1877
|
Transformation.prototype.page = function(value) {
|
@@ -1804,12 +1919,16 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
1804
1919
|
return this.rangeParam(value, "start_offset", "so");
|
1805
1920
|
};
|
1806
1921
|
|
1922
|
+
Transformation.prototype.streamingProfile = function(value) {
|
1923
|
+
return this.param(value, "streaming_profile", "sp");
|
1924
|
+
};
|
1925
|
+
|
1807
1926
|
Transformation.prototype.transformation = function(value) {
|
1808
1927
|
return this.transformationParam(value, "transformation", "t");
|
1809
1928
|
};
|
1810
1929
|
|
1811
1930
|
Transformation.prototype.underlay = function(value) {
|
1812
|
-
return this.
|
1931
|
+
return this.layerParam(value, "underlay", "u");
|
1813
1932
|
};
|
1814
1933
|
|
1815
1934
|
Transformation.prototype.videoCodec = function(value) {
|
@@ -2092,7 +2211,7 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
2092
2211
|
* @protected
|
2093
2212
|
* @param {string} key - attribute name
|
2094
2213
|
* @param {*|boolean} value - the value of the attribute. If the value is boolean `true`, return the key only.
|
2095
|
-
* @returns {string} the attribute
|
2214
|
+
* @returns {string} the attribute
|
2096
2215
|
*
|
2097
2216
|
*/
|
2098
2217
|
|
@@ -2471,10 +2590,256 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
2471
2590
|
return VideoTag;
|
2472
2591
|
|
2473
2592
|
})(HtmlTag);
|
2593
|
+
Layer = (function() {
|
2594
|
+
|
2595
|
+
/**
|
2596
|
+
* Layer
|
2597
|
+
* @constructor Layer
|
2598
|
+
* @param {Object} options - layer parameters
|
2599
|
+
*/
|
2600
|
+
function Layer(options) {
|
2601
|
+
this.options = {};
|
2602
|
+
if (options != null) {
|
2603
|
+
this.options.resourceType = options["resource_type"];
|
2604
|
+
this.options.type = options["type"];
|
2605
|
+
this.options.publicId = options["public_id"];
|
2606
|
+
this.options.format = options["format"];
|
2607
|
+
}
|
2608
|
+
}
|
2609
|
+
|
2610
|
+
Layer.prototype.resourceType = function(value) {
|
2611
|
+
this.options.resourceType = value;
|
2612
|
+
return this;
|
2613
|
+
};
|
2614
|
+
|
2615
|
+
Layer.prototype.type = function(value) {
|
2616
|
+
this.options.type = value;
|
2617
|
+
return this;
|
2618
|
+
};
|
2619
|
+
|
2620
|
+
Layer.prototype.publicId = function(value) {
|
2621
|
+
this.options.publicId = value;
|
2622
|
+
return this;
|
2623
|
+
};
|
2624
|
+
|
2625
|
+
|
2626
|
+
/**
|
2627
|
+
* Get the public ID, formatted for layer parameter
|
2628
|
+
* @function Layer#getPublicId
|
2629
|
+
* @return {String} public ID
|
2630
|
+
*/
|
2631
|
+
|
2632
|
+
Layer.prototype.getPublicId = function() {
|
2633
|
+
var ref;
|
2634
|
+
return (ref = this.options.publicId) != null ? ref.replace(/\//g, ":") : void 0;
|
2635
|
+
};
|
2636
|
+
|
2637
|
+
|
2638
|
+
/**
|
2639
|
+
* Get the public ID, with format if present
|
2640
|
+
* @function Layer#getFullPublicId
|
2641
|
+
* @return {String} public ID
|
2642
|
+
*/
|
2643
|
+
|
2644
|
+
Layer.prototype.getFullPublicId = function() {
|
2645
|
+
if (this.options.format != null) {
|
2646
|
+
return this.getPublicId() + "." + this.options.format;
|
2647
|
+
} else {
|
2648
|
+
return this.getPublicId();
|
2649
|
+
}
|
2650
|
+
};
|
2651
|
+
|
2652
|
+
Layer.prototype.format = function(value) {
|
2653
|
+
this.options.format = value;
|
2654
|
+
return this;
|
2655
|
+
};
|
2656
|
+
|
2657
|
+
|
2658
|
+
/**
|
2659
|
+
* generate the string representation of the layer
|
2660
|
+
* @function Layer#toString
|
2661
|
+
*/
|
2662
|
+
|
2663
|
+
Layer.prototype.toString = function() {
|
2664
|
+
var components;
|
2665
|
+
components = [];
|
2666
|
+
if (this.options.publicId == null) {
|
2667
|
+
throw "Must supply publicId";
|
2668
|
+
}
|
2669
|
+
if (!(this.options.resourceType === "image")) {
|
2670
|
+
components.push(this.options.resourceType);
|
2671
|
+
}
|
2672
|
+
if (!(this.options.type === "upload")) {
|
2673
|
+
components.push(this.options.type);
|
2674
|
+
}
|
2675
|
+
components.push(this.getFullPublicId());
|
2676
|
+
return Util.compact(components).join(":");
|
2677
|
+
};
|
2678
|
+
|
2679
|
+
return Layer;
|
2680
|
+
|
2681
|
+
})();
|
2682
|
+
TextLayer = (function(superClass) {
|
2683
|
+
var textStyleIdentifier;
|
2684
|
+
|
2685
|
+
extend(TextLayer, superClass);
|
2686
|
+
|
2687
|
+
|
2688
|
+
/**
|
2689
|
+
* @constructor TextLayer
|
2690
|
+
* @param {Object} options - layer parameters
|
2691
|
+
*/
|
2692
|
+
|
2693
|
+
function TextLayer(options) {
|
2694
|
+
TextLayer.__super__.constructor.call(this, options);
|
2695
|
+
this.options.resourceType = "text";
|
2696
|
+
}
|
2697
|
+
|
2698
|
+
TextLayer.prototype.resourceType = function(resourceType) {
|
2699
|
+
throw "Cannot modify resourceType for text layers";
|
2700
|
+
};
|
2701
|
+
|
2702
|
+
TextLayer.prototype.type = function(type) {
|
2703
|
+
throw "Cannot modify type for text layers";
|
2704
|
+
};
|
2705
|
+
|
2706
|
+
TextLayer.prototype.format = function(format) {
|
2707
|
+
throw "Cannot modify format for text layers";
|
2708
|
+
};
|
2709
|
+
|
2710
|
+
TextLayer.prototype.fontFamily = function(fontFamily) {
|
2711
|
+
this.options.fontFamily = fontFamily;
|
2712
|
+
return this;
|
2713
|
+
};
|
2714
|
+
|
2715
|
+
TextLayer.prototype.fontSize = function(fontSize) {
|
2716
|
+
this.options.fontSize = fontSize;
|
2717
|
+
return this;
|
2718
|
+
};
|
2719
|
+
|
2720
|
+
TextLayer.prototype.fontWeight = function(fontWeight) {
|
2721
|
+
this.options.fontWeight = fontWeight;
|
2722
|
+
return this;
|
2723
|
+
};
|
2724
|
+
|
2725
|
+
TextLayer.prototype.fontStyle = function(fontStyle) {
|
2726
|
+
this.options.fontStyle = fontStyle;
|
2727
|
+
return this;
|
2728
|
+
};
|
2729
|
+
|
2730
|
+
TextLayer.prototype.textDecoration = function(textDecoration) {
|
2731
|
+
this.options.textDecoration = textDecoration;
|
2732
|
+
return this;
|
2733
|
+
};
|
2734
|
+
|
2735
|
+
TextLayer.prototype.textAlign = function(textAlign) {
|
2736
|
+
this.options.textAlign = textAlign;
|
2737
|
+
return this;
|
2738
|
+
};
|
2739
|
+
|
2740
|
+
TextLayer.prototype.stroke = function(stroke) {
|
2741
|
+
this.options.stroke = stroke;
|
2742
|
+
return this;
|
2743
|
+
};
|
2744
|
+
|
2745
|
+
TextLayer.prototype.letterSpacing = function(letterSpacing) {
|
2746
|
+
this.options.letterSpacing = letterSpacing;
|
2747
|
+
return this;
|
2748
|
+
};
|
2749
|
+
|
2750
|
+
TextLayer.prototype.lineSpacing = function(lineSpacing) {
|
2751
|
+
this.options.lineSpacing = lineSpacing;
|
2752
|
+
return this;
|
2753
|
+
};
|
2754
|
+
|
2755
|
+
TextLayer.prototype.text = function(text) {
|
2756
|
+
this.options.text = text;
|
2757
|
+
return this;
|
2758
|
+
};
|
2759
|
+
|
2760
|
+
|
2761
|
+
/**
|
2762
|
+
* generate the string representation of the layer
|
2763
|
+
* @function TextLayer#toString
|
2764
|
+
* @return {String}
|
2765
|
+
*/
|
2766
|
+
|
2767
|
+
TextLayer.prototype.toString = function() {
|
2768
|
+
var components, publicId, text;
|
2769
|
+
if (this.options.publicId != null) {
|
2770
|
+
publicId = this.getFullPublicId();
|
2771
|
+
} else if (this.options.text != null) {
|
2772
|
+
text = encodeURIComponent(this.options.text).replace(/%2C/g, "%E2%80%9A").replace(/\//g, "%E2%81%84");
|
2773
|
+
} else {
|
2774
|
+
throw "Must supply either text or public_id.";
|
2775
|
+
}
|
2776
|
+
components = [this.options.resourceType, textStyleIdentifier.call(this), publicId, text];
|
2777
|
+
return Util.compact(components).join(":");
|
2778
|
+
};
|
2779
|
+
|
2780
|
+
textStyleIdentifier = function() {
|
2781
|
+
var components, fontSize;
|
2782
|
+
components = [];
|
2783
|
+
if (this.options.fontWeight !== "normal") {
|
2784
|
+
components.push(this.options.fontWeight);
|
2785
|
+
}
|
2786
|
+
if (this.options.fontStyle !== "normal") {
|
2787
|
+
components.push(this.options.fontStyle);
|
2788
|
+
}
|
2789
|
+
if (this.options.textDecoration !== "none") {
|
2790
|
+
components.push(this.options.textDecoration);
|
2791
|
+
}
|
2792
|
+
components.push(this.options.textAlign);
|
2793
|
+
if (this.options.stroke !== "none") {
|
2794
|
+
components.push(this.options.stroke);
|
2795
|
+
}
|
2796
|
+
if (!Util.isEmpty(this.options.letterSpacing)) {
|
2797
|
+
components.push("letter_spacing_" + this.options.letterSpacing);
|
2798
|
+
}
|
2799
|
+
if (this.options.lineSpacing != null) {
|
2800
|
+
components.push("line_spacing_" + this.options.lineSpacing);
|
2801
|
+
}
|
2802
|
+
if (this.options.fontSize != null) {
|
2803
|
+
fontSize = "" + this.options.fontSize;
|
2804
|
+
}
|
2805
|
+
components.unshift(this.options.fontFamily, fontSize);
|
2806
|
+
components = Util.compact(components).join("_");
|
2807
|
+
if (!Util.isEmpty(components)) {
|
2808
|
+
if (Util.isEmpty(this.options.fontFamily)) {
|
2809
|
+
throw "Must supply fontFamily.";
|
2810
|
+
}
|
2811
|
+
if (Util.isEmpty(fontSize)) {
|
2812
|
+
throw "Must supply fontSize.";
|
2813
|
+
}
|
2814
|
+
}
|
2815
|
+
return components;
|
2816
|
+
};
|
2817
|
+
|
2818
|
+
return TextLayer;
|
2819
|
+
|
2820
|
+
})(Layer);
|
2821
|
+
SubtitlesLayer = (function(superClass) {
|
2822
|
+
extend(SubtitlesLayer, superClass);
|
2823
|
+
|
2824
|
+
|
2825
|
+
/**
|
2826
|
+
* Represent a subtitles layer
|
2827
|
+
* @constructor SubtitlesLayer
|
2828
|
+
* @param {Object} options - layer parameters
|
2829
|
+
*/
|
2830
|
+
|
2831
|
+
function SubtitlesLayer(options) {
|
2832
|
+
SubtitlesLayer.__super__.constructor.call(this, options);
|
2833
|
+
this.options.resourceType = "subtitles";
|
2834
|
+
}
|
2835
|
+
|
2836
|
+
return SubtitlesLayer;
|
2837
|
+
|
2838
|
+
})(TextLayer);
|
2474
2839
|
Cloudinary = (function() {
|
2475
2840
|
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, parentWidth;
|
2476
2841
|
|
2477
|
-
VERSION = "2.0.
|
2842
|
+
VERSION = "2.0.9";
|
2478
2843
|
|
2479
2844
|
CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net";
|
2480
2845
|
|
@@ -3653,11 +4018,14 @@ var extend = function(child, parent) { for (var key in parent) { if (hasProp.cal
|
|
3653
4018
|
HtmlTag: HtmlTag,
|
3654
4019
|
ImageTag: ImageTag,
|
3655
4020
|
VideoTag: VideoTag,
|
4021
|
+
Layer: Layer,
|
4022
|
+
TextLayer: TextLayer,
|
4023
|
+
SubtitlesLayer: SubtitlesLayer,
|
3656
4024
|
Cloudinary: Cloudinary,
|
3657
|
-
VERSION: "2.0.
|
4025
|
+
VERSION: "2.0.9",
|
3658
4026
|
CloudinaryJQuery: CloudinaryJQuery
|
3659
4027
|
};
|
3660
4028
|
return cloudinary;
|
3661
4029
|
});
|
3662
4030
|
|
3663
|
-
//# sourceMappingURL=
|
4031
|
+
//# sourceMappingURL=jquery.cloudinary.js.map
|