gina 0.1.1-alpha.156 → 0.1.1-alpha.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/LICENSE +1 -1
  2. package/README-4Contributors.md +17 -0
  3. package/README.md +36 -17
  4. package/bin/cli +31 -17
  5. package/bin/cli-debug +46 -15
  6. package/bin/gina +8 -3
  7. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/AUTHORS +0 -0
  8. package/framework/{v0.1.1-alpha.156/lib/inherits → v0.1.1-alpha.158}/LICENSE +1 -1
  9. package/framework/v0.1.1-alpha.158/VERSION +1 -0
  10. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/html/nolayout.html +0 -0
  11. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/html/static.html +0 -0
  12. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/android-chrome-192x192.png +0 -0
  13. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/android-chrome-512x512.png +0 -0
  14. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/apple-touch-icon.png +0 -0
  15. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/favicon-16x16.png +0 -0
  16. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/favicon-32x32.png +0 -0
  17. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/img/favicon.ico +0 -0
  18. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.js +779 -769
  19. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.js.map +3 -3
  20. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.min.css +0 -0
  21. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.min.css.map +0 -0
  22. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.min.js +138 -138
  23. package/framework/v0.1.1-alpha.158/core/asset/plugin/dist/gina.min.js.map +8 -0
  24. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.onload.min.js +0 -0
  25. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/gina.onload.min.js.map +0 -0
  26. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/css/toolbar-min.css +0 -0
  27. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/css/toolbar.css +0 -0
  28. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/css/toolbar.css.map +0 -0
  29. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/js/jquery-3.1.0.min.js +0 -0
  30. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/main.js +0 -0
  31. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/dist/toolbar/toolbar.html +0 -0
  32. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/readme.md +0 -0
  33. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/asset/plugin/uuid.json +0 -0
  34. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/config.js +1 -1
  35. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/index.js +18 -4
  36. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/connector.js +0 -0
  37. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/connector.v2.js +0 -0
  38. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/connector.v3.js +0 -0
  39. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/connector.v4.js +9 -2
  40. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/n1ql.js +0 -0
  41. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/session-store.js +0 -0
  42. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  43. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
  44. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/connectors/couchbase/lib/session-store.v4.js +0 -0
  45. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/controller/controller.framework.js +0 -0
  46. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/controller/controller.js +2 -2
  47. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/controller/index.js +0 -0
  48. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/.travis.yml +0 -0
  49. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/LICENSE +0 -0
  50. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/README.md +0 -0
  51. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
  52. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/deps/encoding/encoding.js +0 -0
  53. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/lib/main.js +0 -0
  54. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/lib/types/multipart.js +0 -0
  55. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/lib/types/urlencoded.js +0 -0
  56. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/lib/utils.js +0 -0
  57. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/busboy/package.json +0 -0
  58. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  59. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/dev/index.js +1 -1
  60. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/dev/lib/class.js +0 -0
  61. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/dev/lib/factory.js +1 -1
  62. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/dev/lib/tools.js +0 -0
  63. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/gna.js +1 -1
  64. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/README.md +0 -0
  65. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/currency.json +0 -0
  66. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/dist/language/en.json +0 -0
  67. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/dist/language/fr.json +0 -0
  68. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/dist/region/en.json +0 -0
  69. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/dist/region/fr.json +0 -0
  70. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/index.js +2 -2
  71. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/src/make.js +0 -0
  72. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/src/resources/currency.csv +0 -0
  73. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/src/resources/region.csv +0 -0
  74. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/locales/src/resources/region.mapping.json +0 -0
  75. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/mime.types +0 -0
  76. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/model/entity.js +1 -1
  77. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/model/index.js +4 -3
  78. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/model/template/entityFactory.js +1 -1
  79. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/model/template/index.js +1 -1
  80. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/README.md +0 -0
  81. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/index.js +1 -1
  82. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/file/README.md +0 -0
  83. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/file/build.json +0 -0
  84. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/file/package.json +1 -1
  85. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/intl/README.md +0 -0
  86. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/intl/build.json +0 -0
  87. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/intl/package.json +1 -1
  88. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/intl/src/main.js +0 -0
  89. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/storage/README.md +0 -0
  90. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/storage/build.json +0 -0
  91. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/storage/package.json +1 -1
  92. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/storage/src/main.js +0 -0
  93. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/validator/README.md +0 -0
  94. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/validator/build.json +0 -0
  95. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/validator/package.json +1 -1
  96. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/validator/src/form-validator.js +0 -0
  97. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/plugins/lib/validator/src/main.js +0 -0
  98. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/router.js +1 -1
  99. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/server.express.js +0 -0
  100. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/server.isaac.js +0 -0
  101. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/server.js +42 -0
  102. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/status.codes +0 -0
  103. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/config/app.json +0 -0
  104. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/config/routing.json +0 -0
  105. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/config/settings.json +0 -0
  106. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
  107. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/config/templates.json +0 -0
  108. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
  109. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  110. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/controllers/setup.js +0 -0
  111. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle/index.js +0 -0
  112. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  113. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  114. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  115. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  116. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  117. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_public/readme.md +0 -0
  118. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  119. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_templates/html/content/homepage.html +0 -0
  120. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +0 -0
  121. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +0 -0
  122. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/boilerplate/bundle_templates/html/layouts/main.html +0 -0
  123. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/command/gina.bat.tpl +0 -0
  124. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/command/gina.tpl +1 -1
  125. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/env.json +0 -0
  126. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/manifest.json +0 -0
  127. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/package.json +0 -0
  128. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/settings.json +0 -0
  129. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/statics.json +0 -0
  130. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/conf/templates.json +0 -0
  131. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/client/json/401.json +0 -0
  132. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/client/json/403.json +0 -0
  133. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/client/json/404.json +0 -0
  134. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/server/html/50x.html +0 -0
  135. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/server/json/500.json +0 -0
  136. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/error/server/json/503.json +0 -0
  137. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/core/template/extensions/logger/config.json +0 -0
  138. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/console.js +1 -1
  139. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/context.js +1 -1
  140. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/dateFormat.js +1 -1
  141. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/index.js +1 -1
  142. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/json/README.md +0 -0
  143. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/json/package.json +1 -1
  144. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/json/src/main.js +22 -22
  145. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/path.js +1 -1
  146. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/plugins/README.md +0 -0
  147. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/plugins/package.json +1 -1
  148. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/plugins/src/api-error.js +0 -0
  149. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/plugins/src/main.js +2 -2
  150. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/prototypes.js +0 -0
  151. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/task.js +0 -0
  152. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/helpers/text.js +1 -1
  153. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/archiver/README.md +0 -0
  154. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/archiver/build.json +0 -0
  155. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/archiver/package.json +1 -1
  156. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/archiver/src/dep/jszip.min.js +0 -0
  157. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/archiver/src/main.js +167 -167
  158. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/aliases.json +0 -0
  159. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/add.js +0 -0
  160. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/arguments.json +0 -0
  161. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/copy.js +0 -0
  162. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/cp.js +0 -0
  163. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/help.js +0 -0
  164. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/help.txt +0 -0
  165. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/list.js +0 -0
  166. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/remove.js +0 -0
  167. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/rename.js +0 -0
  168. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/restart.js +0 -0
  169. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/rm.js +0 -0
  170. package/framework/v0.1.1-alpha.158/lib/cmd/bundle/start.js +637 -0
  171. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/status.js +0 -0
  172. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/bundle/stop.js +0 -0
  173. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/add.js +0 -0
  174. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/get.js +0 -0
  175. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/help.js +0 -0
  176. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/help.txt +0 -0
  177. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/link-dev.js +0 -0
  178. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/list.js +0 -0
  179. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/remove.js +0 -0
  180. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/rm.js +0 -0
  181. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/set.js +0 -0
  182. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/unset.js +0 -0
  183. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/env/use.js +0 -0
  184. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/build.js +0 -0
  185. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/dot.js +0 -0
  186. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/get.js +0 -0
  187. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/help.js +0 -0
  188. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/help.txt +0 -0
  189. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/init.js +108 -4
  190. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/link-node-modules.js +0 -0
  191. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/link.js +0 -0
  192. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/msg.json +0 -0
  193. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/open.js +0 -0
  194. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/restart.js +6 -2
  195. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/set.js +0 -0
  196. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/start.js +0 -0
  197. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/status.js +0 -0
  198. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/stop.js +0 -0
  199. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/tail.js +36 -3
  200. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/update.js +0 -0
  201. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/framework/version.js +0 -0
  202. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/gina-dev.1.md +0 -0
  203. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/gina-framework.1.md +0 -0
  204. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/gina.1.md +0 -0
  205. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/helper.js +0 -0
  206. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/index.js +1 -1
  207. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/msg.json +0 -0
  208. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/help.js +0 -0
  209. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/help.txt +0 -0
  210. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/inc/scan.js +0 -0
  211. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/list.js +0 -0
  212. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/reset.js +0 -0
  213. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/port/set.js +0 -0
  214. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/add.js +0 -0
  215. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/arguments.json +0 -0
  216. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/build.js +0 -0
  217. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/help.js +0 -0
  218. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/help.txt +0 -0
  219. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/import.js +0 -0
  220. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/list.js +16 -2
  221. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/move.js +0 -0
  222. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/remove.js +0 -0
  223. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/rename.js +0 -0
  224. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/restart.js +0 -0
  225. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/rm.js +0 -0
  226. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/start.js +0 -0
  227. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/status.js +0 -0
  228. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/project/stop.js +0 -0
  229. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/protocol/help.js +0 -0
  230. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/protocol/help.txt +0 -0
  231. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/protocol/list.js +0 -0
  232. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/protocol/set.js +0 -0
  233. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/help.js +0 -0
  234. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/help.txt +0 -0
  235. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/link-local.js +0 -0
  236. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/list.js +0 -0
  237. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/remove.js +0 -0
  238. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/rm.js +0 -0
  239. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/set.js +0 -0
  240. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/unset.js +0 -0
  241. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/scope/use.js +0 -0
  242. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cmd/view/add.js +0 -0
  243. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/collection/README.md +0 -0
  244. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/collection/build.json +0 -0
  245. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/collection/package.json +1 -1
  246. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/collection/src/main.js +0 -0
  247. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/config.js +2 -1
  248. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cron/README.md +0 -0
  249. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cron/package.json +1 -1
  250. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/cron/src/main.js +0 -0
  251. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/generator/index.js +1 -1
  252. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/index.js +1 -1
  253. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158/lib/inherits}/LICENSE +1 -1
  254. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/README.md +0 -0
  255. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  256. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/example/protected_inheritance.js +0 -0
  257. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/example/simple_inheritance.js +0 -0
  258. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  259. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/package.json +1 -1
  260. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/inherits/src/main.js +1 -1
  261. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/README.md +0 -0
  262. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/package.json +1 -1
  263. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/default/index.js +0 -0
  264. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/file/index.js +0 -0
  265. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  266. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  267. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/mq/index.js +0 -0
  268. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/mq/listener.js +0 -0
  269. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/containers/mq/speaker.js +0 -0
  270. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/helper.js +1 -1
  271. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/logger/src/main.js +1 -1
  272. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/math/index.js +7 -7
  273. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/README.md +0 -0
  274. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/example/merge.js +0 -0
  275. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/example/merge_2_literal objects.js +0 -0
  276. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/example/merge_and_preserve_first.js +0 -0
  277. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/package.json +1 -1
  278. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/merge/src/main.js +0 -0
  279. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/model.js +9 -9
  280. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/proc.js +7 -3
  281. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/routing/README.md +0 -0
  282. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/routing/build.json +0 -0
  283. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/routing/package.json +1 -1
  284. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/routing/src/main.js +258 -258
  285. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/session-store.js +6 -6
  286. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/shell.js +0 -0
  287. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/swig-filters/README.md +0 -0
  288. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/swig-filters/package.json +1 -1
  289. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/swig-filters/src/main.js +1 -1
  290. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/url/README.md +0 -0
  291. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/url/index.js +0 -0
  292. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/url/mocks.json +0 -0
  293. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/url/routing.json +0 -0
  294. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/url/test.js +0 -0
  295. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/lib/validator.js +0 -0
  296. package/framework/{v0.1.1-alpha.156 → v0.1.1-alpha.158}/package.json +0 -0
  297. package/package.json +6 -6
  298. package/resources/home/main.json +11 -0
  299. package/resources/home/settings.json +1 -0
  300. package/resources/package.json.template +1 -1
  301. package/script/post_install.js +1 -1
  302. package/script/post_publish.js +1 -1
  303. package/script/pre_install.js +1 -1
  304. package/script/prepare_version.js +1 -1
  305. package/utils/helper.js +0 -141
  306. package/framework/v0.1.1-alpha.156/VERSION +0 -1
  307. package/framework/v0.1.1-alpha.156/core/asset/plugin/dist/gina.min.js.map +0 -8
  308. package/framework/v0.1.1-alpha.156/lib/cmd/bundle/start.js +0 -420
@@ -2679,7 +2679,10 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
2679
2679
  define( 'utils/merge',[],function() { return Merge() })
2680
2680
  };
2681
2681
  function registerEvents(plugin, events) {
2682
- gina.registeredEvents[plugin] = events
2682
+ if ( typeof(gina) == 'undefined' && typeof(window.gina) != 'undefined' ) {
2683
+ gina = window.gina;
2684
+ }
2685
+ gina.registeredEvents[plugin] = events;
2683
2686
  }
2684
2687
  function mergeEventProps(evt, proxiedEvent) {
2685
2688
  for (let p in proxiedEvent) {
@@ -2692,16 +2695,16 @@ function mergeEventProps(evt, proxiedEvent) {
2692
2695
  }
2693
2696
  /**
2694
2697
  * addListener
2695
- *
2696
- * @param {object} target
2697
- * @param {object} element
2698
- * @param {string|array} name
2699
- * @param {callback} callback
2698
+ *
2699
+ * @param {object} target
2700
+ * @param {object} element
2701
+ * @param {string|array} name
2702
+ * @param {callback} callback
2700
2703
  */
2701
2704
  function addListener(target, element, name, callback) {
2702
-
2705
+
2703
2706
  var registerListener = function(target, element, name, callback) {
2704
-
2707
+
2705
2708
  if ( typeof(target.event) != 'undefined' && target.event.isTouchSupported && /^(click|mouseout|mouseover)/.test(name) && target.event[name].indexOf(element) == -1) {
2706
2709
  target.event[name][target.event[name].length] = element
2707
2710
  }
@@ -2718,10 +2721,10 @@ function addListener(target, element, name, callback) {
2718
2721
 
2719
2722
  gina.events[name] = ( typeof(element.id) != 'undefined' && typeof(element.id) != 'object' ) ? element.id : element.getAttribute('id');
2720
2723
  }
2721
-
2724
+
2722
2725
  var i = 0, len = null;
2723
- if ( Array.isArray(name) ) {
2724
- len = name.length;
2726
+ if ( Array.isArray(name) ) {
2727
+ len = name.length;
2725
2728
  for (; i < len; i++) {
2726
2729
  registerListener(target, element, name[i], callback)
2727
2730
  }
@@ -2736,14 +2739,14 @@ function addListener(target, element, name, callback) {
2736
2739
  } else {
2737
2740
  name = ( /\.$/.test(name) ) ? name + element.id : name;
2738
2741
  registerListener(target, element, name, callback);
2739
- }
2742
+ }
2740
2743
  }
2741
-
2744
+
2742
2745
  }
2743
2746
  /**
2744
2747
  * triggerEvent
2745
2748
  * @param {object} target - targeted domain
2746
- * @param {object} element - HTMLFormElement
2749
+ * @param {object} element - HTMLFormElement
2747
2750
  * @param {string} name - event ID
2748
2751
  * @param {object|array|string} args - details
2749
2752
  * @param {object} [proxiedEvent]
@@ -2783,11 +2786,11 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2783
2786
 
2784
2787
 
2785
2788
  }
2786
-
2789
+
2787
2790
  if (window.CustomEvent || document.createEvent) {
2788
-
2789
-
2790
- if (window.CustomEvent) { // new method from ie9
2791
+
2792
+
2793
+ if (window.CustomEvent) { // new method from ie9
2791
2794
  evt = new CustomEvent(name, {
2792
2795
  'detail' : args,
2793
2796
  'bubbles' : true,
@@ -2808,7 +2811,7 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2808
2811
 
2809
2812
  }
2810
2813
  if (proxiedEvent) {
2811
- // merging props
2814
+ // merging props
2812
2815
  evt = mergeEventProps(evt, proxiedEvent);
2813
2816
  }
2814
2817
 
@@ -2821,17 +2824,17 @@ function triggerEvent (target, element, name, args, proxiedEvent) {
2821
2824
  }
2822
2825
 
2823
2826
  } else if (document.createEventObject) { // non standard
2824
-
2827
+
2825
2828
  evt = document.createEventObject();
2826
2829
  evt.srcElement.id = element.id;
2827
2830
  evt.detail = args;
2828
2831
  evt.target = element;
2829
-
2830
- if (proxiedEvent) {
2831
- // merging props
2832
+
2833
+ if (proxiedEvent) {
2834
+ // merging props
2832
2835
  evt = mergeEventProps(evt, proxiedEvent);
2833
2836
  }
2834
-
2837
+
2835
2838
  element.fireEvent('on' + name, evt);
2836
2839
  }
2837
2840
 
@@ -2880,7 +2883,7 @@ function setupXhr(options) {
2880
2883
  options.method = 'GET';
2881
2884
  }
2882
2885
  options.method = options.method.toUpperCase();
2883
-
2886
+
2884
2887
  if ( options.withCredentials ) {
2885
2888
  if ('withCredentials' in xhr) {
2886
2889
  // XHR for Chrome/Firefox/Opera/Safari.
@@ -2901,7 +2904,7 @@ function setupXhr(options) {
2901
2904
 
2902
2905
  return;
2903
2906
  }
2904
-
2907
+
2905
2908
  if ( typeof(options.responseType) != 'undefined' ) {
2906
2909
  xhr.responseType = options.responseType;
2907
2910
  } else {
@@ -2933,22 +2936,22 @@ function setupXhr(options) {
2933
2936
 
2934
2937
  /**
2935
2938
  * handleXhr
2936
- *
2939
+ *
2937
2940
  * @param {object} xhr - instance
2938
- * @param {object} $el - dom objet element
2939
- * @param {object} options
2940
- */
2941
+ * @param {object} $el - dom objet element
2942
+ * @param {object} options
2943
+ */
2941
2944
  function handleXhr(xhr, $el, options, require) {
2942
-
2945
+
2943
2946
  if (!xhr)
2944
2947
  throw new Error('No `xhr` object initiated');
2945
-
2948
+
2946
2949
  //var merge = require('utils/merge');
2947
-
2950
+
2948
2951
  var blob = null
2949
2952
  , isAttachment = null // handle download
2950
2953
  , contentType = null
2951
- , result = null
2954
+ , result = null
2952
2955
  , id = null
2953
2956
  , $link = options.$link || null
2954
2957
  , $form = options.$form || null
@@ -2956,14 +2959,14 @@ function handleXhr(xhr, $el, options, require) {
2956
2959
  ;
2957
2960
  delete options.$link;
2958
2961
  delete options.$form;
2959
-
2962
+
2960
2963
  if ($form || $link) {
2961
2964
  if ($link) {
2962
2965
  // not the link element but the link elements collection : like for popins main container
2963
2966
  $link.target = document.getElementById($link.id);
2964
2967
  $target = gina.link.target;
2965
2968
  id = gina.link.id;
2966
-
2969
+
2967
2970
  // copy $el attributes to $target
2968
2971
  // for (var prop in $link) {
2969
2972
  // if ( !$target[prop] )
@@ -2972,28 +2975,28 @@ function handleXhr(xhr, $el, options, require) {
2972
2975
  } else { // forms
2973
2976
  $target = $form.target;
2974
2977
  id = $target.getAttribute('id');
2975
- }
2978
+ }
2976
2979
  } else {
2977
2980
  $target = $el;
2978
2981
  id = $target.getAttribute('id');
2979
2982
  }
2980
-
2983
+
2981
2984
  // forward callback to HTML data event attribute through `hform` status
2982
- var hLinkIsRequired = ( $link && $el.getAttribute('data-gina-link-event-on-success') || $link && $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
2985
+ var hLinkIsRequired = ( $link && $el.getAttribute('data-gina-link-event-on-success') || $link && $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
2983
2986
  // if (hLinkIsRequired && $link)
2984
2987
  // listenToXhrEvents($link, 'link');
2985
-
2988
+
2986
2989
  // forward callback to HTML data event attribute through `hform` status
2987
2990
  var hFormIsRequired = ( $form && $target.getAttribute('data-gina-form-event-on-submit-success') || $form && $target.getAttribute('data-gina-form-event-on-submit-error') ) ? true : false;
2988
2991
  // success -> data-gina-form-event-on-submit-success
2989
2992
  // error -> data-gina-form-event-on-submit-error
2990
2993
  if (hFormIsRequired && $form)
2991
2994
  listenToXhrEvents($form, 'form');
2992
-
2993
-
2995
+
2996
+
2994
2997
  // to upload, use `multipart/form-data` for `enctype`
2995
2998
  var enctype = $el.getAttribute('enctype') || options.headers['Content-Type'];
2996
-
2999
+
2997
3000
  // setting up headers - all but Content-Type ; it will be set right before .send() is called
2998
3001
  for (var hearder in options.headers) {
2999
3002
  //if ( hearder == 'Content-Type' && typeof (enctype) != 'undefined' && enctype != null && enctype != '') {
@@ -3003,45 +3006,45 @@ function handleXhr(xhr, $el, options, require) {
3003
3006
  continue;
3004
3007
 
3005
3008
  xhr.setRequestHeader(hearder, options.headers[hearder]);
3006
- }
3009
+ }
3007
3010
  xhr.withCredentials = ( typeof(options.withCredentials) != 'undefined' ) ? options.withCredentials : false;
3008
-
3009
-
3011
+
3012
+
3010
3013
  // catching errors
3011
3014
  xhr.onerror = function(event, err) {
3012
-
3015
+
3013
3016
  var error = 'Transaction error: might be due to the server CORS settings.\nPlease, check the console for more details.';
3014
3017
  var result = {
3015
3018
  'status': xhr.status || 500, //500,
3016
3019
  'error' : error
3017
- };
3018
-
3020
+ };
3021
+
3019
3022
  var resultIsObject = true;
3020
3023
  if ($form)
3021
3024
  $form.eventData.error = result;
3022
-
3025
+
3023
3026
  if ($link)
3024
3027
  $link.eventData.error = result;
3025
-
3028
+
3026
3029
  //updateToolbar(result, resultIsObject);
3027
3030
  window.ginaToolbar.update('data-xhr', result, resultIsObject);
3028
-
3031
+
3029
3032
  triggerEvent(gina, $target, 'error.' + id, result);
3030
-
3033
+
3031
3034
  if (hFormIsRequired)
3032
3035
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3033
-
3036
+
3034
3037
  if (hLinkIsRequired)
3035
3038
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3036
3039
  }
3037
-
3040
+
3038
3041
  // catching ready state cb
3039
3042
  xhr.onreadystatechange = function (event) {
3040
3043
  // In case the user is also redirecting
3041
3044
  var redirectDelay = (/Google Inc/i.test(navigator.vendor)) ? 50 : 0;
3042
-
3045
+
3043
3046
  if (xhr.readyState == 2) { // responseType interception
3044
- isAttachment = ( /^attachment\;/.test( xhr.getResponseHeader('Content-Disposition') ) ) ? true : false;
3047
+ isAttachment = ( /^attachment\;/.test( xhr.getResponseHeader('Content-Disposition') ) ) ? true : false;
3045
3048
  // force blob response type
3046
3049
  if ( !xhr.responseType && isAttachment ) {
3047
3050
  xhr.responseType = 'blob';
@@ -3050,21 +3053,21 @@ function handleXhr(xhr, $el, options, require) {
3050
3053
 
3051
3054
  if (xhr.readyState == 4) {
3052
3055
  blob = null;
3053
- contentType = xhr.getResponseHeader('Content-Type');
3054
-
3056
+ contentType = xhr.getResponseHeader('Content-Type');
3057
+
3055
3058
  // 200, 201, 201' etc ...
3056
3059
  if( /^2/.test(xhr.status) ) {
3057
3060
 
3058
- try {
3059
-
3061
+ try {
3062
+
3060
3063
  // handling blob xhr download
3061
3064
  if ( /blob/.test(xhr.responseType) || isAttachment ) {
3062
3065
  if ( typeof(contentType) == 'undefined' || contentType == null) {
3063
3066
  contentType = 'application/octet-stream';
3064
3067
  }
3065
-
3068
+
3066
3069
  blob = new Blob([this.response], { type: contentType });
3067
-
3070
+
3068
3071
  //Create a link element, hide it, direct it towards the blob, and then 'click' it programatically
3069
3072
  var a = document.createElement('a');
3070
3073
  a.style = 'display: none';
@@ -3078,82 +3081,82 @@ function handleXhr(xhr, $el, options, require) {
3078
3081
  a.click();
3079
3082
  //release the reference to the file by revoking the Object URL
3080
3083
  window.URL.revokeObjectURL(url);
3081
-
3084
+
3082
3085
  result = {
3083
3086
  status : xhr.status,
3084
3087
  statusText : xhr.statusText,
3085
3088
  responseType : blob.type,
3086
3089
  type : blob.type,
3087
- size : blob.size
3090
+ size : blob.size
3088
3091
  }
3089
-
3090
- }
3091
3092
 
3092
-
3093
+ }
3094
+
3095
+
3093
3096
  if ( !result && /\/json/.test( contentType ) ) {
3094
3097
  result = JSON.parse(xhr.responseText);
3095
-
3098
+
3096
3099
  if ( typeof(result.status) == 'undefined' )
3097
3100
  result.status = xhr.status || 200;
3098
3101
  }
3099
-
3102
+
3100
3103
  if ( !result && /\/html/.test( contentType ) ) {
3101
-
3104
+
3102
3105
  result = {
3103
3106
  contentType : contentType,
3104
3107
  content : xhr.responseText
3105
3108
  };
3106
-
3109
+
3107
3110
  if ( typeof(result.status) == 'undefined' )
3108
3111
  result.status = xhr.status;
3109
-
3112
+
3110
3113
  // if hasPopinHandler & popinIsBinded
3111
3114
  if ( typeof(gina.popin) != 'undefined' && gina.hasPopinHandler ) {
3112
-
3115
+
3113
3116
  // select popin by id
3114
3117
  var $popin = gina.popin.getActivePopin();
3115
-
3118
+
3116
3119
  if ($popin) {
3117
-
3120
+
3118
3121
  XHRData = {};
3119
3122
  // update toolbar
3120
-
3123
+
3121
3124
  try {
3122
3125
  XHRData = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-data');
3123
3126
  XHRData = JSON.parse(decodeURIComponent(XHRData.value));
3124
-
3125
- XHRView = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-view');
3127
+
3128
+ XHRView = new DOMParser().parseFromString(result.content, 'text/html').getElementById('gina-without-layout-xhr-view');
3126
3129
  XHRView = JSON.parse(decodeURIComponent(XHRView.value));
3127
-
3128
- // update data tab
3130
+
3131
+ // update data tab
3129
3132
  if ( gina && typeof(window.ginaToolbar) && typeof(XHRData) != 'undefined' ) {
3130
3133
  window.ginaToolbar.update('data-xhr', XHRData);
3131
3134
  }
3132
-
3133
- // update view tab
3135
+
3136
+ // update view tab
3134
3137
  if ( gina && typeof(window.ginaToolbar) && typeof(XHRView) != 'undefined' ) {
3135
3138
  window.ginaToolbar.update('view-xhr', XHRView);
3136
- }
3139
+ }
3137
3140
 
3138
3141
  } catch (err) {
3139
3142
  throw err
3140
- }
3141
-
3143
+ }
3144
+
3142
3145
  $popin.loadContent(result.content);
3143
-
3146
+
3144
3147
  result = XHRData;
3145
3148
  triggerEvent(gina, $target, 'success.' + id, result);
3146
-
3149
+
3147
3150
  return;
3148
- }
3149
-
3151
+ }
3152
+
3150
3153
  }
3151
3154
  }
3152
-
3155
+
3153
3156
  if (!result) { // normal case
3154
- result = xhr.responseText;
3157
+ result = xhr.responseText;
3155
3158
  }
3156
-
3159
+
3157
3160
  if ($form)
3158
3161
  $form.eventData.success = result;
3159
3162
 
@@ -3172,13 +3175,13 @@ function handleXhr(xhr, $el, options, require) {
3172
3175
  }
3173
3176
 
3174
3177
  triggerEvent(gina, $target, 'success.' + id, result);
3175
-
3178
+
3176
3179
  if (hFormIsRequired)
3177
3180
  triggerEvent(gina, $target, 'success.' + id + '.hform', result);
3178
-
3181
+
3179
3182
  if (hLinkIsRequired)
3180
3183
  triggerEvent(gina, $target, 'success.' + id + '.hlink', result);
3181
-
3184
+
3182
3185
  } catch (err) {
3183
3186
 
3184
3187
  result = {
@@ -3187,12 +3190,12 @@ function handleXhr(xhr, $el, options, require) {
3187
3190
  stack : err.stack
3188
3191
 
3189
3192
  };
3190
-
3193
+
3191
3194
  if ($form)
3192
3195
  $form.eventData.error = result;
3193
-
3194
3196
 
3195
- XHRData = result;
3197
+
3198
+ XHRData = result;
3196
3199
  // update toolbar
3197
3200
  if ( gina && typeof(window.ginaToolbar) == 'object' && XHRData ) {
3198
3201
  try {
@@ -3209,39 +3212,39 @@ function handleXhr(xhr, $el, options, require) {
3209
3212
  triggerEvent(gina, $target, 'error.' + id, result);
3210
3213
  if (hFormIsRequired)
3211
3214
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3212
-
3215
+
3213
3216
  if (hLinkIsRequired)
3214
3217
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3215
3218
  }
3216
-
3219
+
3217
3220
  // handle redirect
3218
- if ( typeof(result) != 'undefined' && typeof(result.location) != 'undefined' ) {
3219
- window.location.hash = ''; //removing hashtag
3220
-
3221
+ if ( typeof(result) != 'undefined' && typeof(result.location) != 'undefined' ) {
3222
+ window.location.hash = ''; //removing hashtag
3223
+
3221
3224
  // if ( window.location.host == gina.config.hostname && /^(http|https)\:\/\//.test(result.location) ) { // same origin
3222
3225
  // result.location = result.location.replace( new RegExp(gina.config.hostname), '' );
3223
3226
  // } else { // external - need to remove `X-Requested-With` from `options.headers`
3224
3227
  result.location = (!/^http/.test(result.location) && !/^\//.test(result.location) ) ? location.protocol +'//' + result.location : result.location;
3225
- //}
3226
-
3228
+ //}
3229
+
3227
3230
  return setTimeout(() => {
3228
3231
  window.location.href = result.location;
3229
- }, redirectDelay);
3232
+ }, redirectDelay);
3230
3233
  }
3231
3234
 
3232
3235
  } else if ( xhr.status != 0) {
3233
-
3236
+
3234
3237
  result = { 'status': xhr.status, 'message': '' };
3235
3238
  // handling blob xhr error
3236
3239
  if ( /blob/.test(xhr.responseType) ) {
3237
-
3240
+
3238
3241
  blob = new Blob([this.response], { type: 'text/plain' });
3239
-
3242
+
3240
3243
  var reader = new FileReader(), blobError = '';
3241
-
3244
+
3242
3245
  // This fires after the blob has been read/loaded.
3243
3246
  reader.addEventListener('loadend', (e) => {
3244
-
3247
+
3245
3248
  if ( /string/i.test(typeof(e.srcElement.result)) ) {
3246
3249
  blobError += e.srcElement.result;
3247
3250
  } else if ( typeof(e.srcElement.result) == 'object' ) {
@@ -3249,21 +3252,21 @@ function handleXhr(xhr, $el, options, require) {
3249
3252
  } else {
3250
3253
  result.message += e.srcElement.result
3251
3254
  }
3252
-
3255
+
3253
3256
  // once ready
3254
3257
  if ( /^2/.test(reader.readyState) ) {
3255
-
3258
+
3256
3259
  if ( /^(\{|\[)/.test( blobError ) ) {
3257
3260
  try {
3258
3261
  result = merge( result, JSON.parse(blobError) )
3259
3262
  } catch(err) {
3260
3263
  result = merge(result, err)
3261
- }
3264
+ }
3262
3265
  }
3263
-
3266
+
3264
3267
  if (!result.message)
3265
3268
  delete result.message;
3266
-
3269
+
3267
3270
  if ($form)
3268
3271
  $form.eventData.error = result;
3269
3272
 
@@ -3293,23 +3296,23 @@ function handleXhr(xhr, $el, options, require) {
3293
3296
  }
3294
3297
 
3295
3298
  triggerEvent(gina, $target, 'error.' + id, result);
3296
-
3299
+
3297
3300
  if (hFormIsRequired)
3298
3301
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3299
-
3302
+
3300
3303
  if (hLinkIsRequired)
3301
3304
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3302
3305
  }
3303
3306
  return;
3304
-
3305
-
3307
+
3308
+
3306
3309
  });
3307
3310
 
3308
3311
  // Start reading the blob as text.
3309
3312
  reader.readAsText(blob);
3310
-
3313
+
3311
3314
  } else { // normal case
3312
-
3315
+
3313
3316
  if ( /^(\{|\[).test( xhr.responseText ) /) {
3314
3317
 
3315
3318
  try {
@@ -3353,24 +3356,24 @@ function handleXhr(xhr, $el, options, require) {
3353
3356
  }
3354
3357
 
3355
3358
  triggerEvent(gina, $target, 'error.' + id, result);
3356
-
3359
+
3357
3360
  if (hFormIsRequired)
3358
3361
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3359
-
3362
+
3360
3363
  if (hLinkIsRequired)
3361
- triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3364
+ triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3362
3365
  }
3363
-
3366
+
3364
3367
  return;
3365
3368
 
3366
-
3369
+
3367
3370
  }
3368
3371
  }
3369
3372
  };
3370
-
3373
+
3371
3374
  // catching request progress
3372
3375
  xhr.onprogress = function(event) {
3373
-
3376
+
3374
3377
  var percentComplete = '0';
3375
3378
  if (event.lengthComputable) {
3376
3379
  percentComplete = event.loaded / event.total;
@@ -3402,17 +3405,17 @@ function handleXhr(xhr, $el, options, require) {
3402
3405
  $form.eventData.ontimeout = result;
3403
3406
 
3404
3407
  triggerEvent(gina, $target, 'error.' + id, result);
3405
-
3408
+
3406
3409
  if (hFormIsRequired)
3407
3410
  triggerEvent(gina, $target, 'error.' + id + '.hform', result);
3408
-
3411
+
3409
3412
  if (hLinkIsRequired)
3410
3413
  triggerEvent(gina, $target, 'error.' + id + '.hlink', result);
3411
-
3414
+
3412
3415
  return;
3413
3416
  };
3414
-
3415
-
3417
+
3418
+
3416
3419
  //return xhr;
3417
3420
  }
3418
3421
 
@@ -3438,7 +3441,7 @@ function removeListener(target, element, name, callback) {
3438
3441
  } else {
3439
3442
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3440
3443
  element.removeEventListener(name, callback, false);
3441
- }
3444
+ }
3442
3445
  } else if (element.attachEvent) {
3443
3446
  //element.detachEvent('on' + name, callback);
3444
3447
  if ( Array.isArray(element) ) {
@@ -3455,7 +3458,7 @@ function removeListener(target, element, name, callback) {
3455
3458
  } else {
3456
3459
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3457
3460
  element.detachEvent('on' + name, callback);
3458
- }
3461
+ }
3459
3462
  }
3460
3463
  } else {
3461
3464
  //target.customEvent.removeListener(name, callback)
@@ -3473,7 +3476,7 @@ function removeListener(target, element, name, callback) {
3473
3476
  } else {
3474
3477
  name = ( /\.$/.test(name) ) ? name + element.id : name;
3475
3478
  target.customEvent.removeListener(name, callback)
3476
- }
3479
+ }
3477
3480
  }
3478
3481
 
3479
3482
  if ( typeof(gina.events[name]) != 'undefined' ) {
@@ -3514,12 +3517,12 @@ function on(event, cb) {
3514
3517
  if ( this.eventData && !$target.eventData)
3515
3518
  $target.eventData = this.eventData
3516
3519
 
3517
- if ( /\.(hform|hlink)$/.test(event) ) {
3520
+ if ( /\.(hform|hlink)$/.test(event) ) {
3518
3521
  event = ( /\.hform$/.test(event) ) ? event.replace(/\.hform$/, '.' + id + '.hform') : event.replace(/\.hlink$/, '.' + id + '.hlink');
3519
3522
  } else { // normal case
3520
3523
  event += '.' + id;
3521
3524
  }
3522
-
3525
+
3523
3526
 
3524
3527
  if (!gina.events[event]) {
3525
3528
 
@@ -3542,7 +3545,7 @@ function on(event, cb) {
3542
3545
 
3543
3546
  if (cb)
3544
3547
  cb(e, data);
3545
-
3548
+
3546
3549
  //triggerEvent(gina, e.currentTarget, e.type);
3547
3550
  });
3548
3551
 
@@ -3553,10 +3556,10 @@ function on(event, cb) {
3553
3556
 
3554
3557
  return this
3555
3558
  }
3556
-
3557
- // Nothing can be added after on()
3558
-
3559
-
3559
+
3560
+ // Nothing can be added after on()
3561
+
3562
+
3560
3563
  var listenToXhrEvents = function($el, type) {
3561
3564
 
3562
3565
 
@@ -3804,7 +3807,7 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
3804
3807
  ;
3805
3808
  /*
3806
3809
  * This file is part of the gina package.
3807
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
3810
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
3808
3811
  *
3809
3812
  * For the full copyright and license information, please view the LICENSE
3810
3813
  * file that was distributed with this source code.
@@ -7560,7 +7563,7 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
7560
7563
  };
7561
7564
  /*
7562
7565
  * This file is part of the gina package.
7563
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
7566
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
7564
7567
  *
7565
7568
  * For the full copyright and license information, please view the LICENSE
7566
7569
  * file that was distributed with this source code.
@@ -7581,10 +7584,10 @@ function Routing() {
7581
7584
  allowedMethods: ['get', 'post', 'put', 'delete'],
7582
7585
  reservedParams: ['controle', 'file','title', 'namespace', 'path'],
7583
7586
  notFound: {}
7584
- };
7585
-
7587
+ };
7588
+
7586
7589
  self.allowedMethodsString = self.allowedMethods.join(',');
7587
-
7590
+
7588
7591
  // loading utils & plugins
7589
7592
  var plugins = null, inherits = null, merge = null, Validator = null, fs = null, promisify = null;
7590
7593
  if (!isGFFCtx) {
@@ -7594,8 +7597,8 @@ function Routing() {
7594
7597
  merge = require('../../merge');
7595
7598
  plugins = require(__dirname+'/../../../core/plugins') || getContext('gina').plugins;
7596
7599
  Validator = plugins.Validator;
7597
-
7598
- }
7600
+
7601
+ }
7599
7602
  // BO - In case of partial rendering whithout handler defined for the partial
7600
7603
  else {
7601
7604
  if ( !merge || typeof(merge) != 'function' ) {
@@ -7604,16 +7607,16 @@ function Routing() {
7604
7607
  if ( !Validator || typeof(Validator) != 'function' ) {
7605
7608
  var Validator = require('utils/form-validator');
7606
7609
  }
7607
- }
7610
+ }
7608
7611
  // EO - In case of partial rendering whithout handler defined for the partial
7609
-
7612
+
7610
7613
  /**
7611
7614
  * Get url props
7612
7615
  * Used to retrieve additional properties for routes with redirect flag for example
7613
- *
7616
+ *
7614
7617
  * @param {string} [bundle]
7615
- * @param {string} [env]
7616
- *
7618
+ * @param {string} [env]
7619
+ *
7617
7620
  * @returns {object} urlProps - { .host, .hostname, .webroot }
7618
7621
  */
7619
7622
  self.getUrlProps = function(bundle, env) {
@@ -7629,7 +7632,7 @@ function Routing() {
7629
7632
  urlProps.hostname = _route.hostname;
7630
7633
  urlProps.host = _route.host;
7631
7634
  urlProps.webroot = _route.webroot;
7632
- }
7635
+ }
7633
7636
  } else {
7634
7637
  config = getContext('gina').config;
7635
7638
  if ( typeof(getContext('argvFilename')) != 'undefined' ) {
@@ -7641,47 +7644,47 @@ function Routing() {
7641
7644
  if ( typeof(env) == 'undefined' ) {
7642
7645
  env = config.env;
7643
7646
  }
7644
-
7647
+
7645
7648
  urlProps.hostname = config.envConf[bundle][env].hostname;
7646
7649
  urlProps.host = config.envConf[bundle][env].host;
7647
7650
  urlProps.webroot = config.envConf[bundle][env].server.webroot;
7648
7651
  }
7649
-
7652
+
7650
7653
  return urlProps;
7651
7654
  }
7652
-
7655
+
7653
7656
  /**
7654
7657
  * Load bundle routing configuration
7655
- *
7658
+ *
7656
7659
  * @param {object} options
7657
7660
  * {
7658
7661
  * isStadalone: false,
7659
7662
  * bundle: 'default', // bundle's name
7660
7663
  * wroot: '/', // by default
7661
- *
7664
+ *
7662
7665
  * }
7663
- *
7666
+ *
7664
7667
  */
7665
7668
  // self.loadBundleRoutingConfiguration = function(options, filename) {
7666
-
7669
+
7667
7670
  // }
7668
-
7671
+
7669
7672
  /**
7670
7673
  * Get routing
7671
- *
7674
+ *
7672
7675
  * @param {string} [bundle]
7673
7676
  */
7674
7677
  // self.getRouting = function(bundle) {
7675
-
7678
+
7676
7679
  // }
7677
-
7680
+
7678
7681
  /**
7679
7682
  * Get reversed routing
7680
- *
7683
+ *
7681
7684
  * @param {string} [bundle]
7682
7685
  */
7683
7686
  // self.getReverseRouting = function(bundle) {
7684
-
7687
+
7685
7688
  // }
7686
7689
 
7687
7690
  /**
@@ -7696,7 +7699,7 @@ function Routing() {
7696
7699
  * @returns {object|false} foundRoute
7697
7700
  * */
7698
7701
  self.compareUrls = async function(params, url, request, response, next) {
7699
-
7702
+
7700
7703
  if ( typeof(request) == 'undefined' ) {
7701
7704
  request = { routing: {} };
7702
7705
  }
@@ -7750,12 +7753,12 @@ function Routing() {
7750
7753
  *
7751
7754
  * */
7752
7755
  var parseRouting = async function(params, url, request, response, next) {
7753
-
7756
+
7754
7757
  // Sample debug break for specific rule
7755
7758
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7756
7759
  // console.debug('passed '+ params.rule);
7757
7760
  // }
7758
-
7761
+
7759
7762
  var uRe = params.url.split(/\//)
7760
7763
  , uRo = url.split(/\//)
7761
7764
  , uReCount = 0
@@ -7766,30 +7769,30 @@ function Routing() {
7766
7769
  , i = 0
7767
7770
  , method = request.method.toLowerCase()
7768
7771
  ;
7769
-
7772
+
7770
7773
  // TODO - remove comments
7771
7774
  // when requirement is not listed but still validated
7772
- // if (
7773
- // typeof(params.requirements) != 'undefined'
7775
+ // if (
7776
+ // typeof(params.requirements) != 'undefined'
7774
7777
  // && method == params.method.toLowerCase()
7775
7778
  // //&& /validator\:\:/.test(JSON.stringify(params.requirements))
7776
7779
  // ) {
7777
-
7780
+
7778
7781
  // var requiremements = Object.getOwnPropertyNames(params.requirements);
7779
7782
  // var r = 0;
7780
7783
  // // In order to filter variables
7781
7784
  // var uRoVars = uRo.join(',').match(/\:[-_a-z0-9]+/g);
7782
7785
  // // var uRoVarCount = (uRoVars) ? uRoVars.length : 0;
7783
7786
  // while ( r < requiremements.length ) {
7784
-
7787
+
7785
7788
  // // if not listed, but still needing validation
7786
- // if (
7787
- // typeof(params.param[ requiremements[r] ]) == 'undefined'
7789
+ // if (
7790
+ // typeof(params.param[ requiremements[r] ]) == 'undefined'
7788
7791
  // && /^validator\:\:/i.test(params.requirements[ requiremements[r] ])
7789
7792
  // && typeof(request[method][ requiremements[r] ])
7790
7793
  // ) {
7791
7794
  // if (uRo.length != uRe.length) {
7792
- // // r++;
7795
+ // // r++;
7793
7796
  // // continue;
7794
7797
  // break;
7795
7798
  // }
@@ -7799,22 +7802,22 @@ function Routing() {
7799
7802
  // * "requirements" : {
7800
7803
  // * "email": "validator::{ isEmail: true, isString: [7] }"
7801
7804
  // * }
7802
- // *
7805
+ // *
7803
7806
  // * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
7804
- // */
7807
+ // */
7805
7808
  // let regex = params.requirements[ requiremements[r] ];
7806
7809
  // let _data = {}, _ruleObj = {}, _rule = {};
7807
-
7810
+
7808
7811
  // try {
7809
7812
  // _ruleObj = JSON.parse(
7810
7813
  // regex.split(/::/).splice(1)[0]
7811
7814
  // .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
7812
7815
  // .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
7813
- // );
7816
+ // );
7814
7817
  // } catch (err) {
7815
7818
  // throw err;
7816
7819
  // }
7817
-
7820
+
7818
7821
  // let key = requiremements[r];
7819
7822
  // // validator.query case
7820
7823
  // if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
@@ -7828,7 +7831,7 @@ function Routing() {
7828
7831
  // for (let p = 0, pLen = uRo.length; p < pLen; p++) {
7829
7832
  // // :variable only
7830
7833
  // if (!/^\:/.test(uRo[p])) continue;
7831
-
7834
+
7832
7835
  // let pName = uRo[p].replace(/^\:/, '');
7833
7836
  // if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
7834
7837
  // _data[ pName ] = uRe[p];
@@ -7838,24 +7841,24 @@ function Routing() {
7838
7841
  // request.params[pName] = uRe[p];
7839
7842
  // }
7840
7843
  // }
7841
- // }
7844
+ // }
7842
7845
  // }
7843
7846
  // // normal case
7844
7847
  // _data = merge(_data, request[method]);
7845
-
7848
+
7846
7849
  // if ( typeof(_data[key]) == 'undefined' ) {
7847
7850
  // // init default value for unlisted variable/param
7848
7851
  // _data[key] = null;
7849
7852
  // }
7850
-
7851
- // _rule[key] = _ruleObj;
7853
+
7854
+ // _rule[key] = _ruleObj;
7852
7855
  // _validator = new Validator('routing', _data, null, _rule );
7853
-
7856
+
7854
7857
  // if (_ruleObj.count() == 0 ) {
7855
7858
  // console.error('Route validation failed '+ params.rule);
7856
7859
  // return false;
7857
7860
  // }
7858
-
7861
+
7859
7862
  // for (let rule in _ruleObj) {
7860
7863
  // let _result = null;
7861
7864
  // if (Array.isArray(_ruleObj[rule])) { // has args
@@ -7873,12 +7876,12 @@ function Routing() {
7873
7876
  // r++
7874
7877
  // }
7875
7878
  // }
7876
-
7879
+
7877
7880
  // attaching routing description for this request
7878
7881
  var paramMethod = params.method.toLowerCase();
7879
-
7882
+
7880
7883
  var hasAlreadyBeenScored = false;
7881
- if (
7884
+ if (
7882
7885
  typeof(params.requirements) != 'undefined'
7883
7886
  && /get|delete/i.test(method)
7884
7887
  && typeof(request[method]) != 'undefined'
@@ -7887,20 +7890,20 @@ function Routing() {
7887
7890
  typeof(params.requirements) != 'undefined'
7888
7891
  && /get/i.test(method)
7889
7892
  && /delete/i.test(paramMethod)
7890
- ) {
7893
+ ) {
7891
7894
  if ( /get/i.test(method) && /delete/i.test(paramMethod) ) {
7892
7895
  method = paramMethod;
7893
7896
  }
7894
7897
  // `delete` methods don't have a body
7895
7898
  // So, request.delete is {} by default
7896
- if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
7899
+ if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
7897
7900
  // just in case
7898
7901
  if ( typeof(request[method]) == 'undefined' ) {
7899
7902
  request[method] = {};
7900
7903
  }
7901
7904
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
7902
- if (uRe[p] === uRo[p]) {
7903
- ++score;
7905
+ if (uRe[p] === uRo[p]) {
7906
+ ++score;
7904
7907
  continue;
7905
7908
  }
7906
7909
  let _key = uRo[p].substr(1);
@@ -7915,44 +7918,44 @@ function Routing() {
7915
7918
  continue;
7916
7919
  }
7917
7920
  if (
7918
- /^:/.test(uRo[p])
7921
+ /^:/.test(uRo[p])
7919
7922
  && typeof(condition) != 'undefined'
7920
7923
  && new RegExp(condition).test(uRe[p])
7921
7924
  ) {
7922
- ++score;
7923
- request[method][uRo[p].substr(1)] = uRe[p];
7925
+ ++score;
7926
+ request[method][uRo[p].substr(1)] = uRe[p];
7924
7927
  }
7925
7928
  }
7926
- hasAlreadyBeenScored = true;
7927
- }
7928
-
7929
+ hasAlreadyBeenScored = true;
7930
+ }
7931
+
7929
7932
  // Sample debug break for specific rule
7930
7933
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7931
7934
  // console.debug('passed '+ params.rule);
7932
7935
  // }
7933
7936
  for (let p in request[method]) {
7934
7937
  if ( typeof(params.requirements[p]) != 'undefined' && uRo.indexOf(':' + p) < 0 ) {
7935
- uRo[uRoCount] = ':' + p;
7938
+ uRo[uRoCount] = ':' + p;
7936
7939
  ++uRoCount;
7937
-
7940
+
7938
7941
  uRe[uReCount] = request[method][p];
7939
7942
  ++uReCount;
7940
7943
  if (!hasAlreadyBeenScored && uRe.length === uRo.length)
7941
- ++maxLen;
7944
+ ++maxLen;
7942
7945
  }
7943
7946
  }
7944
7947
  }
7945
-
7946
-
7948
+
7949
+
7947
7950
  // Sample debug break for specific rule
7948
7951
  // if ( params.rule == 'my-specific-rule@bundle' ) {
7949
7952
  // console.debug('passed '+ params.rule);
7950
7953
  // }
7951
-
7954
+
7952
7955
  if (!hasAlreadyBeenScored && uRe.length === uRo.length) {
7953
-
7956
+
7954
7957
  for (; i < maxLen; ++i) {
7955
-
7958
+
7956
7959
  if (uRe[i] === uRo[i]) {
7957
7960
  ++score;
7958
7961
  }
@@ -7961,15 +7964,15 @@ function Routing() {
7961
7964
  }
7962
7965
  }
7963
7966
  }
7964
-
7967
+
7965
7968
  // This test is done to catch `validator::` rules under requirements
7966
- if (
7967
- typeof(params.requirements) != 'undefined'
7969
+ if (
7970
+ typeof(params.requirements) != 'undefined'
7968
7971
  && method == params.method.toLowerCase()
7969
7972
  && !hasAlreadyBeenScored
7970
7973
  && score >= maxLen
7971
7974
  ) {
7972
-
7975
+
7973
7976
  var requiremements = Object.getOwnPropertyNames(params.requirements);
7974
7977
  var r = 0;
7975
7978
  // In order to filter variables
@@ -7979,12 +7982,12 @@ function Routing() {
7979
7982
  // requirement name as `key`
7980
7983
  let key = requiremements[r];
7981
7984
  // if not listed, but still needing validation
7982
- if (
7983
- typeof(params.param[ key ]) == 'undefined'
7985
+ if (
7986
+ typeof(params.param[ key ]) == 'undefined'
7984
7987
  && /^validator\:\:/i.test(params.requirements[ key ])
7985
7988
  ) {
7986
7989
  if (uRo.length != uRe.length) {
7987
- // r++;
7990
+ // r++;
7988
7991
  // continue;
7989
7992
  break;
7990
7993
  }
@@ -7994,22 +7997,22 @@ function Routing() {
7994
7997
  * "requirements" : {
7995
7998
  * "email": "validator::{ isEmail: true, isString: [7] }"
7996
7999
  * }
7997
- *
8000
+ *
7998
8001
  * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
7999
- */
8002
+ */
8000
8003
  let regex = params.requirements[ key ];
8001
8004
  let _data = {}, _ruleObj = {}, _rule = {};
8002
-
8005
+
8003
8006
  try {
8004
8007
  _ruleObj = JSON.parse(
8005
8008
  regex.split(/::/).splice(1)[0]
8006
8009
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
8007
8010
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
8008
- );
8011
+ );
8009
8012
  } catch (err) {
8010
8013
  throw err;
8011
8014
  }
8012
-
8015
+
8013
8016
  // validator.query case
8014
8017
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
8015
8018
  _data = _ruleObj.query.data;
@@ -8022,7 +8025,7 @@ function Routing() {
8022
8025
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
8023
8026
  // :variable only
8024
8027
  if (!/^\:/.test(uRo[p])) continue;
8025
-
8028
+
8026
8029
  let pName = uRo[p].replace(/^\:/, '');
8027
8030
  if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
8028
8031
  _data[ pName ] = uRe[p];
@@ -8032,9 +8035,9 @@ function Routing() {
8032
8035
  request.params[pName] = uRe[p];
8033
8036
  }
8034
8037
  }
8035
- }
8038
+ }
8036
8039
  }
8037
-
8040
+
8038
8041
  // If validator.query has data, _data should inherit from request data
8039
8042
  _data = merge(_data, JSON.clone(request[method]) || {} );
8040
8043
  // This test is to initialize query.data[key] to null by default
@@ -8042,20 +8045,20 @@ function Routing() {
8042
8045
  // init default value for unlisted variable/param
8043
8046
  _data[key] = null;
8044
8047
  }
8045
-
8046
- _rule[key] = _ruleObj;
8048
+
8049
+ _rule[key] = _ruleObj;
8047
8050
  if (!isGFFCtx) {
8048
8051
  _validator = new Validator('routing', _data, null, _rule );
8049
8052
  } else {
8050
8053
  _validator = new Validator(_data);
8051
8054
  }
8052
-
8055
+
8053
8056
  if (_ruleObj.count() == 0 ) {
8054
8057
  console.error('Route validation failed '+ params.rule);
8055
8058
  --score;
8056
8059
  r++;
8057
8060
  continue;
8058
- }
8061
+ }
8059
8062
  // for each validation rule
8060
8063
  for (let rule in _ruleObj) {
8061
8064
  // updating query.data
@@ -8067,8 +8070,8 @@ function Routing() {
8067
8070
  _result = await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
8068
8071
  } else {
8069
8072
  _result = await _validator[key][rule](_ruleObj[rule], request, response, next);
8070
- }
8071
-
8073
+ }
8074
+
8072
8075
  //let condition = _ruleObj[rule].validIf.replace(new RegExp('\\$isValid'), _result.isValid);
8073
8076
  // if ( eval(condition)) {
8074
8077
  if ( !_result.isValid ) {
@@ -8084,7 +8087,7 @@ function Routing() {
8084
8087
  }
8085
8088
 
8086
8089
  foundRoute.past = (score === maxLen) ? true : false;
8087
-
8090
+
8088
8091
  if (foundRoute.past) {
8089
8092
  // attaching routing description for this request
8090
8093
  //request.routing = params; // can be retried in controller with: req.routing
@@ -8092,7 +8095,7 @@ function Routing() {
8092
8095
  request.routing = checkRouteParams(params, request[method]);
8093
8096
  foundRoute.request = request;
8094
8097
  }
8095
-
8098
+
8096
8099
 
8097
8100
  return foundRoute;
8098
8101
  };
@@ -8123,7 +8126,7 @@ function Routing() {
8123
8126
  , flags = null
8124
8127
  , key = null
8125
8128
  , tested = false
8126
-
8129
+
8127
8130
  , _validator = null
8128
8131
  , _data = null
8129
8132
  , _ruleObj = null
@@ -8133,57 +8136,57 @@ function Routing() {
8133
8136
  // request method
8134
8137
  , requestMethod = request.method.toLowerCase()
8135
8138
  ;
8136
-
8139
+
8137
8140
  if (!_param.length) return false;
8138
8141
 
8139
8142
  // if custom path, path rewrite
8140
8143
  if (params.param.path && regex.test(params.param.path)) {
8141
8144
  params.param.path = params.param.path.replace(regex, urlVal);
8142
8145
  }
8143
-
8146
+
8144
8147
  // if custom namespace, namespace rewrite
8145
- if (params.param.namespace && regex.test(params.param.namespace)) {
8146
- params.param.namespace = params.param.namespace.replace(regex, urlVal);
8148
+ if (params.param.namespace && regex.test(params.param.namespace)) {
8149
+ params.param.namespace = params.param.namespace.replace(regex, urlVal);
8147
8150
  }
8148
-
8151
+
8149
8152
  // if custom file, file rewrite
8150
- // if (params.param.file && regex.test(params.param.file)) {
8151
- // params.param.file = params.param.file.replace(regex, urlVal);
8153
+ // if (params.param.file && regex.test(params.param.file)) {
8154
+ // params.param.file = params.param.file.replace(regex, urlVal);
8152
8155
  // }
8153
8156
  // file is handle like url replacement (path is like pathname)
8154
8157
  if (typeof (params.param.file) != 'undefined' && /:/.test(params.param.file)) {
8155
- var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
8156
- replacement.variable = urlVal;
8158
+ var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
8159
+ replacement.variable = urlVal;
8157
8160
  params.param.file = params.param.file.replace( _regex, replacement );
8158
8161
  }
8159
8162
 
8160
8163
  // if custom title, title rewrite
8161
- if (params.param.title && regex.test(params.param.title)) {
8164
+ if (params.param.title && regex.test(params.param.title)) {
8162
8165
  params.param.title = params.param.title.replace(regex, urlVal);
8163
8166
  }
8164
8167
 
8165
8168
  if (_param.length == 1) { // fast one
8166
-
8169
+
8167
8170
  re = new RegExp( _param[0]);
8168
8171
  matched = (_param.indexOf(urlVar) > -1) ? _param.indexOf(urlVar) : false;
8169
-
8172
+
8170
8173
  if (matched === false ) {
8171
8174
  // In order to support rules defined like :
8172
8175
  // { params.url } => `/section/:name/page:number`
8173
8176
  // { request.url } => `/section/plante/page4`
8174
8177
  //
8175
8178
  // with keys = [ ":name", ":number" ]
8176
-
8179
+
8177
8180
  if ( urlVar.match(re) ) {
8178
8181
  matched = 0;
8179
8182
  }
8180
8183
  }
8181
-
8184
+
8182
8185
 
8183
8186
  if (matched === false) return matched;
8184
8187
  // filter on method
8185
8188
  if (params.method.toLowerCase() !== requestMethod) return false;
8186
-
8189
+
8187
8190
  if ( typeof(request[requestMethod]) == 'undefined' ) {
8188
8191
  request[requestMethod] = {}
8189
8192
  }
@@ -8195,7 +8198,7 @@ function Routing() {
8195
8198
  regex = params.requirements[key];
8196
8199
  if (/^\//.test(regex)) {
8197
8200
  re = regex.match(/\/(.*)\//).pop();
8198
- flags = regex.replace('/' + re + '/', '');
8201
+ flags = regex.replace('/' + re + '/', '');
8199
8202
 
8200
8203
  tested = new RegExp(re, flags).test(urlVal)
8201
8204
  } else if ( /^validator\:\:/.test(regex) && urlVal) {
@@ -8204,11 +8207,11 @@ function Routing() {
8204
8207
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
8205
8208
  * "email": "validator::{ isEmail: true, isString: [7] }"
8206
8209
  * }
8207
- *
8210
+ *
8208
8211
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
8209
- */
8210
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
8211
- urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
8212
+ */
8213
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
8214
+ urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
8212
8215
  _data[key] = urlVal.replace( new RegExp(str, 'g'), '');
8213
8216
  try {
8214
8217
  //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
@@ -8216,11 +8219,11 @@ function Routing() {
8216
8219
  regex.split(/::/).splice(1)[0]
8217
8220
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
8218
8221
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
8219
- );
8222
+ );
8220
8223
  } catch (err) {
8221
8224
  throw err;
8222
8225
  }
8223
- //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8226
+ //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8224
8227
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
8225
8228
  // since we only have one param
8226
8229
  // :var1 == :var1
@@ -8230,7 +8233,7 @@ function Routing() {
8230
8233
  request.params[key] = _data[key];
8231
8234
  }
8232
8235
  }
8233
- _rule[key] = _ruleObj;
8236
+ _rule[key] = _ruleObj;
8234
8237
  _validator = new Validator('routing', _data, null, _rule );
8235
8238
  if (_ruleObj.count() == 0 ) {
8236
8239
  console.error('Route validation failed '+ params.rule);
@@ -8241,7 +8244,7 @@ function Routing() {
8241
8244
  await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
8242
8245
  } else {
8243
8246
  await _validator[key][rule](_ruleObj[rule], request, response, next);
8244
- }
8247
+ }
8245
8248
  }
8246
8249
  tested = _validator.isValid();
8247
8250
  } else {
@@ -8254,7 +8257,7 @@ function Routing() {
8254
8257
  typeof(params.requirements[key]) != 'undefined' &&
8255
8258
  typeof(request.params) != 'undefined' &&
8256
8259
  tested
8257
- ) {
8260
+ ) {
8258
8261
  request.params[key] = urlVal;
8259
8262
  if ( typeof(request[requestMethod][key]) == 'undefined' ) {
8260
8263
  request[requestMethod][key] = urlVal;
@@ -8304,22 +8307,22 @@ function Routing() {
8304
8307
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
8305
8308
  * "email": "validator::{ isEmail: true, isString: [7] }"
8306
8309
  * }
8307
- *
8310
+ *
8308
8311
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true}} ).isEmail().valid;
8309
- */
8310
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
8311
- urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
8312
+ */
8313
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
8314
+ urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
8312
8315
  _data[key[0]] = urlVal.replace( new RegExp(str, 'g'), '');
8313
- _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8314
- _rule[key[0]] = _ruleObj;
8316
+ _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
8317
+ _rule[key[0]] = _ruleObj;
8315
8318
  _validator = new Validator('routing', _data, null, _rule );
8316
-
8319
+
8317
8320
  for (let rule in _ruleObj) {
8318
8321
  if (Array.isArray(_ruleObj[rule])) { // has args
8319
8322
  _validator[key[0]][rule].apply(_validator[key[0]], _ruleObj[rule])
8320
8323
  } else {
8321
8324
  _validator[key[0]][rule](_ruleObj[rule])
8322
- }
8325
+ }
8323
8326
  }
8324
8327
  tested = _validator.isValid();
8325
8328
  } else {
@@ -8377,9 +8380,9 @@ function Routing() {
8377
8380
 
8378
8381
  return false
8379
8382
  }
8380
-
8383
+
8381
8384
  var replacement = function(matched){
8382
- return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
8385
+ return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
8383
8386
  };
8384
8387
  var checkRouteParams = function(route, params) {
8385
8388
  var variable = null
@@ -8393,14 +8396,14 @@ function Routing() {
8393
8396
  ;
8394
8397
  for (p in route.param) {
8395
8398
  if ( typeof(params) != 'undefined' && typeof(params[p]) == 'undefined' ) continue;
8396
-
8399
+
8397
8400
  if ( /^:/.test(route.param[p]) ) {
8398
8401
  variable = route.param[p].substr(1);
8399
-
8402
+
8400
8403
  if ( typeof(params) != 'undefined' && typeof(params[variable]) != 'undefined' ) {
8401
-
8402
- regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
8403
-
8404
+
8405
+ regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
8406
+
8404
8407
 
8405
8408
  if ( typeof(route.param.path) != 'undefined' && /:/.test(route.param.path) ) {
8406
8409
  route.param.path = route.param.path.replace( regex, params[variable]);
@@ -8413,28 +8416,28 @@ function Routing() {
8413
8416
  }
8414
8417
  // file is handle like url replacement (path is like pathname)
8415
8418
  if (typeof (route.param.file) != 'undefined' && /:/.test(route.param.file)) {
8416
- replacement.variable = params[variable];
8419
+ replacement.variable = params[variable];
8417
8420
  route.param.file = route.param.file.replace( regex, replacement );
8418
8421
  }
8419
-
8420
- if ( /\,/.test(route.url) ) {
8422
+
8423
+ if ( /\,/.test(route.url) ) {
8421
8424
  urls = route.url.split(/\,/g);
8422
8425
  i = 0; len = urls.length;
8423
8426
  for (; i < len; ++i) {
8424
- replacement.variable = params[variable];
8427
+ replacement.variable = params[variable];
8425
8428
  urls[i] = urls[i].replace( regex, replacement );
8426
8429
  }
8427
8430
  route.url = urls.join(',');
8428
- } else {
8429
- replacement.variable = params[variable];
8431
+ } else {
8432
+ replacement.variable = params[variable];
8430
8433
  route.url = route.url.replace( regex, replacement );
8431
8434
  }
8432
8435
  }
8433
8436
  }
8434
8437
  }
8435
-
8438
+
8436
8439
  // Selecting url in case of multiple urls & optional requirmements
8437
- if ( urls ) {
8440
+ if ( urls ) {
8438
8441
  i = 0; len = urls.length;
8439
8442
  var rawUrlVars = null
8440
8443
  , rawUrlScore = null
@@ -8461,8 +8464,8 @@ function Routing() {
8461
8464
  route.urlIndex = i;
8462
8465
  }
8463
8466
  }
8464
- }
8465
-
8467
+ }
8468
+
8466
8469
  return route;
8467
8470
  }
8468
8471
 
@@ -8476,7 +8479,7 @@ function Routing() {
8476
8479
  * @returns {object} route
8477
8480
  * */
8478
8481
  self.getRoute = function(rule, params, urlIndex) {
8479
-
8482
+
8480
8483
  var config = null;
8481
8484
  if (isGFFCtx) {
8482
8485
  config = window.gina.config;
@@ -8486,13 +8489,13 @@ function Routing() {
8486
8489
  config.getRouting = getContext('gina').Config.instance.getRouting;
8487
8490
  }
8488
8491
  }
8489
-
8492
+
8490
8493
  var env = config.env || GINA_ENV // by default, takes the current bundle
8491
8494
  , envTmp = null
8492
8495
  //, scheme = null
8493
8496
  , bundle = config.bundle // by default, takes the current bundle
8494
8497
  ;
8495
-
8498
+
8496
8499
  if ( !/\@/.test(rule) && typeof(bundle) != 'undefined' && bundle != null) {
8497
8500
  rule = rule.toLowerCase()
8498
8501
  rule += '@' + bundle
@@ -8517,8 +8520,8 @@ function Routing() {
8517
8520
 
8518
8521
  rule = arr[0].toLowerCase() +'@'+ bundle;
8519
8522
  }
8520
-
8521
-
8523
+
8524
+
8522
8525
  var routing = config.getRouting(bundle, env);
8523
8526
 
8524
8527
  if ( typeof(routing[rule]) == 'undefined' ) {
@@ -8541,14 +8544,14 @@ function Routing() {
8541
8544
  delete route.urlIndex;
8542
8545
  }
8543
8546
  urlIndex = ( typeof(urlIndex) != 'undefined' ) ? urlIndex : 0;
8544
- route.url = route.url.split(/,/g)[urlIndex];
8547
+ route.url = route.url.split(/,/g)[urlIndex];
8545
8548
  }
8546
8549
  // fix url in case of empty param value allowed by the routing rule
8547
8550
  // to prevent having a folder.
8548
8551
  // eg.: {..., id: '/^\\s*$/'} => {..., id: ''} => /path/to/ becoming /path/to
8549
8552
  if ( /\/$/.test(route.url) && route.url != '/' )
8550
8553
  route.url = route.url.substr(0, route.url.length-1);
8551
-
8554
+
8552
8555
  // Completeting url with extra params e.g.: ?param1=val1&param2=val2
8553
8556
  if ( /GET/i.test(route.method) && typeof(params) != 'undefined' ) {
8554
8557
  var queryParams = '?', maskedUrl = routing[rule].url;
@@ -8559,46 +8562,46 @@ function Routing() {
8559
8562
  if (typeof(params[r]) != 'undefined' )
8560
8563
  queryParams += r +'='+ encodeURIComponent(params[r])+ '&';
8561
8564
  }
8562
-
8565
+
8563
8566
  if (queryParams.length > 1) {
8564
8567
  queryParams = queryParams.substring(0, queryParams.length-1);
8565
8568
  route.url += queryParams;
8566
8569
  }
8567
8570
  }
8568
-
8571
+
8569
8572
  // recommanded for x-bundle coms
8570
8573
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
8571
8574
  route.toUrl = function (ignoreWebRoot) {
8572
-
8575
+
8573
8576
  var urlProps = null;
8574
8577
  if ( /^redirect$/i.test(this.param.control) ) {
8575
8578
  urlProps = self.getUrlProps(this.bundle, (env||GINA_ENV));
8576
8579
  }
8577
-
8580
+
8578
8581
  var wroot = this.webroot || urlProps.webroot
8579
8582
  , hostname = this.hostname || urlProps.hostname
8580
8583
  , path = this.url
8581
8584
  ;
8582
-
8585
+
8583
8586
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
8584
8587
 
8585
8588
  return hostname + this.url
8586
8589
  };
8587
-
8590
+
8588
8591
  /**
8589
8592
  * request current url
8590
- *
8591
- *
8592
- *
8593
+ *
8594
+ *
8595
+ *
8593
8596
  * @param {boolean} [ignoreWebRoot]
8594
8597
  * @param {object} [options] - see: https://nodejs.org/api/https.html#https_new_agent_options
8595
8598
  * @param {object} [_this] - current context: only used when `promisify`is used
8596
- *
8599
+ *
8597
8600
  * @callback {callback} [cb] - see: https://nodejs.org/api/https.html#https_new_agent_options
8598
8601
  * @param {object} res
8599
8602
  */
8600
8603
  route.request = function(ignoreWebRoot, options) {
8601
-
8604
+
8602
8605
  var cb = null, _this = null;
8603
8606
  if ( typeof(arguments[arguments.length-1]) == 'function' ) {
8604
8607
  cb = arguments[arguments.length-1];
@@ -8606,14 +8609,14 @@ function Routing() {
8606
8609
  if ( typeof(arguments[2]) == 'object' ) {
8607
8610
  _this = arguments[2];
8608
8611
  }
8609
-
8612
+
8610
8613
  var wroot = this.webroot || _this.webroot
8611
8614
  , hostname = this.hostname || _this.hostname
8612
8615
  , url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : this.url || _this.url
8613
8616
  ;
8614
-
8617
+
8615
8618
  var scheme = ( /^https/.test(hostname) ) ? 'https' : 'http';
8616
-
8619
+
8617
8620
  if (isGFFCtx) {
8618
8621
  var target = ( typeof(options) != 'undefined' && typeof(options.target) != 'undefined' ) ? options.target : "_self";
8619
8622
  window.open(url, target)
@@ -8623,11 +8626,11 @@ function Routing() {
8623
8626
  // create an agent just for this request
8624
8627
  options.agent = false;
8625
8628
  }
8626
- var agent = require(''+scheme);
8627
- var onAgentResponse = function(res) {
8628
-
8629
+ var agent = require(''+scheme);
8630
+ var onAgentResponse = function(res) {
8631
+
8629
8632
  var data = '', err = false;
8630
-
8633
+
8631
8634
  res.on('data', function (chunk) {
8632
8635
  data += chunk;
8633
8636
  });
@@ -8651,26 +8654,26 @@ function Routing() {
8651
8654
  err = parseError
8652
8655
  }
8653
8656
  }
8654
- if (err) {
8657
+ if (err) {
8655
8658
  cb(err);
8656
8659
  return;
8657
8660
  }
8658
-
8661
+
8659
8662
  cb(false, data);
8660
8663
  return;
8661
8664
  });
8662
8665
  }
8663
- if (cb) {
8666
+ if (cb) {
8664
8667
  agent.get(url, options, onAgentResponse);
8665
8668
  } else {
8666
8669
  // just throw the request without waiting/handling response
8667
8670
  agent.get(url, options);
8668
- }
8671
+ }
8669
8672
  }
8670
- return;
8671
-
8673
+ return;
8674
+
8672
8675
  } // EO route.request()
8673
-
8676
+
8674
8677
  if ( /\:/.test(route.url) ) {
8675
8678
  var paramList = route.url
8676
8679
  .match(/(\:(.*)\/|\:(.*)$)/g)
@@ -8694,21 +8697,21 @@ function Routing() {
8694
8697
  // adding hash if found
8695
8698
  if (hash)
8696
8699
  url += hash;
8697
-
8700
+
8698
8701
  route.url = url;
8699
8702
  // recommanded for x-bundle coms
8700
8703
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
8701
- route.toUrl = function (ignoreWebRoot) {
8704
+ route.toUrl = function (ignoreWebRoot) {
8702
8705
  var wroot = this.webroot
8703
8706
  , hostname = this.hostname
8704
8707
  , path = this.url
8705
8708
  ;
8706
-
8709
+
8707
8710
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
8708
8711
 
8709
8712
  return hostname + this.url
8710
8713
  };
8711
-
8714
+
8712
8715
  return route
8713
8716
  }
8714
8717
 
@@ -8721,18 +8724,18 @@ function Routing() {
8721
8724
  * @param {string} url e.g.: /webroot/some/url/path or http
8722
8725
  * @param {string} [bundle] targeted bundle
8723
8726
  * @param {string} [method] request method (GET|PUT|PUT|DELETE) - GET is set by default
8724
- * @param {object} [request]
8727
+ * @param {object} [request]
8725
8728
  * @param {boolean} [isOverridinMethod] // will replace request.method by the provided method - Used for redirections
8726
- *
8729
+ *
8727
8730
  * @returns {object|boolean} route - when route is found; `false` when not found
8728
8731
  * */
8729
-
8732
+
8730
8733
  self.getRouteByUrl = function (url, bundle, method, request, isOverridinMethod) {
8731
-
8734
+
8732
8735
  if (
8733
- arguments.length == 2
8734
- && typeof(arguments[1]) != 'undefined'
8735
- && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
8736
+ arguments.length == 2
8737
+ && typeof(arguments[1]) != 'undefined'
8738
+ && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
8736
8739
  ) {
8737
8740
  method = arguments[1];
8738
8741
  bundle = undefined;
@@ -8745,24 +8748,24 @@ function Routing() {
8745
8748
  , hostname = null
8746
8749
  , host = null
8747
8750
  ;
8748
-
8751
+
8749
8752
  if ( /\#/.test(url) && url.length > 1 ) {
8750
8753
  var urlPart = url.split(/\#/);
8751
8754
  url = urlPart[0];
8752
8755
  hash = '#' + urlPart[1];
8753
-
8756
+
8754
8757
  urlPart = null;
8755
8758
  }
8756
-
8759
+
8757
8760
  // fast method
8758
8761
  if (
8759
- arguments.length == 1
8760
- && typeof(arguments[0]) != 'undefined'
8762
+ arguments.length == 1
8763
+ && typeof(arguments[0]) != 'undefined'
8761
8764
  ) {
8762
8765
  if ( !/^(https|http)/i.test(url) && !/^\//.test(url)) {
8763
8766
  url = '/'+ url;
8764
8767
  }
8765
-
8768
+
8766
8769
  webroot = '/' + url.split(/\//g)[1];
8767
8770
  if (isGFFCtx) {
8768
8771
  reverseRouting = gina.config.reverseRouting;
@@ -8776,24 +8779,24 @@ function Routing() {
8776
8779
  host = infos.host;
8777
8780
  hostname = infos.hostname;
8778
8781
  infos = null;
8779
- }
8782
+ }
8780
8783
  }
8781
-
8784
+
8782
8785
  isOverridinMethod = ( typeof(arguments[arguments.length-1]) != 'boolean') ? false : arguments[arguments.length-1];
8783
8786
 
8784
- var matched = false
8787
+ var matched = false
8785
8788
  , config = null
8786
8789
  , env = null
8787
8790
  , prefix = null
8788
8791
  , pathname = null
8789
8792
  , params = null
8790
8793
  , isRoute = null
8791
- , foundRoute = null
8792
- , routeObj = null
8794
+ , foundRoute = null
8795
+ , routeObj = null
8793
8796
  ;
8794
-
8795
-
8796
-
8797
+
8798
+
8799
+
8797
8800
  var isMethodProvidedByDefault = ( typeof(method) != 'undefined' ) ? true : false;
8798
8801
 
8799
8802
  if (isGFFCtx) {
@@ -8817,18 +8820,18 @@ function Routing() {
8817
8820
  } else {
8818
8821
 
8819
8822
  var gnaCtx = getContext('gina');
8820
-
8823
+
8821
8824
  config = gnaCtx.config;
8822
8825
  bundle = (typeof (bundle) != 'undefined') ? bundle : config.bundle;
8823
8826
  env = config.env;
8824
8827
  routing = config.getRouting(bundle);
8825
-
8826
-
8828
+
8829
+
8827
8830
 
8828
8831
  hostname = config.envConf[bundle][env].hostname;
8829
8832
  webroot = config.envConf[bundle][env].server.webroot;
8830
8833
  prefix = hostname + webroot;
8831
-
8834
+
8832
8835
  if ( !request ) {
8833
8836
  request = {
8834
8837
  routing: {},
@@ -8848,11 +8851,11 @@ function Routing() {
8848
8851
  if ( typeof(request.routing.path) == 'undefined' )
8849
8852
  request.routing.path = unescape(pathname);
8850
8853
  method = ( typeof(method) != 'undefined' ) ? method.toLowerCase() : 'get';
8851
-
8854
+
8852
8855
  if (isMethodProvidedByDefault) {
8853
8856
  // to handle 303 redirect like PUT -> GET
8854
8857
  request.originalMethod = request.method;
8855
-
8858
+
8856
8859
  request.method = method;
8857
8860
  request.routing.path = unescape(pathname)
8858
8861
  }
@@ -8862,8 +8865,8 @@ function Routing() {
8862
8865
 
8863
8866
  // getting params
8864
8867
  params = {};
8865
-
8866
-
8868
+
8869
+
8867
8870
 
8868
8871
  var paramsList = null;
8869
8872
  var re = new RegExp(method, 'i');
@@ -8878,13 +8881,13 @@ function Routing() {
8878
8881
  if (routing[name].bundle != bundle) continue;
8879
8882
 
8880
8883
  // method filter
8881
- localMethod = routing[name].method;
8884
+ localMethod = routing[name].method;
8882
8885
  if ( /\,/.test( localMethod ) && re.test(localMethod) ) {
8883
8886
  localMethod = request.method
8884
- }
8887
+ }
8885
8888
  if (typeof (routing[name].method) != 'undefined' && !re.test(localMethod)) continue;
8886
-
8887
- //Preparing params to relay to the core/router.
8889
+
8890
+ //Preparing params to relay to the core/router.
8888
8891
  params = {
8889
8892
  method : localMethod,
8890
8893
  requirements : routing[name].requirements,
@@ -8900,8 +8903,8 @@ function Routing() {
8900
8903
 
8901
8904
  // normal case
8902
8905
  //Parsing for the right url.
8903
- try {
8904
-
8906
+ try {
8907
+
8905
8908
  isRoute = self.compareUrls(params, routing[name].url, request);
8906
8909
 
8907
8910
  if (isRoute.past) {
@@ -8921,96 +8924,96 @@ function Routing() {
8921
8924
  } //EO for break out
8922
8925
 
8923
8926
  if (!matched) {
8924
- if (isGFFCtx) {
8925
- var urlHasChanged = false;
8926
- if (
8927
- url == '#'
8928
- && /GET/i.test(method)
8929
- && isMethodProvidedByDefault
8927
+ if (isGFFCtx) {
8928
+ var urlHasChanged = false;
8929
+ if (
8930
+ url == '#'
8931
+ && /GET/i.test(method)
8932
+ && isMethodProvidedByDefault
8930
8933
  || /^404\:/.test(url)
8931
8934
  ) {
8932
8935
  url = location.pathname;
8933
8936
  urlHasChanged = true;
8934
8937
  }
8935
-
8938
+
8936
8939
  if ( typeof(self.notFound) == 'undefined' ) {
8937
8940
  self.notFound = {}
8938
8941
  }
8939
-
8942
+
8940
8943
  var notFound = null, msg = '[ RoutingHelper::getRouteByUrl(rule[, bundle, method]) ] : route [ %r ] is called but not found inside your view: `' + url + '` !';
8941
8944
  if ( gina.hasPopinHandler && gina.popinIsBinded ) {
8942
8945
  notFound = gina.popin.getActivePopin().target.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
8943
8946
  } else {
8944
8947
  notFound = document.body.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
8945
8948
  }
8946
-
8949
+
8947
8950
  notFound = (notFound && notFound.length > 0) ? notFound[0] : null;
8948
-
8951
+
8949
8952
  if ( notFound && isMethodProvidedByDefault && urlHasChanged ) {
8950
-
8951
- var m = notFound.match(/\[\w+\]/)[0];
8952
-
8953
+
8954
+ var m = notFound.match(/\[\w+\]/)[0];
8955
+
8953
8956
  notFound = notFound.replace('404:'+m, m.replace(/\[|\]/g, '')+'::' );
8954
-
8957
+
8955
8958
  msg = msg.replace(/\%r/, notFound.replace(/404\:\s+/, ''));
8956
-
8959
+
8957
8960
  if (typeof(self.notFound[notFound]) == 'undefined') {
8958
- self.notFound[notFound] = {
8961
+ self.notFound[notFound] = {
8959
8962
  count: 1,
8960
- message: msg
8963
+ message: msg
8961
8964
  };
8962
8965
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
8963
8966
  ++self.notFound[notFound].count;
8964
8967
  }
8965
-
8966
- return false
8967
- }
8968
-
8969
- notFound = null;
8970
-
8971
- var altRule = gina.config.reverseRouting[url] || null;
8968
+
8969
+ return false
8970
+ }
8971
+
8972
+ notFound = null;
8973
+
8974
+ var altRule = gina.config.reverseRouting[url] || null;
8972
8975
  if (
8973
- !notFound
8976
+ !notFound
8974
8977
  && altRule
8975
8978
  && typeof(altRule) != 'undefined'
8976
8979
  && altRule.split(/\@(.+)$/)[1] == bundle
8977
8980
  ) {
8978
-
8981
+
8979
8982
  notFound = altRule;
8980
8983
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
8981
-
8984
+
8982
8985
  msg = msg.replace(/\%r/, method.toUpperCase() +'::'+ altRule);
8983
-
8984
- self.notFound[notFound] = {
8986
+
8987
+ self.notFound[notFound] = {
8985
8988
  count: 1,
8986
- message: msg
8989
+ message: msg
8987
8990
  };
8988
- //console.warn(msg);
8991
+ //console.warn(msg);
8989
8992
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
8990
8993
  ++self.notFound[notFound].count;
8991
8994
  }
8992
-
8995
+
8993
8996
  return false
8994
8997
  }
8995
-
8998
+
8996
8999
  // forms
8997
9000
  var altRoute = self.compareUrls(params, url, request) || null;
8998
9001
  if(altRoute.past && isMethodProvidedByDefault) {
8999
9002
  notFound = method.toUpperCase() +'::'+ altRoute.request.routing.rule;
9000
9003
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
9001
9004
  msg = msg.replace(/\%r/, notFound);
9002
- //console.warn(msg);
9005
+ //console.warn(msg);
9003
9006
  } else {
9004
9007
  ++self.notFound[notFound].count;
9005
9008
  }
9006
-
9009
+
9007
9010
  return false
9008
- }
9011
+ }
9009
9012
  return false
9010
9013
  }
9011
9014
 
9012
-
9013
- console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
9015
+
9016
+ console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
9014
9017
  return false;
9015
9018
  } else {
9016
9019
  // fix url in case of empty param value allowed by the routing rule
@@ -9021,21 +9024,21 @@ function Routing() {
9021
9024
  // adding hash if found
9022
9025
  if (hash)
9023
9026
  url += hash;
9024
-
9027
+
9025
9028
  route.url = url;
9026
9029
  // recommanded for x-bundle coms
9027
9030
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
9028
- route.toUrl = function (ignoreWebRoot) {
9031
+ route.toUrl = function (ignoreWebRoot) {
9029
9032
  var wroot = this.webroot
9030
9033
  , hostname = this.hostname
9031
9034
  , path = this.url
9032
9035
  ;
9033
-
9036
+
9034
9037
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
9035
-
9038
+
9036
9039
  return hostname + this.url
9037
9040
  };
9038
-
9041
+
9039
9042
  return route
9040
9043
  }
9041
9044
  }
@@ -9047,7 +9050,7 @@ if ((typeof (module) !== 'undefined') && module.exports) {
9047
9050
  // Publish as node.js module
9048
9051
  module.exports = Routing()
9049
9052
  } else if (typeof (define) === 'function' && define.amd) {
9050
- // Publish as AMD module
9053
+ // Publish as AMD module
9051
9054
  define('utils/routing', ['require', 'utils/form-validator', 'utils/merge'], function() { return Routing() })
9052
9055
  };
9053
9056
  /**
@@ -18006,11 +18009,11 @@ define('gina/toolbar', ['require', 'jquery', 'vendor/uuid'/**, 'utils/merge'*/,
18006
18009
  return Toolbar
18007
18010
  });
18008
18011
  define('gina', [ 'require', 'vendor/uuid', 'utils/merge', 'utils/events', 'helpers/prototypes', 'helpers/dateFormat', 'gina/toolbar' ], function (require) {
18009
-
18010
-
18012
+
18013
+
18011
18014
  var eventsHandler = require('utils/events'); // events handler
18012
18015
  var merge = require('utils/merge');
18013
- var dateFormat = require('helpers/dateFormat')();
18016
+ var dateFormat = require('helpers/dateFormat')();
18014
18017
  var prototypes = require('helpers/prototypes')({ dateFormat: dateFormat });
18015
18018
  var uuid = require('vendor/uuid');
18016
18019
 
@@ -18096,16 +18099,16 @@ define('gina', [ 'require', 'vendor/uuid', 'utils/merge', 'utils/events', 'helpe
18096
18099
 
18097
18100
  'setOptions' : setOptions
18098
18101
  };
18099
-
18102
+
18100
18103
  // iframe case
18101
18104
  if ( typeof(parent.window['gina']) != 'undefined' ) {
18102
18105
  // inheriting from parent frame instance
18103
- window['gina'] = merge((window['gina'] || {}), parent.window['gina']);
18106
+ window['gina'] = merge((window['gina'] || {}), parent.window['gina']);
18104
18107
  }
18105
- $instance = merge( (window['gina'] || {}), $instance);
18108
+ $instance = merge( (window['gina'] || {}), $instance);
18106
18109
 
18107
18110
  registerEvents(this.plugin, events);
18108
-
18111
+
18109
18112
  triggerEvent(gina, proto.target, 'ginaloaded', $instance)
18110
18113
  }
18111
18114
 
@@ -18218,7 +18221,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18218
18221
  var merge = require('utils/merge');
18219
18222
 
18220
18223
  require('utils/events'); // events
18221
-
18224
+
18222
18225
  /**
18223
18226
  * Gina Link Handler
18224
18227
  *
@@ -18268,7 +18271,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18268
18271
 
18269
18272
  // XML Request
18270
18273
  var xhr = null;
18271
-
18274
+
18272
18275
  /**
18273
18276
  * XML Request options
18274
18277
  * */
@@ -18286,7 +18289,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18286
18289
 
18287
18290
  var registeredLinks = [];
18288
18291
 
18289
-
18292
+
18290
18293
 
18291
18294
  var proxyClick = function($childNode, $el, evt) {
18292
18295
 
@@ -18296,25 +18299,25 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18296
18299
  triggerEvent(gina, $el, evt);
18297
18300
  });
18298
18301
  }
18299
-
18300
- var getLinkById = function(id) {
18302
+
18303
+ var getLinkById = function(id) {
18301
18304
  return ( typeof(instance.$links[id]) != 'undefined' ) ? instance.$links[id] : null;
18302
18305
  }
18303
-
18306
+
18304
18307
  var getLinkByUrl = function(url) {
18305
18308
  var $link = null;
18306
-
18309
+
18307
18310
  for (var p in gina.link.$links) {
18308
18311
  if ( typeof(gina.link.$links[p].url) != 'undefined' && gina.link.$links[p].url == url ) {
18309
18312
  $link = gina.link.$links[p];
18310
18313
  break;
18311
18314
  }
18312
18315
  }
18313
-
18316
+
18314
18317
  return $link;
18315
18318
  }
18316
-
18317
-
18319
+
18320
+
18318
18321
 
18319
18322
  /**
18320
18323
  * linkRequest
@@ -18327,12 +18330,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18327
18330
  // link object
18328
18331
  var $link = getLinkByUrl(url);
18329
18332
  var id = $link.id;
18330
-
18331
-
18333
+
18334
+
18332
18335
  // link element
18333
18336
  var $el = document.getElementById(id) || null;
18334
-
18335
- var hLinkIsRequired = null;
18337
+
18338
+ var hLinkIsRequired = null;
18336
18339
  // forward callback to HTML data event attribute through `hform` status
18337
18340
  hLinkIsRequired = ( $el.getAttribute('data-gina-link-event-on-success') || $el.getAttribute('data-gina-link-event-on-error') ) ? true : false;
18338
18341
  // success -> data-gina-form-event-on-submit-success
@@ -18354,20 +18357,23 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18354
18357
  } else {
18355
18358
  options = merge(options, xhrOptions);
18356
18359
  }
18357
-
18360
+
18358
18361
  if ( /^(http|https)\:/.test(url) && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url) ) {
18359
18362
  // is request from same domain ?
18360
18363
  //options.headers['Origin'] = window.protocol+'//'+window.location.host;
18361
18364
  //options.headers['Origin'] = '*';
18362
18365
  //options.headers['Host'] = 'https://freelancer-app.fr.local:3154';
18363
18366
  var isSameDomain = ( new RegExp(window.location.hostname).test(url) ) ? true : false;
18367
+ if (gina.config.envIsDev) {
18368
+ console.debug('Checking CORS from Link plugin...\TODO - local CORS Proxy');
18369
+ }
18364
18370
  if (!isSameDomain) {
18365
18371
  // proxy external urls
18366
18372
  // TODO - instead of using `cors.io`, try to intégrate a local CORS proxy similar to : http://oskarhane.com/avoid-cors-with-nginx-proxy_pass/
18367
18373
  //url = url.match(/^(https|http)\:/)[0] + '//cors.io/?' + url;
18368
18374
  url = url.match(/^(https|http)\:/)[0] + '//corsacme.herokuapp.com/?'+ url;
18369
18375
  //delete options.headers['X-Requested-With']
18370
- }
18376
+ }
18371
18377
  }
18372
18378
  options.url = url;
18373
18379
  // updating link options
@@ -18375,7 +18381,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18375
18381
  options = merge($link.options, options);
18376
18382
 
18377
18383
 
18378
- if ( options.withCredentials ) { // Preflighted requests
18384
+ if ( options.withCredentials ) { // Preflighted requests
18379
18385
  if ('withCredentials' in xhr) {
18380
18386
  // XHR for Chrome/Firefox/Opera/Safari.
18381
18387
  if (options.isSynchrone) {
@@ -18394,7 +18400,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18394
18400
  triggerEvent(gina, $el, 'error.' + id, result)
18395
18401
  }
18396
18402
  } else { // simple requests
18397
-
18403
+
18398
18404
  if (options.isSynchrone) {
18399
18405
  xhr.open(options.method, options.url, options.isSynchrone)
18400
18406
  } else {
@@ -18402,12 +18408,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18402
18408
  }
18403
18409
  }
18404
18410
 
18405
-
18411
+
18406
18412
 
18407
18413
  if (!xhr)
18408
18414
  throw new Error('No `xhr` object initiated');
18409
-
18410
-
18415
+
18416
+
18411
18417
  options.$link = $link;
18412
18418
  //xhr = handleXhr(xhr, $el, options);
18413
18419
  handleXhr(xhr, $el, options, require);
@@ -18416,18 +18422,18 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18416
18422
  }
18417
18423
 
18418
18424
  // var listenToXhrEvents = function($link) {
18419
-
18425
+
18420
18426
  // //data-gina-link-event-on-success
18421
18427
  // var htmlSuccesEventCallback = $link.target.getAttribute('data-gina-link-event-on-success') || null;
18422
18428
  // if (htmlSuccesEventCallback != null) {
18423
-
18429
+
18424
18430
  // if ( /\((.*)\)/.test(htmlSuccesEventCallback) ) {
18425
18431
  // eval(htmlSuccesEventCallback)
18426
18432
  // } else {
18427
18433
  // $link.on('success.hlink', window[htmlSuccesEventCallback])
18428
18434
  // }
18429
18435
  // }
18430
-
18436
+
18431
18437
  // //data-gina-link-event-on-error
18432
18438
  // var htmlErrorEventCallback = $link.target.getAttribute('data-gina-link-event-on-error') || null;
18433
18439
  // if (htmlErrorEventCallback != null) {
@@ -18438,53 +18444,53 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18438
18444
  // }
18439
18445
  // }
18440
18446
  // }
18441
-
18442
-
18443
18447
 
18444
-
18448
+
18449
+
18450
+
18445
18451
  function registerLink($link, options) {
18446
-
18452
+
18447
18453
  if ( typeof(options) != 'object' ) {
18448
18454
  throw new Error('`options` must be an object')
18449
18455
  }
18450
-
18451
- $link.options = merge(options, self.options);
18452
-
18456
+
18457
+ $link.options = merge(options, self.options);
18458
+
18453
18459
  // link element
18454
18460
  var id = $link.id;
18455
18461
  var $el = document.getElementById(id) || null;
18456
-
18457
- if ( typeof(instance.$links[$link.id]) == 'undefined' ) {
18458
18462
 
18459
-
18463
+ if ( typeof(instance.$links[$link.id]) == 'undefined' ) {
18464
+
18465
+
18460
18466
 
18461
18467
  if ( registeredLinks.indexOf($link.id) > -1 ) {
18462
18468
  throw new Error('`link '+$link.id+'` already exists !')
18463
18469
  }
18464
-
18465
-
18470
+
18471
+
18466
18472
  if (!gina.events[evt]) {
18467
-
18468
-
18469
-
18473
+
18474
+
18475
+
18470
18476
  // attach click events
18471
18477
  addListener(gina, $el, evt, function(e) {
18472
18478
  cancelEvent(e);
18473
18479
 
18474
18480
  var $localLink = getLinkById(e.target.id)
18475
- // loading & binding link
18481
+ // loading & binding link
18476
18482
  var localUrl = $localLink.url;
18477
18483
 
18478
- // Non-Preflighted requests
18484
+ // Non-Preflighted requests
18479
18485
  if ( typeof($localLink.options.isSynchrone) == 'undefined' ) {
18480
18486
  $localLink.options.isSynchrone = false;
18481
18487
  }
18482
18488
  if ( typeof($localLink.options.withCredentials) == 'undefined' ) {
18483
18489
  $localLink.options.withCredentials = false
18484
18490
  }
18485
-
18486
- linkRequest(localUrl, $localLink.options);
18487
-
18491
+
18492
+ linkRequest(localUrl, $localLink.options);
18493
+
18488
18494
  //delete gina.events[ $localLink.id ];
18489
18495
  //removeListener(gina, event.target, event.type)
18490
18496
  });
@@ -18502,21 +18508,21 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18502
18508
  }
18503
18509
  }
18504
18510
  }
18505
-
18506
-
18507
18511
 
18508
-
18512
+
18513
+
18514
+
18509
18515
  $link.request = linkRequest;
18510
18516
  $link.getLinkById = getLinkById;
18511
18517
  $link.getLinkByUrl = getLinkByUrl;
18512
-
18518
+
18513
18519
  instance.$links[$link.id] = $link;
18514
-
18515
-
18516
-
18520
+
18521
+
18522
+
18517
18523
  }
18518
18524
  }
18519
-
18525
+
18520
18526
  /**
18521
18527
  * bindLinks
18522
18528
  *
@@ -18524,13 +18530,13 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18524
18530
  * @param {object} [options]
18525
18531
  * */
18526
18532
  var bindLinks = function($target, options) {
18527
-
18533
+
18528
18534
  var id = null;
18529
18535
  if ( typeof($target) == 'undefined' ) {
18530
18536
  $target = instance.target;
18531
18537
  id = instance.id;
18532
18538
  }
18533
-
18539
+
18534
18540
  // binding form elements
18535
18541
  var found = null
18536
18542
  , $el = null
@@ -18545,45 +18551,45 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18545
18551
  // buttons
18546
18552
  //, $button = $target.getElementsByTagName('button')
18547
18553
  ;
18548
-
18549
- var i = 0, len = $a.length;
18554
+
18555
+ var i = 0, len = $a.length;
18550
18556
  for (; i < len; ++i) {
18551
18557
  found = $a[i].getAttribute('data-gina-link');
18552
-
18558
+
18553
18559
  if (!found) continue;
18554
-
18560
+
18555
18561
  $el = $a[i];
18556
18562
  props = {
18557
18563
  type: 'a',
18558
18564
  method: 'GET'
18559
18565
  };
18560
-
18561
-
18566
+
18567
+
18562
18568
  url = $el.getAttribute('data-gina-link-url');
18563
18569
  if ( typeof(url) != 'undefined' && url != null ) {
18564
18570
  props.url = url
18565
18571
  } else {
18566
18572
  props.url = $el.getAttribute('href')
18567
18573
  }
18568
-
18569
-
18570
-
18571
-
18574
+
18575
+
18576
+
18577
+
18572
18578
  elId = $el.getAttribute('id');
18573
18579
  if ( typeof(elId) == 'undefined' || elId == null || elId == '' || /popin\.link/.test(elId) ) {
18574
-
18580
+
18575
18581
  // unbind popin link
18576
18582
  // if ( /popin\.link/.test(elId) ) {
18577
-
18583
+
18578
18584
  // }
18579
-
18585
+
18580
18586
  elId = 'link.click.'+ 'gina-link-' + instance.id +'-'+ uuid.v4();
18581
- }
18587
+ }
18582
18588
  $el['id'] = elId;
18583
18589
  props.id = elId;
18584
18590
  evt = elId;
18585
18591
  $el.setAttribute('id', evt);
18586
-
18592
+
18587
18593
  if ($el.tagName == 'A') {
18588
18594
  onclickAttribute = $el.getAttribute('onclick');
18589
18595
  }
@@ -18598,25 +18604,25 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18598
18604
  }
18599
18605
  $el.setAttribute('onclick', onclickAttribute);
18600
18606
  }
18601
-
18607
+
18602
18608
  $newLink = null;
18603
-
18604
- if ( typeof(instance.$links[props.id]) == 'undefined' ) {
18605
- props.target = $el;
18606
- $newLink = merge(props, $link);
18609
+
18610
+ if ( typeof(instance.$links[props.id]) == 'undefined' ) {
18611
+ props.target = $el;
18612
+ $newLink = merge(props, $link);
18607
18613
  registerLink($newLink, options);
18608
18614
  }
18609
-
18610
-
18615
+
18616
+
18611
18617
  }
18612
-
18618
+
18613
18619
  }
18614
18620
 
18615
18621
  var init = function(options) {
18616
-
18622
+
18617
18623
  setupInstanceProto();
18618
18624
  instance.on('init', function(event) {
18619
-
18625
+
18620
18626
  // setting up AJAX
18621
18627
  if (window.XMLHttpRequest) { // Mozilla, Safari, ...
18622
18628
  xhr = new XMLHttpRequest();
@@ -18629,8 +18635,8 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18629
18635
  }
18630
18636
  catch (e) {}
18631
18637
  }
18632
- }
18633
-
18638
+ }
18639
+
18634
18640
  // proxies
18635
18641
  // click on main document
18636
18642
  evt = 'click';// click proxy
@@ -18642,7 +18648,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18642
18648
  event.target.id = event.target.getAttribute('id')
18643
18649
  }
18644
18650
 
18645
-
18651
+
18646
18652
 
18647
18653
  if ( /^link\.click\./.test(event.target.id) ) {
18648
18654
  cancelEvent(event);
@@ -18653,12 +18659,12 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18653
18659
 
18654
18660
  }
18655
18661
  });
18656
-
18662
+
18657
18663
  if ( typeof(options) == 'undefined' ) {
18658
18664
  options = {}
18659
18665
  }
18660
18666
  instance.options = options;
18661
-
18667
+
18662
18668
  bindLinks(instance.target, options);
18663
18669
  gina.linkIsBinded = true;
18664
18670
 
@@ -18669,14 +18675,14 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18669
18675
  triggerEvent(gina, instance.target, 'ready.' + instance.id, instance);
18670
18676
  });
18671
18677
 
18672
-
18673
-
18678
+
18679
+
18674
18680
 
18675
18681
  instance.initialized = true;
18676
18682
 
18677
18683
  return instance
18678
18684
  }
18679
-
18685
+
18680
18686
  var setupInstanceProto = function() {
18681
18687
 
18682
18688
  instance.bindLinks = bindLinks;
@@ -18684,7 +18690,7 @@ define('gina/link', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/e
18684
18690
  instance.getLinkById = getLinkById;
18685
18691
  instance.getLinkByUrl = getLinkByUrl;
18686
18692
  }
18687
-
18693
+
18688
18694
  return init(options)
18689
18695
  };
18690
18696
 
@@ -18728,7 +18734,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18728
18734
  eventData : {},
18729
18735
 
18730
18736
  '$popins' : {},
18731
- activePopinId : null,
18737
+ activePopinId : null,
18732
18738
  getActivePopin : null, // returns the active $popin
18733
18739
  target : document, // by default
18734
18740
  isReady : false,
@@ -18798,7 +18804,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18798
18804
  gina.popinContainer = instance.id;
18799
18805
  //gina.hasPopinHandler = true;
18800
18806
  }
18801
-
18807
+
18802
18808
  var popinGetContainer = function () {
18803
18809
  instance.target = document.getElementById(gina.popinContainer);
18804
18810
  instance.on = on;
@@ -18812,51 +18818,51 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18812
18818
  triggerEvent(gina, $el, evt);
18813
18819
  });
18814
18820
  }
18815
-
18816
- var getPopinById = function(id) {
18821
+
18822
+ var getPopinById = function(id) {
18817
18823
  return ( typeof(instance.$popins[id]) != 'undefined' ) ? instance.$popins[id] : null;
18818
18824
  }
18819
-
18825
+
18820
18826
  var getPopinByName = function(name) {
18821
-
18827
+
18822
18828
  var $popin = null;
18823
-
18829
+
18824
18830
  for (var p in instance.$popins) {
18825
18831
  if ( instance.$popins[p].name === name ) {
18826
18832
  $popin = instance.$popins[p];
18827
18833
  break;
18828
18834
  }
18829
18835
  }
18830
-
18836
+
18831
18837
  return $popin;
18832
- }
18833
-
18834
- function getActivePopin() {
18838
+ }
18839
+
18840
+ function getActivePopin() {
18835
18841
  var $popin = null;
18836
-
18842
+
18837
18843
  for (var p in gina.popin.$popins) {
18838
18844
  if ( typeof(gina.popin.$popins[p].isOpen) != 'undefined' && gina.popin.$popins[p].isOpen ) {
18839
18845
  $popin = gina.popin.$popins[p];
18840
18846
  break;
18841
18847
  }
18842
18848
  }
18843
-
18849
+
18844
18850
  if (!$popin && gina.popin.activePopinId) {
18845
18851
  $popin = gina.popin.$popins[gina.popin.activePopinId]
18846
18852
  }
18847
-
18853
+
18848
18854
  return $popin;
18849
- }
18850
-
18855
+ }
18856
+
18851
18857
 
18852
18858
  var bindOpen = function($popin, isRouting) {
18853
-
18859
+
18854
18860
  isRouting = ( typeof(isRouting) != 'undefined' ) ? isRouting : false;
18855
-
18861
+
18856
18862
  var attr = 'data-gina-popin-name';
18857
18863
  var $els = getElementsByAttribute(attr);
18858
18864
  var $el = null, name = null;
18859
- var url = null;
18865
+ var url = null;
18860
18866
  var proceed = null, evt = null;
18861
18867
  var i = null, len = null;
18862
18868
 
@@ -18891,9 +18897,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18891
18897
  evt = 'popin.click.'+ 'gina-popin-' + instance.id +'-'+ uuid.v4() +'-'+ name;
18892
18898
  $el['id'] = evt;
18893
18899
  $el.setAttribute( 'id', evt);
18894
-
18900
+
18895
18901
  if (!gina.events[evt]) {
18896
-
18902
+
18897
18903
  // attach click events
18898
18904
  addListener(gina, $el, evt, function(e) {
18899
18905
  cancelEvent(e);
@@ -18907,19 +18913,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18907
18913
  console.debug('active popin should be ', $popin.id);
18908
18914
  gina.popin.activePopinId = $popin.id;
18909
18915
  popinBind(e, $popin);
18910
- if (!$popin.isOpen) {
18916
+ if (!$popin.isOpen) {
18911
18917
  popinOpen($popin.name);
18912
- }
18918
+ }
18913
18919
  }
18914
18920
  });
18915
18921
 
18916
- // loading & binding popin
18922
+ // loading & binding popin
18917
18923
  // Non-Preflighted requests
18918
- var options = {
18924
+ var options = {
18919
18925
  isSynchrone: false,
18920
18926
  withCredentials: false // by default
18921
- };
18922
- options = merge($popin.options, options);
18927
+ };
18928
+ options = merge($popin.options, options);
18923
18929
  var url = this.getAttribute('data-gina-popin-url') || this.getAttribute('href');
18924
18930
  if (!url) {
18925
18931
  throw new Error('Popin `url` not defined, please check value for `data-gina-popin-url`');
@@ -18949,7 +18955,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18949
18955
  evt = 'click';// click proxy
18950
18956
  // for proxies, use popinInstance.id as target is always `document`
18951
18957
  addListener(gina, document, evt, function(event) {
18952
-
18958
+
18953
18959
  if ( event.target.getAttribute('disabled') != null && event.target.getAttribute('disabled') != 'false' ) {
18954
18960
  return false;
18955
18961
  }
@@ -18969,7 +18975,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18969
18975
  if ( /^popin\.click\./.test(event.target.id) ) {
18970
18976
  cancelEvent(event);
18971
18977
  //console.log('popin.click !! ', event.target);
18972
- var _evt = event.target.id;
18978
+ var _evt = event.target.id;
18973
18979
 
18974
18980
  if ( new RegExp( '^popin.click.gina-popin-' + instance.id).test(_evt) )
18975
18981
  triggerEvent(gina, event.target, _evt, event.detail);
@@ -18978,21 +18984,21 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
18978
18984
 
18979
18985
  gina.popinIsBinded = false
18980
18986
  }
18981
-
18982
-
18987
+
18988
+
18983
18989
  function popinBind(e, $popin) {
18984
-
18990
+
18985
18991
  var $el = e.target;
18986
18992
  var eventType = e.type;
18987
-
18988
- if (
18989
- typeof(e.detail) != 'undefined'
18990
- && typeof(e.detail.trim) == 'function'
18993
+
18994
+ if (
18995
+ typeof(e.detail) != 'undefined'
18996
+ && typeof(e.detail.trim) == 'function'
18991
18997
  ) {
18992
18998
  $el.innerHTML = e.detail.trim();
18993
18999
  }
18994
-
18995
-
19000
+
19001
+
18996
19002
  var register = function (type, evt, $element) {
18997
19003
  var isLink = $element.getAttribute('data-gina-popin-is-link');
18998
19004
  isLink = ( /^true$/i.test(isLink) ) ? true : false;
@@ -19004,37 +19010,37 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19004
19010
  addListener(gina, $element, evt, function(event) {
19005
19011
 
19006
19012
  cancelEvent(event);
19007
-
19013
+
19008
19014
  if (type != 'close') {
19009
-
19015
+
19010
19016
  var fired = false;
19011
19017
  var _evt = 'loaded.' + $popin.id;
19012
-
19018
+
19013
19019
  if ( typeof(gina.events[_evt]) == 'undefined' ) {
19014
19020
  addListener(gina, $el, _evt, function(e) {
19015
-
19021
+
19016
19022
  e.preventDefault();
19017
19023
 
19018
19024
  if (!fired) {
19019
- fired = true;
19020
- popinLoadContent(e.detail);
19025
+ fired = true;
19026
+ popinLoadContent(e.detail);
19021
19027
  }
19022
19028
  });
19023
19029
  }
19024
-
19030
+
19025
19031
  // Non-Preflighted requests
19026
- var options = {
19032
+ var options = {
19027
19033
  isSynchrone: false,
19028
19034
  withCredentials: false
19029
19035
  };
19030
- //options = merge(options, $popin.options);
19031
- options = merge($popin.options, options);
19036
+ //options = merge(options, $popin.options);
19037
+ options = merge($popin.options, options);
19032
19038
  popinLoad($popin.name, $element.href, options);
19033
- }
19034
-
19039
+ }
19040
+
19035
19041
  removeListener(gina, event.target, event.type)
19036
19042
  });
19037
-
19043
+
19038
19044
  addListener(gina, $element, 'click', function(event) {
19039
19045
  cancelEvent(event);
19040
19046
  // ignore disabled
@@ -19043,58 +19049,59 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19043
19049
  }
19044
19050
  // NB.: `type == 'action'` will be handled by the form validator
19045
19051
  if ( type == 'link' ) {
19046
- //console.debug('This is a link', event.target);
19052
+ var linkHref = event.target.getAttribute('href') || null;
19053
+ // console.debug('This is a link', event.target);
19047
19054
  var linkTarget = event.target.getAttribute('target');
19048
- if ( linkTarget != null && linkTarget != '' ) {
19049
- var _window = window.open(linkHref, event.target.getAttribute('target'));
19055
+ if ( linkTarget != null && linkTarget != '' ) {
19056
+ var _window = window.open(linkHref, linkTarget);
19050
19057
  // _window.onload = function onWindowLoad() {
19051
- // var $popin = getActivePopin();
19058
+ // var $popin = getActivePopin();
19052
19059
  // triggerEvent(gina, $popin, 'loaded.' + id);
19053
19060
  // }
19054
19061
  } else { // else, inside viewbox
19055
- // TODO - Integrate https://github.com/box/viewer.js#loading-a-simple-viewer
19062
+ // TODO - Integrate https://github.com/box/viewer.js#loading-a-simple-viewer
19056
19063
  triggerEvent(gina, event.target, event.currentTarget.id, $popin);
19057
19064
  }
19058
-
19065
+
19059
19066
  } /**else if ( type == 'action' ) {
19060
19067
  // rewrite form attributes
19061
19068
  //console.debug('This is an action ', event.target);
19062
19069
  }*/ else { // close
19063
-
19070
+
19064
19071
  if ( typeof(event.target.id) == 'undefined' ) {
19065
19072
  event.target.setAttribute('id', evt +'.'+ uuid.v4() );
19066
19073
  event.target.id = event.target.getAttribute('id')
19067
19074
  }
19068
-
19075
+
19069
19076
  if ( /^popin\.close\./.test(event.target.id) ) {
19070
19077
  cancelEvent(event);
19071
19078
  // Just in case we left the popin with a link:target = _blank
19072
19079
  $popin.isRedirecting = false;
19073
19080
  popinClose($popin.name);
19074
19081
  }
19075
-
19082
+
19076
19083
  if ( /^popin\.click\./.test(event.target.id) ) {
19077
19084
  cancelEvent(event);
19078
19085
  var _evt = event.target.id;
19079
-
19086
+
19080
19087
  if ( new RegExp( '^popin.click.gina-popin-' + instance.id).test(_evt) )
19081
19088
  triggerEvent(gina, event.target, _evt, event.detail);
19082
-
19089
+
19083
19090
  }
19084
- }
19091
+ }
19085
19092
  });
19086
-
19093
+
19087
19094
  };
19088
-
19095
+
19089
19096
  gina.popinIsBinded = true;
19090
-
19097
+
19091
19098
  var i = null
19092
19099
  , b = null
19093
19100
  , len = null
19094
19101
  ;
19095
19102
  // bind overlay on click
19096
- if (!$popin.isOpen) {
19097
-
19103
+ if (!$popin.isOpen) {
19104
+
19098
19105
  var $overlay = instance.target.childNodes[0];
19099
19106
  addListener(gina, $overlay, 'mousedown', function(event) {
19100
19107
 
@@ -19103,13 +19110,13 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19103
19110
 
19104
19111
  // remove listeners
19105
19112
  removeListener(gina, event.target, 'mousedown');
19106
-
19113
+
19107
19114
  // binding popin close
19108
19115
  var $close = []
19109
- , $buttonsTMP = []
19116
+ , $buttonsTMP = []
19110
19117
  ;
19111
-
19112
- i = 0;
19118
+
19119
+ i = 0;
19113
19120
  $buttonsTMP = $el.getElementsByTagName('button');
19114
19121
  b = 0; len = $buttonsTMP.length;
19115
19122
  if ( len > 0 ) {
@@ -19117,10 +19124,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19117
19124
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19118
19125
  $close[i] = $buttonsTMP[b];
19119
19126
  ++i;
19120
- }
19127
+ }
19121
19128
  }
19122
19129
  }
19123
-
19130
+
19124
19131
  $buttonsTMP = $el.getElementsByTagName('div');
19125
19132
  b = 0; len = $buttonsTMP.length;
19126
19133
  if ( len > 0 ) {
@@ -19128,10 +19135,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19128
19135
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19129
19136
  $close[i] = $buttonsTMP[b];
19130
19137
  ++i
19131
- }
19138
+ }
19132
19139
  }
19133
19140
  }
19134
-
19141
+
19135
19142
  $buttonsTMP = $el.getElementsByTagName('a');
19136
19143
  b = 0; len = $buttonsTMP.length;
19137
19144
  if ( len > 0 ) {
@@ -19139,10 +19146,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19139
19146
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19140
19147
  $close[i] = $buttonsTMP[b];
19141
19148
  ++i
19142
- }
19149
+ }
19143
19150
  }
19144
19151
  }
19145
-
19152
+
19146
19153
  b = 0; len = $close.length;
19147
19154
  for (; b < len; ++b) {
19148
19155
  let $el = $close[b];
@@ -19152,23 +19159,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19152
19159
  if ( typeof(gina.events[ evt ]) != 'undefined' && gina.events[ evt ] == eId ) {
19153
19160
  removeListener(gina, $el, evt);
19154
19161
  }
19155
- if ( typeof(gina.events[ eId ]) != 'undefined' && gina.events[ eId ] == eId ) {
19162
+ if ( typeof(gina.events[ eId ]) != 'undefined' && gina.events[ eId ] == eId ) {
19156
19163
  removeListener(gina, $el, eId);
19157
19164
  }
19158
-
19165
+
19159
19166
  if ( typeof(gina.events[ evt +'.'+ eId ]) != 'undefined' && gina.events[ evt +'.'+ eId ] == eId ) {
19160
19167
  removeListener(gina, $el, evt +'.'+ eId);
19161
19168
  }
19162
-
19169
+
19163
19170
  if ( typeof(gina.events[ evt +'.'+ eId ]) != 'undefined' && gina.events[ evt +'.'+ eId ] == evt +'.'+ eId ) {
19164
19171
  removeListener(gina, $el, evt +'.'+ eId);
19165
19172
  }
19166
19173
  }
19167
-
19168
-
19174
+
19175
+
19169
19176
  //removeListener(gina, $close[b], $close[b].getAttribute('id') );
19170
19177
  }
19171
-
19178
+
19172
19179
  // div with click
19173
19180
  // var $elTMP = $form.target.getElementsByTagName('div');
19174
19181
  // if ( $elTMP.length > 0 ) {
@@ -19183,19 +19190,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19183
19190
  // $els.push( $elTMP[i] )
19184
19191
  // }
19185
19192
  // }
19186
-
19193
+
19187
19194
  // Just in case we left the popin with a link:target = _blank
19188
19195
  $popin.isRedirecting = false;
19189
19196
  popinClose($popin.name);
19190
19197
  }
19191
-
19198
+
19192
19199
  });
19193
19200
  }
19194
19201
  // detecting form in popin
19195
19202
  if ( /<form/i.test($el.innerHTML) && typeof($validatorInstance) != 'undefined' && $validatorInstance ) {
19196
19203
  $popin.hasForm = true;
19197
19204
  }
19198
-
19205
+
19199
19206
  // binding popin close & links (& its target attributes)
19200
19207
  var $close = []
19201
19208
  , $buttonsTMP = []
@@ -19209,7 +19216,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19209
19216
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19210
19217
  $close[i] = $buttonsTMP[b];
19211
19218
  ++i
19212
- }
19219
+ }
19213
19220
  }
19214
19221
  }
19215
19222
 
@@ -19220,7 +19227,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19220
19227
  if ( /gina-popin-close/.test($buttonsTMP[b].className) ) {
19221
19228
  $close[i] = $buttonsTMP[b];
19222
19229
  ++i;
19223
- }
19230
+ }
19224
19231
  }
19225
19232
  }
19226
19233
 
@@ -19233,15 +19240,15 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19233
19240
  ++i;
19234
19241
  continue
19235
19242
  }
19236
-
19237
- if (
19238
- typeof($buttonsTMP[b]) != 'undefined'
19239
- && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19240
- // ignore href already bindded byr formValidator or the user
19243
+
19244
+ if (
19245
+ typeof($buttonsTMP[b]) != 'undefined'
19246
+ && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19247
+ // ignore href already bindded byr formValidator or the user
19241
19248
  && !$buttonsTMP[b].id
19242
19249
  ||
19243
19250
  typeof($buttonsTMP[b]) != 'undefined'
19244
- && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19251
+ && !/(\#|\#.*)$/.test($buttonsTMP[b].href) // ignore href="#"
19245
19252
  && !/^(click\.|popin\.link)/.test($buttonsTMP[b].id)
19246
19253
  ) {
19247
19254
  $link.push($buttonsTMP[b]);
@@ -19249,7 +19256,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19249
19256
  }
19250
19257
  }
19251
19258
  }
19252
-
19259
+
19253
19260
  var onclickAttribute = null, evt = null;
19254
19261
  // close events
19255
19262
  b = 0; len = $close.length;
@@ -19276,14 +19283,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19276
19283
 
19277
19284
  } else {
19278
19285
  evt = $close[b]['id'];
19279
- }
19286
+ }
19280
19287
 
19281
19288
 
19282
19289
  if ( typeof(gina.events[evt]) == 'undefined' || gina.events[evt] != $close[b].id ) {
19283
19290
  register('close', evt, $close[b])
19284
19291
  }
19285
19292
  }
19286
-
19293
+
19287
19294
  // link events
19288
19295
  i = 0; len = $link.length;
19289
19296
  var _form = null, f = null, fLen = null;
@@ -19295,16 +19302,16 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19295
19302
  , isSubmitLink = null
19296
19303
  , isLink = null
19297
19304
  ;
19298
-
19305
+
19299
19306
  for (; i < len; ++i) {
19300
19307
  // if is disabled, stop propagation
19301
19308
  if ( $link[i].getAttribute('disabled') != null ) {
19302
19309
  continue;
19303
19310
  }
19304
-
19305
- $link[i]['id'] = ( /^null$/i.test($link[i].getAttribute('id')) ) ? null : $link[i].getAttribute('id');
19311
+
19312
+ $link[i]['id'] = ( /^null$/i.test($link[i].getAttribute('id')) ) ? null : $link[i].getAttribute('id');
19306
19313
  if (!$link[i]['id'] || !/^popin\.link/.test($link[i]['id']) || !/^popin\.click/.test($link[i]['id']) ) {
19307
-
19314
+
19308
19315
  // just in case
19309
19316
  isLink = true;
19310
19317
  aHref = $link[i].getAttribute('href');
@@ -19313,7 +19320,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19313
19320
  $link[i].setAttribute('href', '#');
19314
19321
  isLink = false;
19315
19322
  }
19316
- // link or action ?
19323
+ // link or action ?
19317
19324
  if (/^null$/i.test($link[i]['id'])) {
19318
19325
  if ( isLink ) {
19319
19326
  evt = 'popin.link.' + uuid.v4();
@@ -19325,29 +19332,29 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19325
19332
  } else {
19326
19333
  evt = $link[i]['id'];
19327
19334
  }
19328
-
19329
- $link[i]['id'] = evt;
19335
+
19336
+ $link[i]['id'] = evt;
19330
19337
  $link[i].setAttribute( 'id', evt);
19331
-
19338
+
19332
19339
  } else {
19333
19340
  evt = $link[i]['id'];
19334
19341
  }
19335
-
19342
+
19336
19343
  // ignore `isSubmitLink == true`
19337
19344
  // will be handled by validator
19338
19345
  isSubmitLink = $link[i].getAttribute('data-gina-form-submit');
19339
- isSubmitLink = ( isSubmitLink && /^true$/i.test(isSubmitLink) ) ? true : false;
19346
+ isSubmitLink = ( isSubmitLink && /^true$/i.test(isSubmitLink) ) ? true : false;
19340
19347
  if (isSubmitLink) {
19341
19348
  continue;
19342
19349
  }
19343
-
19344
-
19350
+
19351
+
19345
19352
  if ( !/^(null|\s*)$/.test($link[i].getAttribute('href')) ) {
19346
19353
  addListener(gina, $link[i], 'click', function(linkEvent) {
19347
19354
  linkEvent.preventDefault();
19348
-
19355
+
19349
19356
  $popin.isRedirecting = true;
19350
-
19357
+
19351
19358
  if ($popin.hasForm) {
19352
19359
  // Experimental - inheritedData
19353
19360
  // Inhertitance from previously request: merging datas with current form context
@@ -19364,7 +19371,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19364
19371
  inheritedData = merge(inheritedData, JSON.parse(decodeURIComponent(_formData)));
19365
19372
  }
19366
19373
  }
19367
-
19374
+
19368
19375
  // has already params ?
19369
19376
  if ( inheritedData.count() > 0 ) {
19370
19377
  if ( /\?/.test(linkEvent.currentTarget.href) ) {
@@ -19372,7 +19379,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19372
19379
  } else {
19373
19380
  linkEvent.currentTarget.href += '?inheritedData=' + encodeURIComponent(JSON.stringify(inheritedData));
19374
19381
  }
19375
- }
19382
+ }
19376
19383
  }
19377
19384
  })
19378
19385
  }
@@ -19380,10 +19387,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19380
19387
  if ( typeof(gina.events[evt]) == 'undefined' || gina.events[evt] != $link[i].id ) {
19381
19388
  register('link', evt, $link[i])
19382
19389
  }
19383
-
19384
-
19385
- } // EO for(; i < len; ++i)
19386
-
19390
+
19391
+
19392
+ } // EO for(; i < len; ++i)
19393
+
19387
19394
  // bind with formValidator if forms are found
19388
19395
  if ($popin.hasForm) {
19389
19396
  var _id = null;
@@ -19410,22 +19417,22 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19410
19417
  removeListener(gina, $popin.target, eventType);
19411
19418
  }
19412
19419
  }
19413
-
19420
+
19414
19421
  }
19415
-
19422
+
19416
19423
  function updateToolbar(result, resultIsObject) {
19417
19424
  // update toolbar errors
19418
19425
  var $popin = getActivePopin();
19419
-
19426
+
19420
19427
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && typeof(result) != 'undefined' && typeof(resultIsObject) != 'undefined' && result ) {
19421
-
19428
+
19422
19429
  var XHRData = result;
19423
-
19424
- try {
19430
+
19431
+ try {
19425
19432
  var XHRDataNew = null;
19426
19433
  if ( !resultIsObject && XHRData.error && /^(\{|\[)/.test(XHRData.error) )
19427
19434
  XHRData.error = JSON.parse(XHRData.error);
19428
-
19435
+
19429
19436
  // bad .. should not happen
19430
19437
  if ( typeof(XHRData.error) != 'undefined' && typeof(XHRData.error) == 'object' && typeof(XHRData.error) == 'object' ) {
19431
19438
  // by default
@@ -19443,7 +19450,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19443
19450
  } else if ( typeof(XHRData.error) != 'undefined' && typeof(XHRData.error) == 'string' ) {
19444
19451
  XHRData = result;
19445
19452
  }
19446
-
19453
+
19447
19454
  XHRData.isXHRViewData = true;
19448
19455
  ginaToolbar.update('data-xhr', XHRData );
19449
19456
  return;
@@ -19451,7 +19458,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19451
19458
  throw err
19452
19459
  }
19453
19460
  }
19454
-
19461
+
19455
19462
  // update toolbar
19456
19463
  try {
19457
19464
  var $popin = getPopinById(instance.activePopinId);
@@ -19459,17 +19466,17 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19459
19466
  } catch (err) {
19460
19467
  ginaToolbar.update('data-xhr', err );
19461
19468
  }
19462
-
19463
-
19469
+
19470
+
19464
19471
  // XHRData
19465
- var XHRData = null;
19472
+ var XHRData = null;
19466
19473
  if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19467
19474
  // converting Element to DOM object
19468
- XHRData = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-data');
19475
+ XHRData = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-data');
19469
19476
  } else {
19470
19477
  XHRData = document.getElementById('gina-without-layout-xhr-data');
19471
19478
  }
19472
-
19479
+
19473
19480
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && XHRData ) {
19474
19481
  try {
19475
19482
 
@@ -19487,19 +19494,19 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19487
19494
 
19488
19495
  // XHRView
19489
19496
  var XHRView = null;
19490
- if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19497
+ if ( typeof(result) == 'string' && /\<(.*)\>/.test(result) ) {
19491
19498
  // converting Element to DOM object
19492
- XHRView = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-view');
19499
+ XHRView = new DOMParser().parseFromString(result, 'text/html').getElementById('gina-without-layout-xhr-view');
19493
19500
  } else {
19494
19501
  XHRView = document.getElementById('gina-without-layout-xhr-view');
19495
19502
  }
19496
-
19503
+
19497
19504
  if ( gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar && XHRView ) {
19498
19505
  try {
19499
19506
 
19500
19507
  if ( typeof(XHRView.value) != 'undefined' && XHRView.value ) {
19501
-
19502
- XHRView = JSON.parse( decodeURIComponent( XHRView.value ) );
19508
+
19509
+ XHRView = JSON.parse( decodeURIComponent( XHRView.value ) );
19503
19510
  // reset data-xhr
19504
19511
  //ginaToolbar.update("view-xhr", null);
19505
19512
  ginaToolbar.update('view-xhr', XHRView);
@@ -19551,12 +19558,12 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19551
19558
  // popin object
19552
19559
  var $popin = getPopinByName(name);
19553
19560
  var id = $popin.id;
19554
-
19561
+
19555
19562
  // set as active if none is active
19556
19563
  if ( !gina.popin.activePopinId ) {
19557
19564
  gina.popin.activePopinId = id;
19558
19565
  }
19559
-
19566
+
19560
19567
  // popin element
19561
19568
  var $el = document.getElementById(id) || null;
19562
19569
 
@@ -19575,28 +19582,31 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19575
19582
  // In order to inherit without overriding default xhrOptions
19576
19583
  var isWithCredentials = xhrOptions.withCredentials;
19577
19584
  options = merge(options, xhrOptions);
19578
-
19585
+
19579
19586
  options.withCredentials = isWithCredentials;
19580
19587
  }
19581
-
19582
- if (
19588
+
19589
+ if (
19583
19590
  /^(http|https)\:/.test(url)
19584
- && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url)
19591
+ && !new RegExp('^' + window.location.protocol + '//'+ window.location.host).test(url)
19585
19592
  ) {
19586
19593
  // is request from same domain ?
19587
19594
  //options.headers['Origin'] = window.protocol+'//'+window.location.host;
19588
19595
  //options.headers['Origin'] = '*';
19589
19596
  //options.headers['Host'] = 'https://domain.local:3154';
19590
19597
  var isSameDomain = ( new RegExp(window.location.hostname).test(url) ) ? true : false;
19598
+ if (gina.config.envIsDev) {
19599
+ console.debug('Checking CORS from Popin plugin...\TODO - local CORS Proxy');
19600
+ }
19591
19601
  if (!isSameDomain) {
19592
19602
  // proxy external urls
19593
19603
  // TODO - instead of using `cors.io` or similar services, try to intégrate a local CORS proxy similar to : http://oskarhane.com/avoid-cors-with-nginx-proxy_pass/
19594
19604
  //url = url.match(/^(https|http)\:/)[0] + '//cors.io/?' + url;
19595
19605
  url = url.match(/^(https|http)\:/)[0] + '//corsacme.herokuapp.com/?'+ url;
19596
19606
  //url = url.match(/^(https|http)\:/)[0] + '//cors-anywhere.herokuapp.com/' + url;
19597
-
19607
+
19598
19608
  //delete options.headers['X-Requested-With']
19599
-
19609
+
19600
19610
  // remove credentials on untrusted env
19601
19611
  // if forced by user options, it will be restored with $popin.options merge
19602
19612
  options.withCredentials = false;
@@ -19607,7 +19617,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19607
19617
  $popin.options = merge(options, $popin.options);
19608
19618
 
19609
19619
 
19610
- if ( options.withCredentials ) { // Preflighted requests
19620
+ if ( options.withCredentials ) { // Preflighted requests
19611
19621
  if ('withCredentials' in xhr) {
19612
19622
  // XHR for Chrome/Firefox/Opera/Safari.
19613
19623
  if (options.isSynchrone) {
@@ -19626,7 +19636,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19626
19636
  triggerEvent(gina, $el, 'error.' + id, result)
19627
19637
  }
19628
19638
  } else { // simple requests
19629
-
19639
+
19630
19640
  if (options.isSynchrone) {
19631
19641
  xhr.open(options.method, options.url, options.isSynchrone)
19632
19642
  } else {
@@ -19634,32 +19644,32 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19634
19644
  }
19635
19645
  }
19636
19646
 
19637
-
19647
+
19638
19648
 
19639
19649
  if (xhr) {
19640
19650
  // setting up headers
19641
19651
  xhr.withCredentials = ( typeof(options.withCredentials) != 'undefined' ) ? options.withCredentials : false;
19642
-
19652
+
19643
19653
  xhr.onerror = function(event, err) {
19644
-
19654
+
19645
19655
  var error = 'Transaction error: might be due to the server CORS settings.\nPlease, check the console for more details.';
19646
19656
  var result = {
19647
19657
  'status': xhr.status, //500,
19648
19658
  'error' : error
19649
- };
19650
-
19659
+ };
19660
+
19651
19661
  var resultIsObject = true;
19652
- instance.eventData.error = result +'\n'+ err;
19662
+ instance.eventData.error = result +'\n'+ err;
19653
19663
  updateToolbar(result, resultIsObject);
19654
19664
  triggerEvent(gina, $el, 'error.' + id, result)
19655
19665
  }
19656
-
19657
-
19666
+
19667
+
19658
19668
  for (var header in options.headers) {
19659
19669
  xhr.setRequestHeader(header, options.headers[header]);
19660
19670
  }
19661
-
19662
-
19671
+
19672
+
19663
19673
  // catching ready state cb
19664
19674
  xhr.onreadystatechange = function (event) {
19665
19675
  if (xhr.readyState == 4) {
@@ -19678,20 +19688,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19678
19688
  result.contentType = contentType;
19679
19689
  isRedirecting = false;
19680
19690
  }
19681
-
19691
+
19682
19692
 
19683
19693
  instance.eventData.success = result;
19684
-
19685
- if (
19694
+
19695
+ if (
19686
19696
  !isJsonContent && $popin.isOpen && !$popin.hasForm
19687
19697
  ||
19688
19698
  !isJsonContent && $popin.isOpen && isRedirecting
19689
- ) {
19699
+ ) {
19690
19700
  popinLoadContent(result, isRedirecting);
19691
19701
  } else {
19692
-
19693
- if (
19694
- isJsonContent && typeof(result.location) != 'undefined'
19702
+
19703
+ if (
19704
+ isJsonContent && typeof(result.location) != 'undefined'
19695
19705
  ||
19696
19706
  isJsonContent && typeof(result.reload) != 'undefined'
19697
19707
  ) {
@@ -19703,14 +19713,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19703
19713
  isXhrRedirect = true;
19704
19714
  }
19705
19715
  if ( typeof(result.location) != 'undefined' && isXhrRedirect ) {
19706
-
19707
- if (
19708
- typeof(result.popin) != 'undefined'
19716
+
19717
+ if (
19718
+ typeof(result.popin) != 'undefined'
19709
19719
  && typeof(result.popin.close) != 'undefined'
19710
19720
  ) {
19711
19721
  $popin.isRedirecting = false;
19712
19722
  $popin.close();
19713
-
19723
+
19714
19724
  var _reload = (result.popin.reload) ? result.popin.reload : false;
19715
19725
  if ( !result.popin.location && !result.popin.url) {
19716
19726
  delete result.popin;
@@ -19718,9 +19728,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19718
19728
  if (_reload) {
19719
19729
  result.popin = { reload: _reload };
19720
19730
  }
19721
- }
19731
+ }
19722
19732
  }
19723
-
19733
+
19724
19734
  var _target = '_self'; // by default
19725
19735
  if ( typeof(result.target) != 'undefined' ) {
19726
19736
  if ( /^(blank|self|parent|top)$/ ) {
@@ -19728,7 +19738,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19728
19738
  }
19729
19739
  _target = result.target
19730
19740
  }
19731
-
19741
+
19732
19742
  // special case of location without having the popin open
19733
19743
  // can occure while tunnelling
19734
19744
  if ( /^_self$/.test(_target) ) {
@@ -19738,7 +19748,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19738
19748
  } else {
19739
19749
  popinUrl = result.location;
19740
19750
  }
19741
-
19751
+
19742
19752
  $popin
19743
19753
  .load( $popin.name, popinUrl, $popin.options );
19744
19754
  return setTimeout( function onPopinredirect($popin){
@@ -19748,22 +19758,22 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19748
19758
  }
19749
19759
  }, 50, $popin);
19750
19760
  }
19751
-
19752
-
19761
+
19762
+
19753
19763
  window.open(result.location, _target);
19754
19764
  return;
19755
19765
  }
19756
-
19766
+
19757
19767
  if ( typeof(result.location) != 'undefined' ) {
19758
19768
  document.location = result.location;
19759
19769
  return;
19760
19770
  }
19761
-
19771
+
19762
19772
  if ( typeof(result.reload) != 'undefined' ) {
19763
19773
  document.location.reload();
19764
19774
  return;
19765
19775
  }
19766
-
19776
+
19767
19777
  if ( typeof(result.popin) != 'undefined' ) {
19768
19778
  if ( typeof(result.popin.close) != 'undefined' ) {
19769
19779
  $popin.isRedirecting = false;
@@ -19771,7 +19781,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19771
19781
  }
19772
19782
  }
19773
19783
  }
19774
-
19784
+
19775
19785
  //if ( !isJsonContent && $popin.hasForm) {
19776
19786
  //$validatorInstance.handleXhrResponse(xhr, $forms[0], $forms[0].id, event, true);
19777
19787
  //handleXhr(xhr, $el, options, require)
@@ -19781,23 +19791,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19781
19791
  triggerEvent(gina, $el, 'loaded.' + id, result);
19782
19792
  return
19783
19793
  }
19784
-
19794
+
19785
19795
  triggerEvent(gina, $forms[0], 'success.' + id, result);
19786
-
19796
+
19787
19797
  }
19788
-
19798
+
19789
19799
  if (GINA_ENV_IS_DEV)
19790
19800
  updateToolbar(result);
19791
19801
 
19792
19802
  } catch (err) {
19793
-
19803
+
19794
19804
  var resultIsObject = false;
19795
-
19805
+
19796
19806
  var result = {
19797
19807
  'status': 422,
19798
19808
  'error' : err.description || err.stack
19799
19809
  };
19800
-
19810
+
19801
19811
  if ( /application\/json/.test( xhr.getResponseHeader("Content-Type") ) ) {
19802
19812
  result.error = JSON.parse(xhr.responseText);
19803
19813
  resultIsObject = true
@@ -19823,8 +19833,8 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19823
19833
  resultIsObject = true
19824
19834
  }
19825
19835
 
19826
- instance.eventData.error = result;
19827
-
19836
+ instance.eventData.error = result;
19837
+
19828
19838
 
19829
19839
  // update toolbar
19830
19840
  if (GINA_ENV_IS_DEV)
@@ -19869,18 +19879,18 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19869
19879
  // sending
19870
19880
  //var data = JSON.stringify({ sample: 'data'});
19871
19881
  xhr.send();
19872
-
19882
+
19873
19883
 
19874
19884
  return {
19875
19885
  'open': function () {
19876
19886
  var fired = false;
19877
19887
  addListener(gina, $el, 'loaded.' + id, function(e) {
19878
-
19888
+
19879
19889
  e.preventDefault();
19880
19890
 
19881
19891
  if (!fired) {
19882
19892
  fired = true;
19883
-
19893
+
19884
19894
  instance.activePopinId = $popin.id;
19885
19895
  popinBind(e, $popin);
19886
19896
  popinOpen($popin.name);
@@ -19895,40 +19905,40 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19895
19905
 
19896
19906
  /**
19897
19907
  * popinLoadContent
19898
- *
19908
+ *
19899
19909
  * @param {string} html - plain/text
19900
19910
  * @param {boolean} [isRedirecting] - to handle link inside popin without form
19901
19911
  */
19902
19912
  function popinLoadContent(stringContent, isRedirecting) {
19903
-
19904
- var $popin = getActivePopin();
19905
- if ( !$popin ) {
19913
+
19914
+ var $popin = getActivePopin();
19915
+ if ( !$popin ) {
19906
19916
  return;
19907
19917
  }
19908
19918
  if (!$popin.isOpen)
19909
19919
  throw new Error('Popin `'+$popin.name+'` is not open !');
19910
-
19920
+
19911
19921
  $popin.isRedirecting = ( typeof(isRedirecting) != 'undefined' ) ? isRedirecting : false;
19912
-
19922
+
19913
19923
  var $el = $popin.target;
19914
- // if (
19915
- // typeof(stringContent) != 'undefined'
19916
- // && typeof(stringContent.trim) == 'function'
19924
+ // if (
19925
+ // typeof(stringContent) != 'undefined'
19926
+ // && typeof(stringContent.trim) == 'function'
19917
19927
  // ) {
19918
- $el.innerHTML = stringContent.trim();
19928
+ $el.innerHTML = stringContent.trim();
19919
19929
  // }
19920
-
19921
- popinUnbind($popin.name, true);
19930
+
19931
+ popinUnbind($popin.name, true);
19922
19932
  popinBind({ target: $el, type: 'loaded.' + $popin.id }, $popin);
19923
-
19933
+
19924
19934
  if ( !$popin.isRedirecting ) {
19925
19935
  triggerEvent(gina, instance.target, 'open.'+ $popin.id, $popin);
19926
19936
  } else {
19927
19937
  triggerEvent(gina, instance.target, 'loaded.' + $popin.id, $popin);
19928
19938
  }
19929
19939
  }
19930
-
19931
- function getScript(source) {
19940
+
19941
+ function getScript(source) {
19932
19942
  // then trigger scripts load
19933
19943
  //var xhr = new XMLHttpRequest();
19934
19944
  var xhr = setupXhr();
@@ -19937,28 +19947,28 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19937
19947
  xhr.onload = function () {
19938
19948
  eval(xhr.response);
19939
19949
  };
19940
- xhr.send();
19950
+ xhr.send();
19941
19951
  }
19942
-
19952
+
19943
19953
  /**
19944
19954
  * popinOpen
19945
- *
19955
+ *
19946
19956
  * If you get a x-origin error, check if you have `Vary` rule
19947
19957
  * set in your policy : // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
19948
- *
19958
+ *
19949
19959
  * Add to your project/env.json the following rule
19950
- * {
19960
+ * {
19951
19961
  * "$bundle" : {
19952
19962
  * "server": {
19953
19963
  * "response": {
19954
19964
  * // other definitions ...
19955
- *
19965
+ *
19956
19966
  * "vary": "Origin"
19957
19967
  * }
19958
19968
  * }
19959
- * }
19969
+ * }
19960
19970
  * }
19961
- *
19971
+ *
19962
19972
  * Opens a popin by name
19963
19973
  *
19964
19974
  * @parama {string} name
@@ -19970,10 +19980,10 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19970
19980
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getPopinById(this.id);
19971
19981
  if ( !$popin ) {
19972
19982
  throw new Error('Popin name `'+name+'` not found !')
19973
- }
19983
+ }
19974
19984
  id = $popin.id;
19975
19985
  $el = document.getElementById(id);
19976
-
19986
+
19977
19987
  // load external resources in order of declaration
19978
19988
  // TODO - Add support for stylesheets
19979
19989
  var globalScriptsList = $popin.parentScripts
@@ -19983,7 +19993,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19983
19993
  , len = scripts.length
19984
19994
  ;
19985
19995
  var domain = gina.config.hostname.replace(/(https|http|)\:\/\//, '').replace(/\:\d+$/, '');
19986
- var reDomain = new RegExp(domain+'\:\\d+\|'+domain);
19996
+ var reDomain = new RegExp(domain+'\:\\d+\|'+domain);
19987
19997
  for (;i < len; ++i) {
19988
19998
  if ( typeof(scripts[i].src) == 'undefined' || scripts[i].src == '' ) {
19989
19999
  continue;
@@ -19994,20 +20004,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
19994
20004
  // don't load if already in the global context
19995
20005
  if ( globalScriptsList.indexOf(filename) > -1 )
19996
20006
  continue;
19997
-
20007
+
19998
20008
  getScript(scripts[i].src);
19999
20009
  }
20000
20010
  //i = 0; len = styles.length
20001
-
20011
+
20002
20012
  popinBind({ target: $el, type: 'loaded.' + $popin.id }, $popin);
20003
-
20013
+
20004
20014
 
20005
20015
  if ( !/gina-popin-is-active/.test($el.className) )
20006
20016
  $el.className += ' gina-popin-is-active';
20007
20017
 
20008
20018
  // overlay
20009
20019
  if ( !/gina-popin-is-active/.test(instance.target.firstChild.className) )
20010
- instance.target.firstChild.className += ' gina-popin-is-active';
20020
+ instance.target.firstChild.className += ' gina-popin-is-active';
20011
20021
  // overlay
20012
20022
  if ( /gina-popin-is-active/.test(instance.target.firstChild.className) ) {
20013
20023
  removeListener(gina, instance.target, 'open.'+ $popin.id)
@@ -20016,7 +20026,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20016
20026
  $popin.isOpen = true;
20017
20027
  // so it can be forwarded to the handler who is listening
20018
20028
  $popin.target = $el;
20019
-
20029
+
20020
20030
  instance.activePopinId = $popin.id;
20021
20031
 
20022
20032
  // update toolbar
@@ -20071,17 +20081,17 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20071
20081
  *
20072
20082
  * */
20073
20083
  function popinUnbind(name, isRouting) {
20074
-
20084
+
20075
20085
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
20076
20086
  var $el = null;
20077
20087
  if ( !$popin && typeof(name) != 'undefined' ) {
20078
20088
  throw new Error('Popin `'+name+'` not found !');
20079
20089
  }
20080
-
20090
+
20081
20091
  // by default
20082
20092
  if ( typeof($popin) != 'undefined' && $popin != null ) {
20083
20093
  $el = $popin.target;
20084
-
20094
+
20085
20095
  isRouting = ( typeof(isRouting) != 'undefined' ) ? isRouting : false;
20086
20096
 
20087
20097
  if ( $el != null && /gina-popin-is-active/.test($el.className) ) {
@@ -20089,7 +20099,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20089
20099
  instance.target.firstChild.className = instance.target.firstChild.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
20090
20100
  $el.className = $el.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
20091
20101
  $el.innerHTML = '';
20092
- }
20102
+ }
20093
20103
 
20094
20104
  // removing from FormValidator instance
20095
20105
  if ($validatorInstance) {
@@ -20103,15 +20113,15 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20103
20113
  }
20104
20114
  }
20105
20115
  }
20106
-
20116
+
20107
20117
  gina.popinIsBinded = false;
20108
-
20118
+
20109
20119
  // remove listeners
20110
20120
  removeListener(gina, $popin.target, 'loaded.' + $popin.id);
20111
20121
  }
20112
- }
20122
+ }
20113
20123
  }
20114
-
20124
+
20115
20125
 
20116
20126
  /**
20117
20127
  * popinClose
@@ -20122,7 +20132,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20122
20132
  *
20123
20133
  * */
20124
20134
  function popinClose(name) {
20125
-
20135
+
20126
20136
  var $popin = null;
20127
20137
  if ( typeof(name) == 'undefined' && /^true$/.test(this.isOpen) ) {
20128
20138
  name = this.name;
@@ -20131,7 +20141,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20131
20141
  $popin = getPopinByName(name) || getActivePopin();
20132
20142
  if (!$popin)
20133
20143
  return;
20134
-
20144
+
20135
20145
  name = $popin.name;
20136
20146
  }
20137
20147
  //var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
@@ -20141,29 +20151,29 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20141
20151
  }
20142
20152
  if (!$popin.isOpen)
20143
20153
  return;
20144
-
20154
+
20145
20155
  // by default
20146
20156
  if ( typeof($popin) != 'undefined' && $popin != null ) {
20147
-
20157
+
20148
20158
  // in case popinClose is called by the user e.g.: binding cancel/close with a <A> tag
20149
20159
  // but at the same time, the <A> href is not empty -> redirection wanted in the HTML
20150
20160
  // in this case, we want to ignore close
20151
20161
  if ( $popin.isRedirecting )
20152
20162
  return;
20153
-
20163
+
20154
20164
  $el = $popin.target;
20155
-
20165
+
20156
20166
  removeListener(gina, $popin.target, 'ready.' + instance.id);
20157
-
20167
+
20158
20168
  if ( $popin.hasForm ) {
20159
20169
  $popin.hasForm = false;
20160
20170
  }
20161
20171
 
20162
20172
  if ( $el != null && /gina-popin-is-active/.test($el.className) ) {
20163
-
20164
- popinUnbind(name);
20173
+
20174
+ popinUnbind(name);
20165
20175
  $popin.isOpen = false;
20166
- gina.popinIsBinded = false;
20176
+ gina.popinIsBinded = false;
20167
20177
 
20168
20178
  // restore toolbar
20169
20179
  if ( GINA_ENV_IS_DEV && gina && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar )
@@ -20176,16 +20186,16 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20176
20186
  ;
20177
20187
  try {
20178
20188
  for (; s<sLen; ++s) {
20179
- document.getElementById( $popin.$headers[s].id ).remove();
20189
+ document.getElementById( $popin.$headers[s].id ).remove();
20180
20190
  }
20181
20191
  } catch(err){
20182
20192
  console.warn('Could not remove script `'+ $popin.$headers[s].id +'`\n'+ err.stack)
20183
20193
  }
20184
- $popin.$headers = [];
20194
+ $popin.$headers = [];
20185
20195
  }
20186
20196
  triggerEvent(gina, $popin.target, 'close.'+ $popin.id, $popin);
20187
20197
  }
20188
- }
20198
+ }
20189
20199
  }
20190
20200
 
20191
20201
  /**
@@ -20197,26 +20207,26 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20197
20207
  *
20198
20208
  * */
20199
20209
  function popinDestroy(name) {
20200
-
20210
+
20201
20211
  var $popin = ( typeof(name) != 'undefined') ? getPopinByName(name) : getActivePopin();
20202
20212
  var id = null, $el = null;
20203
20213
  if ( !$popin && typeof(name) != 'undefined' ) {
20204
20214
  throw new Error('Popin `'+name+'` not found !');
20205
20215
  }
20206
-
20216
+
20207
20217
  id = $popin.id;
20208
20218
  }
20209
-
20219
+
20210
20220
  function registerPopin($popin, options) {
20211
-
20221
+
20212
20222
  if ( typeof(options) != 'object' ) {
20213
20223
  throw new Error('`options` must be an object')
20214
20224
  }
20215
-
20225
+
20216
20226
  $popin.options = merge(options, self.options);
20217
20227
  $popin.id = 'gina-popin-' + instance.id +'-'+ $popin.options['name'];
20218
-
20219
- if ( typeof(instance.$popins[$popin.id]) == 'undefined' ) {
20228
+
20229
+ if ( typeof(instance.$popins[$popin.id]) == 'undefined' ) {
20220
20230
 
20221
20231
  if ( typeof($popin.options['name']) != 'string' || $popin.options['name'] == '' ) {
20222
20232
  throw new Error('`options.name` can not be left `empty` or `undefined`')
@@ -20231,20 +20241,20 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20231
20241
  $validatorInstance = $popin.options['validator'];
20232
20242
  $popin.validateFormById = $validatorInstance.validateFormById;
20233
20243
  }
20234
-
20244
+
20235
20245
 
20236
20246
  $popin.options['class'] = 'gina-popin-container ' + $popin.options['class'];
20237
20247
 
20238
-
20239
- $popin.name = $popin.options['name'];
20240
- $popin.target = instance.target;
20248
+
20249
+ $popin.name = $popin.options['name'];
20250
+ $popin.target = instance.target;
20241
20251
  $popin.load = popinLoad;
20242
20252
  $popin.loadContent = popinLoadContent;
20243
20253
  $popin.open = popinOpen;
20244
20254
  $popin.close = popinClose;
20245
20255
  if (GINA_ENV_IS_DEV)
20246
20256
  $popin.updateToolbar = updateToolbar;
20247
-
20257
+
20248
20258
  // Get main resources
20249
20259
  $popin.parentScripts = [];
20250
20260
  $popin.parentStyles = [];
@@ -20262,7 +20272,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20262
20272
  $popin.parentScripts[s] = filename;
20263
20273
  }
20264
20274
  // Parent Styles
20265
- var mainDocumentStyles = document.getElementsByTagName('link');
20275
+ var mainDocumentStyles = document.getElementsByTagName('link');
20266
20276
  for (let s = 0, len = mainDocumentStyles.length; s < len; s++ ) {
20267
20277
  if ( typeof(mainDocumentStyles[s].rel) == 'undefined' || !/stylesheet/i.test(mainDocumentStyles[s].rel) )
20268
20278
  continue;
@@ -20272,9 +20282,9 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20272
20282
  .replace(reDomain, '');
20273
20283
  $popin.parentStyles[s] = filename;
20274
20284
  }
20275
-
20276
-
20277
-
20285
+
20286
+
20287
+
20278
20288
  instance.$popins[$popin.id] = $popin;
20279
20289
 
20280
20290
  // setting up AJAX
@@ -20290,23 +20300,23 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20290
20300
  catch (e) {}
20291
20301
  }
20292
20302
  }
20293
-
20294
-
20295
-
20296
- bindOpen($popin);
20303
+
20304
+
20305
+
20306
+ bindOpen($popin);
20297
20307
  }
20298
20308
  }
20299
20309
 
20300
20310
  var init = function(options) {
20301
-
20311
+
20302
20312
  setupInstanceProto();
20303
20313
  //instance.on('init', function(event) {
20304
20314
  addListener(gina, instance.target, 'init.'+instance.id, function(e) {
20305
-
20315
+
20306
20316
  var $newPopin = null;
20307
20317
  var popinId = 'gina-popin-' + instance.id +'-'+ options['name'];
20308
- if ( typeof(instance.$popins[popinId]) == 'undefined' ) {
20309
- var $newPopin = merge({}, $popin);
20318
+ if ( typeof(instance.$popins[popinId]) == 'undefined' ) {
20319
+ var $newPopin = merge({}, $popin);
20310
20320
  registerPopin($newPopin, options);
20311
20321
  }
20312
20322
 
@@ -20317,14 +20327,14 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20317
20327
  triggerEvent(gina, instance.target, 'ready.' + instance.id, $newPopin);
20318
20328
  });
20319
20329
 
20320
-
20321
-
20330
+
20331
+
20322
20332
 
20323
20333
  instance.initialized = true;
20324
20334
 
20325
20335
  return instance
20326
20336
  }
20327
-
20337
+
20328
20338
  var setupInstanceProto = function() {
20329
20339
  instance.getPopinById = getPopinById;
20330
20340
  instance.getPopinByName = getPopinByName;
@@ -20334,7 +20344,7 @@ define('gina/popin', [ 'require', 'jquery', 'vendor/uuid','utils/merge', 'utils/
20334
20344
  instance.open = popinOpen;
20335
20345
  instance.close = popinClose;
20336
20346
  }
20337
-
20347
+
20338
20348
 
20339
20349
  if ( !gina.hasPopinHandler ) {
20340
20350
  popinCreateContainer();
@@ -20492,7 +20502,7 @@ define("utils/polyfill", function(){});
20492
20502
 
20493
20503
  /**
20494
20504
  * This file is part of the gina package.
20495
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
20505
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
20496
20506
  *
20497
20507
  * For the full copyright and license information, please view the LICENSE
20498
20508
  * file that was distributed with this source code.