riotjs-rails 0.9.8 → 1.0.4
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 +81 -57
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f222c4cd22794990b0681aa182d3af6f72cd1f5f
|
4
|
+
data.tar.gz: 915c88f6e99f63079c46144eeec23181b8494bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b242901d2737c0f5a26bf6d3583eabe7ecc166ac2d8573b836eff2465fa702b920dd53863dd0c08e5132e4a229935ab56ff400484b32d4132bd9a7380a44a45
|
7
|
+
data.tar.gz: 7b11dbaedd9be16fa687695ff555e68b8bb061025af6f88101699adaaa95155bb911405c93165fb2e3ef9b47cde4216f64d1d7170330f4a2b99cc35796e755d1
|
data/lib/riotjs-rails/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
/* Riot 0.
|
2
|
-
(function(
|
1
|
+
/* Riot 1.0.4, @license MIT, (c) 2014 Muut Inc + contributors */
|
2
|
+
(function(riot) { "use strict";
|
3
3
|
|
4
|
-
|
4
|
+
riot.observable = function(el) {
|
5
5
|
var callbacks = {}, slice = [].slice;
|
6
6
|
|
7
7
|
el.on = function(events, fn) {
|
8
8
|
if (typeof fn === "function") {
|
9
|
-
events.replace(
|
9
|
+
events.replace(/\S+/g, function(name, pos) {
|
10
10
|
(callbacks[name] = callbacks[name] || []).push(fn);
|
11
11
|
fn.typed = pos > 0;
|
12
12
|
});
|
@@ -14,11 +14,18 @@ $.observable = function(el) {
|
|
14
14
|
return el;
|
15
15
|
};
|
16
16
|
|
17
|
-
el.off = function(events) {
|
18
|
-
events
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
el.off = function(events, fn) {
|
18
|
+
if (events === "*") callbacks = {};
|
19
|
+
else if (fn) {
|
20
|
+
var arr = callbacks[events];
|
21
|
+
for (var i = 0, cb; (cb = arr && arr[i]); ++i) {
|
22
|
+
if (cb === fn) { arr.splice(i, 1); i--; }
|
23
|
+
}
|
24
|
+
} else {
|
25
|
+
events.replace(/\S+/g, function(name) {
|
26
|
+
callbacks[name] = [];
|
27
|
+
});
|
28
|
+
}
|
22
29
|
return el;
|
23
30
|
};
|
24
31
|
|
@@ -32,11 +39,11 @@ $.observable = function(el) {
|
|
32
39
|
var args = slice.call(arguments, 1),
|
33
40
|
fns = callbacks[name] || [];
|
34
41
|
|
35
|
-
for (var i = 0, fn; fn = fns[i]; ++i) {
|
36
|
-
if (!
|
42
|
+
for (var i = 0, fn; (fn = fns[i]); ++i) {
|
43
|
+
if (!fn.busy) {
|
37
44
|
fn.busy = true;
|
38
45
|
fn.apply(el, fn.typed ? [name].concat(args) : args);
|
39
|
-
fn.
|
46
|
+
if (fn.one) { fns.splice(i, 1); i--; }
|
40
47
|
fn.busy = false;
|
41
48
|
}
|
42
49
|
}
|
@@ -47,59 +54,76 @@ $.observable = function(el) {
|
|
47
54
|
return el;
|
48
55
|
|
49
56
|
};
|
57
|
+
var FN = {}, // Precompiled templates (JavaScript functions)
|
58
|
+
template_escape = {"\\": "\\\\", "\n": "\\n", "\r": "\\r", "'": "\\'"},
|
59
|
+
render_escape = {'&': '&', '"': '"', '<': '<', '>': '>'};
|
50
60
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
if(!template) return '';
|
61
|
+
function default_escape_fn(str, key) {
|
62
|
+
return str == null ? '' : (str+'').replace(/[&\"<>]/g, function(char) {
|
63
|
+
return render_escape[char];
|
64
|
+
});
|
65
|
+
}
|
57
66
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
.replace(/\r/g, "\\r")
|
62
|
-
.replace(/'/g, "\\'")
|
63
|
-
.replace(/\{\s*(\w+)\s*\}/g, "'+(_.$1?(_.$1+'').replace(/&/g,'&').replace(/\"/g,'"').replace(/</g,'<').replace(/>/g,'>'):(_.$1===0?0:''))+'") + "'"
|
64
|
-
);
|
67
|
+
riot.render = function(tmpl, data, escape_fn) {
|
68
|
+
if (escape_fn === true) escape_fn = default_escape_fn;
|
69
|
+
tmpl = tmpl || '';
|
65
70
|
|
66
|
-
return FN[
|
71
|
+
return (FN[tmpl] = FN[tmpl] || new Function("_", "e", "return '" +
|
72
|
+
tmpl.replace(/[\\\n\r']/g, function(char) {
|
73
|
+
return template_escape[char];
|
74
|
+
}).replace(/{\s*([\w\.]+)\s*}/g, "' + (e?e(_.$1,'$1'):_.$1||(_.$1==null?'':_.$1)) + '") + "'")
|
75
|
+
)(data, escape_fn);
|
67
76
|
};
|
68
|
-
|
69
|
-
|
70
77
|
/* Cross browser popstate */
|
78
|
+
(function () {
|
79
|
+
// for browsers only
|
80
|
+
if (typeof window === "undefined") return;
|
81
|
+
|
82
|
+
var currentHash,
|
83
|
+
pops = riot.observable({}),
|
84
|
+
listen = window.addEventListener,
|
85
|
+
doc = document;
|
86
|
+
|
87
|
+
function pop(hash) {
|
88
|
+
hash = hash.type ? location.hash : hash;
|
89
|
+
if (hash !== currentHash) pops.trigger("pop", hash);
|
90
|
+
currentHash = hash;
|
91
|
+
}
|
92
|
+
|
93
|
+
/* Always fire pop event upon page load (normalize behaviour across browsers) */
|
94
|
+
|
95
|
+
// standard browsers
|
96
|
+
if (listen) {
|
97
|
+
listen("popstate", pop, false);
|
98
|
+
doc.addEventListener("DOMContentLoaded", pop, false);
|
99
|
+
|
100
|
+
// IE
|
101
|
+
} else {
|
102
|
+
doc.attachEvent("onreadystatechange", function() {
|
103
|
+
if (doc.readyState === "complete") pop("");
|
104
|
+
});
|
105
|
+
}
|
71
106
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
pops = $.observable({}),
|
77
|
-
listen = window.addEventListener,
|
78
|
-
doc = document;
|
79
|
-
|
80
|
-
function pop(hash) {
|
81
|
-
hash = hash.type ? location.hash : hash;
|
82
|
-
if (hash != currentHash) pops.trigger("pop", hash);
|
83
|
-
currentHash = hash;
|
84
|
-
}
|
107
|
+
/* Change the browser URL or listen to changes on the URL */
|
108
|
+
riot.route = function(to) {
|
109
|
+
// listen
|
110
|
+
if (typeof to === "function") return pops.on("pop", to);
|
85
111
|
|
86
|
-
|
87
|
-
|
88
|
-
|
112
|
+
// fire
|
113
|
+
if (history.pushState) history.pushState(0, 0, to);
|
114
|
+
pop(to);
|
89
115
|
|
116
|
+
};
|
117
|
+
})();
|
118
|
+
if (typeof exports === 'object') {
|
119
|
+
// CommonJS support
|
120
|
+
module.exports = riot;
|
121
|
+
} else if (typeof define === 'function' && define.amd) {
|
122
|
+
// support AMD
|
123
|
+
define(function() { return riot; });
|
90
124
|
} else {
|
91
|
-
|
92
|
-
|
93
|
-
});
|
125
|
+
// support browser
|
126
|
+
window.riot = riot;
|
94
127
|
}
|
95
128
|
|
96
|
-
|
97
|
-
$.route = function(to) {
|
98
|
-
// listen
|
99
|
-
if (typeof to === "function") return pops.on("pop", to);
|
100
|
-
|
101
|
-
// fire
|
102
|
-
if (history.pushState) history.pushState(0, 0, to);
|
103
|
-
pop(to);
|
104
|
-
|
105
|
-
};})(typeof top == "object" ? window.$ || (window.$ = {}) : exports);
|
129
|
+
})({});
|
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.
|
4
|
+
version: 1.0.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: 2014-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple asset-pipeline wrapper for riot.js by moot
|
14
14
|
email:
|
@@ -17,7 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- .gitignore
|
20
|
+
- ".gitignore"
|
21
21
|
- Gemfile
|
22
22
|
- LICENSE.md
|
23
23
|
- Rakefile
|
@@ -36,17 +36,17 @@ require_paths:
|
|
36
36
|
- lib
|
37
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
48
|
rubyforge_project: riotjs-rails
|
49
|
-
rubygems_version: 2.
|
49
|
+
rubygems_version: 2.2.2
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: riot.js asset pipeline provider/wrapper
|