vendor/assets/build/js/atome/atome.js in atome-0.5.1.1 vs vendor/assets/build/js/atome/atome.js in atome-0.5.1.4
- old
+ new
@@ -58,25 +58,98 @@
// }
// Usage:
// let atomeDrag = new AtomeDrag();
// atomeDrag.drag('atome_id', 'options');
+const Atomeanimation = {}
-const Atomeanimation ={
-
-}
-
// TODO: put in a class
+
const atome = {
- jsSchedule: function (years, months, days, hours, minutes, seconds, proc) {
+ jsSchedule: function (years, months, days, hours, minutes, seconds, atome, proc) {
const now = new Date();
- const formatedDate = new Date(years, months - 1, days, hours, minutes, seconds);
- const diffTime = Math.abs(formatedDate - now);
+ const formatDate = new Date(years, months - 1, days, hours, minutes, seconds);
+ const diffTime = Math.abs(formatDate - now);
setTimeout(function () {
- Opal.Object.$schedule_callback(proc);
+ atome.$schedule_callback(proc);
}, diffTime);
+ },
+ jsReader: function (file, atome, proc) {
+ fetch('medias/' + file)
+ .then(response => response.text())
+ .then(text => atome.$read_callback(text, proc))
+ },
+ js_Fullscreen: function (atome_id){
+ let elem = document.getElementById(atome_id)
+ if (elem.requestFullscreen) {
+ elem.requestFullscreen();
+ } else if (elem.webkitRequestFullscreen) { /* Safari */
+ elem.webkitEnterFullscreen();
+ } else if (elem.msRequestFullscreen) { /* IE11 */
+ elem.msRequestFullscreen();
+ }
+
}
+
}
+
+
+// example ruby equivalent in js //
+Opal.queue(function (Opal) {/* Generated by Opal 1.6.0 */
+ const $klass = Opal.klass, $defs = Opal.defs, $def = Opal.def;
+// The line below create the AtomicJS cons to simplify access to js object from ruby
+
+ // var $const_set = Opal.const_set, $nesting = [], nil = Opal.nil;
+ // return $const_set($nesting[0], 'AtomicJS', atome)
+
+ (function ($base, $super) {
+ const self = $klass($base, $super, 'Atome_html');
+ $def(self, '$initialize', function $$initialize(val) {
+ // Init code below
+ }, 1);
+
+ $defs(self, '$check_this', function $$check_this(val) {
+ // getter code below
+ return (val);
+ }, 0);
+
+ $def(self, '$way', function $way() {
+ // getter code below
+ return (self.my_var);
+ }, 0);
+
+ return $def(self, '$way=', function $way(val) {
+ //self method example
+ return (self.my_var = val);
+ }, 0);
+
+
+ })();
+
+ // new class below
+ return (function ($base, $super) {
+ const self = $klass($base, $super, 'Atome');
+
+ $defs(self, '$verif', function $$verif(val) {
+ //self method example
+ return (val);
+ }, 0);
+
+ $def(self, '$new_method', function $way() {
+ // getter code below
+ return (self.new_method);
+ }, 0);
+
+
+ return $def(self, '$new_method=', function $way(val) {
+ //setter code below
+ return (self.atome = val);
+ }, 0);
+
+ })();
+});
+
+