riotjs-rails 0.9.5 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/riotjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/riot.js +86 -79
- 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: fff3e2e20b71c20b47c77462ed46a02d531d23c3
|
4
|
+
data.tar.gz: 4bdf83ef0ffc93fd1242ee9a1d2e4c0e8efec3ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61444d1aa78a9c0ab13b5b4d883923a05e12277844f62c9239525039a99cefc56e6d80034513f050685d3e9829b3685ac61ba8bd9b229bb36916e4481ec6e17b
|
7
|
+
data.tar.gz: 4f3fcc0711c045441496e8b557aa13a29258d3d73b1de7b5730e42fb31b7cc38ed09b4345f2b3b19fb5a18dd0408284a4714e453d7225bf8f8347ad2b6494689
|
data/lib/riotjs-rails/version.rb
CHANGED
@@ -1,110 +1,117 @@
|
|
1
|
+
/*
|
2
|
+
Riot.js 0.9.7 | moot.it/riotjs | @license MIT
|
3
|
+
(c) 2013 Tero Piirainen, Moot Inc and other contributors.
|
4
|
+
*/
|
5
|
+
(function($) { "use strict";
|
1
6
|
|
7
|
+
$.observable = function(el) {
|
8
|
+
var callbacks = {}, slice = [].slice;
|
2
9
|
|
3
|
-
|
4
|
-
/*global exports, window, setTimeout, history, location, document */
|
10
|
+
el.on = function(events, fn) {
|
5
11
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
// avoid multiple execution. popstate should be fired only once etc.
|
10
|
-
if ($.riot) return;
|
11
|
-
|
12
|
-
$.riot = "0.9.5";
|
13
|
-
|
14
|
-
$.observable = function(el) {
|
15
|
-
|
16
|
-
var callbacks = {},
|
17
|
-
slice = [].slice;
|
12
|
+
if (typeof fn === "function") {
|
13
|
+
events = events.split(/\s+/);
|
18
14
|
|
19
|
-
|
15
|
+
for (var i = 0, len = events.length, type; i < len; i++) {
|
16
|
+
type = events[i];
|
17
|
+
(callbacks[type] = callbacks[type] || []).push(fn);
|
18
|
+
if (len > 1) fn.typed = true;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return el;
|
22
|
+
};
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
el.off = function(events) {
|
25
|
+
events = events.split(/\s+/);
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
if (len > 1) fn.typed = true;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
return el;
|
31
|
-
};
|
27
|
+
for (var i = 0; i < events.length; i++) {
|
28
|
+
callbacks[events[i]] = [];
|
29
|
+
}
|
32
30
|
|
33
|
-
el
|
34
|
-
|
31
|
+
return el;
|
32
|
+
};
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
// only single event supported
|
35
|
+
el.one = function(type, fn) {
|
36
|
+
if (fn) fn.one = true;
|
37
|
+
return el.on(type, fn);
|
39
38
|
|
40
|
-
|
41
|
-
};
|
39
|
+
};
|
42
40
|
|
43
|
-
|
44
|
-
el.one = function(type, fn) {
|
45
|
-
if (fn) fn.one = true;
|
46
|
-
return el.on(type, fn);
|
41
|
+
el.trigger = function(type) {
|
47
42
|
|
48
|
-
|
43
|
+
var args = slice.call(arguments, 1),
|
44
|
+
fns = callbacks[type] || [];
|
49
45
|
|
50
|
-
|
46
|
+
for (var i = 0, fn; i < fns.length; ++i) {
|
47
|
+
fn = fns[i];
|
51
48
|
|
52
|
-
|
53
|
-
fns = callbacks[type] || [];
|
49
|
+
if (fn.one && fn.done) continue;
|
54
50
|
|
55
|
-
|
56
|
-
|
51
|
+
// add event argument when multiple listeners
|
52
|
+
fn.apply(el, fn.typed ? [type].concat(args) : args);
|
57
53
|
|
58
|
-
|
54
|
+
fn.done = true;
|
55
|
+
}
|
59
56
|
|
60
|
-
|
61
|
-
|
57
|
+
return el;
|
58
|
+
};
|
62
59
|
|
63
|
-
|
64
|
-
}
|
60
|
+
return el;
|
65
61
|
|
66
|
-
|
67
|
-
};
|
62
|
+
};
|
68
63
|
|
69
|
-
|
64
|
+
// Precompiled templates (JavaScript functions)
|
65
|
+
var FN = {};
|
70
66
|
|
71
|
-
|
67
|
+
// Render a template with data
|
68
|
+
$.render = function(template, data) {
|
69
|
+
if(!template) return '';
|
72
70
|
|
73
|
-
|
71
|
+
FN[template] = FN[template] || new Function("_",
|
72
|
+
"return '" + template
|
73
|
+
.replace(/\n/g, "\\n")
|
74
|
+
.replace(/\r/g, "\\r")
|
75
|
+
.replace(/'/g, "\\'")
|
76
|
+
.replace(/\{\s*(\w+)\s*\}/g, "'+(_.$1?(_.$1+'').replace(/&/g,'&').replace(/\"/g,'"').replace(/</g,'<').replace(/>/g,'>'):(_.$1===0?0:''))+'") + "'"
|
77
|
+
);
|
74
78
|
|
75
|
-
|
76
|
-
|
77
|
-
fn = $.observable({}),
|
78
|
-
listen = top.addEventListener,
|
79
|
-
doc = document;
|
79
|
+
return FN[template](data);
|
80
|
+
};
|
80
81
|
|
81
|
-
function pop(hash) {
|
82
|
-
hash = hash.type ? location.hash : hash;
|
83
|
-
if (hash != currentHash) fn.trigger("pop", hash);
|
84
|
-
currentHash = hash;
|
85
|
-
}
|
86
82
|
|
87
|
-
|
88
|
-
|
89
|
-
doc.addEventListener("DOMContentLoaded", pop, false);
|
83
|
+
// browsers only
|
84
|
+
if (typeof top != "object") return;
|
90
85
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
86
|
+
// cross browser popstate
|
87
|
+
var currentHash,
|
88
|
+
pops = $.observable({}),
|
89
|
+
listen = window.addEventListener,
|
90
|
+
doc = document;
|
95
91
|
|
96
|
-
|
92
|
+
function pop(hash) {
|
93
|
+
hash = hash.type ? location.hash : hash;
|
94
|
+
if (hash != currentHash) pops.trigger("pop", hash);
|
95
|
+
currentHash = hash;
|
96
|
+
}
|
97
97
|
|
98
|
-
|
99
|
-
|
98
|
+
if (listen) {
|
99
|
+
listen("popstate", pop, false);
|
100
|
+
doc.addEventListener("DOMContentLoaded", pop, false);
|
100
101
|
|
101
|
-
|
102
|
-
|
102
|
+
} else {
|
103
|
+
doc.attachEvent("onreadystatechange", function() {
|
104
|
+
if (doc.readyState === "complete") pop("");
|
105
|
+
});
|
106
|
+
}
|
103
107
|
|
104
|
-
|
105
|
-
|
106
|
-
|
108
|
+
// Change the browser URL or listen to changes on the URL
|
109
|
+
$.route = function(to) {
|
110
|
+
// listen
|
111
|
+
if (typeof to === "function") return pops.on("pop", to);
|
107
112
|
|
108
|
-
|
113
|
+
// fire
|
114
|
+
if (history.pushState) history.pushState(0, 0, to);
|
115
|
+
pop(to);
|
109
116
|
|
110
|
-
})(typeof
|
117
|
+
};})(typeof top == "object" ? window.$ || (window.$ = {}) : exports);
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Butler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple asset-pipeline wrapper for riot.js by moot
|
14
14
|
email:
|