card-mod-script 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/decko/autosave.js.coffee +30 -0
- data/assets/script/decko/bridge.js.coffee +31 -0
- data/assets/script/decko/card_menu.js.coffee +26 -0
- data/assets/script/decko/components.js.coffee +49 -0
- data/assets/script/decko/decko.js.coffee +82 -0
- data/assets/script/decko/doubleclick.js.coffee +30 -0
- data/assets/script/decko/editor.js.coffee +57 -0
- data/assets/script/decko/filter.js.coffee +183 -0
- data/assets/script/decko/filter_items.js.coffee +128 -0
- data/assets/script/decko/filter_links.js.coffee +81 -0
- data/assets/script/decko/follow.js.coffee +22 -0
- data/assets/script/decko/layout.js.coffee +76 -0
- data/assets/script/decko/link_editor.js.coffee +61 -0
- data/assets/script/decko/mod.js.coffee +79 -0
- data/assets/script/decko/modal.js.coffee +113 -0
- data/assets/script/decko/name_editor.js.coffee +40 -0
- data/assets/script/decko/navbox.js.coffee +74 -0
- data/assets/script/decko/nest_editor.js.coffee +166 -0
- data/assets/script/decko/nest_editor_name.js.coffee +102 -0
- data/assets/script/decko/nest_editor_options.js.coffee +93 -0
- data/assets/script/decko/nest_editor_rules.js.coffee +3 -0
- data/assets/script/decko/overlay.js.coffee +54 -0
- data/assets/script/decko/pointer_config.js.coffee +79 -0
- data/assets/script/decko/pointer_list_editor.js.coffee +67 -0
- data/assets/script/decko/recaptcha.js.coffee +19 -0
- data/assets/script/decko/selectable_filtered_content.js.coffee +12 -0
- data/assets/script/decko/slot.js.coffee +182 -0
- data/assets/script/decko/slot_ready.js.coffee +12 -0
- data/assets/script/decko/slotter.js.coffee +268 -0
- data/assets/script/decko/type_editor.js.coffee +21 -0
- data/assets/script/decko/upload.js.coffee +64 -0
- data/assets/script/jquery-ui.min.js +13 -0
- data/assets/script/jquery.autosize.js +274 -0
- data/assets/script/manifest.yml +57 -0
- data/init/early/init_execjs.rb +3 -0
- data/set/abstract/00_script.rb +30 -31
- data/set/abstract/01_asset_script.rb +0 -16
- data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
- data/set/all/head_javascript.rb +12 -8
- data/set/right/script.rb +1 -14
- data/set/type/local_script_folder_group.rb +2 -2
- data/set/type/local_script_manifest_group.rb +1 -1
- data/set/type_plus_right/mod/script.rb +56 -0
- data/set/type_plus_right/set/script.rb +7 -0
- data/vendor/jquery_file_upload/LICENSE.txt +11 -12
- data/vendor/jquery_file_upload/README.md +189 -72
- data/vendor/jquery_file_upload/SECURITY.md +227 -0
- data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
- data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
- data/vendor/jquery_file_upload/cors/result.html +12 -10
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
- data/vendor/jquery_file_upload/docker-compose.yml +55 -0
- data/vendor/jquery_file_upload/index.html +332 -230
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
- data/vendor/jquery_file_upload/js/demo.js +75 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
- data/vendor/jquery_file_upload/package-lock.json +6853 -0
- data/vendor/jquery_file_upload/package.json +71 -10
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
- data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
- data/vendor/jquery_file_upload/server/php/php.ini +5 -0
- data/vendor/jquery_file_upload/test/index.html +36 -159
- data/vendor/jquery_file_upload/test/unit.js +989 -0
- data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
- data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
- data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
- data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
- data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
- data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
- data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
- data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
- metadata +66 -50
- data/file/mod_script_script_decko_machine_output/file.js +0 -2710
- data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
- data/lib/javascript/script_html5shiv_printshiv.js +0 -1
- data/set/self/script_html5shiv_printshiv.rb +0 -11
- data/set/self/script_mods.rb +0 -1
- data/set/type/mod_script_assets.rb +0 -21
- data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
- data/vendor/jquery_file_upload/angularjs.html +0 -211
- data/vendor/jquery_file_upload/basic-plus.html +0 -226
- data/vendor/jquery_file_upload/basic.html +0 -136
- data/vendor/jquery_file_upload/bower-version-update.js +0 -16
- data/vendor/jquery_file_upload/bower.json +0 -64
- data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
- data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
- data/vendor/jquery_file_upload/css/style.css +0 -15
- data/vendor/jquery_file_upload/jquery-ui.html +0 -252
- data/vendor/jquery_file_upload/js/app.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
- data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
- data/vendor/jquery_file_upload/js/main.js +0 -75
- data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
- data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
- data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
- data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
- data/vendor/jquery_file_upload/test/test.js +0 -1292
@@ -0,0 +1,274 @@
|
|
1
|
+
/*!
|
2
|
+
Autosize 1.18.13
|
3
|
+
license: MIT
|
4
|
+
http://www.jacklmoore.com/autosize
|
5
|
+
*/
|
6
|
+
(function ($) {
|
7
|
+
var
|
8
|
+
defaults = {
|
9
|
+
className: 'autosizejs',
|
10
|
+
id: 'autosizejs',
|
11
|
+
append: '\n',
|
12
|
+
callback: false,
|
13
|
+
resizeDelay: 10,
|
14
|
+
placeholder: true
|
15
|
+
},
|
16
|
+
|
17
|
+
// border:0 is unnecessary, but avoids a bug in Firefox on OSX
|
18
|
+
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
|
19
|
+
|
20
|
+
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
21
|
+
typographyStyles = [
|
22
|
+
'fontFamily',
|
23
|
+
'fontSize',
|
24
|
+
'fontWeight',
|
25
|
+
'fontStyle',
|
26
|
+
'letterSpacing',
|
27
|
+
'textTransform',
|
28
|
+
'wordSpacing',
|
29
|
+
'textIndent',
|
30
|
+
'whiteSpace'
|
31
|
+
],
|
32
|
+
|
33
|
+
// to keep track which textarea is being mirrored when adjust() is called.
|
34
|
+
mirrored,
|
35
|
+
|
36
|
+
// the mirror element, which is used to calculate what size the mirrored element should be.
|
37
|
+
mirror = $(copy).data('autosize', true)[0];
|
38
|
+
|
39
|
+
// test that line-height can be accurately copied.
|
40
|
+
mirror.style.lineHeight = '99px';
|
41
|
+
if ($(mirror).css('lineHeight') === '99px') {
|
42
|
+
typographyStyles.push('lineHeight');
|
43
|
+
}
|
44
|
+
mirror.style.lineHeight = '';
|
45
|
+
|
46
|
+
$.fn.autosize = function (options) {
|
47
|
+
if (!this.length) {
|
48
|
+
return this;
|
49
|
+
}
|
50
|
+
|
51
|
+
options = $.extend({}, defaults, options || {});
|
52
|
+
|
53
|
+
if (mirror.parentNode !== document.body) {
|
54
|
+
$(document.body).append(mirror);
|
55
|
+
}
|
56
|
+
|
57
|
+
return this.each(function () {
|
58
|
+
var
|
59
|
+
ta = this,
|
60
|
+
$ta = $(ta),
|
61
|
+
maxHeight,
|
62
|
+
minHeight,
|
63
|
+
boxOffset = 0,
|
64
|
+
callback = $.isFunction(options.callback),
|
65
|
+
originalStyles = {
|
66
|
+
height: ta.style.height,
|
67
|
+
overflow: ta.style.overflow,
|
68
|
+
overflowY: ta.style.overflowY,
|
69
|
+
wordWrap: ta.style.wordWrap,
|
70
|
+
resize: ta.style.resize
|
71
|
+
},
|
72
|
+
timeout,
|
73
|
+
width = $ta.width(),
|
74
|
+
taResize = $ta.css('resize');
|
75
|
+
|
76
|
+
if ($ta.data('autosize')) {
|
77
|
+
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
$ta.data('autosize', true);
|
81
|
+
|
82
|
+
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
|
83
|
+
boxOffset = $ta.outerHeight() - $ta.height();
|
84
|
+
}
|
85
|
+
|
86
|
+
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
87
|
+
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
88
|
+
|
89
|
+
$ta.css({
|
90
|
+
overflow: 'hidden',
|
91
|
+
overflowY: 'hidden',
|
92
|
+
wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
|
93
|
+
});
|
94
|
+
|
95
|
+
if (taResize === 'vertical') {
|
96
|
+
$ta.css('resize','none');
|
97
|
+
} else if (taResize === 'both') {
|
98
|
+
$ta.css('resize', 'horizontal');
|
99
|
+
}
|
100
|
+
|
101
|
+
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
|
102
|
+
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
|
103
|
+
function setWidth() {
|
104
|
+
var width;
|
105
|
+
var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
|
106
|
+
|
107
|
+
if (style) {
|
108
|
+
|
109
|
+
width = ta.getBoundingClientRect().width;
|
110
|
+
|
111
|
+
if (width === 0 || typeof width !== 'number') {
|
112
|
+
width = parseInt(style.width,10);
|
113
|
+
}
|
114
|
+
|
115
|
+
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
|
116
|
+
width -= parseInt(style[val],10);
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
width = $ta.width();
|
120
|
+
}
|
121
|
+
|
122
|
+
mirror.style.width = Math.max(width,0) + 'px';
|
123
|
+
}
|
124
|
+
|
125
|
+
function initMirror() {
|
126
|
+
var styles = {};
|
127
|
+
|
128
|
+
mirrored = ta;
|
129
|
+
mirror.className = options.className;
|
130
|
+
mirror.id = options.id;
|
131
|
+
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
132
|
+
|
133
|
+
// mirror is a duplicate textarea located off-screen that
|
134
|
+
// is automatically updated to contain the same text as the
|
135
|
+
// original textarea. mirror always has a height of 0.
|
136
|
+
// This gives a cross-browser supported way getting the actual
|
137
|
+
// height of the text, through the scrollTop property.
|
138
|
+
$.each(typographyStyles, function(i,val){
|
139
|
+
styles[val] = $ta.css(val);
|
140
|
+
});
|
141
|
+
|
142
|
+
$(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
|
143
|
+
|
144
|
+
setWidth();
|
145
|
+
|
146
|
+
// Chrome-specific fix:
|
147
|
+
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
|
148
|
+
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
|
149
|
+
if (window.chrome) {
|
150
|
+
var width = ta.style.width;
|
151
|
+
ta.style.width = '0px';
|
152
|
+
var ignore = ta.offsetWidth;
|
153
|
+
ta.style.width = width;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// Using mainly bare JS in this function because it is going
|
158
|
+
// to fire very often while typing, and needs to very efficient.
|
159
|
+
function adjust() {
|
160
|
+
var height, original;
|
161
|
+
|
162
|
+
if (mirrored !== ta) {
|
163
|
+
initMirror();
|
164
|
+
} else {
|
165
|
+
setWidth();
|
166
|
+
}
|
167
|
+
|
168
|
+
if (!ta.value && options.placeholder) {
|
169
|
+
// If the textarea is empty, copy the placeholder text into
|
170
|
+
// the mirror control and use that for sizing so that we
|
171
|
+
// don't end up with placeholder getting trimmed.
|
172
|
+
mirror.value = ($ta.attr("placeholder") || '');
|
173
|
+
} else {
|
174
|
+
mirror.value = ta.value;
|
175
|
+
}
|
176
|
+
|
177
|
+
mirror.value += options.append || '';
|
178
|
+
mirror.style.overflowY = ta.style.overflowY;
|
179
|
+
original = parseInt(ta.style.height,10);
|
180
|
+
|
181
|
+
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
|
182
|
+
mirror.scrollTop = 0;
|
183
|
+
|
184
|
+
mirror.scrollTop = 9e4;
|
185
|
+
|
186
|
+
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
187
|
+
height = mirror.scrollTop;
|
188
|
+
|
189
|
+
if (maxHeight && height > maxHeight) {
|
190
|
+
ta.style.overflowY = 'scroll';
|
191
|
+
height = maxHeight;
|
192
|
+
} else {
|
193
|
+
ta.style.overflowY = 'hidden';
|
194
|
+
if (height < minHeight) {
|
195
|
+
height = minHeight;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
height += boxOffset;
|
200
|
+
|
201
|
+
if (original !== height) {
|
202
|
+
ta.style.height = height + 'px';
|
203
|
+
if (callback) {
|
204
|
+
options.callback.call(ta,ta);
|
205
|
+
}
|
206
|
+
$ta.trigger('autosize.resized');
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
function resize () {
|
211
|
+
clearTimeout(timeout);
|
212
|
+
timeout = setTimeout(function(){
|
213
|
+
var newWidth = $ta.width();
|
214
|
+
|
215
|
+
if (newWidth !== width) {
|
216
|
+
width = newWidth;
|
217
|
+
adjust();
|
218
|
+
}
|
219
|
+
}, parseInt(options.resizeDelay,10));
|
220
|
+
}
|
221
|
+
|
222
|
+
if ('onpropertychange' in ta) {
|
223
|
+
if ('oninput' in ta) {
|
224
|
+
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
225
|
+
// so binding to onkeyup to catch most of those occasions. There is no way that I
|
226
|
+
// know of to detect something like 'cut' in IE9.
|
227
|
+
$ta.on('input.autosize keyup.autosize', adjust);
|
228
|
+
} else {
|
229
|
+
// IE7 / IE8
|
230
|
+
$ta.on('propertychange.autosize', function(){
|
231
|
+
if(event.propertyName === 'value'){
|
232
|
+
adjust();
|
233
|
+
}
|
234
|
+
});
|
235
|
+
}
|
236
|
+
} else {
|
237
|
+
// Modern Browsers
|
238
|
+
$ta.on('input.autosize', adjust);
|
239
|
+
}
|
240
|
+
|
241
|
+
// Set options.resizeDelay to false if using fixed-width textarea elements.
|
242
|
+
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
|
243
|
+
|
244
|
+
if (options.resizeDelay !== false) {
|
245
|
+
$(window).on('resize.autosize', resize);
|
246
|
+
}
|
247
|
+
|
248
|
+
// Event for manual triggering if needed.
|
249
|
+
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
|
250
|
+
$ta.on('autosize.resize', adjust);
|
251
|
+
|
252
|
+
// Event for manual triggering that also forces the styles to update as well.
|
253
|
+
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
|
254
|
+
$ta.on('autosize.resizeIncludeStyle', function() {
|
255
|
+
mirrored = null;
|
256
|
+
adjust();
|
257
|
+
});
|
258
|
+
|
259
|
+
$ta.on('autosize.destroy', function(){
|
260
|
+
mirrored = null;
|
261
|
+
clearTimeout(timeout);
|
262
|
+
$(window).off('resize', resize);
|
263
|
+
$ta
|
264
|
+
.off('autosize')
|
265
|
+
.off('.autosize')
|
266
|
+
.css(originalStyles)
|
267
|
+
.removeData('autosize');
|
268
|
+
});
|
269
|
+
|
270
|
+
// Call adjust in case the textarea already contains text.
|
271
|
+
adjust();
|
272
|
+
});
|
273
|
+
};
|
274
|
+
}(jQuery || $)); // jQuery or jQuery-like library, such as Zepto
|
@@ -0,0 +1,57 @@
|
|
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
|
+
|
11
|
+
jquery:
|
12
|
+
items:
|
13
|
+
# - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery3.js
|
14
|
+
# - ../../vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js
|
15
|
+
# jquery-ui includes all interaction components, the dialog and the autocomplete widget
|
16
|
+
# and all dependencies for those
|
17
|
+
# decko depends on autocomplete, sortable, jquery.autosize and jquery.fileupload
|
18
|
+
# the dialog widget is not used in decko but in wikirate
|
19
|
+
# don't know if iframe-transport is needed but it used to be there
|
20
|
+
- jquery-ui.min.js
|
21
|
+
- jquery.autosize.js
|
22
|
+
- ../../vendor/jquery_file_upload/js/jquery.fileupload.js
|
23
|
+
- ../../vendor/jquery_file_upload/js/jquery.iframe-transport.js
|
24
|
+
|
25
|
+
decko:
|
26
|
+
items:
|
27
|
+
- decko/mod.js.coffee
|
28
|
+
- decko/editor.js.coffee
|
29
|
+
- decko/name_editor.js.coffee
|
30
|
+
- decko/autosave.js.coffee
|
31
|
+
- decko/doubleclick.js.coffee
|
32
|
+
- decko/layout.js.coffee
|
33
|
+
- decko/navbox.js.coffee
|
34
|
+
- decko/upload.js.coffee
|
35
|
+
- decko/slot.js.coffee
|
36
|
+
- decko/decko.js.coffee
|
37
|
+
- decko/type_editor.js.coffee
|
38
|
+
- decko/modal.js.coffee
|
39
|
+
- decko/overlay.js.coffee
|
40
|
+
- decko/recaptcha.js.coffee
|
41
|
+
- decko/slotter.js.coffee
|
42
|
+
- decko/bridge.js.coffee
|
43
|
+
- decko/nest_editor.js.coffee
|
44
|
+
- decko/nest_editor_rules.js.coffee
|
45
|
+
- decko/nest_editor_options.js.coffee
|
46
|
+
- decko/nest_editor_name.js.coffee
|
47
|
+
- decko/link_editor.js.coffee
|
48
|
+
- decko/components.js.coffee
|
49
|
+
- decko/follow.js.coffee
|
50
|
+
- decko/card_menu.js.coffee
|
51
|
+
- decko/slot_ready.js.coffee
|
52
|
+
- decko/pointer_config.js.coffee
|
53
|
+
- decko/pointer_list_editor.js.coffee
|
54
|
+
- decko/filter.js.coffee
|
55
|
+
- decko/filter_links.js.coffee
|
56
|
+
- decko/filter_items.js.coffee
|
57
|
+
- decko/selectable_filtered_content.js.coffee
|
data/set/abstract/00_script.rb
CHANGED
@@ -3,44 +3,43 @@
|
|
3
3
|
require "coderay"
|
4
4
|
require "uglifier"
|
5
5
|
|
6
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
8
|
+
format :js do
|
9
|
+
view :compressed do
|
10
|
+
js = compress(_render_core)
|
11
|
+
comment_with_source js
|
12
|
+
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
comment_with_source js
|
18
|
-
end
|
14
|
+
def comment_with_source js
|
15
|
+
"// #{card.name}\n#{js}"
|
16
|
+
end
|
19
17
|
|
20
|
-
def
|
21
|
-
|
22
|
-
end
|
18
|
+
def compress input
|
19
|
+
compress? ? try_compress(input) : input
|
20
|
+
end
|
23
21
|
|
24
|
-
def
|
25
|
-
|
26
|
-
rescue StandardError => e
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
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::
|
2
|
-
include_set Abstract::MachineInput
|
3
|
-
include_set Abstract::AssetList
|
1
|
+
include_set Abstract::AssetGroup
|
4
2
|
|
5
|
-
|
6
|
-
|
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
|
25
|
-
|
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
|
data/set/all/head_javascript.rb
CHANGED
@@ -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
|
-
(
|
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
|
70
|
-
|
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
|
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::
|
2
|
-
include_set Abstract::
|
1
|
+
include_set Abstract::FolderGroup
|
2
|
+
include_set Abstract::ScriptGroup
|
@@ -1,2 +1,2 @@
|
|
1
1
|
include_set Abstract::LocalManifestGroup
|
2
|
-
include_set Abstract::
|
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
|
@@ -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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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.
|