trusty-cms 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/app/assets/javascripts/admin/assets_admin.js +1 -2
- data/app/assets/javascripts/admin.js +3 -3
- data/app/assets/javascripts/ckeditor/config.js +17 -17
- data/lib/generators/extension/templates/cucumber_paths.rb +0 -2
- data/lib/generators/extension_controller/extension_controller_generator.rb +0 -1
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +0 -1
- data/lib/generators/extension_migration/extension_migration_generator.rb +0 -1
- data/lib/generators/extension_model/extension_model_generator.rb +0 -1
- data/lib/generators/instance/instance_generator.rb +0 -1
- data/lib/generators/language_extension/templates/test_helper.rb +0 -1
- data/lib/generators/trusty_cms/trusty_cms_generator.rb +0 -1
- data/lib/trusty_cms.rb +1 -1
- data/package.json +4 -0
- data/yarn.lock +46 -0
- metadata +35 -39
- data/app/assets/javascripts/admin/jquery.cookie.js +0 -117
- data/app/assets/javascripts/admin/jquery.fileupload.js +0 -1457
- data/app/assets/javascripts/admin/jquery.iframe-transport.js +0 -214
- data/app/assets/javascripts/admin/jquery.treetable.js +0 -629
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef01db17864b39bd25d87227e0d6b78995df3a784e6ef4fc1416919d7effe180
|
4
|
+
data.tar.gz: 6b66fad628f8bac4f030edda68a33d403de8530ea41f86ca3fae78ed6921f785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e57ba7b714ba22b4a493a2f6616bcab50658f3c53647aa997e7e6b75c218db5f994a351bc352314ff8f42ddf65c0e148a2a787f6bc540fb9287414e8f2fadc7e
|
7
|
+
data.tar.gz: 98915375ec4787f9ead33fe204a01ec15508d8eac073ebc1ea3ab4d34b3d17142899fa071f6fcd7b73b3fd8f3673072e930b5d0dc600359202ef6378b88919ff
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (5.
|
4
|
+
trusty-cms (5.2.0)
|
5
5
|
RedCloth (= 4.3.2)
|
6
6
|
activestorage-validator
|
7
7
|
acts_as_list (>= 0.9.5, < 1.1.0)
|
@@ -186,7 +186,6 @@ GEM
|
|
186
186
|
addressable (~> 2.7)
|
187
187
|
libv8-node (16.10.0.0-x86_64-darwin)
|
188
188
|
libv8-node (16.10.0.0-x86_64-linux)
|
189
|
-
libv8-node (16.10.0.0-x86_64-linux-musl)
|
190
189
|
loofah (2.15.0)
|
191
190
|
crass (~> 1.0.2)
|
192
191
|
nokogiri (>= 1.5.9)
|
@@ -318,7 +317,7 @@ GEM
|
|
318
317
|
activesupport (>= 5.2)
|
319
318
|
sprockets (>= 3.0.0)
|
320
319
|
stringex (2.8.5)
|
321
|
-
stringio (3.0.
|
320
|
+
stringio (3.0.2)
|
322
321
|
temple (0.8.2)
|
323
322
|
terrapin (0.6.0)
|
324
323
|
climate_control (>= 0.0.3, < 1.0)
|
@@ -344,6 +343,7 @@ GEM
|
|
344
343
|
PLATFORMS
|
345
344
|
x86_64-darwin-18
|
346
345
|
x86_64-darwin-20
|
346
|
+
x86_64-darwin-21
|
347
347
|
x86_64-linux
|
348
348
|
|
349
349
|
DEPENDENCIES
|
@@ -10,6 +10,5 @@
|
|
10
10
|
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
11
|
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
|
-
//= require '
|
14
|
-
//= require 'admin/jquery.fileupload'
|
13
|
+
//= require 'blueimp-file-upload/js/jquery.fileupload.js'
|
15
14
|
//= require 'admin/assets'
|
@@ -13,9 +13,9 @@
|
|
13
13
|
//= require jquery/dist/jquery.js
|
14
14
|
//= require jquery-ujs/src/rails.js
|
15
15
|
//= require jquery-ui-bundle/jquery-ui
|
16
|
-
//= require
|
17
|
-
//= require '
|
18
|
-
//= require '
|
16
|
+
//= require js-cookie/dist/js.cookie
|
17
|
+
//= require 'jquery-validation/dist/jquery.validate.min'
|
18
|
+
//= require 'jquery-treetable/jquery.treetable'
|
19
19
|
//= require_tree './admin/validations'
|
20
20
|
//= require ckeditor/init
|
21
21
|
//= require 'admin/persist.min'
|
@@ -1,21 +1,21 @@
|
|
1
|
-
CKEDITOR.editorConfig = function(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
CKEDITOR.editorConfig = function (config) {
|
2
|
+
config.allowedContent = true;
|
3
|
+
config.removeFormatTags = "";
|
4
|
+
config.protectedSource.push(/<r:([\S]+).*<\/r:\1>/g);
|
5
|
+
config.protectedSource.push(/<r:[^>/]*\/>/g);
|
6
|
+
//let paste from word be available
|
7
|
+
// config.forcePasteAsPlainText = false;
|
8
|
+
// if you want to remove clipboard, you have to remove all of these:
|
9
|
+
// clipboard, pastetext, pastefromword
|
10
|
+
config.removePlugins = "save, newpage, preview, print, templates, forms, flash, smiley, language, pagebreak, iframe, bidi";
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
var startupMode = Cookies.get('ckeditor.startupMode');
|
13
|
+
if (startupMode == 'source' || startupMode == 'wysiwyg') {
|
14
|
+
config.startupMode = startupMode;
|
15
|
+
}
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
this.on('mode', function () {
|
18
|
+
Cookies.set('ckeditor.startupMode', this.mode);
|
19
|
+
})
|
20
20
|
|
21
21
|
};
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module NavigationHelpers
|
2
|
-
|
3
2
|
# Extend the standard PathMatchers with your own paths
|
4
3
|
# to be used in your features.
|
5
4
|
#
|
@@ -16,7 +15,6 @@ module NavigationHelpers
|
|
16
15
|
PathMatchers.merge!({
|
17
16
|
# /<%= file_name %>/i => 'admin_<%= file_name %>_path'
|
18
17
|
})
|
19
|
-
|
20
18
|
end
|
21
19
|
|
22
20
|
World(NavigationHelpers)
|
data/lib/trusty_cms.rb
CHANGED
data/package.json
CHANGED
@@ -8,9 +8,13 @@
|
|
8
8
|
"license": "MIT",
|
9
9
|
"dependencies": {
|
10
10
|
"@fortawesome/fontawesome-free": "^5.13.0",
|
11
|
+
"blueimp-file-upload": "^10.32.0",
|
11
12
|
"jquery": "^3.5.0",
|
13
|
+
"jquery-treetable": "^3.2.0-1",
|
12
14
|
"jquery-ui-bundle": "^1.12.1",
|
13
15
|
"jquery-ujs": "^1.2.2",
|
16
|
+
"jquery-validation": "^1.19.3",
|
17
|
+
"js-cookie": "^3.0.1",
|
14
18
|
"tablesaw": "^3.1.2"
|
15
19
|
},
|
16
20
|
"devDependencies": {
|
data/yarn.lock
CHANGED
@@ -323,6 +323,30 @@ balanced-match@^1.0.0:
|
|
323
323
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
324
324
|
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
325
325
|
|
326
|
+
blueimp-canvas-to-blob@3:
|
327
|
+
version "3.29.0"
|
328
|
+
resolved "https://registry.yarnpkg.com/blueimp-canvas-to-blob/-/blueimp-canvas-to-blob-3.29.0.tgz#d965f06cb1a67fdae207a2be56683f55ef531466"
|
329
|
+
integrity sha512-0pcSSGxC0QxT+yVkivxIqW0Y4VlO2XSDPofBAqoJ1qJxgH9eiUDLv50Rixij2cDuEfx4M6DpD9UGZpRhT5Q8qg==
|
330
|
+
|
331
|
+
blueimp-file-upload@^10.32.0:
|
332
|
+
version "10.32.0"
|
333
|
+
resolved "https://registry.yarnpkg.com/blueimp-file-upload/-/blueimp-file-upload-10.32.0.tgz#897c91f813ccf4b6cd14db2da3da237ce433e04e"
|
334
|
+
integrity sha512-3WMJw5Cbfz94Adl1OeyH+rRpGwHiNHzja+CR6aRWPoAtwrUwvP5gXKo0XdX+sdPE+iCU63Xmba88hoHQmzY8RQ==
|
335
|
+
optionalDependencies:
|
336
|
+
blueimp-canvas-to-blob "3"
|
337
|
+
blueimp-load-image "5"
|
338
|
+
blueimp-tmpl "3"
|
339
|
+
|
340
|
+
blueimp-load-image@5:
|
341
|
+
version "5.16.0"
|
342
|
+
resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-5.16.0.tgz#16b763f57e6725f8865517bca8eb7c3dc7d41e09"
|
343
|
+
integrity sha512-3DUSVdOtlfNRk7moRZuTwDmA3NnG8KIJuLcq3c0J7/BIr6X3Vb/EpX3kUH1joxUhmoVF4uCpDfz7wHkz8pQajA==
|
344
|
+
|
345
|
+
blueimp-tmpl@3:
|
346
|
+
version "3.20.0"
|
347
|
+
resolved "https://registry.yarnpkg.com/blueimp-tmpl/-/blueimp-tmpl-3.20.0.tgz#bed897db362c70d3740e0ad1020ce84bfa15ceaa"
|
348
|
+
integrity sha512-g6ln9L+VX8ZA4WA8mgKMethYH+5teroJ2uOkCvcthy9Y9d9LrQ42OAMn+r3ECKu9CB+xe9GOChlIUJBSxwkI6g==
|
349
|
+
|
326
350
|
brace-expansion@^1.1.7:
|
327
351
|
version "1.1.11"
|
328
352
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
@@ -931,6 +955,13 @@ javascript-natural-sort@^0.7.1:
|
|
931
955
|
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
|
932
956
|
integrity sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=
|
933
957
|
|
958
|
+
jquery-treetable@^3.2.0-1:
|
959
|
+
version "3.2.0-1"
|
960
|
+
resolved "https://registry.yarnpkg.com/jquery-treetable/-/jquery-treetable-3.2.0-1.tgz#2a844f59396f764f71747a5087ee555d360aaed7"
|
961
|
+
integrity sha1-KoRPWTlvdk9xdHpQh+5VXTYKrtc=
|
962
|
+
dependencies:
|
963
|
+
jquery ">=1.6"
|
964
|
+
|
934
965
|
jquery-ui-bundle@^1.12.1:
|
935
966
|
version "1.12.1"
|
936
967
|
resolved "https://registry.yarnpkg.com/jquery-ui-bundle/-/jquery-ui-bundle-1.12.1.tgz#d6be2e4c377494e2378b1cae2920a91d1182d8c4"
|
@@ -943,11 +974,26 @@ jquery-ujs@^1.2.2:
|
|
943
974
|
dependencies:
|
944
975
|
jquery ">=1.8.0"
|
945
976
|
|
977
|
+
jquery-validation@^1.19.3:
|
978
|
+
version "1.19.3"
|
979
|
+
resolved "https://registry.yarnpkg.com/jquery-validation/-/jquery-validation-1.19.3.tgz#50b350eba8b02bcfd119ba15f199487b7eb64086"
|
980
|
+
integrity sha512-iXxCS5W7STthSTMFX/NDZfWHBLbJ1behVK3eAgHXAV8/0vRa9M4tiqHvJMr39VGWHMGdlkhrtrkBuaL2UlE8yw==
|
981
|
+
|
982
|
+
jquery@>=1.6:
|
983
|
+
version "3.6.0"
|
984
|
+
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
|
985
|
+
integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==
|
986
|
+
|
946
987
|
jquery@>=1.8.0, jquery@^3.5.0:
|
947
988
|
version "3.5.0"
|
948
989
|
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.0.tgz#9980b97d9e4194611c36530e7dc46a58d7340fc9"
|
949
990
|
integrity sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ==
|
950
991
|
|
992
|
+
js-cookie@^3.0.1:
|
993
|
+
version "3.0.1"
|
994
|
+
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.1.tgz#9e39b4c6c2f56563708d7d31f6f5f21873a92414"
|
995
|
+
integrity sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==
|
996
|
+
|
951
997
|
js-tokens@^4.0.0:
|
952
998
|
version "4.0.0"
|
953
999
|
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|
@@ -601,10 +601,6 @@ files:
|
|
601
601
|
- app/assets/javascripts/admin/custom_file_upload.js
|
602
602
|
- app/assets/javascripts/admin/datecheck.js
|
603
603
|
- app/assets/javascripts/admin/dropdown.js
|
604
|
-
- app/assets/javascripts/admin/jquery.cookie.js
|
605
|
-
- app/assets/javascripts/admin/jquery.fileupload.js
|
606
|
-
- app/assets/javascripts/admin/jquery.iframe-transport.js
|
607
|
-
- app/assets/javascripts/admin/jquery.treetable.js
|
608
604
|
- app/assets/javascripts/admin/jquery.validate.min.js
|
609
605
|
- app/assets/javascripts/admin/modernizr.js
|
610
606
|
- app/assets/javascripts/admin/more-or-less.js
|
@@ -1174,51 +1170,51 @@ specification_version: 4
|
|
1174
1170
|
summary: A no-fluff content management system designed for small teams.
|
1175
1171
|
test_files:
|
1176
1172
|
- spec/spec_helper.rb
|
1177
|
-
- spec/
|
1178
|
-
- spec/controllers/users_controller_spec.rb
|
1179
|
-
- spec/models/layout_spec.rb
|
1180
|
-
- spec/ci/database.mysql.yml
|
1173
|
+
- spec/support/custom_actions.rb
|
1181
1174
|
- spec/fixtures/users.yml
|
1182
|
-
- spec/
|
1183
|
-
- spec/
|
1184
|
-
- spec/
|
1185
|
-
- spec/dummy/
|
1186
|
-
- spec/dummy/
|
1187
|
-
- spec/dummy/
|
1188
|
-
- spec/dummy/
|
1175
|
+
- spec/dummy/package.json
|
1176
|
+
- spec/dummy/yarn.lock
|
1177
|
+
- spec/dummy/bin/rake
|
1178
|
+
- spec/dummy/bin/bundle
|
1179
|
+
- spec/dummy/bin/rails
|
1180
|
+
- spec/dummy/bin/setup
|
1181
|
+
- spec/dummy/Rakefile
|
1189
1182
|
- spec/dummy/config/boot.rb
|
1190
|
-
- spec/dummy/config/
|
1191
|
-
- spec/dummy/config/
|
1183
|
+
- spec/dummy/config/secrets.yml
|
1184
|
+
- spec/dummy/config/application.rb
|
1185
|
+
- spec/dummy/config/routes.rb
|
1192
1186
|
- spec/dummy/config/environments/development.rb
|
1193
|
-
- spec/dummy/config/environments/production.rb
|
1194
1187
|
- spec/dummy/config/environments/test.rb
|
1195
|
-
- spec/dummy/config/
|
1188
|
+
- spec/dummy/config/environments/production.rb
|
1189
|
+
- spec/dummy/config/database.yml
|
1190
|
+
- spec/dummy/config/environment.rb
|
1191
|
+
- spec/dummy/config/locales/en.yml
|
1196
1192
|
- spec/dummy/config/initializers/assets.rb
|
1197
|
-
- spec/dummy/config/initializers/
|
1198
|
-
- spec/dummy/config/initializers/inflections.rb
|
1193
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
1199
1194
|
- spec/dummy/config/initializers/mime_types.rb
|
1200
|
-
- spec/dummy/config/initializers/
|
1195
|
+
- spec/dummy/config/initializers/inflections.rb
|
1201
1196
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
1202
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
1203
1197
|
- spec/dummy/config/initializers/trusty_cms_config.rb
|
1204
|
-
- spec/dummy/config/
|
1198
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
1199
|
+
- spec/dummy/config/initializers/session_store.rb
|
1200
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
1205
1201
|
- spec/dummy/README.rdoc
|
1206
|
-
- spec/dummy/
|
1207
|
-
- spec/dummy/
|
1208
|
-
- spec/dummy/public/500.html
|
1202
|
+
- spec/dummy/app/assets/config/manifest.js
|
1203
|
+
- spec/dummy/db/schema.rb
|
1209
1204
|
- spec/dummy/public/422.html
|
1205
|
+
- spec/dummy/public/500.html
|
1210
1206
|
- spec/dummy/public/favicon.ico
|
1211
|
-
- spec/dummy/
|
1212
|
-
- spec/dummy/package.json
|
1207
|
+
- spec/dummy/public/404.html
|
1213
1208
|
- spec/dummy/config.ru
|
1214
|
-
- spec/
|
1215
|
-
- spec/dummy/bin/rails
|
1216
|
-
- spec/dummy/bin/rake
|
1217
|
-
- spec/dummy/bin/bundle
|
1218
|
-
- spec/dummy/app/assets/config/manifest.js
|
1219
|
-
- spec/factories/page_part.rb
|
1209
|
+
- spec/factories/layout.rb
|
1220
1210
|
- spec/factories/page.rb
|
1211
|
+
- spec/factories/page_part.rb
|
1221
1212
|
- spec/factories/user.rb
|
1222
|
-
- spec/
|
1213
|
+
- spec/controllers/application_controller_spec.rb
|
1214
|
+
- spec/controllers/users_controller_spec.rb
|
1223
1215
|
- spec/rails_helper.rb
|
1224
|
-
- spec/
|
1216
|
+
- spec/features/layouts_spec.rb
|
1217
|
+
- spec/features/pages_spec.rb
|
1218
|
+
- spec/features/config_spec.rb
|
1219
|
+
- spec/models/layout_spec.rb
|
1220
|
+
- spec/ci/database.mysql.yml
|
@@ -1,117 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Cookie Plugin v1.4.1
|
3
|
-
* https://github.com/carhartl/jquery-cookie
|
4
|
-
*
|
5
|
-
* Copyright 2006, 2014 Klaus Hartl
|
6
|
-
* Released under the MIT license
|
7
|
-
*/
|
8
|
-
(function (factory) {
|
9
|
-
if (typeof define === 'function' && define.amd) {
|
10
|
-
// AMD
|
11
|
-
define(['jquery'], factory);
|
12
|
-
} else if (typeof exports === 'object') {
|
13
|
-
// CommonJS
|
14
|
-
factory(require('jquery'));
|
15
|
-
} else {
|
16
|
-
// Browser globals
|
17
|
-
factory(jQuery);
|
18
|
-
}
|
19
|
-
}(function ($) {
|
20
|
-
|
21
|
-
var pluses = /\+/g;
|
22
|
-
|
23
|
-
function encode(s) {
|
24
|
-
return config.raw ? s : encodeURIComponent(s);
|
25
|
-
}
|
26
|
-
|
27
|
-
function decode(s) {
|
28
|
-
return config.raw ? s : decodeURIComponent(s);
|
29
|
-
}
|
30
|
-
|
31
|
-
function stringifyCookieValue(value) {
|
32
|
-
return encode(config.json ? JSON.stringify(value) : String(value));
|
33
|
-
}
|
34
|
-
|
35
|
-
function parseCookieValue(s) {
|
36
|
-
if (s.indexOf('"') === 0) {
|
37
|
-
// This is a quoted cookie as according to RFC2068, unescape...
|
38
|
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
39
|
-
}
|
40
|
-
|
41
|
-
try {
|
42
|
-
// Replace server-side written pluses with spaces.
|
43
|
-
// If we can't decode the cookie, ignore it, it's unusable.
|
44
|
-
// If we can't parse the cookie, ignore it, it's unusable.
|
45
|
-
s = decodeURIComponent(s.replace(pluses, ' '));
|
46
|
-
return config.json ? JSON.parse(s) : s;
|
47
|
-
} catch(e) {}
|
48
|
-
}
|
49
|
-
|
50
|
-
function read(s, converter) {
|
51
|
-
var value = config.raw ? s : parseCookieValue(s);
|
52
|
-
return $.isFunction(converter) ? converter(value) : value;
|
53
|
-
}
|
54
|
-
|
55
|
-
var config = $.cookie = function (key, value, options) {
|
56
|
-
|
57
|
-
// Write
|
58
|
-
|
59
|
-
if (arguments.length > 1 && !$.isFunction(value)) {
|
60
|
-
options = $.extend({}, config.defaults, options);
|
61
|
-
|
62
|
-
if (typeof options.expires === 'number') {
|
63
|
-
var days = options.expires, t = options.expires = new Date();
|
64
|
-
t.setTime(+t + days * 864e+5);
|
65
|
-
}
|
66
|
-
|
67
|
-
return (document.cookie = [
|
68
|
-
encode(key), '=', stringifyCookieValue(value),
|
69
|
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
70
|
-
options.path ? '; path=' + options.path : '',
|
71
|
-
options.domain ? '; domain=' + options.domain : '',
|
72
|
-
options.secure ? '; secure' : ''
|
73
|
-
].join(''));
|
74
|
-
}
|
75
|
-
|
76
|
-
// Read
|
77
|
-
|
78
|
-
var result = key ? undefined : {};
|
79
|
-
|
80
|
-
// To prevent the for loop in the first place assign an empty array
|
81
|
-
// in case there are no cookies at all. Also prevents odd result when
|
82
|
-
// calling $.cookie().
|
83
|
-
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
84
|
-
|
85
|
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
86
|
-
var parts = cookies[i].split('=');
|
87
|
-
var name = decode(parts.shift());
|
88
|
-
var cookie = parts.join('=');
|
89
|
-
|
90
|
-
if (key && key === name) {
|
91
|
-
// If second argument (value) is a function it's a converter...
|
92
|
-
result = read(cookie, value);
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
|
96
|
-
// Prevent storing a cookie that we couldn't decode.
|
97
|
-
if (!key && (cookie = read(cookie)) !== undefined) {
|
98
|
-
result[name] = cookie;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
return result;
|
103
|
-
};
|
104
|
-
|
105
|
-
config.defaults = {};
|
106
|
-
|
107
|
-
$.removeCookie = function (key, options) {
|
108
|
-
if ($.cookie(key) === undefined) {
|
109
|
-
return false;
|
110
|
-
}
|
111
|
-
|
112
|
-
// Must not alter options, thus extending a fresh object...
|
113
|
-
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
114
|
-
return !$.cookie(key);
|
115
|
-
};
|
116
|
-
|
117
|
-
}));
|