card-mod-script 0.13.2 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/components.js.coffee +3 -0
  3. data/assets/script/decko/decko.js.coffee +0 -15
  4. data/assets/script/decko/editor.js.coffee +3 -1
  5. data/assets/script/decko/filter.js.coffee +14 -7
  6. data/assets/script/decko/filter_links.js.coffee +2 -2
  7. data/assets/script/decko/mod.js.coffee +2 -8
  8. data/assets/script/decko/name_editor.js.coffee +0 -18
  9. data/assets/script/decko/overlay.js.coffee +0 -3
  10. data/assets/script/{script_pointer_config.js.coffee → decko/pointer_config.js.coffee} +1 -2
  11. data/assets/script/{script_pointer_list_editor.js.coffee → decko/pointer_list_editor.js.coffee} +0 -0
  12. data/assets/script/decko/slot.js.coffee +3 -3
  13. data/assets/script/decko/slot_ready.js.coffee +1 -0
  14. data/assets/script/decko/slotter.js.coffee +23 -31
  15. data/assets/script/decko/type_editor.js.coffee +21 -0
  16. data/assets/script/decko/upload.js.coffee +12 -5
  17. data/assets/script/jquery-ui.min.js +13 -0
  18. data/assets/script/manifest.yml +16 -3
  19. data/init/early/init_execjs.rb +3 -0
  20. data/set/abstract/00_script.rb +30 -31
  21. data/set/abstract/01_asset_script.rb +0 -16
  22. data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
  23. data/set/all/head_javascript.rb +12 -8
  24. data/set/right/script.rb +1 -14
  25. data/set/type/local_script_folder_group.rb +2 -2
  26. data/set/type/local_script_manifest_group.rb +1 -1
  27. data/set/type_plus_right/mod/script.rb +56 -0
  28. data/set/type_plus_right/set/script.rb +7 -0
  29. data/vendor/jquery_file_upload/LICENSE.txt +11 -12
  30. data/vendor/jquery_file_upload/README.md +189 -72
  31. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  32. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  33. data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
  34. data/vendor/jquery_file_upload/cors/result.html +12 -10
  35. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
  36. data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
  37. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  38. data/vendor/jquery_file_upload/index.html +332 -230
  39. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
  40. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
  41. data/vendor/jquery_file_upload/js/demo.js +75 -0
  42. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
  43. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
  44. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
  45. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
  46. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
  47. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
  48. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
  49. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
  50. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
  51. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  52. data/vendor/jquery_file_upload/package.json +71 -10
  53. data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
  54. data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
  55. data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
  56. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  57. data/vendor/jquery_file_upload/test/index.html +36 -159
  58. data/vendor/jquery_file_upload/test/unit.js +989 -0
  59. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  60. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  61. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  62. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  63. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  64. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  65. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  66. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  67. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  68. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  69. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  70. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  71. metadata +36 -53
  72. data/assets/script/jquery-ui.js +0 -10
  73. data/file/mod_script_script_decko_machine_output/file.js +0 -2710
  74. data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
  75. data/lib/javascript/script_html5shiv_printshiv.js +0 -1
  76. data/set/self/script_html5shiv_printshiv.rb +0 -11
  77. data/set/self/script_mods.rb +0 -1
  78. data/set/type/mod_script_assets.rb +0 -21
  79. data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
  80. data/vendor/jquery_file_upload/angularjs.html +0 -211
  81. data/vendor/jquery_file_upload/basic-plus.html +0 -226
  82. data/vendor/jquery_file_upload/basic.html +0 -136
  83. data/vendor/jquery_file_upload/bower-version-update.js +0 -16
  84. data/vendor/jquery_file_upload/bower.json +0 -64
  85. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
  86. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
  87. data/vendor/jquery_file_upload/css/style.css +0 -15
  88. data/vendor/jquery_file_upload/jquery-ui.html +0 -252
  89. data/vendor/jquery_file_upload/js/app.js +0 -101
  90. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
  91. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
  92. data/vendor/jquery_file_upload/js/main.js +0 -75
  93. data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
  94. data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
  95. data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
  96. data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
  97. data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
  98. data/vendor/jquery_file_upload/test/test.js +0 -1292
@@ -1,13 +1,23 @@
1
+ remote:
2
+ items:
3
+ - src: https://code.jquery.com/jquery-3.6.0.min.js
4
+ integrity: sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=
5
+ crossorigin: anonymous
6
+ - src: https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.0/rails.min.js
7
+ integrity: sha512-7JCF1tm2gqb7ddeKwz64uEhSx9f/Eu+90/LQ26ymVJlkrrOI7C1JR0KUHLi4FASyVwkuAekBNsMfCWJm1l9bHQ==
8
+ crossorigin: anonymous
9
+ referrerpolicy: no-referrer
10
+
1
11
  jquery:
2
12
  items:
3
- - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery3.js
4
- - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js
13
+ # - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery3.js
14
+ # - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js
5
15
  # jquery-ui includes all interaction components, the dialog and the autocomplete widget
6
16
  # and all dependencies for those
7
17
  # decko depends on autocomplete, sortable, jquery.autosize and jquery.fileupload
8
18
  # the dialog widget is not used in decko but in wikirate
9
19
  # don't know if iframe-transport is needed but it used to be there
10
- - jquery-ui.js
20
+ - jquery-ui.min.js
11
21
  - jquery.autosize.js
12
22
  - ../../vendor/jquery_file_upload/js/jquery.fileupload.js
13
23
  - ../../vendor/jquery_file_upload/js/jquery.iframe-transport.js
@@ -24,6 +34,7 @@ decko:
24
34
  - decko/upload.js.coffee
25
35
  - decko/slot.js.coffee
26
36
  - decko/decko.js.coffee
37
+ - decko/type_editor.js.coffee
27
38
  - decko/modal.js.coffee
28
39
  - decko/overlay.js.coffee
29
40
  - decko/recaptcha.js.coffee
@@ -38,6 +49,8 @@ decko:
38
49
  - decko/follow.js.coffee
39
50
  - decko/card_menu.js.coffee
40
51
  - decko/slot_ready.js.coffee
52
+ - decko/pointer_config.js.coffee
53
+ - decko/pointer_list_editor.js.coffee
41
54
  - decko/filter.js.coffee
42
55
  - decko/filter_links.js.coffee
43
56
  - decko/filter_items.js.coffee
@@ -0,0 +1,3 @@
1
+ # By requiring this here, we force the runtime detection (common installation problem)
2
+
3
+ require "execjs"
@@ -3,44 +3,43 @@
3
3
  require "coderay"
4
4
  require "uglifier"
5
5
 
6
- def self.included host_class
7
- host_class.include_set Abstract::Machine
8
- host_class.include_set Abstract::MachineInput
6
+ include_set Abstract::AssetInputter, input_format: :js, input_view: :compressed
9
7
 
10
- host_class.machine_input { standard_machine_input }
11
- host_class.store_machine_output filetype: "js"
12
- end
8
+ format :js do
9
+ view :compressed do
10
+ js = compress(_render_core)
11
+ comment_with_source js
12
+ end
13
13
 
14
- def standard_machine_input
15
- js = format(:js)._render_core
16
- js = compress js if compress?
17
- comment_with_source js
18
- end
14
+ def comment_with_source js
15
+ "// #{card.name}\n#{js}"
16
+ end
19
17
 
20
- def comment_with_source js
21
- "//#{name}\n#{js}"
22
- end
18
+ def compress input
19
+ compress? ? try_compress(input) : input
20
+ end
23
21
 
24
- def compress input
25
- Uglifier.compile input
26
- rescue StandardError => e
27
- # CoffeeScript is compiled in a view
28
- # If there is a CoffeeScript syntax error we get the rescued view here
29
- # and the error that the rescued view is no valid Javascript
30
- # To get the original error we have to refer to Card::Error.current
31
- raise Card::Error, compression_error_message(e)
32
- end
22
+ def try_compress input
23
+ Uglifier.compile(input)
24
+ rescue StandardError => e
25
+ # CoffeeScript is compiled in a view
26
+ # If there is a CoffeeScript syntax error we get the rescued view here
27
+ # and the error that the rescued view is no valid Javascript
28
+ # To get the original error we have to refer to Card::Error.current
29
+ raise Card::Error, compression_error_message(e)
30
+ end
33
31
 
34
- def compression_error_message e
35
- if Card::Error.current
36
- Card::Error.current.message
37
- else
38
- "JavaScript::SyntaxError (#{name}): #{e.message}"
32
+ def compression_error_message e
33
+ if Card::Error.current
34
+ Card::Error.current.message
35
+ else
36
+ "JavaScript::SyntaxError (#{name}): #{e.message}"
37
+ end
39
38
  end
40
- end
41
39
 
42
- def compress?
43
- Cardio.config.compress_javascript
40
+ def compress?
41
+ Cardio.config.compress_assets
42
+ end
44
43
  end
45
44
 
46
45
  def clean_html?
@@ -7,19 +7,3 @@ include_set Abstract::AssetFile
7
7
  def compress?
8
8
  @minimize
9
9
  end
10
-
11
- format :js do
12
- view :source do
13
- if @local
14
- card.machine_output_url
15
- else
16
- source
17
- end
18
- end
19
- end
20
-
21
- format :html do
22
- view :javascript_include_tag do
23
- javascript_include_tag card.machine_output_url
24
- end
25
- end
@@ -1,9 +1,14 @@
1
- include_set Abstract::Machine
2
- include_set Abstract::MachineInput
3
- include_set Abstract::AssetList
1
+ include_set Abstract::AssetGroup
4
2
 
5
- machine_input { standard_machine_input }
6
- store_machine_output filetype: "js"
3
+ def asset_input_content
4
+ format(:js).render_core
5
+ end
6
+
7
+ format :js do
8
+ view :core do
9
+ card.render_items_and_compress :js
10
+ end
11
+ end
7
12
 
8
13
  def new_asset_constants path
9
14
  if path.ends_with? ".js.coffee"
@@ -21,12 +26,6 @@ def javascript_constants
21
26
  { type_id: JavaScriptID, set_module: Abstract::AssetJavaScript }
22
27
  end
23
28
 
24
- def standard_machine_input
25
- render_items_and_compress :js
26
- end
27
-
28
- format :html do
29
- view :javascript_include_tag do
30
- javascript_include_tag card.machine_output_url
31
- end
29
+ def valid_file_extensions
30
+ %w[js coffee]
32
31
  end
@@ -1,9 +1,13 @@
1
1
  format :html do
2
+ # script_config basket is a hash where
3
+ # - key is the codename of a card with javascript config (usually in json format)
4
+ # - value is the name of a javascript method that handles the config
5
+ basket[:script_config] = {}
6
+
2
7
  def views_in_head
3
8
  super + %w[
4
9
  decko_script_variables
5
10
  head_javascript
6
- html5shiv_tag
7
11
  script_config_and_initiation
8
12
  ]
9
13
  end
@@ -20,13 +24,9 @@ format :html do
20
24
  Array.wrap(head_javascript_paths).reject(&:empty?).join("\n")
21
25
  end
22
26
 
23
- view :html5shiv_tag, unknown: true, perms: :none do
24
- nest :script_html5shiv_printshiv, view: :script_tag
25
- end
26
-
27
27
  view :script_config_and_initiation, unknown: true, perms: :none do
28
28
  javascript_tag do
29
- (mod_js_configs << trigger_slot_ready).join "\n\n"
29
+ (script_configs << trigger_slot_ready).join "\n\n"
30
30
  end
31
31
  end
32
32
 
@@ -66,10 +66,14 @@ format :html do
66
66
  "{ #{vars} }"
67
67
  end
68
68
 
69
- def mod_js_configs
70
- mod_js_config.map do |codename, js_decko_function|
69
+ def script_configs
70
+ basket[:script_config].map do |codename, js_decko_function|
71
71
  config_json = escape_javascript Card::Rule.global_setting(codename)
72
72
  "decko.#{js_decko_function}('#{config_json}')"
73
73
  end
74
74
  end
75
+
76
+ def javascript_include_tag *args
77
+ "\n<!-- #{card.name} -->#{super}"
78
+ end
75
79
  end
data/set/right/script.rb CHANGED
@@ -1,22 +1,9 @@
1
- include_set Abstract::Pointer
1
+ include_set Type::List
2
2
 
3
3
  def ok_to_read
4
4
  true
5
5
  end
6
6
 
7
- def refresh_output force: false
8
- item_cards.each do |item_card|
9
- # puts "refreshing #{item_card.name}".yellow
10
- item_card.try :refresh_output, force: force
11
- end
12
- end
13
-
14
- def regenerate_machine_output
15
- item_cards.each do |item_card|
16
- item_card.try :regenerate_machine_output
17
- end
18
- end
19
-
20
7
  format :html do
21
8
  view :javascript_include_tag do
22
9
  card.item_cards.map do |script|
@@ -1,2 +1,2 @@
1
- include_set Abstract::LocalFolderGroup
2
- include_set Abstract::ScriptAssetList
1
+ include_set Abstract::FolderGroup
2
+ include_set Abstract::ScriptGroup
@@ -1,2 +1,2 @@
1
1
  include_set Abstract::LocalManifestGroup
2
- include_set Abstract::ScriptAssetList
2
+ include_set Abstract::ScriptGroup
@@ -0,0 +1,56 @@
1
+ include_set Abstract::AssetOutputter, output_format: :js
2
+ include_set Abstract::ModAssets
3
+
4
+ def make_asset_output_coded
5
+ super mod_name
6
+ end
7
+
8
+ def subpath
9
+ "script"
10
+ end
11
+
12
+ def folder_group_type_id
13
+ ::Card::LocalScriptFolderGroupID
14
+ end
15
+
16
+ def local_manifest_group_type_id
17
+ ::Card::LocalScriptManifestGroupID
18
+ end
19
+
20
+ def refresh_asset
21
+ update_asset_output if asset_output_needs_refresh?
22
+ end
23
+
24
+ def asset_output_needs_refresh?
25
+ !asset_output_updated_at || source_changed?(since: asset_output_updated_at)
26
+ end
27
+
28
+ def asset_output_updated_at
29
+ asset_output_card&.file_updated_at
30
+ end
31
+
32
+ format :html do
33
+ view :javascript_include_tag do
34
+ [remote_include_tags, local_include_tag].flatten.compact.join "\n"
35
+ end
36
+
37
+ def local_include_tag
38
+ return unless local_url
39
+
40
+ javascript_include_tag local_url
41
+ end
42
+
43
+ def remote_include_tags
44
+ remote_items = card.manifest_group_items "remote"
45
+ return unless remote_items
46
+
47
+ remote_items.map do |args|
48
+ tag_args = args.clone
49
+ javascript_include_tag tag_args.delete("src"), tag_args
50
+ end
51
+ end
52
+
53
+ def local_url
54
+ card.asset_output_url
55
+ end
56
+ end
@@ -0,0 +1,7 @@
1
+ # include_set Abstract::AssetOutputter, output_format: :js
2
+
3
+ def input_item_cards
4
+ item_cards.reject do |item_card|
5
+ item_card.is_a? Abstract::ModAssets
6
+ end
7
+ end
@@ -2,20 +2,19 @@ MIT License
2
2
 
3
3
  Copyright © 2010 Sebastian Tschan, https://blueimp.net
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.