cloudinary 1.11.1 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- data/.github/pull_request_template.md +24 -0
- data/.gitignore +6 -1
- data/.travis.yml +15 -5
- data/CHANGELOG.md +149 -0
- data/Rakefile +3 -45
- data/cloudinary.gemspec +20 -4
- data/lib/active_storage/blob_key.rb +20 -0
- data/lib/active_storage/service/cloudinary_service.rb +229 -0
- data/lib/cloudinary.rb +31 -22
- data/lib/cloudinary/api.rb +173 -5
- data/lib/cloudinary/auth_token.rb +6 -4
- data/lib/cloudinary/carrier_wave.rb +3 -1
- data/lib/cloudinary/carrier_wave/remote.rb +3 -2
- data/lib/cloudinary/carrier_wave/storage.rb +2 -1
- data/lib/cloudinary/cloudinary_controller.rb +2 -4
- data/lib/cloudinary/helper.rb +30 -3
- data/lib/cloudinary/railtie.rb +7 -3
- data/lib/cloudinary/uploader.rb +35 -6
- data/lib/cloudinary/utils.rb +112 -40
- data/lib/cloudinary/version.rb +1 -1
- data/lib/cloudinary/video_helper.rb +96 -22
- data/lib/tasks/cloudinary/fetch_assets.rake +48 -0
- data/lib/tasks/{cloudinary.rake → cloudinary/sync_static.rake} +0 -0
- data/tools/allocate_test_cloud.sh +9 -0
- data/tools/get_test_cloud.sh +9 -0
- data/tools/update_version +29 -11
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +48 -14
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +24 -4
- data/vendor/assets/javascripts/cloudinary/jquery.ui.widget.js +741 -561
- data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
- metadata +62 -67
- data/spec/access_control_spec.rb +0 -102
- data/spec/api_spec.rb +0 -567
- data/spec/archive_spec.rb +0 -129
- data/spec/auth_token_spec.rb +0 -77
- data/spec/cache_spec.rb +0 -109
- data/spec/cloudinary_helper_spec.rb +0 -325
- data/spec/cloudinary_spec.rb +0 -32
- data/spec/data/sync_static/app/assets/javascripts/1.coffee +0 -1
- data/spec/data/sync_static/app/assets/javascripts/1.js +0 -1
- data/spec/data/sync_static/app/assets/stylesheets/1.css +0 -3
- data/spec/docx.docx +0 -0
- data/spec/favicon.ico +0 -0
- data/spec/image_spec.rb +0 -107
- data/spec/logo.png +0 -0
- data/spec/rake_spec.rb +0 -160
- data/spec/sample_asset_file.tsv +0 -4
- data/spec/search_spec.rb +0 -109
- data/spec/spec_helper.rb +0 -266
- data/spec/storage_spec.rb +0 -44
- data/spec/streaminig_profiles_api_spec.rb +0 -74
- data/spec/support/helpers/temp_file_helpers.rb +0 -22
- data/spec/support/shared_contexts/rake.rb +0 -19
- data/spec/uploader_spec.rb +0 -392
- data/spec/utils_methods_spec.rb +0 -54
- data/spec/utils_spec.rb +0 -970
- data/spec/video_tag_spec.rb +0 -253
- data/spec/video_url_spec.rb +0 -185
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'rest_client'
|
3
|
+
require 'json'
|
4
|
+
require 'rubygems/package'
|
5
|
+
|
6
|
+
unless Rake::Task.task_defined?('cloudinary:fetch_assets') # prevent double-loading/execution
|
7
|
+
namespace :cloudinary do
|
8
|
+
desc "Fetch the latest JavaScript library files and create the JavaScript index files"
|
9
|
+
task :fetch_assets do
|
10
|
+
index_files = %w[jquery.ui.widget.js jquery.iframe-transport.js jquery.fileupload.js jquery.cloudinary.js]
|
11
|
+
processing_files = %w[canvas-to-blob.min.js load-image.all.min.js jquery.fileupload-process.js jquery.fileupload-image.js jquery.fileupload-validate.js]
|
12
|
+
files = index_files + processing_files
|
13
|
+
|
14
|
+
release = JSON(RestClient.get("https://api.github.com/repos/cloudinary/cloudinary_js/releases/latest"))
|
15
|
+
|
16
|
+
FileUtils.rm_rf 'vendor/assets'
|
17
|
+
html_folder = 'vendor/assets/html'
|
18
|
+
FileUtils.mkdir_p html_folder
|
19
|
+
js_folder = 'vendor/assets/javascripts/cloudinary'
|
20
|
+
FileUtils.mkdir_p js_folder
|
21
|
+
|
22
|
+
puts "Fetching cloudinary_js version #{release["tag_name"]}\n\n"
|
23
|
+
sio = StringIO.new(RestClient.get(release["tarball_url"]).body)
|
24
|
+
file = Zlib::GzipReader.new(sio)
|
25
|
+
tar = Gem::Package::TarReader.new(file)
|
26
|
+
tar.each_entry do |entry|
|
27
|
+
name = File.basename(entry.full_name)
|
28
|
+
if files.include? name
|
29
|
+
js_full_name = File.join(js_folder, name)
|
30
|
+
puts "Adding #{js_full_name}"
|
31
|
+
File.write js_full_name, entry.read
|
32
|
+
elsif name == 'cloudinary_cors.html'
|
33
|
+
html_full_name = File.join(html_folder, name)
|
34
|
+
puts "Adding #{html_full_name}"
|
35
|
+
File.write html_full_name, entry.read
|
36
|
+
end
|
37
|
+
end
|
38
|
+
puts "Creating 'index.js' and 'processing.js' files"
|
39
|
+
File.open("vendor/assets/javascripts/cloudinary/index.js", "w") do |f|
|
40
|
+
index_files.each { |name| f.puts "//= require ./#{name}" }
|
41
|
+
end
|
42
|
+
File.open("vendor/assets/javascripts/cloudinary/processing.js", "w") do |f|
|
43
|
+
processing_files.each { |name| f.puts "//= require ./#{name}" }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
API_ENDPOINT="https://sub-account-testing.cloudinary.com/create_sub_account"
|
4
|
+
|
5
|
+
SDK_NAME="${1}"
|
6
|
+
|
7
|
+
CLOUD_DETAILS=$(curl -sS -d "{\"prefix\" : \"${SDK_NAME}\"}" "${API_ENDPOINT}")
|
8
|
+
|
9
|
+
echo "${CLOUD_DETAILS}" | ruby -e "require 'json'; c=JSON.parse(ARGF.read)['payload']; puts 'cloudinary://' + c['cloudApiKey'] + ':'+ c['cloudApiSecret'] + '@' + c['cloudName']"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
4
|
+
|
5
|
+
RUBY_VER=$(ruby -v | head -n 1 | cut -d ' ' -f 2);
|
6
|
+
SDK_VER=$(grep -oiP '(?<=VERSION = ")([a-zA-Z0-9\-.]+)(?=")' lib/cloudinary/version.rb)
|
7
|
+
|
8
|
+
|
9
|
+
bash "${DIR}"/allocate_test_cloud.sh "Ruby ${RUBY_VER} SDK ${SDK_VER}"
|
data/tools/update_version
CHANGED
@@ -12,6 +12,8 @@ QUOTE=
|
|
12
12
|
|
13
13
|
NEW_VERSION=
|
14
14
|
|
15
|
+
UPDATE_ONLY=false
|
16
|
+
|
15
17
|
function echo_err
|
16
18
|
{
|
17
19
|
echo "$@" 1>&2;
|
@@ -23,6 +25,7 @@ function usage
|
|
23
25
|
echo " -v | --version <version> set a new version"
|
24
26
|
echo " -c | --current show current version"
|
25
27
|
echo " -d | --dry-run print the commands without executing them"
|
28
|
+
echo " -u | --update-only only update the version"
|
26
29
|
echo " -h | --help print this information and exit"
|
27
30
|
echo
|
28
31
|
echo "For example: $0 -v 1.2.3"
|
@@ -30,7 +33,7 @@ function usage
|
|
30
33
|
|
31
34
|
function process_arguments
|
32
35
|
{
|
33
|
-
while [ "$1" != "" ]; do
|
36
|
+
while [[ "$1" != "" ]]; do
|
34
37
|
case $1 in
|
35
38
|
-v | --version )
|
36
39
|
shift
|
@@ -53,6 +56,11 @@ function process_arguments
|
|
53
56
|
echo "Dry Run"
|
54
57
|
echo ""
|
55
58
|
;;
|
59
|
+
-u | --update-only )
|
60
|
+
UPDATE_ONLY=true
|
61
|
+
echo "Only update version"
|
62
|
+
echo ""
|
63
|
+
;;
|
56
64
|
-h | --help )
|
57
65
|
usage; return 0
|
58
66
|
;;
|
@@ -72,7 +80,7 @@ function pushd
|
|
72
80
|
# Intentionally make popd silent
|
73
81
|
function popd
|
74
82
|
{
|
75
|
-
command popd
|
83
|
+
command popd > /dev/null
|
76
84
|
}
|
77
85
|
|
78
86
|
# Check if one version is less than or equal than other
|
@@ -82,7 +90,7 @@ function popd
|
|
82
90
|
# ver_lte 1.2.4 1.2.3 && echo "yes" || echo "no" # no
|
83
91
|
function ver_lte
|
84
92
|
{
|
85
|
-
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
|
93
|
+
[[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]]
|
86
94
|
}
|
87
95
|
|
88
96
|
# Extract the last entry or entry for a given version
|
@@ -108,6 +116,10 @@ function verify_dependencies
|
|
108
116
|
return 1
|
109
117
|
fi
|
110
118
|
|
119
|
+
if [[ "${UPDATE_ONLY}" = true ]]; then
|
120
|
+
return 0;
|
121
|
+
fi
|
122
|
+
|
111
123
|
if [[ -z "$(type -t git-changelog)" ]]
|
112
124
|
then
|
113
125
|
echo_err "git-extras packages is not installed."
|
@@ -127,25 +139,26 @@ function safe_replace
|
|
127
139
|
|
128
140
|
grep -q "${old}" "${file}" || { echo_err "${old} was not found in ${file}"; return 1; }
|
129
141
|
|
130
|
-
${CMD_PREFIX} sed -
|
142
|
+
${CMD_PREFIX} sed -i.bak -e "${QUOTE}s/${old}/${new}/${QUOTE}" -- "${file}" && rm -- "${file}.bak"
|
131
143
|
}
|
132
144
|
|
133
145
|
function current_version
|
134
146
|
{
|
135
|
-
grep -oiP '(?<=VERSION = ")([
|
147
|
+
grep -oiP '(?<=VERSION = ")([a-zA-Z0-9\-.]+)(?=")' lib/cloudinary/version.rb
|
136
148
|
}
|
137
149
|
|
138
150
|
function update_version
|
139
151
|
{
|
140
|
-
if [ -z "${NEW_VERSION}" ]; then
|
152
|
+
if [[ -z "${NEW_VERSION}" ]]; then
|
141
153
|
usage; return 1
|
142
154
|
fi
|
143
155
|
|
144
156
|
# Enter git root
|
145
157
|
pushd $(git rev-parse --show-toplevel)
|
158
|
+
|
146
159
|
local current_version=$(current_version)
|
147
160
|
|
148
|
-
if [ -z "${current_version}" ]; then
|
161
|
+
if [[ -z "${current_version}" ]]; then
|
149
162
|
echo_err "Failed getting current version, please check directory structure and/or contact developer"
|
150
163
|
return 1
|
151
164
|
fi
|
@@ -166,12 +179,17 @@ function update_version
|
|
166
179
|
lib/cloudinary/version.rb\
|
167
180
|
|| return 1
|
168
181
|
|
169
|
-
|
182
|
+
if [[ "${UPDATE_ONLY}" = true ]]; then
|
183
|
+
popd;
|
184
|
+
return 0;
|
185
|
+
fi
|
186
|
+
|
187
|
+
${CMD_PREFIX} git changelog -t "${NEW_VERSION}" || true
|
170
188
|
|
171
189
|
echo ""
|
172
190
|
echo "# After editing CHANGELOG.md, optionally review changes and issue these commands:"
|
173
191
|
echo git add lib/cloudinary/version.rb CHANGELOG.md
|
174
|
-
echo git commit -m \"Version ${NEW_VERSION}\"
|
192
|
+
echo git commit -m "\"Version ${NEW_VERSION}\""
|
175
193
|
echo sed -e "'1,/^${NEW_VERSION//./\\.}/d'" \
|
176
194
|
-e "'/^=/d'" \
|
177
195
|
-e "'/^$/d'" \
|
@@ -180,7 +198,7 @@ function update_version
|
|
180
198
|
\| git tag -a "'${NEW_VERSION}'" --file=-
|
181
199
|
|
182
200
|
# Don't run those commands on dry run
|
183
|
-
[ -n "${CMD_PREFIX}" ] && { popd; return 0; }
|
201
|
+
[[ -n "${CMD_PREFIX}" ]] && { popd; return 0; }
|
184
202
|
|
185
203
|
echo ""
|
186
204
|
read -p "Run the above commands automatically? (y/N): " confirm && [[ ${confirm} == [yY] || ${confirm} == [yY][eE][sS] ]] || { popd; return 0; }
|
@@ -197,6 +215,6 @@ function update_version
|
|
197
215
|
popd
|
198
216
|
}
|
199
217
|
|
218
|
+
process_arguments "$@"
|
200
219
|
verify_dependencies
|
201
|
-
process_arguments $*
|
202
220
|
update_version
|
@@ -164,7 +164,7 @@ var slice = [].slice,
|
|
164
164
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
165
165
|
* @example
|
166
166
|
*
|
167
|
-
* function Foo(){};
|
167
|
+
* function Foo(){};
|
168
168
|
* isFunction(Foo);
|
169
169
|
* // => true
|
170
170
|
*
|
@@ -802,7 +802,7 @@ var slice = [].slice,
|
|
802
802
|
function TextLayer(options) {
|
803
803
|
var keys;
|
804
804
|
TextLayer.__super__.constructor.call(this, options);
|
805
|
-
keys = ["resourceType", "resourceType", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecoration", "textAlign", "stroke", "letterSpacing", "lineSpacing", "text"];
|
805
|
+
keys = ["resourceType", "resourceType", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecoration", "textAlign", "stroke", "letterSpacing", "lineSpacing", "fontHinting", "fontAntialiasing", "text"];
|
806
806
|
if (options != null) {
|
807
807
|
keys.forEach((function(_this) {
|
808
808
|
return function(key) {
|
@@ -871,6 +871,16 @@ var slice = [].slice,
|
|
871
871
|
return this;
|
872
872
|
};
|
873
873
|
|
874
|
+
TextLayer.prototype.fontAntialiasing = function(fontAntialiasing){
|
875
|
+
this.options.fontAntialiasing = fontAntialiasing;
|
876
|
+
return this;
|
877
|
+
};
|
878
|
+
|
879
|
+
TextLayer.prototype.fontHinting = function(fontHinting ){
|
880
|
+
this.options.fontHinting = fontHinting ;
|
881
|
+
return this;
|
882
|
+
};
|
883
|
+
|
874
884
|
TextLayer.prototype.text = function(text) {
|
875
885
|
this.options.text = text;
|
876
886
|
return this;
|
@@ -932,6 +942,12 @@ var slice = [].slice,
|
|
932
942
|
if (!(Util.isEmpty(this.options.lineSpacing) && !Util.isNumberLike(this.options.lineSpacing))) {
|
933
943
|
components.push("line_spacing_" + this.options.lineSpacing);
|
934
944
|
}
|
945
|
+
if (this.options.fontAntialiasing !== "none") {
|
946
|
+
components.push("antialias_"+this.options.fontAntialiasing);
|
947
|
+
}
|
948
|
+
if (this.options.fontHinting !== "none") {
|
949
|
+
components.push("hinting_"+this.options.fontHinting);
|
950
|
+
}
|
935
951
|
if (!Util.isEmpty(Util.compact(components))) {
|
936
952
|
if (Util.isEmpty(this.options.fontFamily)) {
|
937
953
|
throw "Must supply fontFamily. " + components;
|
@@ -1387,7 +1403,8 @@ var slice = [].slice,
|
|
1387
1403
|
"*": "mul",
|
1388
1404
|
"/": "div",
|
1389
1405
|
"+": "add",
|
1390
|
-
"-": "sub"
|
1406
|
+
"-": "sub",
|
1407
|
+
"^": "pow",
|
1391
1408
|
};
|
1392
1409
|
|
1393
1410
|
|
@@ -1456,30 +1473,33 @@ var slice = [].slice,
|
|
1456
1473
|
return new this(expressionStr);
|
1457
1474
|
};
|
1458
1475
|
|
1459
|
-
|
1460
1476
|
/**
|
1461
1477
|
* Normalize a string expression
|
1462
1478
|
* @function Cloudinary#normalize
|
1463
1479
|
* @param {string} expression a expression, e.g. "w gt 100", "width_gt_100", "width > 100"
|
1464
1480
|
* @return {string} the normalized form of the value expression, e.g. "w_gt_100"
|
1465
1481
|
*/
|
1466
|
-
|
1467
1482
|
Expression.normalize = function(expression) {
|
1468
|
-
var operators,
|
1483
|
+
var operators, operatorsPattern, operatorsReplaceRE, predefinedVarsPattern, predefinedVarsReplaceRE;
|
1469
1484
|
if (expression == null) {
|
1470
1485
|
return expression;
|
1471
1486
|
}
|
1472
1487
|
expression = String(expression);
|
1473
|
-
operators = "
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1488
|
+
operators = "\\|\\||>=|<=|&&|!=|>|=|<|/|-|\\+|\\*|\\^";
|
1489
|
+
|
1490
|
+
// operators
|
1491
|
+
operatorsPattern = "((" + operators + ")(?=[ _]))";
|
1492
|
+
operatorsReplaceRE = new RegExp(operatorsPattern, "g");
|
1493
|
+
expression = expression.replace(operatorsReplaceRE, match => Expression.OPERATORS[match]);
|
1494
|
+
|
1495
|
+
// predefined variables
|
1496
|
+
predefinedVarsPattern = "(" + Object.keys(Expression.PREDEFINED_VARS).join("|") + ")";
|
1497
|
+
predefinedVarsReplaceRE = new RegExp(predefinedVarsPattern, "g");
|
1498
|
+
expression = expression.replace(predefinedVarsReplaceRE, (match, p1, offset) => (expression[offset - 1] === '$' ? match : Expression.PREDEFINED_VARS[match]));
|
1499
|
+
|
1479
1500
|
return expression.replace(/[ _]+/g, '_');
|
1480
1501
|
};
|
1481
1502
|
|
1482
|
-
|
1483
1503
|
/**
|
1484
1504
|
* Serialize the expression
|
1485
1505
|
* @return {string} the expression as a string
|
@@ -2780,6 +2800,20 @@ var slice = [].slice,
|
|
2780
2800
|
return this.param(value, "gravity", "g");
|
2781
2801
|
};
|
2782
2802
|
|
2803
|
+
Transformation.prototype.fps = function(value) {
|
2804
|
+
return this.param(value, "fps", "fps", (function(_this) {
|
2805
|
+
return function(fps) {
|
2806
|
+
if (Util.isString(fps)) {
|
2807
|
+
return fps;
|
2808
|
+
} else if (Util.isArray(fps)) {
|
2809
|
+
return fps.join("-");
|
2810
|
+
} else {
|
2811
|
+
return fps;
|
2812
|
+
}
|
2813
|
+
};
|
2814
|
+
})(this));
|
2815
|
+
};
|
2816
|
+
|
2783
2817
|
Transformation.prototype.height = function(value) {
|
2784
2818
|
return this.param(value, "height", "h", (function(_this) {
|
2785
2819
|
return function() {
|
@@ -3040,7 +3074,7 @@ var slice = [].slice,
|
|
3040
3074
|
* @protected
|
3041
3075
|
* @param {string} key - attribute name
|
3042
3076
|
* @param {*|boolean} value - the value of the attribute. If the value is boolean `true`, return the key only.
|
3043
|
-
* @returns {string} the attribute
|
3077
|
+
* @returns {string} the attribute
|
3044
3078
|
*
|
3045
3079
|
*/
|
3046
3080
|
|
@@ -43,7 +43,7 @@
|
|
43
43
|
'|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
|
44
44
|
).test(window.navigator.userAgent) ||
|
45
45
|
// Feature detection for all other devices:
|
46
|
-
$('<input type="file"
|
46
|
+
$('<input type="file"/>').prop('disabled'));
|
47
47
|
|
48
48
|
// The FileReader API is not actually used, but works as feature detection,
|
49
49
|
// as some Safari versions (5?) support XHR file uploads via the FormData API,
|
@@ -261,6 +261,9 @@
|
|
261
261
|
// Callback for dragover events of the dropZone(s):
|
262
262
|
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
263
263
|
|
264
|
+
// Callback before the start of each chunk upload request (before form data initialization):
|
265
|
+
// chunkbeforesend: function (e, data) {}, // .bind('fileuploadchunkbeforesend', func);
|
266
|
+
|
264
267
|
// Callback for the start of each chunk upload request:
|
265
268
|
// chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
|
266
269
|
|
@@ -434,6 +437,13 @@
|
|
434
437
|
}
|
435
438
|
},
|
436
439
|
|
440
|
+
_deinitProgressListener: function (options) {
|
441
|
+
var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
442
|
+
if (xhr.upload) {
|
443
|
+
$(xhr.upload).unbind('progress');
|
444
|
+
}
|
445
|
+
},
|
446
|
+
|
437
447
|
_isInstanceOf: function (type, obj) {
|
438
448
|
// Cross-frame instanceof check
|
439
449
|
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
@@ -453,7 +463,7 @@
|
|
453
463
|
}
|
454
464
|
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
|
455
465
|
options.headers['Content-Disposition'] = 'attachment; filename="' +
|
456
|
-
encodeURI(file.name) + '"';
|
466
|
+
encodeURI(file.uploadName || file.name) + '"';
|
457
467
|
}
|
458
468
|
if (!multipart) {
|
459
469
|
options.contentType = file.type || 'application/octet-stream';
|
@@ -489,7 +499,11 @@
|
|
489
499
|
});
|
490
500
|
}
|
491
501
|
if (options.blob) {
|
492
|
-
formData.append(
|
502
|
+
formData.append(
|
503
|
+
paramName,
|
504
|
+
options.blob,
|
505
|
+
file.uploadName || file.name
|
506
|
+
);
|
493
507
|
} else {
|
494
508
|
$.each(options.files, function (index, file) {
|
495
509
|
// This check allows the tests to run with
|
@@ -762,6 +776,8 @@
|
|
762
776
|
// Expose the chunk bytes position range:
|
763
777
|
o.contentRange = 'bytes ' + ub + '-' +
|
764
778
|
(ub + o.chunkSize - 1) + '/' + fs;
|
779
|
+
// Trigger chunkbeforesend to allow form data to be updated for this chunk
|
780
|
+
that._trigger('chunkbeforesend', null, o);
|
765
781
|
// Process the upload data (the blob and potential form data):
|
766
782
|
that._initXHRData(o);
|
767
783
|
// Add progress listeners for this chunk upload:
|
@@ -808,6 +824,9 @@
|
|
808
824
|
o.context,
|
809
825
|
[jqXHR, textStatus, errorThrown]
|
810
826
|
);
|
827
|
+
})
|
828
|
+
.always(function () {
|
829
|
+
that._deinitProgressListener(o);
|
811
830
|
});
|
812
831
|
};
|
813
832
|
this._enhancePromise(promise);
|
@@ -909,6 +928,7 @@
|
|
909
928
|
}).fail(function (jqXHR, textStatus, errorThrown) {
|
910
929
|
that._onFail(jqXHR, textStatus, errorThrown, options);
|
911
930
|
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
931
|
+
that._deinitProgressListener(options);
|
912
932
|
that._onAlways(
|
913
933
|
jqXHRorResult,
|
914
934
|
textStatus,
|
@@ -1126,7 +1146,7 @@
|
|
1126
1146
|
dirReader = entry.createReader();
|
1127
1147
|
readEntries();
|
1128
1148
|
} else {
|
1129
|
-
// Return an
|
1149
|
+
// Return an empty list for file system items
|
1130
1150
|
// other than files or directories:
|
1131
1151
|
dfd.resolve([]);
|
1132
1152
|
}
|
@@ -1,571 +1,751 @@
|
|
1
|
-
/*! jQuery UI - v1.
|
2
|
-
* http://jqueryui.com
|
3
|
-
* Includes: widget.js
|
4
|
-
* Copyright
|
1
|
+
/*! jQuery UI - v1.12.1+CommonJS - 2018-02-10
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: widget.js
|
4
|
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
5
5
|
|
6
6
|
(function( factory ) {
|
7
|
-
|
7
|
+
if ( typeof define === "function" && define.amd ) {
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define([ "jquery" ], factory );
|
11
|
+
} else if ( typeof exports === "object" ) {
|
11
12
|
|
12
|
-
|
13
|
+
// Node/CommonJS
|
14
|
+
factory( require( "jquery" ) );
|
15
|
+
} else {
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
// Browser globals
|
18
|
+
factory( jQuery );
|
19
|
+
}
|
20
|
+
}(function( $ ) {
|
16
21
|
|
17
|
-
|
22
|
+
$.ui = $.ui || {};
|
23
|
+
|
24
|
+
var version = $.ui.version = "1.12.1";
|
25
|
+
|
26
|
+
|
27
|
+
/*!
|
28
|
+
* jQuery UI Widget 1.12.1
|
29
|
+
* http://jqueryui.com
|
30
|
+
*
|
31
|
+
* Copyright jQuery Foundation and other contributors
|
32
|
+
* Released under the MIT license.
|
33
|
+
* http://jquery.org/license
|
34
|
+
*/
|
35
|
+
|
36
|
+
//>>label: Widget
|
37
|
+
//>>group: Core
|
38
|
+
//>>description: Provides a factory for creating stateful widgets with a common API.
|
39
|
+
//>>docs: http://api.jqueryui.com/jQuery.widget/
|
40
|
+
//>>demos: http://jqueryui.com/widget/
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
var widgetUuid = 0;
|
45
|
+
var widgetSlice = Array.prototype.slice;
|
46
|
+
|
47
|
+
$.cleanData = ( function( orig ) {
|
48
|
+
return function( elems ) {
|
49
|
+
var events, elem, i;
|
50
|
+
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
|
51
|
+
try {
|
52
|
+
|
53
|
+
// Only trigger remove when necessary to save time
|
54
|
+
events = $._data( elem, "events" );
|
55
|
+
if ( events && events.remove ) {
|
56
|
+
$( elem ).triggerHandler( "remove" );
|
57
|
+
}
|
58
|
+
|
59
|
+
// Http://bugs.jquery.com/ticket/8235
|
60
|
+
} catch ( e ) {}
|
61
|
+
}
|
62
|
+
orig( elems );
|
63
|
+
};
|
64
|
+
} )( $.cleanData );
|
65
|
+
|
66
|
+
$.widget = function( name, base, prototype ) {
|
67
|
+
var existingConstructor, constructor, basePrototype;
|
68
|
+
|
69
|
+
// ProxiedPrototype allows the provided prototype to remain unmodified
|
70
|
+
// so that it can be used as a mixin for multiple widgets (#8876)
|
71
|
+
var proxiedPrototype = {};
|
72
|
+
|
73
|
+
var namespace = name.split( "." )[ 0 ];
|
74
|
+
name = name.split( "." )[ 1 ];
|
75
|
+
var fullName = namespace + "-" + name;
|
76
|
+
|
77
|
+
if ( !prototype ) {
|
78
|
+
prototype = base;
|
79
|
+
base = $.Widget;
|
80
|
+
}
|
81
|
+
|
82
|
+
if ( $.isArray( prototype ) ) {
|
83
|
+
prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
|
84
|
+
}
|
85
|
+
|
86
|
+
// Create selector for plugin
|
87
|
+
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
88
|
+
return !!$.data( elem, fullName );
|
89
|
+
};
|
90
|
+
|
91
|
+
$[ namespace ] = $[ namespace ] || {};
|
92
|
+
existingConstructor = $[ namespace ][ name ];
|
93
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
94
|
+
|
95
|
+
// Allow instantiation without "new" keyword
|
96
|
+
if ( !this._createWidget ) {
|
97
|
+
return new constructor( options, element );
|
98
|
+
}
|
99
|
+
|
100
|
+
// Allow instantiation without initializing for simple inheritance
|
101
|
+
// must use "new" keyword (the code above always passes args)
|
102
|
+
if ( arguments.length ) {
|
103
|
+
this._createWidget( options, element );
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
// Extend with the existing constructor to carry over any static properties
|
108
|
+
$.extend( constructor, existingConstructor, {
|
109
|
+
version: prototype.version,
|
110
|
+
|
111
|
+
// Copy the object used to create the prototype in case we need to
|
112
|
+
// redefine the widget later
|
113
|
+
_proto: $.extend( {}, prototype ),
|
114
|
+
|
115
|
+
// Track widgets that inherit from this widget in case this widget is
|
116
|
+
// redefined after a widget inherits from it
|
117
|
+
_childConstructors: []
|
118
|
+
} );
|
119
|
+
|
120
|
+
basePrototype = new base();
|
121
|
+
|
122
|
+
// We need to make the options hash a property directly on the new instance
|
123
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
124
|
+
// inheriting from
|
125
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
126
|
+
$.each( prototype, function( prop, value ) {
|
127
|
+
if ( !$.isFunction( value ) ) {
|
128
|
+
proxiedPrototype[ prop ] = value;
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
proxiedPrototype[ prop ] = ( function() {
|
132
|
+
function _super() {
|
133
|
+
return base.prototype[ prop ].apply( this, arguments );
|
134
|
+
}
|
135
|
+
|
136
|
+
function _superApply( args ) {
|
137
|
+
return base.prototype[ prop ].apply( this, args );
|
138
|
+
}
|
139
|
+
|
140
|
+
return function() {
|
141
|
+
var __super = this._super;
|
142
|
+
var __superApply = this._superApply;
|
143
|
+
var returnValue;
|
144
|
+
|
145
|
+
this._super = _super;
|
146
|
+
this._superApply = _superApply;
|
147
|
+
|
148
|
+
returnValue = value.apply( this, arguments );
|
149
|
+
|
150
|
+
this._super = __super;
|
151
|
+
this._superApply = __superApply;
|
152
|
+
|
153
|
+
return returnValue;
|
154
|
+
};
|
155
|
+
} )();
|
156
|
+
} );
|
157
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
158
|
+
|
159
|
+
// TODO: remove support for widgetEventPrefix
|
160
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
161
|
+
// don't prefix for widgets that aren't DOM-based
|
162
|
+
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
|
163
|
+
}, proxiedPrototype, {
|
164
|
+
constructor: constructor,
|
165
|
+
namespace: namespace,
|
166
|
+
widgetName: name,
|
167
|
+
widgetFullName: fullName
|
168
|
+
} );
|
169
|
+
|
170
|
+
// If this widget is being redefined then we need to find all widgets that
|
171
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
172
|
+
// the new version of this widget. We're essentially trying to replace one
|
173
|
+
// level in the prototype chain.
|
174
|
+
if ( existingConstructor ) {
|
175
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
176
|
+
var childPrototype = child.prototype;
|
177
|
+
|
178
|
+
// Redefine the child widget using the same prototype that was
|
179
|
+
// originally used, but inherit from the new version of the base
|
180
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
|
181
|
+
child._proto );
|
182
|
+
} );
|
183
|
+
|
184
|
+
// Remove the list of existing child constructors from the old constructor
|
185
|
+
// so the old child constructors can be garbage collected
|
186
|
+
delete existingConstructor._childConstructors;
|
187
|
+
} else {
|
188
|
+
base._childConstructors.push( constructor );
|
189
|
+
}
|
190
|
+
|
191
|
+
$.widget.bridge( name, constructor );
|
192
|
+
|
193
|
+
return constructor;
|
194
|
+
};
|
195
|
+
|
196
|
+
$.widget.extend = function( target ) {
|
197
|
+
var input = widgetSlice.call( arguments, 1 );
|
198
|
+
var inputIndex = 0;
|
199
|
+
var inputLength = input.length;
|
200
|
+
var key;
|
201
|
+
var value;
|
202
|
+
|
203
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
204
|
+
for ( key in input[ inputIndex ] ) {
|
205
|
+
value = input[ inputIndex ][ key ];
|
206
|
+
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
207
|
+
|
208
|
+
// Clone objects
|
209
|
+
if ( $.isPlainObject( value ) ) {
|
210
|
+
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
211
|
+
$.widget.extend( {}, target[ key ], value ) :
|
212
|
+
|
213
|
+
// Don't extend strings, arrays, etc. with objects
|
214
|
+
$.widget.extend( {}, value );
|
215
|
+
|
216
|
+
// Copy everything else by reference
|
217
|
+
} else {
|
218
|
+
target[ key ] = value;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
return target;
|
224
|
+
};
|
225
|
+
|
226
|
+
$.widget.bridge = function( name, object ) {
|
227
|
+
var fullName = object.prototype.widgetFullName || name;
|
228
|
+
$.fn[ name ] = function( options ) {
|
229
|
+
var isMethodCall = typeof options === "string";
|
230
|
+
var args = widgetSlice.call( arguments, 1 );
|
231
|
+
var returnValue = this;
|
232
|
+
|
233
|
+
if ( isMethodCall ) {
|
234
|
+
|
235
|
+
// If this is an empty collection, we need to have the instance method
|
236
|
+
// return undefined instead of the jQuery instance
|
237
|
+
if ( !this.length && options === "instance" ) {
|
238
|
+
returnValue = undefined;
|
239
|
+
} else {
|
240
|
+
this.each( function() {
|
241
|
+
var methodValue;
|
242
|
+
var instance = $.data( this, fullName );
|
243
|
+
|
244
|
+
if ( options === "instance" ) {
|
245
|
+
returnValue = instance;
|
246
|
+
return false;
|
247
|
+
}
|
248
|
+
|
249
|
+
if ( !instance ) {
|
250
|
+
return $.error( "cannot call methods on " + name +
|
251
|
+
" prior to initialization; " +
|
252
|
+
"attempted to call method '" + options + "'" );
|
253
|
+
}
|
254
|
+
|
255
|
+
if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
|
256
|
+
return $.error( "no such method '" + options + "' for " + name +
|
257
|
+
" widget instance" );
|
258
|
+
}
|
259
|
+
|
260
|
+
methodValue = instance[ options ].apply( instance, args );
|
261
|
+
|
262
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
263
|
+
returnValue = methodValue && methodValue.jquery ?
|
264
|
+
returnValue.pushStack( methodValue.get() ) :
|
265
|
+
methodValue;
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
} );
|
269
|
+
}
|
270
|
+
} else {
|
271
|
+
|
272
|
+
// Allow multiple hashes to be passed on init
|
273
|
+
if ( args.length ) {
|
274
|
+
options = $.widget.extend.apply( null, [ options ].concat( args ) );
|
275
|
+
}
|
276
|
+
|
277
|
+
this.each( function() {
|
278
|
+
var instance = $.data( this, fullName );
|
279
|
+
if ( instance ) {
|
280
|
+
instance.option( options || {} );
|
281
|
+
if ( instance._init ) {
|
282
|
+
instance._init();
|
283
|
+
}
|
284
|
+
} else {
|
285
|
+
$.data( this, fullName, new object( options, this ) );
|
286
|
+
}
|
287
|
+
} );
|
288
|
+
}
|
289
|
+
|
290
|
+
return returnValue;
|
291
|
+
};
|
292
|
+
};
|
293
|
+
|
294
|
+
$.Widget = function( /* options, element */ ) {};
|
295
|
+
$.Widget._childConstructors = [];
|
296
|
+
|
297
|
+
$.Widget.prototype = {
|
298
|
+
widgetName: "widget",
|
299
|
+
widgetEventPrefix: "",
|
300
|
+
defaultElement: "<div>",
|
301
|
+
|
302
|
+
options: {
|
303
|
+
classes: {},
|
304
|
+
disabled: false,
|
305
|
+
|
306
|
+
// Callbacks
|
307
|
+
create: null
|
308
|
+
},
|
309
|
+
|
310
|
+
_createWidget: function( options, element ) {
|
311
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
312
|
+
this.element = $( element );
|
313
|
+
this.uuid = widgetUuid++;
|
314
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
315
|
+
|
316
|
+
this.bindings = $();
|
317
|
+
this.hoverable = $();
|
318
|
+
this.focusable = $();
|
319
|
+
this.classesElementLookup = {};
|
320
|
+
|
321
|
+
if ( element !== this ) {
|
322
|
+
$.data( element, this.widgetFullName, this );
|
323
|
+
this._on( true, this.element, {
|
324
|
+
remove: function( event ) {
|
325
|
+
if ( event.target === element ) {
|
326
|
+
this.destroy();
|
327
|
+
}
|
328
|
+
}
|
329
|
+
} );
|
330
|
+
this.document = $( element.style ?
|
331
|
+
|
332
|
+
// Element within the document
|
333
|
+
element.ownerDocument :
|
334
|
+
|
335
|
+
// Element is window or document
|
336
|
+
element.document || element );
|
337
|
+
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
|
338
|
+
}
|
339
|
+
|
340
|
+
this.options = $.widget.extend( {},
|
341
|
+
this.options,
|
342
|
+
this._getCreateOptions(),
|
343
|
+
options );
|
344
|
+
|
345
|
+
this._create();
|
346
|
+
|
347
|
+
if ( this.options.disabled ) {
|
348
|
+
this._setOptionDisabled( this.options.disabled );
|
349
|
+
}
|
350
|
+
|
351
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
352
|
+
this._init();
|
353
|
+
},
|
354
|
+
|
355
|
+
_getCreateOptions: function() {
|
356
|
+
return {};
|
357
|
+
},
|
358
|
+
|
359
|
+
_getCreateEventData: $.noop,
|
360
|
+
|
361
|
+
_create: $.noop,
|
362
|
+
|
363
|
+
_init: $.noop,
|
364
|
+
|
365
|
+
destroy: function() {
|
366
|
+
var that = this;
|
367
|
+
|
368
|
+
this._destroy();
|
369
|
+
$.each( this.classesElementLookup, function( key, value ) {
|
370
|
+
that._removeClass( value, key );
|
371
|
+
} );
|
372
|
+
|
373
|
+
// We can probably remove the unbind calls in 2.0
|
374
|
+
// all event bindings should go through this._on()
|
375
|
+
this.element
|
376
|
+
.off( this.eventNamespace )
|
377
|
+
.removeData( this.widgetFullName );
|
378
|
+
this.widget()
|
379
|
+
.off( this.eventNamespace )
|
380
|
+
.removeAttr( "aria-disabled" );
|
381
|
+
|
382
|
+
// Clean up events and states
|
383
|
+
this.bindings.off( this.eventNamespace );
|
384
|
+
},
|
385
|
+
|
386
|
+
_destroy: $.noop,
|
387
|
+
|
388
|
+
widget: function() {
|
389
|
+
return this.element;
|
390
|
+
},
|
391
|
+
|
392
|
+
option: function( key, value ) {
|
393
|
+
var options = key;
|
394
|
+
var parts;
|
395
|
+
var curOption;
|
396
|
+
var i;
|
397
|
+
|
398
|
+
if ( arguments.length === 0 ) {
|
399
|
+
|
400
|
+
// Don't return a reference to the internal hash
|
401
|
+
return $.widget.extend( {}, this.options );
|
402
|
+
}
|
403
|
+
|
404
|
+
if ( typeof key === "string" ) {
|
405
|
+
|
406
|
+
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
407
|
+
options = {};
|
408
|
+
parts = key.split( "." );
|
409
|
+
key = parts.shift();
|
410
|
+
if ( parts.length ) {
|
411
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
412
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
413
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
414
|
+
curOption = curOption[ parts[ i ] ];
|
415
|
+
}
|
416
|
+
key = parts.pop();
|
417
|
+
if ( arguments.length === 1 ) {
|
418
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
419
|
+
}
|
420
|
+
curOption[ key ] = value;
|
421
|
+
} else {
|
422
|
+
if ( arguments.length === 1 ) {
|
423
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
424
|
+
}
|
425
|
+
options[ key ] = value;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
|
429
|
+
this._setOptions( options );
|
430
|
+
|
431
|
+
return this;
|
432
|
+
},
|
433
|
+
|
434
|
+
_setOptions: function( options ) {
|
435
|
+
var key;
|
436
|
+
|
437
|
+
for ( key in options ) {
|
438
|
+
this._setOption( key, options[ key ] );
|
439
|
+
}
|
440
|
+
|
441
|
+
return this;
|
442
|
+
},
|
443
|
+
|
444
|
+
_setOption: function( key, value ) {
|
445
|
+
if ( key === "classes" ) {
|
446
|
+
this._setOptionClasses( value );
|
447
|
+
}
|
448
|
+
|
449
|
+
this.options[ key ] = value;
|
450
|
+
|
451
|
+
if ( key === "disabled" ) {
|
452
|
+
this._setOptionDisabled( value );
|
453
|
+
}
|
454
|
+
|
455
|
+
return this;
|
456
|
+
},
|
457
|
+
|
458
|
+
_setOptionClasses: function( value ) {
|
459
|
+
var classKey, elements, currentElements;
|
460
|
+
|
461
|
+
for ( classKey in value ) {
|
462
|
+
currentElements = this.classesElementLookup[ classKey ];
|
463
|
+
if ( value[ classKey ] === this.options.classes[ classKey ] ||
|
464
|
+
!currentElements ||
|
465
|
+
!currentElements.length ) {
|
466
|
+
continue;
|
467
|
+
}
|
468
|
+
|
469
|
+
// We are doing this to create a new jQuery object because the _removeClass() call
|
470
|
+
// on the next line is going to destroy the reference to the current elements being
|
471
|
+
// tracked. We need to save a copy of this collection so that we can add the new classes
|
472
|
+
// below.
|
473
|
+
elements = $( currentElements.get() );
|
474
|
+
this._removeClass( currentElements, classKey );
|
475
|
+
|
476
|
+
// We don't use _addClass() here, because that uses this.options.classes
|
477
|
+
// for generating the string of classes. We want to use the value passed in from
|
478
|
+
// _setOption(), this is the new value of the classes option which was passed to
|
479
|
+
// _setOption(). We pass this value directly to _classes().
|
480
|
+
elements.addClass( this._classes( {
|
481
|
+
element: elements,
|
482
|
+
keys: classKey,
|
483
|
+
classes: value,
|
484
|
+
add: true
|
485
|
+
} ) );
|
486
|
+
}
|
487
|
+
},
|
488
|
+
|
489
|
+
_setOptionDisabled: function( value ) {
|
490
|
+
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
|
491
|
+
|
492
|
+
// If the widget is becoming disabled, then nothing is interactive
|
493
|
+
if ( value ) {
|
494
|
+
this._removeClass( this.hoverable, null, "ui-state-hover" );
|
495
|
+
this._removeClass( this.focusable, null, "ui-state-focus" );
|
496
|
+
}
|
497
|
+
},
|
498
|
+
|
499
|
+
enable: function() {
|
500
|
+
return this._setOptions( { disabled: false } );
|
501
|
+
},
|
502
|
+
|
503
|
+
disable: function() {
|
504
|
+
return this._setOptions( { disabled: true } );
|
505
|
+
},
|
506
|
+
|
507
|
+
_classes: function( options ) {
|
508
|
+
var full = [];
|
509
|
+
var that = this;
|
510
|
+
|
511
|
+
options = $.extend( {
|
512
|
+
element: this.element,
|
513
|
+
classes: this.options.classes || {}
|
514
|
+
}, options );
|
515
|
+
|
516
|
+
function processClassString( classes, checkOption ) {
|
517
|
+
var current, i;
|
518
|
+
for ( i = 0; i < classes.length; i++ ) {
|
519
|
+
current = that.classesElementLookup[ classes[ i ] ] || $();
|
520
|
+
if ( options.add ) {
|
521
|
+
current = $( $.unique( current.get().concat( options.element.get() ) ) );
|
522
|
+
} else {
|
523
|
+
current = $( current.not( options.element ).get() );
|
524
|
+
}
|
525
|
+
that.classesElementLookup[ classes[ i ] ] = current;
|
526
|
+
full.push( classes[ i ] );
|
527
|
+
if ( checkOption && options.classes[ classes[ i ] ] ) {
|
528
|
+
full.push( options.classes[ classes[ i ] ] );
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}
|
532
|
+
|
533
|
+
this._on( options.element, {
|
534
|
+
"remove": "_untrackClassesElement"
|
535
|
+
} );
|
536
|
+
|
537
|
+
if ( options.keys ) {
|
538
|
+
processClassString( options.keys.match( /\S+/g ) || [], true );
|
539
|
+
}
|
540
|
+
if ( options.extra ) {
|
541
|
+
processClassString( options.extra.match( /\S+/g ) || [] );
|
542
|
+
}
|
543
|
+
|
544
|
+
return full.join( " " );
|
545
|
+
},
|
546
|
+
|
547
|
+
_untrackClassesElement: function( event ) {
|
548
|
+
var that = this;
|
549
|
+
$.each( that.classesElementLookup, function( key, value ) {
|
550
|
+
if ( $.inArray( event.target, value ) !== -1 ) {
|
551
|
+
that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
|
552
|
+
}
|
553
|
+
} );
|
554
|
+
},
|
555
|
+
|
556
|
+
_removeClass: function( element, keys, extra ) {
|
557
|
+
return this._toggleClass( element, keys, extra, false );
|
558
|
+
},
|
559
|
+
|
560
|
+
_addClass: function( element, keys, extra ) {
|
561
|
+
return this._toggleClass( element, keys, extra, true );
|
562
|
+
},
|
563
|
+
|
564
|
+
_toggleClass: function( element, keys, extra, add ) {
|
565
|
+
add = ( typeof add === "boolean" ) ? add : extra;
|
566
|
+
var shift = ( typeof element === "string" || element === null ),
|
567
|
+
options = {
|
568
|
+
extra: shift ? keys : extra,
|
569
|
+
keys: shift ? element : keys,
|
570
|
+
element: shift ? this.element : element,
|
571
|
+
add: add
|
572
|
+
};
|
573
|
+
options.element.toggleClass( this._classes( options ), add );
|
574
|
+
return this;
|
575
|
+
},
|
576
|
+
|
577
|
+
_on: function( suppressDisabledCheck, element, handlers ) {
|
578
|
+
var delegateElement;
|
579
|
+
var instance = this;
|
580
|
+
|
581
|
+
// No suppressDisabledCheck flag, shuffle arguments
|
582
|
+
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
583
|
+
handlers = element;
|
584
|
+
element = suppressDisabledCheck;
|
585
|
+
suppressDisabledCheck = false;
|
586
|
+
}
|
587
|
+
|
588
|
+
// No element argument, shuffle and use this.element
|
589
|
+
if ( !handlers ) {
|
590
|
+
handlers = element;
|
591
|
+
element = this.element;
|
592
|
+
delegateElement = this.widget();
|
593
|
+
} else {
|
594
|
+
element = delegateElement = $( element );
|
595
|
+
this.bindings = this.bindings.add( element );
|
596
|
+
}
|
597
|
+
|
598
|
+
$.each( handlers, function( event, handler ) {
|
599
|
+
function handlerProxy() {
|
600
|
+
|
601
|
+
// Allow widgets to customize the disabled handling
|
602
|
+
// - disabled as an array instead of boolean
|
603
|
+
// - disabled class as method for disabling individual parts
|
604
|
+
if ( !suppressDisabledCheck &&
|
605
|
+
( instance.options.disabled === true ||
|
606
|
+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
607
|
+
return;
|
608
|
+
}
|
609
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
610
|
+
.apply( instance, arguments );
|
611
|
+
}
|
612
|
+
|
613
|
+
// Copy the guid so direct unbinding works
|
614
|
+
if ( typeof handler !== "string" ) {
|
615
|
+
handlerProxy.guid = handler.guid =
|
616
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
617
|
+
}
|
618
|
+
|
619
|
+
var match = event.match( /^([\w:-]*)\s*(.*)$/ );
|
620
|
+
var eventName = match[ 1 ] + instance.eventNamespace;
|
621
|
+
var selector = match[ 2 ];
|
622
|
+
|
623
|
+
if ( selector ) {
|
624
|
+
delegateElement.on( eventName, selector, handlerProxy );
|
625
|
+
} else {
|
626
|
+
element.on( eventName, handlerProxy );
|
627
|
+
}
|
628
|
+
} );
|
629
|
+
},
|
630
|
+
|
631
|
+
_off: function( element, eventName ) {
|
632
|
+
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
|
633
|
+
this.eventNamespace;
|
634
|
+
element.off( eventName ).off( eventName );
|
635
|
+
|
636
|
+
// Clear the stack to avoid memory leaks (#10056)
|
637
|
+
this.bindings = $( this.bindings.not( element ).get() );
|
638
|
+
this.focusable = $( this.focusable.not( element ).get() );
|
639
|
+
this.hoverable = $( this.hoverable.not( element ).get() );
|
640
|
+
},
|
641
|
+
|
642
|
+
_delay: function( handler, delay ) {
|
643
|
+
function handlerProxy() {
|
644
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
645
|
+
.apply( instance, arguments );
|
646
|
+
}
|
647
|
+
var instance = this;
|
648
|
+
return setTimeout( handlerProxy, delay || 0 );
|
649
|
+
},
|
650
|
+
|
651
|
+
_hoverable: function( element ) {
|
652
|
+
this.hoverable = this.hoverable.add( element );
|
653
|
+
this._on( element, {
|
654
|
+
mouseenter: function( event ) {
|
655
|
+
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
|
656
|
+
},
|
657
|
+
mouseleave: function( event ) {
|
658
|
+
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
|
659
|
+
}
|
660
|
+
} );
|
661
|
+
},
|
662
|
+
|
663
|
+
_focusable: function( element ) {
|
664
|
+
this.focusable = this.focusable.add( element );
|
665
|
+
this._on( element, {
|
666
|
+
focusin: function( event ) {
|
667
|
+
this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
|
668
|
+
},
|
669
|
+
focusout: function( event ) {
|
670
|
+
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
|
671
|
+
}
|
672
|
+
} );
|
673
|
+
},
|
674
|
+
|
675
|
+
_trigger: function( type, event, data ) {
|
676
|
+
var prop, orig;
|
677
|
+
var callback = this.options[ type ];
|
678
|
+
|
679
|
+
data = data || {};
|
680
|
+
event = $.Event( event );
|
681
|
+
event.type = ( type === this.widgetEventPrefix ?
|
682
|
+
type :
|
683
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
684
|
+
|
685
|
+
// The original event may come from any element
|
686
|
+
// so we need to reset the target on the new event
|
687
|
+
event.target = this.element[ 0 ];
|
688
|
+
|
689
|
+
// Copy original event properties over to the new event
|
690
|
+
orig = event.originalEvent;
|
691
|
+
if ( orig ) {
|
692
|
+
for ( prop in orig ) {
|
693
|
+
if ( !( prop in event ) ) {
|
694
|
+
event[ prop ] = orig[ prop ];
|
695
|
+
}
|
696
|
+
}
|
697
|
+
}
|
698
|
+
|
699
|
+
this.element.trigger( event, data );
|
700
|
+
return !( $.isFunction( callback ) &&
|
701
|
+
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
|
702
|
+
event.isDefaultPrevented() );
|
703
|
+
}
|
704
|
+
};
|
705
|
+
|
706
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
707
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
708
|
+
if ( typeof options === "string" ) {
|
709
|
+
options = { effect: options };
|
710
|
+
}
|
711
|
+
|
712
|
+
var hasOptions;
|
713
|
+
var effectName = !options ?
|
714
|
+
method :
|
715
|
+
options === true || typeof options === "number" ?
|
716
|
+
defaultEffect :
|
717
|
+
options.effect || defaultEffect;
|
718
|
+
|
719
|
+
options = options || {};
|
720
|
+
if ( typeof options === "number" ) {
|
721
|
+
options = { duration: options };
|
722
|
+
}
|
723
|
+
|
724
|
+
hasOptions = !$.isEmptyObject( options );
|
725
|
+
options.complete = callback;
|
726
|
+
|
727
|
+
if ( options.delay ) {
|
728
|
+
element.delay( options.delay );
|
729
|
+
}
|
730
|
+
|
731
|
+
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
732
|
+
element[ method ]( options );
|
733
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
734
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
735
|
+
} else {
|
736
|
+
element.queue( function( next ) {
|
737
|
+
$( this )[ method ]();
|
738
|
+
if ( callback ) {
|
739
|
+
callback.call( element[ 0 ] );
|
740
|
+
}
|
741
|
+
next();
|
742
|
+
} );
|
743
|
+
}
|
744
|
+
};
|
745
|
+
} );
|
746
|
+
|
747
|
+
var widget = $.widget;
|
18
748
|
|
19
|
-
// Browser globals
|
20
|
-
factory( jQuery );
|
21
|
-
}
|
22
|
-
}(function( $ ) {
|
23
|
-
/*!
|
24
|
-
* jQuery UI Widget 1.11.4
|
25
|
-
* http://jqueryui.com
|
26
|
-
*
|
27
|
-
* Copyright jQuery Foundation and other contributors
|
28
|
-
* Released under the MIT license.
|
29
|
-
* http://jquery.org/license
|
30
|
-
*
|
31
|
-
* http://api.jqueryui.com/jQuery.widget/
|
32
|
-
*/
|
33
|
-
|
34
|
-
|
35
|
-
var widget_uuid = 0,
|
36
|
-
widget_slice = Array.prototype.slice;
|
37
|
-
|
38
|
-
$.cleanData = (function( orig ) {
|
39
|
-
return function( elems ) {
|
40
|
-
var events, elem, i;
|
41
|
-
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
42
|
-
try {
|
43
|
-
|
44
|
-
// Only trigger remove when necessary to save time
|
45
|
-
events = $._data( elem, "events" );
|
46
|
-
if ( events && events.remove ) {
|
47
|
-
$( elem ).triggerHandler( "remove" );
|
48
|
-
}
|
49
|
-
|
50
|
-
// http://bugs.jquery.com/ticket/8235
|
51
|
-
} catch ( e ) {}
|
52
|
-
}
|
53
|
-
orig( elems );
|
54
|
-
};
|
55
|
-
})( $.cleanData );
|
56
|
-
|
57
|
-
$.widget = function( name, base, prototype ) {
|
58
|
-
var fullName, existingConstructor, constructor, basePrototype,
|
59
|
-
// proxiedPrototype allows the provided prototype to remain unmodified
|
60
|
-
// so that it can be used as a mixin for multiple widgets (#8876)
|
61
|
-
proxiedPrototype = {},
|
62
|
-
namespace = name.split( "." )[ 0 ];
|
63
|
-
|
64
|
-
name = name.split( "." )[ 1 ];
|
65
|
-
fullName = namespace + "-" + name;
|
66
|
-
|
67
|
-
if ( !prototype ) {
|
68
|
-
prototype = base;
|
69
|
-
base = $.Widget;
|
70
|
-
}
|
71
|
-
|
72
|
-
// create selector for plugin
|
73
|
-
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
74
|
-
return !!$.data( elem, fullName );
|
75
|
-
};
|
76
|
-
|
77
|
-
$[ namespace ] = $[ namespace ] || {};
|
78
|
-
existingConstructor = $[ namespace ][ name ];
|
79
|
-
constructor = $[ namespace ][ name ] = function( options, element ) {
|
80
|
-
// allow instantiation without "new" keyword
|
81
|
-
if ( !this._createWidget ) {
|
82
|
-
return new constructor( options, element );
|
83
|
-
}
|
84
|
-
|
85
|
-
// allow instantiation without initializing for simple inheritance
|
86
|
-
// must use "new" keyword (the code above always passes args)
|
87
|
-
if ( arguments.length ) {
|
88
|
-
this._createWidget( options, element );
|
89
|
-
}
|
90
|
-
};
|
91
|
-
// extend with the existing constructor to carry over any static properties
|
92
|
-
$.extend( constructor, existingConstructor, {
|
93
|
-
version: prototype.version,
|
94
|
-
// copy the object used to create the prototype in case we need to
|
95
|
-
// redefine the widget later
|
96
|
-
_proto: $.extend( {}, prototype ),
|
97
|
-
// track widgets that inherit from this widget in case this widget is
|
98
|
-
// redefined after a widget inherits from it
|
99
|
-
_childConstructors: []
|
100
|
-
});
|
101
|
-
|
102
|
-
basePrototype = new base();
|
103
|
-
// we need to make the options hash a property directly on the new instance
|
104
|
-
// otherwise we'll modify the options hash on the prototype that we're
|
105
|
-
// inheriting from
|
106
|
-
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
107
|
-
$.each( prototype, function( prop, value ) {
|
108
|
-
if ( !$.isFunction( value ) ) {
|
109
|
-
proxiedPrototype[ prop ] = value;
|
110
|
-
return;
|
111
|
-
}
|
112
|
-
proxiedPrototype[ prop ] = (function() {
|
113
|
-
var _super = function() {
|
114
|
-
return base.prototype[ prop ].apply( this, arguments );
|
115
|
-
},
|
116
|
-
_superApply = function( args ) {
|
117
|
-
return base.prototype[ prop ].apply( this, args );
|
118
|
-
};
|
119
|
-
return function() {
|
120
|
-
var __super = this._super,
|
121
|
-
__superApply = this._superApply,
|
122
|
-
returnValue;
|
123
|
-
|
124
|
-
this._super = _super;
|
125
|
-
this._superApply = _superApply;
|
126
|
-
|
127
|
-
returnValue = value.apply( this, arguments );
|
128
|
-
|
129
|
-
this._super = __super;
|
130
|
-
this._superApply = __superApply;
|
131
|
-
|
132
|
-
return returnValue;
|
133
|
-
};
|
134
|
-
})();
|
135
|
-
});
|
136
|
-
constructor.prototype = $.widget.extend( basePrototype, {
|
137
|
-
// TODO: remove support for widgetEventPrefix
|
138
|
-
// always use the name + a colon as the prefix, e.g., draggable:start
|
139
|
-
// don't prefix for widgets that aren't DOM-based
|
140
|
-
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
141
|
-
}, proxiedPrototype, {
|
142
|
-
constructor: constructor,
|
143
|
-
namespace: namespace,
|
144
|
-
widgetName: name,
|
145
|
-
widgetFullName: fullName
|
146
|
-
});
|
147
|
-
|
148
|
-
// If this widget is being redefined then we need to find all widgets that
|
149
|
-
// are inheriting from it and redefine all of them so that they inherit from
|
150
|
-
// the new version of this widget. We're essentially trying to replace one
|
151
|
-
// level in the prototype chain.
|
152
|
-
if ( existingConstructor ) {
|
153
|
-
$.each( existingConstructor._childConstructors, function( i, child ) {
|
154
|
-
var childPrototype = child.prototype;
|
155
|
-
|
156
|
-
// redefine the child widget using the same prototype that was
|
157
|
-
// originally used, but inherit from the new version of the base
|
158
|
-
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
159
|
-
});
|
160
|
-
// remove the list of existing child constructors from the old constructor
|
161
|
-
// so the old child constructors can be garbage collected
|
162
|
-
delete existingConstructor._childConstructors;
|
163
|
-
} else {
|
164
|
-
base._childConstructors.push( constructor );
|
165
|
-
}
|
166
|
-
|
167
|
-
$.widget.bridge( name, constructor );
|
168
|
-
|
169
|
-
return constructor;
|
170
|
-
};
|
171
|
-
|
172
|
-
$.widget.extend = function( target ) {
|
173
|
-
var input = widget_slice.call( arguments, 1 ),
|
174
|
-
inputIndex = 0,
|
175
|
-
inputLength = input.length,
|
176
|
-
key,
|
177
|
-
value;
|
178
|
-
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
179
|
-
for ( key in input[ inputIndex ] ) {
|
180
|
-
value = input[ inputIndex ][ key ];
|
181
|
-
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
182
|
-
// Clone objects
|
183
|
-
if ( $.isPlainObject( value ) ) {
|
184
|
-
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
185
|
-
$.widget.extend( {}, target[ key ], value ) :
|
186
|
-
// Don't extend strings, arrays, etc. with objects
|
187
|
-
$.widget.extend( {}, value );
|
188
|
-
// Copy everything else by reference
|
189
|
-
} else {
|
190
|
-
target[ key ] = value;
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}
|
195
|
-
return target;
|
196
|
-
};
|
197
|
-
|
198
|
-
$.widget.bridge = function( name, object ) {
|
199
|
-
var fullName = object.prototype.widgetFullName || name;
|
200
|
-
$.fn[ name ] = function( options ) {
|
201
|
-
var isMethodCall = typeof options === "string",
|
202
|
-
args = widget_slice.call( arguments, 1 ),
|
203
|
-
returnValue = this;
|
204
|
-
|
205
|
-
if ( isMethodCall ) {
|
206
|
-
this.each(function() {
|
207
|
-
var methodValue,
|
208
|
-
instance = $.data( this, fullName );
|
209
|
-
if ( options === "instance" ) {
|
210
|
-
returnValue = instance;
|
211
|
-
return false;
|
212
|
-
}
|
213
|
-
if ( !instance ) {
|
214
|
-
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
215
|
-
"attempted to call method '" + options + "'" );
|
216
|
-
}
|
217
|
-
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
218
|
-
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
219
|
-
}
|
220
|
-
methodValue = instance[ options ].apply( instance, args );
|
221
|
-
if ( methodValue !== instance && methodValue !== undefined ) {
|
222
|
-
returnValue = methodValue && methodValue.jquery ?
|
223
|
-
returnValue.pushStack( methodValue.get() ) :
|
224
|
-
methodValue;
|
225
|
-
return false;
|
226
|
-
}
|
227
|
-
});
|
228
|
-
} else {
|
229
|
-
|
230
|
-
// Allow multiple hashes to be passed on init
|
231
|
-
if ( args.length ) {
|
232
|
-
options = $.widget.extend.apply( null, [ options ].concat(args) );
|
233
|
-
}
|
234
|
-
|
235
|
-
this.each(function() {
|
236
|
-
var instance = $.data( this, fullName );
|
237
|
-
if ( instance ) {
|
238
|
-
instance.option( options || {} );
|
239
|
-
if ( instance._init ) {
|
240
|
-
instance._init();
|
241
|
-
}
|
242
|
-
} else {
|
243
|
-
$.data( this, fullName, new object( options, this ) );
|
244
|
-
}
|
245
|
-
});
|
246
|
-
}
|
247
|
-
|
248
|
-
return returnValue;
|
249
|
-
};
|
250
|
-
};
|
251
|
-
|
252
|
-
$.Widget = function( /* options, element */ ) {};
|
253
|
-
$.Widget._childConstructors = [];
|
254
|
-
|
255
|
-
$.Widget.prototype = {
|
256
|
-
widgetName: "widget",
|
257
|
-
widgetEventPrefix: "",
|
258
|
-
defaultElement: "<div>",
|
259
|
-
options: {
|
260
|
-
disabled: false,
|
261
|
-
|
262
|
-
// callbacks
|
263
|
-
create: null
|
264
|
-
},
|
265
|
-
_createWidget: function( options, element ) {
|
266
|
-
element = $( element || this.defaultElement || this )[ 0 ];
|
267
|
-
this.element = $( element );
|
268
|
-
this.uuid = widget_uuid++;
|
269
|
-
this.eventNamespace = "." + this.widgetName + this.uuid;
|
270
|
-
|
271
|
-
this.bindings = $();
|
272
|
-
this.hoverable = $();
|
273
|
-
this.focusable = $();
|
274
|
-
|
275
|
-
if ( element !== this ) {
|
276
|
-
$.data( element, this.widgetFullName, this );
|
277
|
-
this._on( true, this.element, {
|
278
|
-
remove: function( event ) {
|
279
|
-
if ( event.target === element ) {
|
280
|
-
this.destroy();
|
281
|
-
}
|
282
|
-
}
|
283
|
-
});
|
284
|
-
this.document = $( element.style ?
|
285
|
-
// element within the document
|
286
|
-
element.ownerDocument :
|
287
|
-
// element is window or document
|
288
|
-
element.document || element );
|
289
|
-
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
290
|
-
}
|
291
|
-
|
292
|
-
this.options = $.widget.extend( {},
|
293
|
-
this.options,
|
294
|
-
this._getCreateOptions(),
|
295
|
-
options );
|
296
|
-
|
297
|
-
this._create();
|
298
|
-
this._trigger( "create", null, this._getCreateEventData() );
|
299
|
-
this._init();
|
300
|
-
},
|
301
|
-
_getCreateOptions: $.noop,
|
302
|
-
_getCreateEventData: $.noop,
|
303
|
-
_create: $.noop,
|
304
|
-
_init: $.noop,
|
305
|
-
|
306
|
-
destroy: function() {
|
307
|
-
this._destroy();
|
308
|
-
// we can probably remove the unbind calls in 2.0
|
309
|
-
// all event bindings should go through this._on()
|
310
|
-
this.element
|
311
|
-
.unbind( this.eventNamespace )
|
312
|
-
.removeData( this.widgetFullName )
|
313
|
-
// support: jquery <1.6.3
|
314
|
-
// http://bugs.jquery.com/ticket/9413
|
315
|
-
.removeData( $.camelCase( this.widgetFullName ) );
|
316
|
-
this.widget()
|
317
|
-
.unbind( this.eventNamespace )
|
318
|
-
.removeAttr( "aria-disabled" )
|
319
|
-
.removeClass(
|
320
|
-
this.widgetFullName + "-disabled " +
|
321
|
-
"ui-state-disabled" );
|
322
|
-
|
323
|
-
// clean up events and states
|
324
|
-
this.bindings.unbind( this.eventNamespace );
|
325
|
-
this.hoverable.removeClass( "ui-state-hover" );
|
326
|
-
this.focusable.removeClass( "ui-state-focus" );
|
327
|
-
},
|
328
|
-
_destroy: $.noop,
|
329
|
-
|
330
|
-
widget: function() {
|
331
|
-
return this.element;
|
332
|
-
},
|
333
|
-
|
334
|
-
option: function( key, value ) {
|
335
|
-
var options = key,
|
336
|
-
parts,
|
337
|
-
curOption,
|
338
|
-
i;
|
339
|
-
|
340
|
-
if ( arguments.length === 0 ) {
|
341
|
-
// don't return a reference to the internal hash
|
342
|
-
return $.widget.extend( {}, this.options );
|
343
|
-
}
|
344
|
-
|
345
|
-
if ( typeof key === "string" ) {
|
346
|
-
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
347
|
-
options = {};
|
348
|
-
parts = key.split( "." );
|
349
|
-
key = parts.shift();
|
350
|
-
if ( parts.length ) {
|
351
|
-
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
352
|
-
for ( i = 0; i < parts.length - 1; i++ ) {
|
353
|
-
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
354
|
-
curOption = curOption[ parts[ i ] ];
|
355
|
-
}
|
356
|
-
key = parts.pop();
|
357
|
-
if ( arguments.length === 1 ) {
|
358
|
-
return curOption[ key ] === undefined ? null : curOption[ key ];
|
359
|
-
}
|
360
|
-
curOption[ key ] = value;
|
361
|
-
} else {
|
362
|
-
if ( arguments.length === 1 ) {
|
363
|
-
return this.options[ key ] === undefined ? null : this.options[ key ];
|
364
|
-
}
|
365
|
-
options[ key ] = value;
|
366
|
-
}
|
367
|
-
}
|
368
|
-
|
369
|
-
this._setOptions( options );
|
370
|
-
|
371
|
-
return this;
|
372
|
-
},
|
373
|
-
_setOptions: function( options ) {
|
374
|
-
var key;
|
375
|
-
|
376
|
-
for ( key in options ) {
|
377
|
-
this._setOption( key, options[ key ] );
|
378
|
-
}
|
379
|
-
|
380
|
-
return this;
|
381
|
-
},
|
382
|
-
_setOption: function( key, value ) {
|
383
|
-
this.options[ key ] = value;
|
384
|
-
|
385
|
-
if ( key === "disabled" ) {
|
386
|
-
this.widget()
|
387
|
-
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
388
|
-
|
389
|
-
// If the widget is becoming disabled, then nothing is interactive
|
390
|
-
if ( value ) {
|
391
|
-
this.hoverable.removeClass( "ui-state-hover" );
|
392
|
-
this.focusable.removeClass( "ui-state-focus" );
|
393
|
-
}
|
394
|
-
}
|
395
|
-
|
396
|
-
return this;
|
397
|
-
},
|
398
|
-
|
399
|
-
enable: function() {
|
400
|
-
return this._setOptions({ disabled: false });
|
401
|
-
},
|
402
|
-
disable: function() {
|
403
|
-
return this._setOptions({ disabled: true });
|
404
|
-
},
|
405
|
-
|
406
|
-
_on: function( suppressDisabledCheck, element, handlers ) {
|
407
|
-
var delegateElement,
|
408
|
-
instance = this;
|
409
|
-
|
410
|
-
// no suppressDisabledCheck flag, shuffle arguments
|
411
|
-
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
412
|
-
handlers = element;
|
413
|
-
element = suppressDisabledCheck;
|
414
|
-
suppressDisabledCheck = false;
|
415
|
-
}
|
416
|
-
|
417
|
-
// no element argument, shuffle and use this.element
|
418
|
-
if ( !handlers ) {
|
419
|
-
handlers = element;
|
420
|
-
element = this.element;
|
421
|
-
delegateElement = this.widget();
|
422
|
-
} else {
|
423
|
-
element = delegateElement = $( element );
|
424
|
-
this.bindings = this.bindings.add( element );
|
425
|
-
}
|
426
|
-
|
427
|
-
$.each( handlers, function( event, handler ) {
|
428
|
-
function handlerProxy() {
|
429
|
-
// allow widgets to customize the disabled handling
|
430
|
-
// - disabled as an array instead of boolean
|
431
|
-
// - disabled class as method for disabling individual parts
|
432
|
-
if ( !suppressDisabledCheck &&
|
433
|
-
( instance.options.disabled === true ||
|
434
|
-
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
435
|
-
return;
|
436
|
-
}
|
437
|
-
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
438
|
-
.apply( instance, arguments );
|
439
|
-
}
|
440
|
-
|
441
|
-
// copy the guid so direct unbinding works
|
442
|
-
if ( typeof handler !== "string" ) {
|
443
|
-
handlerProxy.guid = handler.guid =
|
444
|
-
handler.guid || handlerProxy.guid || $.guid++;
|
445
|
-
}
|
446
|
-
|
447
|
-
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
448
|
-
eventName = match[1] + instance.eventNamespace,
|
449
|
-
selector = match[2];
|
450
|
-
if ( selector ) {
|
451
|
-
delegateElement.delegate( selector, eventName, handlerProxy );
|
452
|
-
} else {
|
453
|
-
element.bind( eventName, handlerProxy );
|
454
|
-
}
|
455
|
-
});
|
456
|
-
},
|
457
|
-
|
458
|
-
_off: function( element, eventName ) {
|
459
|
-
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
|
460
|
-
this.eventNamespace;
|
461
|
-
element.unbind( eventName ).undelegate( eventName );
|
462
|
-
|
463
|
-
// Clear the stack to avoid memory leaks (#10056)
|
464
|
-
this.bindings = $( this.bindings.not( element ).get() );
|
465
|
-
this.focusable = $( this.focusable.not( element ).get() );
|
466
|
-
this.hoverable = $( this.hoverable.not( element ).get() );
|
467
|
-
},
|
468
|
-
|
469
|
-
_delay: function( handler, delay ) {
|
470
|
-
function handlerProxy() {
|
471
|
-
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
472
|
-
.apply( instance, arguments );
|
473
|
-
}
|
474
|
-
var instance = this;
|
475
|
-
return setTimeout( handlerProxy, delay || 0 );
|
476
|
-
},
|
477
|
-
|
478
|
-
_hoverable: function( element ) {
|
479
|
-
this.hoverable = this.hoverable.add( element );
|
480
|
-
this._on( element, {
|
481
|
-
mouseenter: function( event ) {
|
482
|
-
$( event.currentTarget ).addClass( "ui-state-hover" );
|
483
|
-
},
|
484
|
-
mouseleave: function( event ) {
|
485
|
-
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
486
|
-
}
|
487
|
-
});
|
488
|
-
},
|
489
|
-
|
490
|
-
_focusable: function( element ) {
|
491
|
-
this.focusable = this.focusable.add( element );
|
492
|
-
this._on( element, {
|
493
|
-
focusin: function( event ) {
|
494
|
-
$( event.currentTarget ).addClass( "ui-state-focus" );
|
495
|
-
},
|
496
|
-
focusout: function( event ) {
|
497
|
-
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
498
|
-
}
|
499
|
-
});
|
500
|
-
},
|
501
|
-
|
502
|
-
_trigger: function( type, event, data ) {
|
503
|
-
var prop, orig,
|
504
|
-
callback = this.options[ type ];
|
505
|
-
|
506
|
-
data = data || {};
|
507
|
-
event = $.Event( event );
|
508
|
-
event.type = ( type === this.widgetEventPrefix ?
|
509
|
-
type :
|
510
|
-
this.widgetEventPrefix + type ).toLowerCase();
|
511
|
-
// the original event may come from any element
|
512
|
-
// so we need to reset the target on the new event
|
513
|
-
event.target = this.element[ 0 ];
|
514
|
-
|
515
|
-
// copy original event properties over to the new event
|
516
|
-
orig = event.originalEvent;
|
517
|
-
if ( orig ) {
|
518
|
-
for ( prop in orig ) {
|
519
|
-
if ( !( prop in event ) ) {
|
520
|
-
event[ prop ] = orig[ prop ];
|
521
|
-
}
|
522
|
-
}
|
523
|
-
}
|
524
|
-
|
525
|
-
this.element.trigger( event, data );
|
526
|
-
return !( $.isFunction( callback ) &&
|
527
|
-
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
528
|
-
event.isDefaultPrevented() );
|
529
|
-
}
|
530
|
-
};
|
531
|
-
|
532
|
-
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
533
|
-
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
534
|
-
if ( typeof options === "string" ) {
|
535
|
-
options = { effect: options };
|
536
|
-
}
|
537
|
-
var hasOptions,
|
538
|
-
effectName = !options ?
|
539
|
-
method :
|
540
|
-
options === true || typeof options === "number" ?
|
541
|
-
defaultEffect :
|
542
|
-
options.effect || defaultEffect;
|
543
|
-
options = options || {};
|
544
|
-
if ( typeof options === "number" ) {
|
545
|
-
options = { duration: options };
|
546
|
-
}
|
547
|
-
hasOptions = !$.isEmptyObject( options );
|
548
|
-
options.complete = callback;
|
549
|
-
if ( options.delay ) {
|
550
|
-
element.delay( options.delay );
|
551
|
-
}
|
552
|
-
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
553
|
-
element[ method ]( options );
|
554
|
-
} else if ( effectName !== method && element[ effectName ] ) {
|
555
|
-
element[ effectName ]( options.duration, options.easing, callback );
|
556
|
-
} else {
|
557
|
-
element.queue(function( next ) {
|
558
|
-
$( this )[ method ]();
|
559
|
-
if ( callback ) {
|
560
|
-
callback.call( element[ 0 ] );
|
561
|
-
}
|
562
|
-
next();
|
563
|
-
});
|
564
|
-
}
|
565
|
-
};
|
566
|
-
});
|
567
|
-
|
568
|
-
var widget = $.widget;
|
569
749
|
|
570
750
|
|
571
751
|
|