card-mod-format 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/clicks_and_hovers.js.coffee +49 -0
  3. data/assets/script/decko/decko.js.coffee +32 -0
  4. data/assets/script/decko/decko_jquery.js.coffee +25 -0
  5. data/assets/script/decko/slot.js.coffee +150 -0
  6. data/assets/script/decko/slot_ready.js.coffee +11 -0
  7. data/assets/script/decko/slotter.js.coffee +208 -0
  8. data/assets/script/jquery/jquery-ui.min.js +13 -0
  9. data/assets/script/jquery/jquery.autosize.js +274 -0
  10. data/assets/script/jquery/jquery.ui.autocomplete.html.js +41 -0
  11. data/assets/script/manifest.yml +38 -0
  12. data/assets/style/common.scss +73 -0
  13. data/assets/style/logo_and_credit.scss +24 -0
  14. data/assets/style/menu.scss +43 -0
  15. data/assets/style/messaging.scss +59 -0
  16. data/assets/style/misc.scss +90 -0
  17. data/assets/style/open_and_closed.scss +68 -0
  18. data/data/files/credit_image.svg +59 -0
  19. data/data/files/mod_format_script_asset_output/file.js +66 -0
  20. data/data/real.yml +67 -0
  21. data/lib/card/format/html_format.rb +0 -2
  22. data/lib/card/mod/format.rb +4 -0
  23. data/lib/card/path.rb +20 -20
  24. data/set/all/base.rb +1 -11
  25. data/set/all/content.rb +3 -11
  26. data/set/all/csv.rb +22 -74
  27. data/set/all/data.rb +2 -2
  28. data/set/all/demo.rb +6 -2
  29. data/set/all/error.rb +1 -1
  30. data/set/all/html/error.rb +1 -1
  31. data/set/all/html/head.rb +22 -12
  32. data/set/all/html/header.rb +10 -40
  33. data/set/all/html/header_wrap.haml +3 -4
  34. data/set/all/html/labeled.haml +1 -1
  35. data/set/all/html/menu.rb +36 -12
  36. data/set/all/html/views.rb +8 -17
  37. data/set/all/html/wrap.rb +5 -4
  38. data/set/all/html.rb +2 -3
  39. data/set/all/json.rb +1 -5
  40. data/set/right/head.rb +1 -0
  41. data/set/type/cardtype.rb +4 -6
  42. data/set/type/json.rb +1 -1
  43. data/set/type/number.rb +1 -16
  44. data/vendor/jquery_file_upload/LICENSE.txt +20 -0
  45. data/vendor/jquery_file_upload/README.md +224 -0
  46. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  47. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  48. data/vendor/jquery_file_upload/cors/postmessage.html +85 -0
  49. data/vendor/jquery_file_upload/cors/result.html +26 -0
  50. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
  51. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
  52. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +68 -0
  53. data/vendor/jquery_file_upload/css/jquery.fileupload.css +36 -0
  54. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  55. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  56. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  57. data/vendor/jquery_file_upload/index.html +357 -0
  58. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
  59. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +97 -0
  60. data/vendor/jquery_file_upload/js/demo.js +75 -0
  61. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +101 -0
  62. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +347 -0
  63. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +170 -0
  64. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +759 -0
  65. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +119 -0
  66. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +101 -0
  67. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1604 -0
  68. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +227 -0
  69. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +805 -0
  70. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  71. data/vendor/jquery_file_upload/package.json +116 -0
  72. data/vendor/jquery_file_upload/server/gae-python/app.yaml +18 -0
  73. data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
  74. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  75. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
  76. data/vendor/jquery_file_upload/server/php/Dockerfile +44 -0
  77. data/vendor/jquery_file_upload/server/php/UploadHandler.php +1480 -0
  78. data/vendor/jquery_file_upload/server/php/index.php +15 -0
  79. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  80. data/vendor/jquery_file_upload/test/index.html +49 -0
  81. data/vendor/jquery_file_upload/test/unit.js +989 -0
  82. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  83. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  84. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  85. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  86. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  87. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  88. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  89. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  90. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  91. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  92. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  93. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  94. data/vendor/jquery_rails/CHANGELOG.md +359 -0
  95. data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
  96. data/vendor/jquery_rails/Gemfile +22 -0
  97. data/vendor/jquery_rails/MIT-LICENSE +21 -0
  98. data/vendor/jquery_rails/README.md +75 -0
  99. data/vendor/jquery_rails/Rakefile +59 -0
  100. data/vendor/jquery_rails/VERSIONS.md +62 -0
  101. data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
  102. data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
  103. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
  104. data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
  105. data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
  106. data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
  107. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
  108. data/vendor/jquery_rails/test/test_helper.rb +6 -0
  109. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
  110. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
  111. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
  112. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
  113. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
  114. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
  115. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
  116. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
  117. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
  118. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
  119. metadata +104 -7
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "blueimp-file-upload",
3
+ "version": "10.32.0",
4
+ "title": "jQuery File Upload",
5
+ "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
6
+ "keywords": [
7
+ "jquery",
8
+ "file",
9
+ "upload",
10
+ "widget",
11
+ "multiple",
12
+ "selection",
13
+ "drag",
14
+ "drop",
15
+ "progress",
16
+ "preview",
17
+ "cross-domain",
18
+ "cross-site",
19
+ "chunk",
20
+ "resume",
21
+ "gae",
22
+ "go",
23
+ "python",
24
+ "php",
25
+ "bootstrap"
26
+ ],
27
+ "homepage": "https://github.com/blueimp/jQuery-File-Upload",
28
+ "author": {
29
+ "name": "Sebastian Tschan",
30
+ "url": "https://blueimp.net"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git://github.com/blueimp/jQuery-File-Upload.git"
35
+ },
36
+ "license": "MIT",
37
+ "peerDependencies": {
38
+ "jquery": ">=1.7"
39
+ },
40
+ "optionalDependencies": {
41
+ "blueimp-canvas-to-blob": "3",
42
+ "blueimp-load-image": "5",
43
+ "blueimp-tmpl": "3"
44
+ },
45
+ "devDependencies": {
46
+ "eslint": "7",
47
+ "eslint-config-blueimp": "2",
48
+ "eslint-config-prettier": "8",
49
+ "eslint-plugin-jsdoc": "36",
50
+ "eslint-plugin-prettier": "4",
51
+ "prettier": "2",
52
+ "stylelint": "13",
53
+ "stylelint-config-prettier": "8",
54
+ "stylelint-config-recommended": "5"
55
+ },
56
+ "stylelint": {
57
+ "extends": [
58
+ "stylelint-config-recommended",
59
+ "stylelint-config-prettier"
60
+ ],
61
+ "ignoreFiles": [
62
+ "css/*.min.css",
63
+ "css/vendor/*",
64
+ "test/vendor/*"
65
+ ]
66
+ },
67
+ "eslintConfig": {
68
+ "extends": [
69
+ "blueimp",
70
+ "plugin:jsdoc/recommended",
71
+ "plugin:prettier/recommended"
72
+ ],
73
+ "env": {
74
+ "browser": true
75
+ }
76
+ },
77
+ "eslintIgnore": [
78
+ "*.min.js",
79
+ "test/vendor"
80
+ ],
81
+ "prettier": {
82
+ "arrowParens": "avoid",
83
+ "proseWrap": "always",
84
+ "singleQuote": true,
85
+ "trailingComma": "none"
86
+ },
87
+ "scripts": {
88
+ "lint": "stylelint '**/*.css' && eslint .",
89
+ "unit": "docker-compose run --rm mocha",
90
+ "wdio": "docker-compose run --rm wdio",
91
+ "test": "npm run lint && npm run unit && npm run wdio && npm run wdio -- conf/firefox.js",
92
+ "posttest": "docker-compose down -v",
93
+ "preversion": "npm test",
94
+ "postversion": "git push --tags origin master && npm publish"
95
+ },
96
+ "files": [
97
+ "css/jquery.fileupload-noscript.css",
98
+ "css/jquery.fileupload-ui-noscript.css",
99
+ "css/jquery.fileupload-ui.css",
100
+ "css/jquery.fileupload.css",
101
+ "img/loading.gif",
102
+ "img/progressbar.gif",
103
+ "js/cors/jquery.postmessage-transport.js",
104
+ "js/cors/jquery.xdr-transport.js",
105
+ "js/vendor/jquery.ui.widget.js",
106
+ "js/jquery.fileupload-audio.js",
107
+ "js/jquery.fileupload-image.js",
108
+ "js/jquery.fileupload-process.js",
109
+ "js/jquery.fileupload-ui.js",
110
+ "js/jquery.fileupload-validate.js",
111
+ "js/jquery.fileupload-video.js",
112
+ "js/jquery.fileupload.js",
113
+ "js/jquery.iframe-transport.js"
114
+ ],
115
+ "main": "js/jquery.fileupload.js"
116
+ }
@@ -0,0 +1,18 @@
1
+ runtime: python27
2
+ api_version: 1
3
+ threadsafe: true
4
+
5
+ libraries:
6
+ - name: PIL
7
+ version: latest
8
+
9
+ handlers:
10
+ - url: /(favicon\.ico|robots\.txt)
11
+ static_files: static/\1
12
+ upload: static/(.*)
13
+ expiration: '1d'
14
+ - url: /.*
15
+ script: main.app
16
+
17
+ automatic_scaling:
18
+ max_instances: 1
@@ -0,0 +1,204 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # jQuery File Upload Plugin GAE Python Example
4
+ # https://github.com/blueimp/jQuery-File-Upload
5
+ #
6
+ # Copyright 2011, Sebastian Tschan
7
+ # https://blueimp.net
8
+ #
9
+ # Licensed under the MIT license:
10
+ # https://opensource.org/licenses/MIT
11
+ #
12
+
13
+ from google.appengine.api import memcache, images
14
+ import json
15
+ import os
16
+ import re
17
+ import urllib
18
+ import webapp2
19
+
20
+ DEBUG=os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
21
+ WEBSITE = 'https://blueimp.github.io/jQuery-File-Upload/'
22
+ MIN_FILE_SIZE = 1 # bytes
23
+ # Max file size is memcache limit (1MB) minus key size minus overhead:
24
+ MAX_FILE_SIZE = 999000 # bytes
25
+ IMAGE_TYPES = re.compile('image/(gif|p?jpeg|(x-)?png)')
26
+ ACCEPT_FILE_TYPES = IMAGE_TYPES
27
+ THUMB_MAX_WIDTH = 80
28
+ THUMB_MAX_HEIGHT = 80
29
+ THUMB_SUFFIX = '.'+str(THUMB_MAX_WIDTH)+'x'+str(THUMB_MAX_HEIGHT)+'.png'
30
+ EXPIRATION_TIME = 300 # seconds
31
+ # If set to None, only allow redirects to the referer protocol+host.
32
+ # Set to a regexp for custom pattern matching against the redirect value:
33
+ REDIRECT_ALLOW_TARGET = None
34
+
35
+ class CORSHandler(webapp2.RequestHandler):
36
+ def cors(self):
37
+ headers = self.response.headers
38
+ headers['Access-Control-Allow-Origin'] = '*'
39
+ headers['Access-Control-Allow-Methods'] =\
40
+ 'OPTIONS, HEAD, GET, POST, DELETE'
41
+ headers['Access-Control-Allow-Headers'] =\
42
+ 'Content-Type, Content-Range, Content-Disposition'
43
+
44
+ def initialize(self, request, response):
45
+ super(CORSHandler, self).initialize(request, response)
46
+ self.cors()
47
+
48
+ def json_stringify(self, obj):
49
+ return json.dumps(obj, separators=(',', ':'))
50
+
51
+ def options(self, *args, **kwargs):
52
+ pass
53
+
54
+ class UploadHandler(CORSHandler):
55
+ def validate(self, file):
56
+ if file['size'] < MIN_FILE_SIZE:
57
+ file['error'] = 'File is too small'
58
+ elif file['size'] > MAX_FILE_SIZE:
59
+ file['error'] = 'File is too big'
60
+ elif not ACCEPT_FILE_TYPES.match(file['type']):
61
+ file['error'] = 'Filetype not allowed'
62
+ else:
63
+ return True
64
+ return False
65
+
66
+ def validate_redirect(self, redirect):
67
+ if redirect:
68
+ if REDIRECT_ALLOW_TARGET:
69
+ return REDIRECT_ALLOW_TARGET.match(redirect)
70
+ referer = self.request.headers['referer']
71
+ if referer:
72
+ from urlparse import urlparse
73
+ parts = urlparse(referer)
74
+ redirect_allow_target = '^' + re.escape(
75
+ parts.scheme + '://' + parts.netloc + '/'
76
+ )
77
+ return re.match(redirect_allow_target, redirect)
78
+ return False
79
+
80
+ def get_file_size(self, file):
81
+ file.seek(0, 2) # Seek to the end of the file
82
+ size = file.tell() # Get the position of EOF
83
+ file.seek(0) # Reset the file position to the beginning
84
+ return size
85
+
86
+ def write_blob(self, data, info):
87
+ key = urllib.quote(info['type'].encode('utf-8'), '') +\
88
+ '/' + str(hash(data)) +\
89
+ '/' + urllib.quote(info['name'].encode('utf-8'), '')
90
+ try:
91
+ memcache.set(key, data, time=EXPIRATION_TIME)
92
+ except: #Failed to add to memcache
93
+ return (None, None)
94
+ thumbnail_key = None
95
+ if IMAGE_TYPES.match(info['type']):
96
+ try:
97
+ img = images.Image(image_data=data)
98
+ img.resize(
99
+ width=THUMB_MAX_WIDTH,
100
+ height=THUMB_MAX_HEIGHT
101
+ )
102
+ thumbnail_data = img.execute_transforms()
103
+ thumbnail_key = key + THUMB_SUFFIX
104
+ memcache.set(
105
+ thumbnail_key,
106
+ thumbnail_data,
107
+ time=EXPIRATION_TIME
108
+ )
109
+ except: #Failed to resize Image or add to memcache
110
+ thumbnail_key = None
111
+ return (key, thumbnail_key)
112
+
113
+ def handle_upload(self):
114
+ results = []
115
+ for name, fieldStorage in self.request.POST.items():
116
+ if type(fieldStorage) is unicode:
117
+ continue
118
+ result = {}
119
+ result['name'] = urllib.unquote(fieldStorage.filename)
120
+ result['type'] = fieldStorage.type
121
+ result['size'] = self.get_file_size(fieldStorage.file)
122
+ if self.validate(result):
123
+ key, thumbnail_key = self.write_blob(
124
+ fieldStorage.value,
125
+ result
126
+ )
127
+ if key is not None:
128
+ result['url'] = self.request.host_url + '/' + key
129
+ result['deleteUrl'] = result['url']
130
+ result['deleteType'] = 'DELETE'
131
+ if thumbnail_key is not None:
132
+ result['thumbnailUrl'] = self.request.host_url +\
133
+ '/' + thumbnail_key
134
+ else:
135
+ result['error'] = 'Failed to store uploaded file.'
136
+ results.append(result)
137
+ return results
138
+
139
+ def head(self):
140
+ pass
141
+
142
+ def get(self):
143
+ self.redirect(WEBSITE)
144
+
145
+ def post(self):
146
+ if (self.request.get('_method') == 'DELETE'):
147
+ return self.delete()
148
+ result = {'files': self.handle_upload()}
149
+ s = self.json_stringify(result)
150
+ redirect = self.request.get('redirect')
151
+ if self.validate_redirect(redirect):
152
+ return self.redirect(str(
153
+ redirect.replace('%s', urllib.quote(s, ''), 1)
154
+ ))
155
+ if 'application/json' in self.request.headers.get('Accept'):
156
+ self.response.headers['Content-Type'] = 'application/json'
157
+ self.response.write(s)
158
+
159
+ class FileHandler(CORSHandler):
160
+ def normalize(self, str):
161
+ return urllib.quote(urllib.unquote(str), '')
162
+
163
+ def get(self, content_type, data_hash, file_name):
164
+ content_type = self.normalize(content_type)
165
+ file_name = self.normalize(file_name)
166
+ key = content_type + '/' + data_hash + '/' + file_name
167
+ data = memcache.get(key)
168
+ if data is None:
169
+ return self.error(404)
170
+ # Prevent browsers from MIME-sniffing the content-type:
171
+ self.response.headers['X-Content-Type-Options'] = 'nosniff'
172
+ content_type = urllib.unquote(content_type)
173
+ if not IMAGE_TYPES.match(content_type):
174
+ # Force a download dialog for non-image types:
175
+ content_type = 'application/octet-stream'
176
+ elif file_name.endswith(THUMB_SUFFIX):
177
+ content_type = 'image/png'
178
+ self.response.headers['Content-Type'] = content_type
179
+ # Cache for the expiration time:
180
+ self.response.headers['Cache-Control'] = 'public,max-age=%d' \
181
+ % EXPIRATION_TIME
182
+ self.response.write(data)
183
+
184
+ def delete(self, content_type, data_hash, file_name):
185
+ content_type = self.normalize(content_type)
186
+ file_name = self.normalize(file_name)
187
+ key = content_type + '/' + data_hash + '/' + file_name
188
+ result = {key: memcache.delete(key)}
189
+ content_type = urllib.unquote(content_type)
190
+ if IMAGE_TYPES.match(content_type):
191
+ thumbnail_key = key + THUMB_SUFFIX
192
+ result[thumbnail_key] = memcache.delete(thumbnail_key)
193
+ if 'application/json' in self.request.headers.get('Accept'):
194
+ self.response.headers['Content-Type'] = 'application/json'
195
+ s = self.json_stringify(result)
196
+ self.response.write(s)
197
+
198
+ app = webapp2.WSGIApplication(
199
+ [
200
+ ('/', UploadHandler),
201
+ ('/(.+)/([^/]+)/([^/]+)', FileHandler)
202
+ ],
203
+ debug=DEBUG
204
+ )
@@ -0,0 +1,2 @@
1
+ User-agent: *
2
+ Disallow:
@@ -0,0 +1,44 @@
1
+ FROM php:8.0.11-apache
2
+
3
+ # Enable the Apache Headers module:
4
+ RUN ln -s /etc/apache2/mods-available/headers.load \
5
+ /etc/apache2/mods-enabled/headers.load
6
+
7
+ # Enable the Apache Rewrite module:
8
+ RUN ln -s /etc/apache2/mods-available/rewrite.load \
9
+ /etc/apache2/mods-enabled/rewrite.load
10
+
11
+ # Install GD, Imagick and ImageMagick as image conversion options:
12
+ RUN DEBIAN_FRONTEND=noninteractive \
13
+ apt-get update && apt-get install -y --no-install-recommends \
14
+ libpng-dev \
15
+ libjpeg-dev \
16
+ libmagickwand-dev \
17
+ imagemagick \
18
+ && pecl install \
19
+ imagick \
20
+ && docker-php-ext-enable \
21
+ imagick \
22
+ && docker-php-ext-configure \
23
+ gd --with-jpeg=/usr/include/ \
24
+ && docker-php-ext-install \
25
+ gd \
26
+ # Uninstall obsolete packages:
27
+ && apt-get autoremove -y \
28
+ libpng-dev \
29
+ libjpeg-dev \
30
+ libmagickwand-dev \
31
+ # Remove obsolete files:
32
+ && apt-get clean \
33
+ && rm -rf \
34
+ /tmp/* \
35
+ /usr/share/doc/* \
36
+ /var/cache/* \
37
+ /var/lib/apt/lists/* \
38
+ /var/tmp/*
39
+
40
+ # Use the default development configuration:
41
+ RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
42
+
43
+ # Add a custom configuration file:
44
+ COPY php.ini "$PHP_INI_DIR/conf.d/"