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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bddaf38a81cc9901335a8f5d909f1c21c05aea20
4
- data.tar.gz: 474140b905184903f4c0c3ce8bccf1c5eebced54
3
+ metadata.gz: fff3e2e20b71c20b47c77462ed46a02d531d23c3
4
+ data.tar.gz: 4bdf83ef0ffc93fd1242ee9a1d2e4c0e8efec3ce
5
5
  SHA512:
6
- metadata.gz: 93c5cba307dce5b0cf803a33cad2a64dc8895a0a50c03dab806d14680a57d0417b84e2e5abce69a38658481c78903c5e4160dac05b149faef73eef5e768df4a3
7
- data.tar.gz: 77a67d977f1dc15202efba82399d6369bb9600502609f41f1431837ea61aa3de739704ad6ee12833dd0ed8009fc6849a323dd0964567d8d009e15f4ec9cd4d37
6
+ metadata.gz: 61444d1aa78a9c0ab13b5b4d883923a05e12277844f62c9239525039a99cefc56e6d80034513f050685d3e9829b3685ac61ba8bd9b229bb36916e4481ec6e17b
7
+ data.tar.gz: 4f3fcc0711c045441496e8b557aa13a29258d3d73b1de7b5730e42fb31b7cc38ed09b4345f2b3b19fb5a18dd0408284a4714e453d7225bf8f8347ad2b6494689
@@ -1,5 +1,5 @@
1
1
  module Riot
2
2
  module Rails
3
- VERSION = "0.9.5"
3
+ VERSION = "0.9.7"
4
4
  end
5
5
  end
@@ -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
- (function(is_node) { "use strict";
4
- /*global exports, window, setTimeout, history, location, document */
10
+ el.on = function(events, fn) {
5
11
 
6
- var top = is_node ? exports : window,
7
- $ = is_node ? top : top.$ = top.$ || {};
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
- el.on = function(events, fn) {
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
- if (typeof fn == "function") {
22
- events = events.split(/\s+/);
24
+ el.off = function(events) {
25
+ events = events.split(/\s+/);
23
26
 
24
- for (var i = 0, len = events.length, type; i < len; i++) {
25
- type = events[i];
26
- (callbacks[type] = callbacks[type] || []).push(fn);
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.off = function(events) {
34
- events = events.split(/\s+/);
31
+ return el;
32
+ };
35
33
 
36
- for (var i = 0; i < events.length; i++) {
37
- callbacks[events[i]] = [];
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
- return el;
41
- };
39
+ };
42
40
 
43
- // only single event supported
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
- el.trigger = function(type) {
46
+ for (var i = 0, fn; i < fns.length; ++i) {
47
+ fn = fns[i];
51
48
 
52
- var args = slice.call(arguments, 1),
53
- fns = callbacks[type] || [];
49
+ if (fn.one && fn.done) continue;
54
50
 
55
- for (var i = 0, fn; i < fns.length; ++i) {
56
- fn = fns[i];
51
+ // add event argument when multiple listeners
52
+ fn.apply(el, fn.typed ? [type].concat(args) : args);
57
53
 
58
- if (fn.one && fn.done) continue;
54
+ fn.done = true;
55
+ }
59
56
 
60
- // add event argument when multiple listeners
61
- fn.apply(el, fn.typed ? [type].concat(args) : args);
57
+ return el;
58
+ };
62
59
 
63
- fn.done = true;
64
- }
60
+ return el;
65
61
 
66
- return el;
67
- };
62
+ };
68
63
 
69
- return el;
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
- if (is_node) return;
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,'&amp;').replace(/\"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;'):(_.$1===0?0:''))+'") + "'"
77
+ );
74
78
 
75
- // cross browser popstate
76
- var currentHash,
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
- if (listen) {
88
- listen("popstate", pop, false);
89
- doc.addEventListener("DOMContentLoaded", pop, false);
83
+ // browsers only
84
+ if (typeof top != "object") return;
90
85
 
91
- } else {
92
- doc.attachEvent("onreadystatechange", function() {
93
- if (doc.readyState == "complete") pop("");
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
- // Change the browser URL or listen to changes on the URL
99
- $.route = function(to) {
98
+ if (listen) {
99
+ listen("popstate", pop, false);
100
+ doc.addEventListener("DOMContentLoaded", pop, false);
100
101
 
101
- // listen
102
- if (typeof to == "function") return fn.on("pop", to);
102
+ } else {
103
+ doc.attachEvent("onreadystatechange", function() {
104
+ if (doc.readyState === "complete") pop("");
105
+ });
106
+ }
103
107
 
104
- // fire
105
- if (history.pushState) history.pushState(0, 0, to);
106
- pop(to);
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 exports == "object");
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.5
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: 2013-11-15 00:00:00.000000000 Z
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: