riotjs-rails 0.9.1 → 0.9.4
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.
- checksums.yaml +4 -4
- data/lib/riotjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/riot.js +109 -58
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f5502b82d3614366a5255f3ead2804df572f30b
|
4
|
+
data.tar.gz: bf6620022db75e138a06318a3960d2406e13f5f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0e7d2137ca1c9bfd7d26936243ad81af0f3e97c35fec2c0a9da6bc672d6028e7e933bad4e4d22b9bdedfbabcec4480229f1a4a0f49eb0dbd2592605dc97ceb
|
7
|
+
data.tar.gz: f54d329404bf242f6121e69f3d083c9640333437fa942c5049ce919e12321fc104bbf31a23bbf49c71f4d7cd603354d7bf1b9b9ad53dfdfeed4182de4ccd0eda
|
data/lib/riotjs-rails/version.rb
CHANGED
@@ -1,82 +1,133 @@
|
|
1
|
-
/* Riot.js 0.9.1 | moot.it/riotjs | (c) 2013 Moot Inc | @license: MIT */
|
2
|
-
(function($, win) {
|
3
1
|
|
4
|
-
|
5
|
-
|
2
|
+
/*
|
3
|
+
Riot.js 0.9.4 | moot.it/riotjs | @license MIT
|
4
|
+
(c) 2013 Tero Piirainen, Moot Inc and other contributors.
|
5
|
+
*/
|
6
|
+
(function(top) { "use strict";
|
7
|
+
|
8
|
+
var $ = top.$ = top.$ || {};
|
9
|
+
|
10
|
+
// avoid multiple execution. popstate should be fired only once etc.
|
11
|
+
if ($.riot) return;
|
12
|
+
|
13
|
+
$.riot = "0.9.4";
|
14
|
+
|
15
|
+
function isFunction(el) {
|
16
|
+
return Object.prototype.toString.call(el) == '[object Function]';
|
17
|
+
}
|
18
|
+
|
19
|
+
$.observable = function(el) {
|
20
|
+
|
21
|
+
var callbacks = {},
|
6
22
|
slice = [].slice;
|
7
23
|
|
24
|
+
el.on = function(events, fn) {
|
25
|
+
if (isFunction(fn)) {
|
26
|
+
events = events.split(/\s+/);
|
8
27
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
28
|
+
for (var i = 0, len = events.length, type; i < len; i++) {
|
29
|
+
type = events[i];
|
30
|
+
(callbacks[type] = callbacks[type] || []).push(fn);
|
31
|
+
if (len > 1) fn.typed = true;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return el;
|
35
|
+
};
|
18
36
|
|
19
|
-
|
20
|
-
|
21
|
-
var jq = $({});
|
37
|
+
el.off = function(events, fn) {
|
38
|
+
events = events.split(/\s+/);
|
22
39
|
|
23
|
-
|
24
|
-
|
40
|
+
for (var j = 0, type; j < events.length; j++) {
|
41
|
+
type = events[j];
|
25
42
|
|
26
|
-
|
27
|
-
|
28
|
-
var args = slice.call(arguments, 1)
|
29
|
-
if (names.split(" ")[1]) args.unshift(e.type)
|
30
|
-
fn.apply(obj, args)
|
31
|
-
})
|
43
|
+
// remove single type
|
44
|
+
if (!fn) { callbacks[type] = []; continue; }
|
32
45
|
|
33
|
-
|
34
|
-
|
46
|
+
var fns = callbacks[type] || [],
|
47
|
+
pos = -1;
|
35
48
|
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
for (var i = 0, len = fns.length; i < len; i++) {
|
50
|
+
if (fns[i] === fn || fns[i].listener === fn) { pos = i; break; }
|
51
|
+
}
|
39
52
|
|
40
|
-
|
41
|
-
|
53
|
+
if (pos >= 0) fns.splice(pos, 1);
|
54
|
+
}
|
55
|
+
return el;
|
56
|
+
};
|
42
57
|
|
43
|
-
|
58
|
+
// only single event supported
|
59
|
+
el.one = function(type, fn) {
|
44
60
|
|
45
|
-
|
46
|
-
|
61
|
+
function on() {
|
62
|
+
el.off(type, fn);
|
63
|
+
fn.apply(el, arguments);
|
64
|
+
}
|
47
65
|
|
48
|
-
|
49
|
-
|
66
|
+
if (isFunction(fn)) {
|
67
|
+
on.listener = fn;
|
68
|
+
el.on(type, on);
|
69
|
+
}
|
50
70
|
|
51
|
-
|
52
|
-
|
71
|
+
return el;
|
72
|
+
};
|
53
73
|
|
54
|
-
|
55
|
-
setTimeout(function() {
|
56
|
-
if (!page_popped) win.trigger("popstate")
|
57
|
-
}, 1);
|
74
|
+
el.trigger = function(type) {
|
58
75
|
|
59
|
-
|
60
|
-
|
76
|
+
var args = slice.call(arguments, 1),
|
77
|
+
fns = callbacks[type] || [];
|
61
78
|
|
62
|
-
|
79
|
+
for (var i = 0, len = fns.length, fn, added; i < len; ++i) {
|
80
|
+
fn = fns[i];
|
63
81
|
|
64
|
-
|
65
|
-
|
82
|
+
// possibly removed
|
83
|
+
if (!fn) continue;
|
66
84
|
|
67
|
-
|
68
|
-
|
69
|
-
win.on("popstate", function(e, hash) {
|
70
|
-
to(hash || location.hash)
|
71
|
-
})
|
85
|
+
// add event argument when multiple listeners
|
86
|
+
fn.apply(el, fn.typed ? [type].concat(args) : args);
|
72
87
|
|
73
|
-
// fire
|
74
|
-
} else if (to != location.hash) {
|
75
|
-
if (history.pushState) history.pushState("", "", to)
|
76
|
-
win.trigger("popstate", [to]);
|
77
88
|
}
|
78
89
|
|
79
|
-
|
90
|
+
return el;
|
91
|
+
};
|
92
|
+
|
93
|
+
return el;
|
94
|
+
|
95
|
+
};
|
96
|
+
|
97
|
+
// emit window.popstate event consistently on page load, on every browser
|
98
|
+
var page_popped,
|
99
|
+
fn = $.observable({});
|
100
|
+
|
101
|
+
function pop(hash) {
|
102
|
+
fn.trigger("pop", hash || top.location.hash);
|
103
|
+
}
|
104
|
+
|
105
|
+
function on(event, fn) {
|
106
|
+
top.addEventListener(event, fn, false);
|
107
|
+
}
|
108
|
+
|
109
|
+
on("load", function() {
|
110
|
+
top.setTimeout(function() { page_popped || pop(); }, 1);
|
111
|
+
});
|
112
|
+
|
113
|
+
on("popstate", function(e) {
|
114
|
+
if (!page_popped) page_popped = true;
|
115
|
+
pop();
|
116
|
+
});
|
117
|
+
|
118
|
+
// Change the browser URL or listen to changes on the URL
|
119
|
+
$.route = function(to) {
|
120
|
+
|
121
|
+
// listen
|
122
|
+
if (isFunction(to)) {
|
123
|
+
fn.on("pop", to);
|
124
|
+
|
125
|
+
// fire
|
126
|
+
} else if (to != top.location.hash) {
|
127
|
+
if (top.history.pushState) top.history.pushState("", "", to);
|
128
|
+
pop(to);
|
129
|
+
}
|
80
130
|
|
131
|
+
};
|
81
132
|
|
82
|
-
})(
|
133
|
+
})(window);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riotjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Butler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple asset-pipeline wrapper for riot.js by moot
|
14
14
|
email:
|