Permalink
Browse files

Initial release

  • Loading branch information...
felipevex committed May 4, 2016
1 parent 86455b2 commit 6b473c075ecd6baa3611f34e3b4960d1ab093381
Showing with 44,555 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +38 −1 README.md
  3. +2 −0 extraParams.hxml
  4. +13 −0 haxelib.json
  5. +8 −0 priori.hxml
  6. +32 −0 priori.json
  7. +162 −0 priori/app/PriApp.hx
  8. +27 −0 priori/assets/Asset.hx
  9. +73 −0 priori/assets/AssetAudio.hx
  10. +69 −0 priori/assets/AssetComponent.hx
  11. +81 −0 priori/assets/AssetImage.hx
  12. +132 −0 priori/assets/AssetManager.hx
  13. +30 −0 priori/assets/AssetManagerEvent.hx
  14. +199 −0 priori/audio/PriAudio.hx
  15. +62 −0 priori/event/PriEvent.hx
  16. +204 −0 priori/event/PriEventDispatcher.hx
  17. +22 −0 priori/event/PriMouseEvent.hx
  18. +17 −0 priori/event/PriSwipeEvent.hx
  19. +28 −0 priori/event/PriTapEvent.hx
  20. +13 −0 priori/geom/PriGeomBox.hx
  21. +8 −0 priori/net/PriRequestContentType.hx
  22. +12 −0 priori/net/PriRequestMethod.hx
  23. +12 −0 priori/net/PriURLHeader.hx
  24. +123 −0 priori/net/PriURLLoader.hx
  25. +21 −0 priori/net/PriURLRequest.hx
  26. +74 −0 priori/persistence/PriPersists.hx
  27. +15 −0 priori/plugins/DateTimePicker.hx
  28. +15 −0 priori/plugins/PerfectScrollbars.hx
  29. +35 −0 priori/style/border/BorderStyle.hx
  30. +7 −0 priori/style/border/BorderType.hx
  31. +100 −0 priori/style/font/PriFontStyle.hx
  32. +7 −0 priori/style/font/PriFontStyleAlign.hx
  33. +7 −0 priori/style/font/PriFontStyleItalic.hx
  34. +6 −0 priori/style/font/PriFontStyleVariant.hx
  35. +17 −0 priori/style/font/PriFontStyleWeight.hx
  36. +81 −0 priori/system/PriDevice.hx
  37. +11 −0 priori/system/PriDeviceBrowser.hx
  38. +13 −0 priori/system/PriDeviceSystem.hx
  39. +35 −0 priori/view/PriCanvas.hx
  40. +637 −0 priori/view/PriDisplay.hx
  41. +115 −0 priori/view/PriImage.hx
  42. +83 −0 priori/view/component/PriComponentBase.hx
  43. +84 −0 priori/view/component/PriExtendable.hx
  44. +210 −0 priori/view/container/PriContainer.hx
  45. +171 −0 priori/view/container/PriGroup.hx
  46. +168 −0 priori/view/container/PriScrollableContainer.hx
  47. +24 −0 priori/view/form/PriFormButton.hx
  48. +51 −0 priori/view/form/PriFormCheckBox.hx
  49. +30 −0 priori/view/form/PriFormElementBase.hx
  50. +78 −0 priori/view/form/PriFormInputText.hx
  51. +66 −0 priori/view/form/PriFormLabel.hx
  52. +207 −0 priori/view/form/PriFormSelect.hx
  53. +515 −0 priori/view/grid/PriDataGrid.hx
  54. +30 −0 priori/view/grid/PriDataGridEvent.hx
  55. +31 −0 priori/view/grid/PriDataGridInterval.hx
  56. +111 −0 priori/view/grid/cell/PriGridCellRenderer.hx
  57. +43 −0 priori/view/grid/cell/PriGridCellRendererCheck.hx
  58. +40 −0 priori/view/grid/cell/PriGridCellRendererDefault.hx
  59. +76 −0 priori/view/grid/column/PriGridColumn.hx
  60. +82 −0 priori/view/grid/column/PriGridColumnSize.hx
  61. +49 −0 priori/view/grid/column/PriGridColumnSort.hx
  62. +182 −0 priori/view/grid/header/PriGridHeader.hx
  63. +25 −0 priori/view/grid/header/PriGridHeaderRenderer.hx
  64. +40 −0 priori/view/grid/header/PriGridHeaderRendererDefault.hx
  65. +39 −0 priori/view/grid/header/PriGridHeaderSortCaret.hx
  66. +57 −0 priori/view/grid/header/PriGridHeaderSortCaretDefault.hx
  67. +186 −0 priori/view/grid/row/PriGridRow.hx
  68. +143 −0 priori/view/layout/PriGridLayout.hx
  69. +52 −0 priori/view/layout/PriHorizontalLayout.hx
  70. +71 −0 priori/view/layout/PriLayout.hx
  71. +7 −0 priori/view/layout/PriLayoutAlignType.hx
  72. +6 −0 priori/view/layout/PriLayoutDistributionType.hx
  73. +7 −0 priori/view/layout/PriLayoutSizeType.hx
  74. +53 −0 priori/view/layout/PriVerticalLayout.hx
  75. +130 −0 priori/view/text/PriText.hx
  76. +3 −0 priori_run.hxml
  77. +19 −0 project/cleanbase/priori.json
  78. +28 −0 project/cleanbase/src/Main._hx
  79. +18 −0 project/main/MainBuild._hx
  80. BIN run.n
  81. +112 −0 src_run/HaxeLib.hx
  82. +16 −0 src_run/Main.hx
  83. +111 −0 src_run/PrioriRun.hx
  84. +81 −0 src_run/data/PrioriArgs.hx
  85. +76 −0 src_run/data/PrioriData.hx
  86. +30 −0 src_run/helper/Helper.hx
  87. +124 −0 src_run/helper/HelperBuilder.hx
  88. +152 −0 src_run/helper/HelperLib.hx
  89. +17 −0 src_run/helper/HelperOutput.hx
  90. +167 −0 src_run/helper/HelperPath.hx
  91. +42 −0 src_run/helper/HelperPlatform.hx
  92. +67 −0 src_run/helper/HelperProcess.hx
  93. +28 −0 template/css/priori.css
  94. +19 −0 template/index.html
  95. +4 −0 template/js/html5shiv.min.js
  96. +4 −0 template/js/jquery-2.1.4.min.js
  97. +1 −0 template/js/jquery.mobile-events.min.js
  98. +5 −0 template/js/respond.min.js
  99. +3 −0 test/PriCompTest.html
  100. +6 −0 test/PriComponentLayout.html
  101. BIN test/audio/explode.ogg
  102. +476 −0 test/css/bootstrap-theme.css
  103. +1 −0 test/css/bootstrap-theme.css.map
  104. +5 −0 test/css/bootstrap-theme.min.css
  105. +6,584 −0 test/css/bootstrap.css
  106. +1 −0 test/css/bootstrap.css.map
  107. +5 −0 test/css/bootstrap.min.css
  108. +28 −0 test/css/priori.css
  109. +3 −0 test/data/data.php
  110. BIN test/fonts/glyphicons-halflings-regular.eot
  111. +288 −0 test/fonts/glyphicons-halflings-regular.svg
  112. BIN test/fonts/glyphicons-halflings-regular.ttf
  113. BIN test/fonts/glyphicons-halflings-regular.woff
  114. BIN test/fonts/glyphicons-halflings-regular.woff2
  115. +56 −0 test/index.html
  116. +2,317 −0 test/js/bootstrap.js
  117. +7 −0 test/js/bootstrap.min.js
  118. +4 −0 test/js/html5shiv.min.js
  119. +9,210 −0 test/js/jquery-2.1.4.js
  120. +4 −0 test/js/jquery-2.1.4.min.js
  121. +9,977 −0 test/js/moment-with-locales.js
  122. +13 −0 test/js/npm.js
  123. +5 −0 test/js/respond.min.js
  124. +472 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker.css
  125. +8 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css
  126. +505 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker.standalone.css
  127. +8 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css
  128. +791 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.css
  129. +8 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css
  130. +822 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.css
  131. +8 −0 test/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.min.css
  132. +1,920 −0 test/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js
  133. +8 −0 test/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js
  134. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ar.min.js
  135. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.az.min.js
  136. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.bg.min.js
  137. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.bs.min.js
  138. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ca.min.js
  139. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.cs.min.js
  140. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.cy.min.js
  141. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.da.min.js
  142. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.de.min.js
  143. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.el.min.js
  144. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.en-GB.min.js
  145. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.eo.min.js
  146. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.es.min.js
  147. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.et.min.js
  148. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.eu.min.js
  149. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fa.min.js
  150. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fi.min.js
  151. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fo.min.js
  152. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fr-CH.min.js
  153. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fr.min.js
  154. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.gl.min.js
  155. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.he.min.js
  156. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.hr.min.js
  157. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.hu.min.js
  158. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.hy.min.js
  159. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.id.min.js
  160. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.is.min.js
  161. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.it-CH.min.js
  162. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.it.min.js
  163. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ja.min.js
  164. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ka.min.js
  165. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.kh.min.js
  166. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.kk.min.js
  167. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ko.min.js
  168. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.kr.min.js
  169. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.lt.min.js
  170. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.lv.min.js
  171. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.me.min.js
  172. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.mk.min.js
  173. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.mn.min.js
  174. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ms.min.js
  175. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.nb.min.js
  176. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.nl-BE.min.js
  177. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.nl.min.js
  178. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.no.min.js
  179. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.pl.min.js
  180. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.pt-BR.min.js
  181. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.pt.min.js
  182. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ro.min.js
  183. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.rs-latin.min.js
  184. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.rs.min.js
  185. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.ru.min.js
  186. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sk.min.js
  187. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sl.min.js
  188. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sq.min.js
  189. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sr-latin.min.js
  190. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sr.min.js
  191. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sv.min.js
  192. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.sw.min.js
  193. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.th.min.js
  194. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.tr.min.js
  195. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.uk.min.js
  196. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.vi.min.js
  197. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js
  198. +1 −0 test/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-TW.min.js
  199. +5 −0 test/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css
  200. +9 −0 test/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js
  201. +183 −0 test/plugins/jquery-mobile-events/README.md
  202. +875 −0 test/plugins/jquery-mobile-events/jquery.mobile-events.js
  203. +1 −0 test/plugins/jquery-mobile-events/jquery.mobile-events.min.js
  204. +104 −0 test/plugins/perfect-scrollbar/css/perfect-scrollbar.css
  205. +2 −0 test/plugins/perfect-scrollbar/css/perfect-scrollbar.min.css
  206. +2 −0 test/plugins/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js
  207. +2 −0 test/plugins/perfect-scrollbar/js/min/perfect-scrollbar.min.js
  208. +1,450 −0 test/plugins/perfect-scrollbar/js/perfect-scrollbar.jquery.js
  209. +1,421 −0 test/plugins/perfect-scrollbar/js/perfect-scrollbar.js
  210. +2 −0 test/priori/awesome/FAIcon.html
  211. +4 −0 test/priori/bootstrap/Button.html
  212. +12 −0 test/priori/bootstrap/DropDown.html
  213. +20 −0 test/priori/bootstrap/DropDownSplit.html
  214. +1 −0 test/priori/bootstrap/FormCheckbox.html
  215. +6 −0 test/priori/bootstrap/FormDatePicker.html
  216. +6 −0 test/priori/bootstrap/FormDateTimePicker.html
  217. +1 −0 test/priori/bootstrap/FormField.html
  218. +1 −0 test/priori/bootstrap/FormLabel.html
  219. +1 −0 test/priori/bootstrap/FormSelect.html
  220. +1 −0 test/priori/bootstrap/Icon.html
  221. +1 −0 test/priori/bootstrap/Label.html
  222. +2 −0 test/priori/bootstrap/NavTab.html
View
@@ -0,0 +1 @@
*.iml
View
@@ -1 +1,38 @@
# priori
![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) ![Haxelib Version](https://img.shields.io/github/tag/triture/priori.svg?style=flat&label=haxelib)
# Priori
Build Single Page Application only using Haxe? Priori is the answer.
Priori helps you to create cross-browser web apps for desktops, tablets and smartphones using all benefits of the modern, high level, strictly typed programming language that you already know - and love.
## Simple to use
If you are familiar with OpenfFL, you will feel at home. Otherwise, you can check our [example project](https://github.com/triture/priori-example) to start your experimentations.
**Create New Project**
```
haxelib run priori create
```
**Compile Project**
```
haxelib run priori build
```
Optional Parameters:
- -f : priori.json file name
- -p : source path
- -D : Any -D flag will be passed to the haxe compiler
## Instalation
Requires [Haxe](http://haxe.org) 3.1.0+.
* **Step one:** install jQueryExtern lib via [haxelib](http://haxe.org/doc/haxelib/using_haxelib): `haxelib install jQueryExtern`
* **Step two:** install Priori lib: `haxelib install priori`
You can also install aditional priori libs:
- [Bootstrap for Priori](https://github.com/triture/priori-bootstrap): `haxelib install priori-bootstrap`
- [Font Awesome for Priori](https://github.com/triture/priori-fontawesome): `haxelib install priori-fontawesome`
- [Scene Manager for Priori](https://github.com/triture/priori-scenemanager): `haxelib install priori-scenemanager`
## Priori Example Project
Check out some Priori [examples](https://github.com/triture/priori-example).
View
@@ -0,0 +1,2 @@
--macro jQuery.haxe.Config.addPlugin('priori.plugins.PerfectScrollbars')
--macro jQuery.haxe.Config.addPlugin('priori.plugins.DateTimePicker')
View
@@ -0,0 +1,13 @@
{
"name": "priori",
"url": "",
"license": "MIT",
"tags": [ "html5", "web", "js", "javascript", "priori", "spa", "cross", "webapp"],
"description": "Build Single Page Application only using Haxe",
"version": "0.0.1",
"releasenote": "Initial release. Fully functional but many things are changing yet.",
"contributors": [ "triture" ],
"dependencies": {
"jQueryExtern" : ""
}
}
View
@@ -0,0 +1,8 @@
-lib jQueryExtern
-lib priori
-cp src_test
-main Main
-js out/release/priori.js
View
@@ -0,0 +1,32 @@
{
"project_name" : "Priori",
"lang" : "en",
"meta" : [
"<meta charset=\"utf-8\">",
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">",
"<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">",
"<meta name=\"apple-touch-fullscreen\" content=\"yes\">",
"<meta id=\"extViewportMeta\" name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no\">"
],
"link" : [
"<!--[if lt IE 9]> \n <script type=\"text/javascript\" src=\"js/html5shiv.min.js\"></script> \n <![endif]-->",
"<!--[if lt IE 9]> \n <script type=\"text/javascript\" src=\"js/respond.min.js\"></script> \n <![endif]-->",
"<script type=\"text/javascript\" src=\"js/jquery-2.1.4.min.js\"></script>",
"<script type=\"text/javascript\" src=\"js/jquery.mobile-events.min.js\"></script>",
"<link href=\"css/priori.css\" rel=\"stylesheet\">"
],
"dependencies" : [
"jQueryExtern"
],
"src" : [
"src"
],
"template" : "template",
"output" : "build"
}
View
@@ -0,0 +1,162 @@
package priori.app;
import haxe.ds.StringMap;
import priori.assets.AssetManagerEvent;
import priori.view.container.PriGroup;
import priori.assets.AssetManager;
import jQuery.Event;
import priori.event.PriEvent;
import haxe.Timer;
import priori.geom.PriGeomBox;
import jQuery.JQuery;
import priori.app.PriApp;
import priori.view.PriDisplay;
class PriApp extends PriGroup {
public static var PRIORI_MAP:StringMap<Dynamic> = new StringMap<Dynamic>();
private static var _g:PriApp;
private var _body:JQuery;
private var _window:JQuery;
private var _document:JQuery;
private var _fps:Int;
private var _delta:Float;
private var _timer:Timer;
private var _fullSetupCalled:Bool;
public function new() {
if (_g != null) {
throw "Do not create PriApp instance";
} else {
_g = this;
}
this._fps = 60;
super();
trace("** PRIORI APP **");
this.setupApp();
}
@noCompletion override private function set_width(value:Float) {
return value;
}
@noCompletion override private function get_width():Float {
return this.getAppSize().width;
}
@noCompletion override private function set_height(value:Float):Float {
return value;
}
@noCompletion override private function get_height():Float {
return this.getAppSize().height;
}
@noCompletion override private function set_x(value:Float) {
return 0;
}
@noCompletion override private function get_x():Float {
return 0;
}
@noCompletion override private function set_y(value:Float) {
return 0;
}
@noCompletion override private function get_y():Float {
return 0;
}
public function getMSUptate():Int {
return Std.int(1000 / this._fps);
}
private function setupApp():Void {
var box:PriGeomBox = this.getAppSize();
this.getElement().css("width", "100%");
this.getElement().css("height", "100%");
this.getElement().css("position", "fixed");
this.getWindow().resize(
function(e:Event):Void {
this.dispatchEvent(new PriEvent(PriEvent.RESIZE, false));
}
);
// prevent backspace
this.getDocument().keydown(function (e) {
if (e.which == 8 && !(new JQuery(e.target).is("input:not([readonly]):not([type=radio]):not([type=checkbox]), textarea, [contentEditable], [contentEditable=true]"))) {
e.preventDefault();
}
});
var body:JQuery = this.getBody();
body.css("border", "0px");
body.css("margin", "0px");
body.append(this.getElement());
this.dispatchEvent(new PriEvent(PriEvent.ADDED_TO_APP, true));
this.dispatchEvent(new PriEvent(PriEvent.RESIZE, false));
this.invalidate();
this.validate();
}
public function getAppSize():PriGeomBox {
var b:PriGeomBox = new PriGeomBox();
var e:JQuery = this.getWindow();
b.width = e.width();
b.height = e.height();
b.x = 0;
b.y = 0;
return b;
}
private function getDocument():JQuery {
return new JQuery(js.Browser.document);
}
private function getWindow():JQuery {
if (_window == null) {
_window = new JQuery(js.Browser.window);
}
return _window;
}
public function getBody():JQuery {
if (_body == null) {
_body = new JQuery("body");
}
return _body;
}
public static function g():PriApp {
if (_g == null) {
throw "Application not yet created";
}
return _g;
}
}
View
@@ -0,0 +1,27 @@
package priori.assets;
import priori.event.PriEventDispatcher;
import jQuery.JQuery;
import String;
class Asset extends PriEventDispatcher {
public var id:String;
public var url:String;
public function new(id:String, url:String) {
super();
this.id = id;
this.url = url;
}
public function load():Void {
}
public function getElement():JQuery {
return new JQuery();
}
}
@@ -0,0 +1,73 @@
package priori.assets;
import jQuery.Event;
import priori.event.PriEvent;
import jQuery.JQuery;
class AssetAudio extends Asset {
private var _elementId:String;
private var _isLoading:Bool = false;
private var _isLoaded:Bool = false;
private var _element:JQuery;
public var urlMP3:String;
public function new(id:String, urlOGG:String, urlMP3:String = null) {
this.urlMP3 = urlMP3;
super(id, urlOGG);
}
override public function load():Void {
if (_isLoaded == false && _isLoading == false) {
this._isLoading = true;
this._element = new JQuery("<audio>");
this._element.on("loadeddata", this._onLoadAudio);
if (this.url != null && this.url != "") {
this._element.append(new JQuery("<source>", {src : this.url, type : "audio/ogg"}));
}
if (this.urlMP3 != null && this.urlMP3 != "") {
this._element.append(new JQuery("<source>", {src : this.urlMP3, type : "audio/mp3"}));
}
this._element.find("source").on("error", this._onErrorAudio);
} else if (_isLoaded) {
this.dispatchEvent(new PriEvent(PriEvent.COMPLETE));
}
}
override public function getElement():JQuery {
if (_isLoaded == false) {
throw "Asset not loaded";
}
return this._element.clone();
}
private function _onErrorAudio(e:Event):Void {
this._isLoading = false;
this._isLoaded = false;
this._element.off();
this._element.find("source").off();
this._element = null;
this.dispatchEvent(new PriEvent(PriEvent.ERROR));
}
private function _onLoadAudio(e:Event):Void {
this._isLoading = false;
this._isLoaded = true;
this._element.off();
this._element.find("source").off();
this.dispatchEvent(new PriEvent(PriEvent.COMPLETE));
}
}
Oops, something went wrong.

0 comments on commit 6b473c0

Please sign in to comment.