card-mod-script 0.13.3 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) 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 +13 -6
  6. data/assets/script/decko/mod.js.coffee +2 -8
  7. data/assets/script/{script_pointer_config.js.coffee → decko/pointer_config.js.coffee} +1 -2
  8. data/assets/script/{script_pointer_list_editor.js.coffee → decko/pointer_list_editor.js.coffee} +0 -0
  9. data/assets/script/decko/slot.js.coffee +2 -2
  10. data/assets/script/decko/slot_ready.js.coffee +1 -0
  11. data/assets/script/decko/slotter.js.coffee +23 -31
  12. data/assets/script/decko/type_editor.js.coffee +21 -0
  13. data/assets/script/decko/upload.js.coffee +12 -5
  14. data/assets/script/manifest.yml +15 -2
  15. data/set/abstract/00_script.rb +30 -31
  16. data/set/abstract/01_asset_script.rb +0 -16
  17. data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
  18. data/set/all/head_javascript.rb +4 -5
  19. data/set/right/script.rb +1 -14
  20. data/set/type/local_script_folder_group.rb +2 -2
  21. data/set/type/local_script_manifest_group.rb +1 -1
  22. data/set/type_plus_right/mod/script.rb +56 -0
  23. data/set/type_plus_right/set/script.rb +7 -0
  24. data/vendor/jquery_file_upload/LICENSE.txt +11 -12
  25. data/vendor/jquery_file_upload/README.md +189 -72
  26. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  27. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  28. data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
  29. data/vendor/jquery_file_upload/cors/result.html +12 -10
  30. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
  31. data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
  32. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  33. data/vendor/jquery_file_upload/index.html +332 -230
  34. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
  35. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
  36. data/vendor/jquery_file_upload/js/demo.js +75 -0
  37. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
  38. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
  39. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
  40. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
  41. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
  42. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
  43. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
  44. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
  45. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
  46. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  47. data/vendor/jquery_file_upload/package.json +71 -10
  48. data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
  49. data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
  50. data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
  51. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  52. data/vendor/jquery_file_upload/test/index.html +36 -159
  53. data/vendor/jquery_file_upload/test/unit.js +989 -0
  54. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  55. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  56. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  57. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  58. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  59. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  60. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  61. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  62. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  63. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  64. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  65. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  66. metadata +34 -52
  67. data/file/mod_script_script_decko_machine_output/file.js +0 -2685
  68. data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
  69. data/lib/javascript/script_html5shiv_printshiv.js +0 -1
  70. data/set/self/script_html5shiv_printshiv.rb +0 -11
  71. data/set/self/script_mods.rb +0 -1
  72. data/set/type/mod_script_assets.rb +0 -21
  73. data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
  74. data/vendor/jquery_file_upload/angularjs.html +0 -211
  75. data/vendor/jquery_file_upload/basic-plus.html +0 -226
  76. data/vendor/jquery_file_upload/basic.html +0 -136
  77. data/vendor/jquery_file_upload/bower-version-update.js +0 -16
  78. data/vendor/jquery_file_upload/bower.json +0 -64
  79. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
  80. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
  81. data/vendor/jquery_file_upload/css/style.css +0 -15
  82. data/vendor/jquery_file_upload/jquery-ui.html +0 -252
  83. data/vendor/jquery_file_upload/js/app.js +0 -101
  84. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
  85. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
  86. data/vendor/jquery_file_upload/js/main.js +0 -75
  87. data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
  88. data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
  89. data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
  90. data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
  91. data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
  92. data/vendor/jquery_file_upload/test/test.js +0 -1292
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e22e166f454a635898b7e2aa3fdea0a7c602e97b0281813e404d557f5f3e89db
4
- data.tar.gz: 8f77fb6b3c1f54135d9902d56ce0c8cac38aad0cd4620d33f291a61cafa7b853
3
+ metadata.gz: 7923354578f4f18092c900b26fec2db7bde9e2fe6c258c07d12b77a612e6229d
4
+ data.tar.gz: 00c930bbca21ec39dc8d536c2caadf1018f001e5a93fdbe42a9ebbaac7400630
5
5
  SHA512:
6
- metadata.gz: 4431b86b7dc3050a93ffdfeccc0d44d0e9d15cba8537867653c6b623e3f8a3e790d533f0bbc0f1f59690f27117e6c96ccbad3140f57ec5cbf138262f9f6d1d69
7
- data.tar.gz: b0c065f6ff1078d4b62dbeab2cef630216d4b3c2ea73531c56e3de725ff055b8c30c643a9d923abe6e4241c6fb680092166a73eda33be61afc35ef835c3271a7
6
+ metadata.gz: 388aeb2a60d30464c3f0b4378a181aa7e9d546f492d643f2f3909cf350b3d18bc0a532a846a74e367acb1ebfb8b311d36524b4fe3dc1194a8d5a0ebce2ae8dfa
7
+ data.tar.gz: 499e0a9190faa15e20e0b8451cbff6fcd818ca15a7933f3fd48c38b66ae8927f95aa6f03ab684c7d1f340d3c7b878e919ff2fe9504f446d8534074f0a61af0c5
@@ -42,5 +42,8 @@ $(window).ready ->
42
42
  $(event.target).closest('form').submit()
43
43
  false
44
44
 
45
+ $("body").on "click", "._popover_link", (event) ->
46
+ event.preventDefault();
47
+
45
48
 
46
49
 
@@ -45,16 +45,6 @@ $(window).ready ->
45
45
  $('body').on 'click', 'button.redirecter', ->
46
46
  window.location = $(this).attr('href')
47
47
 
48
- $('body').on "change", '.live-type-field', ->
49
- $this = $(this)
50
-
51
- setSlotMode($this)
52
- $this.data 'params', $(this).closest('form').serialize()
53
- $this.data 'url', $(this).attr 'href'
54
-
55
- $('body').on 'change', '.edit-type-field', ->
56
- $(this).closest('form').submit()
57
-
58
48
  $('body').on 'mouseenter', '[hover_content]', ->
59
49
  $(this).attr 'hover_restore', $(this).html()
60
50
  $(this).html $(this).attr( 'hover_content' )
@@ -83,11 +73,6 @@ decko.slotReady (slot) ->
83
73
  # #ajaxEnabled: false
84
74
  # }
85
75
 
86
- setSlotMode = ($el, mode=null) ->
87
- $slotter = $el.closest(".slotter")
88
- if $slotter.length && $slotter.attr('data-slotter-mode')
89
- $slotter.attr 'data-original-slotter-mode', $slotter.attr('slotter-mode')
90
- $slotter.attr 'data-slotter-mode', mode
91
76
 
92
77
 
93
78
  warn = (stuff) -> console.log stuff if console?
@@ -28,8 +28,10 @@ jQuery.fn.extend
28
28
  setContentFields: (selector, fn) ->
29
29
  $.each @find(selector), ->
30
30
  $(this).setContentField(fn)
31
+ contentField: ->
32
+ @closest('.card-editor').find '.d0-card-content'
31
33
  setContentField: (fn) ->
32
- field = @closest('.card-editor').find('.d0-card-content')
34
+ field = @contentField()
33
35
  init_val = field.val() # tinymce-jquery overrides val();
34
36
  # that's why we're not using it.
35
37
  new_val = fn.call this
@@ -9,11 +9,19 @@ decko.filter = (el) ->
9
9
  else
10
10
  $(el).closest("._filtered-content").find "._filter-widget"
11
11
 
12
+
13
+ # the filter form includes the below
14
+ @form = @widget.find "._filter-form"
15
+
16
+ # one-click filter links
17
+ @quickFilter = @widget.find "._quick-filter"
18
+
19
+ # include filters field, more-fields dropdown, and reset button
12
20
  @activeContainer = @widget.find "._filter-container"
21
+
22
+ # the "More Filters" Dropdown
13
23
  @dropdown = @widget.find "._add-filter-dropdown"
14
24
  @dropdownItems = @widget.find "._filter-category-select"
15
- @form = @widget.find "._filter-form"
16
- @quickFilter = @widget.find "._quick-filter"
17
25
 
18
26
  @showWithStatus = (status) ->
19
27
  f = this
@@ -23,11 +31,10 @@ decko.filter = (el) ->
23
31
  f.activate item.data("category")
24
32
 
25
33
  @reset = () ->
26
- # @clear()
27
- @dropdownItems.show()
28
34
  @restrict @form.find("._reset-filter").data("reset")
29
35
 
30
36
  @clear = () ->
37
+ @dropdownItems.show()
31
38
  @activeContainer.find(".input-group").remove()
32
39
 
33
40
  @activate = (category, value) ->
@@ -83,11 +90,10 @@ decko.filter = (el) ->
83
90
  # only has effect if there is a data-options-card value
84
91
 
85
92
  @initSelectField = (field) ->
86
- field.find("select").select2(
93
+ field.find("select").select2
87
94
  containerCssClass: ":all:"
88
95
  width: "auto"
89
96
  dropdownAutoWidth: "true"
90
- )
91
97
 
92
98
  @activeField = (category) ->
93
99
  @activeContainer.find("._filter-input-#{category}")
@@ -95,6 +101,7 @@ decko.filter = (el) ->
95
101
  @isActive = (category) ->
96
102
  @activeField(category).length
97
103
 
104
+ # clear filter and use restrictions in data
98
105
  @restrict = (data) ->
99
106
  @clear()
100
107
  for key of data
@@ -17,10 +17,10 @@ window.decko ||= {} #needed to run w/o *head. eg. jasmine
17
17
  # initfunc()
18
18
 
19
19
  $(window).ready ->
20
- $('body').on 'click', '._stop_propagation', (event)->
20
+ $(document).on 'click', '._stop_propagation', (event)->
21
21
  event.stopPropagation()
22
22
 
23
- $('body').on 'click', '._prevent_default', (event)->
23
+ $(document).on 'click', '._prevent_default', (event)->
24
24
  event.preventDefault()
25
25
 
26
26
  $('body').on 'mouseenter', 'a[data-hover-text]', ->
@@ -77,9 +77,3 @@ $.extend decko,
77
77
  toggleShade: (shadeSlot) ->
78
78
  shadeSlot.find('.shade-content').slideToggle 1000
79
79
  shadeSlot.find('.glyphicon').toggleClass 'glyphicon-triangle-right glpyphicon-triangle-bottom'
80
-
81
-
82
-
83
-
84
-
85
-
@@ -45,8 +45,7 @@ $.extend decko,
45
45
  input.autocomplete { source: decko.slotPath(path) }
46
46
 
47
47
  pointerContent: (vals) ->
48
- list = $.map $.makeArray(vals), (v) -> if v then '[[' + v + ']]'
49
- $.makeArray(list).join "\n"
48
+ $.makeArray(vals).join "\n"
50
49
 
51
50
  linkListContent: (input_groups) ->
52
51
  vals = input_groups.map( ->
@@ -148,8 +148,8 @@ jQuery.fn.extend
148
148
  slotMark: ->
149
149
  if @data('cardId') then "~#{@data('cardId')}" else @data("cardName")
150
150
 
151
- setSlotContent: (val, mode, $slotter) ->
152
- v = $(val)[0] && $(val) || val
151
+ setSlotContent: (newContent, mode, $slotter) ->
152
+ v = $(newContent)[0] && $(newContent) || newContent
153
153
 
154
154
  if typeof(v) == "string"
155
155
  # Needed to support "TEXT: result" pattern in success (eg deleting nested cards)
@@ -9,3 +9,4 @@ decko.slotReady (slot) ->
9
9
  )
10
10
 
11
11
 
12
+
@@ -63,7 +63,7 @@
63
63
  #
64
64
  #
65
65
  $(window).ready ->
66
- $('body').on 'ajax:success', '.slotter', (event, data, c, d) ->
66
+ $('body').on 'ajax:success', '.slotter', (event, data) ->
67
67
  $(this).slotterSuccess event, data
68
68
 
69
69
  $('body').on 'ajax:error', '.slotter', (event, xhr) ->
@@ -114,27 +114,15 @@ jQuery.fn.extend
114
114
  form.append input
115
115
  input.val value
116
116
 
117
- slotterSuccess: (event, data) ->
117
+ slotterSuccess: (event, responseData) ->
118
+ debugger
118
119
  unless @hasClass("slotter")
119
120
  console.log "warning: slotterSuccess called on non-slotter element #{this}"
120
121
  return
121
122
 
122
123
  return if event.slotSuccessful
123
124
 
124
- if @data("reload")
125
- window.location.reload(true)
126
-
127
- if @data("update-modal-origin")
128
- @updateModalOrigin()
129
-
130
- if @data("update-origin")
131
- @updateOrigin()
132
-
133
- if @data('original-slotter-mode')
134
- @attr 'data-slotter-mode', @data('original-slotter-mode')
135
-
136
- mode = @data("slotter-mode")
137
- @showSuccessResponse data, mode
125
+ @showSuccessResponse responseData, @data("slotter-mode")
138
126
 
139
127
  if @hasClass "_close-overlay"
140
128
  @removeOverlay()
@@ -150,21 +138,24 @@ jQuery.fn.extend
150
138
  reload_url = @data("update-foreign-slot-url")
151
139
  $slot.reloadSlot reload_url
152
140
 
141
+ if @data('original-slotter-mode')
142
+ @attr 'data-slotter-mode', @data('original-slotter-mode')
143
+ if @data('original-slot-selector')
144
+ @attr 'data-slot-selector', @data('original-slot-selector')
145
+
153
146
  event.slotSuccessful = true
154
147
 
155
- showSuccessResponse: (data, mode) ->
156
- if mode == "silent-success"
157
- return
158
- else if mode == "update-modal-origin"
159
- @updateModalOrigin()
160
- else if mode == "update-origin"
161
- @updateOrigin()
162
- else if data.redirect
163
- window.location = data.redirect
164
- else if data.reload
148
+ showSuccessResponse: (responseData, mode) ->
149
+ if responseData.redirect
150
+ window.location = responseData.redirect
151
+ else if responseData.reload
165
152
  window.location.reload(true)
166
153
  else
167
- @updateSlot data, mode
154
+ switch mode
155
+ when "silent-success" then return
156
+ when "update-modal-origin" then @updateModalOrigin()
157
+ when "update-origin" then @updateOrigin()
158
+ else @updateSlot responseData, mode
168
159
 
169
160
  showErrorResponse: (status, result) ->
170
161
  if status == 403 #permission denied
@@ -200,12 +191,13 @@ jQuery.fn.extend
200
191
 
201
192
  registerAsOrigin: (type, slot) ->
202
193
  if slot.hasClass("_modal-slot")
203
- slot = slot.find(".modal-body .card-slot")
194
+ slot = slot.find(".modal-body") # put the origin slot id on the modal-body instead
195
+ # of on the slot, so that it survives slot reloads
204
196
  slot.attr("data-#{type}-origin-slot-id", @closest(".card-slot").data("slot-id"))
205
197
 
206
- updateSlot: (data, mode) ->
198
+ updateSlot: (newContent, mode) ->
207
199
  mode ||= "replace"
208
- @setSlotContent data, mode, $(this)
200
+ @setSlotContent newContent, mode, $(this)
209
201
 
210
202
  # close modal or overlay
211
203
  closeOnSuccess: (type) ->
@@ -236,7 +228,7 @@ jQuery.fn.extend
236
228
  )
237
229
  return false
238
230
 
239
- widget = input.data 'blueimpFileupload' #jQuery UI widget
231
+ widget = input.data 'wblueimpFileupload' #jQuery UI widget
240
232
 
241
233
  # browsers that can't do ajax uploads use iframe
242
234
  unless widget._isXHRUpload(widget.options)
@@ -0,0 +1,21 @@
1
+ $(window).ready ->
2
+ $('body').on "change", '._live-type-field', ->
3
+ $this = $(this)
4
+
5
+ setSlotMode($this)
6
+ debugger
7
+ $this.data 'params', $this.closest('form').serialize()
8
+ $this.data 'url', $this.attr 'href'
9
+
10
+ $('body').on 'change', '.edit-type-field', ->
11
+ $(this).closest('form').submit()
12
+
13
+ setSlotMode = ($el, mode=null) ->
14
+ $slotter = $el.closest(".slotter")
15
+ if $slotter.length
16
+ if $slotter.attr('data-slotter-mode')
17
+ $slotter.attr 'data-original-slotter-mode', $slotter.attr('data-slotter-mode')
18
+ $slotter.attr 'data-slotter-mode', mode
19
+ if $slotter.attr('data-slot-selector')
20
+ $slotter.attr 'data-original-slot-selector', $slotter.attr('data-slot-selector')
21
+ $slotter.removeAttr 'data-slot-selector'
@@ -1,10 +1,10 @@
1
1
  $.extend decko,
2
2
  upload_file: (fileupload) ->
3
- # for file as a subcard in a form,
4
- # excess parameters are included in the request which cause errors.
5
- # only the file, type_id and attachment_card_name are needed
6
- # attachment_card_name is the original card name,
7
- # ex: card[subcards][+logo][image], card[file]
3
+ # for file as a subcard in a form,
4
+ # excess parameters are included in the request which cause errors.
5
+ # only the file, type_id and attachment_card_name are needed
6
+ # attachment_card_name is the original card name,
7
+ # ex: card[subcards][+logo][image], card[file]
8
8
  $(fileupload).on 'fileuploadsubmit', (e,data) ->
9
9
  $_this = $(this)
10
10
  card_name = $_this.siblings(".attachment_card_name:first").attr("name")
@@ -36,6 +36,7 @@ $.extend decko,
36
36
  'value="preview_editor" name="view">'
37
37
  data.submit()
38
38
  editor.find('.choose-file').hide()
39
+ # editor.find(".file-upload").prop "disabled", true
39
40
  editor.find('.extra_upload_param').remove()
40
41
 
41
42
  progressallFile: (e, data) ->
@@ -51,7 +52,13 @@ $(window).ready ->
51
52
  $('body').on 'click', '.cancel-upload', ->
52
53
  editor = $(this).closest '.card-editor'
53
54
  editor.find('.choose-file').show()
55
+ # editor.find(".file-upload").prop "disabled", false
54
56
  editor.find('.chosen-file').empty()
55
57
  editor.find('.progress').show()
56
58
  editor.find('#progress .progress-bar').css('width', '0%')
57
59
  editor.find('#progress').hide()
60
+
61
+ $('body').on "submit", "form", ->
62
+ uploader = $(this).find ".file-upload[type=file]"
63
+ if uploader[0]
64
+ uploader.prop "disabled", true
@@ -1,7 +1,17 @@
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
@@ -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
@@ -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
@@ -8,7 +8,6 @@ format :html do
8
8
  super + %w[
9
9
  decko_script_variables
10
10
  head_javascript
11
- html5shiv_tag
12
11
  script_config_and_initiation
13
12
  ]
14
13
  end
@@ -25,10 +24,6 @@ format :html do
25
24
  Array.wrap(head_javascript_paths).reject(&:empty?).join("\n")
26
25
  end
27
26
 
28
- view :html5shiv_tag, unknown: true, perms: :none do
29
- nest :script_html5shiv_printshiv, view: :script_tag
30
- end
31
-
32
27
  view :script_config_and_initiation, unknown: true, perms: :none do
33
28
  javascript_tag do
34
29
  (script_configs << trigger_slot_ready).join "\n\n"
@@ -77,4 +72,8 @@ format :html do
77
72
  "decko.#{js_decko_function}('#{config_json}')"
78
73
  end
79
74
  end
75
+
76
+ def javascript_include_tag *args
77
+ "\n<!-- #{card.name} -->#{super}"
78
+ end
80
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.