jekyll-attendease 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/assets/auth_check.js +133 -0
- data/lib/jekyll-attendease.rb +1 -97
- metadata +16 -14
@@ -0,0 +1,133 @@
|
|
1
|
+
var JekyllAttendease = {
|
2
|
+
|
3
|
+
attendease_logged_in: false,
|
4
|
+
|
5
|
+
microsoft: false,
|
6
|
+
|
7
|
+
addEvent: function(obj, eventType, targetFunction, useCapture)
|
8
|
+
{
|
9
|
+
if (obj.addEventListener)
|
10
|
+
{
|
11
|
+
obj.addEventListener(eventType, targetFunction, false);
|
12
|
+
}
|
13
|
+
else if (obj.attachEvent)
|
14
|
+
{
|
15
|
+
obj.attachEvent('on' + eventType, targetFunction);
|
16
|
+
}
|
17
|
+
else
|
18
|
+
{
|
19
|
+
obj['on' + eventType] = targetFunction;
|
20
|
+
}
|
21
|
+
},
|
22
|
+
|
23
|
+
onLoginCheck: function(callback)
|
24
|
+
{
|
25
|
+
if (document.attachEvent)
|
26
|
+
{
|
27
|
+
this.addEvent(document, "dataavailable", callback);
|
28
|
+
}
|
29
|
+
else
|
30
|
+
{
|
31
|
+
this.addEvent(document, "attendease.loggedin", callback);
|
32
|
+
}
|
33
|
+
},
|
34
|
+
|
35
|
+
isLoggedIn: function()
|
36
|
+
{
|
37
|
+
return this.attendease_logged_in;
|
38
|
+
},
|
39
|
+
|
40
|
+
handleAuthState: function()
|
41
|
+
{
|
42
|
+
var xmlhttp = false;
|
43
|
+
|
44
|
+
if (window.XMLHttpRequest)
|
45
|
+
{
|
46
|
+
xmlhttp = new XMLHttpRequest();
|
47
|
+
}
|
48
|
+
else if (window.ActiveXObject)
|
49
|
+
{
|
50
|
+
try
|
51
|
+
{
|
52
|
+
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
53
|
+
}
|
54
|
+
catch (e)
|
55
|
+
{
|
56
|
+
try
|
57
|
+
{
|
58
|
+
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
59
|
+
}
|
60
|
+
catch (e)
|
61
|
+
{
|
62
|
+
xmlhttp = false;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
if (xmlhttp)
|
68
|
+
{
|
69
|
+
xmlhttp.onreadystatechange = function()
|
70
|
+
{
|
71
|
+
if (xmlhttp.readyState == 4)
|
72
|
+
{
|
73
|
+
var accountObject = false;
|
74
|
+
|
75
|
+
if (xmlhttp.status == 200)
|
76
|
+
{
|
77
|
+
authActionElement = document.getElementById("attendease-auth-action");
|
78
|
+
if (authActionElement)
|
79
|
+
{
|
80
|
+
authActionElement.innerHTML = '<a class="attendease-auth-logout" href="/attendease/logout">Logout</a>';
|
81
|
+
}
|
82
|
+
|
83
|
+
accountObject = JSON.parse(xmlhttp.responseText);
|
84
|
+
|
85
|
+
authAccountElement = document.getElementById("attendease-auth-account");
|
86
|
+
if (authAccountElement)
|
87
|
+
{
|
88
|
+
authAccountElement.innerHTML = '<a class="attendease-auth-account" href="/attendease/account">' + accountObject.name + '</a>';
|
89
|
+
}
|
90
|
+
|
91
|
+
this.attendease_logged_in = true;
|
92
|
+
}
|
93
|
+
else
|
94
|
+
{
|
95
|
+
authActionElement = document.getElementById("attendease-auth-action");
|
96
|
+
if (authActionElement)
|
97
|
+
{
|
98
|
+
authActionElement.innerHTML = '<a class="attendease-auth-logout" href="/attendease/login">Login</a>';
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
data = { loggedin: this.attendease_logged_in, account: accountObject, loginURL: "/attendease/login", logoutURL: "/attendease/logout", accountURL: "/attendease/account" };
|
103
|
+
|
104
|
+
if (document.createEvent)
|
105
|
+
{
|
106
|
+
e = document.createEvent("HTMLEvents");
|
107
|
+
e.initEvent("attendease.loggedin", true, true);
|
108
|
+
e.data = data;
|
109
|
+
document.dispatchEvent(e);
|
110
|
+
}
|
111
|
+
else if (document.attachEvent)
|
112
|
+
{
|
113
|
+
e = document.createEventObject();
|
114
|
+
e.eventType = "attendease.loggedin";
|
115
|
+
e.memo = data;
|
116
|
+
document.fireEvent("ondataavailable", e);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
xmlhttp.open("GET","/attendease/verify_credentials.json",true);
|
121
|
+
xmlhttp.send();
|
122
|
+
}
|
123
|
+
}
|
124
|
+
};
|
125
|
+
|
126
|
+
if (window.ActiveXObject)
|
127
|
+
{
|
128
|
+
JekyllAttendease.addEvent(window, 'load', JekyllAttendease.handleAuthState);
|
129
|
+
}
|
130
|
+
else
|
131
|
+
{
|
132
|
+
JekyllAttendease.addEvent(document, 'DOMContentLoaded', JekyllAttendease.handleAuthState);
|
133
|
+
}
|
data/lib/jekyll-attendease.rb
CHANGED
@@ -226,103 +226,7 @@ layout: layout
|
|
226
226
|
def render(context)
|
227
227
|
@attendease_data_path = "#{context['site']['source']}/_attendease_data"
|
228
228
|
|
229
|
-
|
230
|
-
<script type="text/javascript">
|
231
|
-
var JekyllAttendease = {
|
232
|
-
|
233
|
-
attendease_logged_in: false,
|
234
|
-
|
235
|
-
addEvent: function(obj, eventType, targetFunction, useCapture)
|
236
|
-
{
|
237
|
-
if (obj.addEventListener)
|
238
|
-
{
|
239
|
-
obj.addEventListener(eventType, targetFunction, false);
|
240
|
-
}
|
241
|
-
else if (obj.attachEvent)
|
242
|
-
{
|
243
|
-
obj.attachEvent('on' + eventType, targetFunction);
|
244
|
-
}
|
245
|
-
else
|
246
|
-
{
|
247
|
-
obj['on' + eventType] = targetFunction;
|
248
|
-
}
|
249
|
-
},
|
250
|
-
|
251
|
-
onLoginCheck: function(callback) {
|
252
|
-
this.addEvent(document, "attendease.loggedin", callback);
|
253
|
-
},
|
254
|
-
|
255
|
-
isLoggedIn: function() {
|
256
|
-
return this.attendease_logged_in;
|
257
|
-
},
|
258
|
-
|
259
|
-
handleAuthState: function() {
|
260
|
-
var xmlhttp;
|
261
|
-
if (window.XMLHttpRequest)
|
262
|
-
{
|
263
|
-
xmlhttp=new XMLHttpRequest();
|
264
|
-
xmlhttp.onreadystatechange=function()
|
265
|
-
{
|
266
|
-
if (xmlhttp.readyState==4)
|
267
|
-
{
|
268
|
-
var accountObject = false;
|
269
|
-
|
270
|
-
if (xmlhttp.status==200)
|
271
|
-
{
|
272
|
-
authActionElement = document.getElementById("attendease-auth-action");
|
273
|
-
if (authActionElement)
|
274
|
-
{
|
275
|
-
authActionElement.innerHTML = '<a class="attendease-auth-logout" href="/attendease/logout">Logout</a>';
|
276
|
-
}
|
277
|
-
|
278
|
-
accountObject = JSON.parse(xmlhttp.responseText);
|
279
|
-
|
280
|
-
authAccountElement = document.getElementById("attendease-auth-account");
|
281
|
-
if (authAccountElement)
|
282
|
-
{
|
283
|
-
authAccountElement.innerHTML = '<a class="attendease-auth-account" href="/attendease/account">' + accountObject.name + '</a>';
|
284
|
-
}
|
285
|
-
|
286
|
-
this.attendease_logged_in = true;
|
287
|
-
}
|
288
|
-
else
|
289
|
-
{
|
290
|
-
authActionElement = document.getElementById("attendease-auth-action");
|
291
|
-
if (authActionElement)
|
292
|
-
{
|
293
|
-
authActionElement.innerHTML = '<a class="attendease-auth-logout" href="/attendease/login">Login</a>';
|
294
|
-
}
|
295
|
-
}
|
296
|
-
|
297
|
-
data = { loggedin: this.attendease_logged_in, account: accountObject, loginURL: "/attendease/login", logoutURL: "/attendease/logout", accountURL: "/attendease/account" };
|
298
|
-
|
299
|
-
if (document.createEvent)
|
300
|
-
{
|
301
|
-
event = document.createEvent("HTMLEvents");
|
302
|
-
event.initEvent("attendease.loggedin", true, true);
|
303
|
-
event.data = data;
|
304
|
-
document.dispatchEvent(event);
|
305
|
-
}
|
306
|
-
else
|
307
|
-
{
|
308
|
-
event = document.createEventObject();
|
309
|
-
event.eventType = "attendease.loggedin";
|
310
|
-
event.memo = data;
|
311
|
-
document.fireEvent("on" + event.eventType, event);
|
312
|
-
}
|
313
|
-
}
|
314
|
-
}
|
315
|
-
xmlhttp.open("GET","/attendease/verify_credentials.json",true);
|
316
|
-
xmlhttp.send();
|
317
|
-
}
|
318
|
-
}
|
319
|
-
};
|
320
|
-
|
321
|
-
document.addEventListener('DOMContentLoaded', JekyllAttendease.handleAuthState);
|
322
|
-
</script>
|
323
|
-
eos
|
324
|
-
|
325
|
-
content
|
229
|
+
"<script type=\"text/javascript\">#{File.open(File.expand_path(File.dirname(__FILE__) + "/../assets/auth_check.js")).read}</script>"
|
326
230
|
end
|
327
231
|
end
|
328
232
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-attendease
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.7
|
5
4
|
prerelease:
|
5
|
+
version: 0.3.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Wood
|
@@ -11,40 +11,40 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-08-
|
14
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
17
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '0'
|
22
|
+
none: false
|
23
|
+
name: httparty
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
|
27
|
-
none: false
|
26
|
+
requirement: !ruby/object:Gem::Requirement
|
28
27
|
requirements:
|
29
28
|
- - ! '>='
|
30
29
|
- !ruby/object:Gem::Version
|
31
30
|
version: '0'
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: json
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
31
|
none: false
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
34
|
requirements:
|
37
35
|
- - ! '>='
|
38
36
|
- !ruby/object:Gem::Version
|
39
37
|
version: '0'
|
38
|
+
none: false
|
39
|
+
name: json
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
|
-
|
43
|
-
none: false
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - ! '>='
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '0'
|
47
|
+
none: false
|
48
48
|
description: Bring your event data into Jekyll for amazing event websites.
|
49
49
|
email: support@attendease.com
|
50
50
|
executables: []
|
@@ -53,6 +53,7 @@ extra_rdoc_files: []
|
|
53
53
|
files:
|
54
54
|
- README.md
|
55
55
|
- lib/jekyll-attendease.rb
|
56
|
+
- assets/auth_check.js
|
56
57
|
homepage: https://attendease.com/
|
57
58
|
licenses: []
|
58
59
|
post_install_message:
|
@@ -60,17 +61,17 @@ rdoc_options: []
|
|
60
61
|
require_paths:
|
61
62
|
- lib
|
62
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
68
|
none: false
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - ! '>='
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
|
+
none: false
|
74
75
|
requirements: []
|
75
76
|
rubyforge_project:
|
76
77
|
rubygems_version: 1.8.23
|
@@ -78,3 +79,4 @@ signing_key:
|
|
78
79
|
specification_version: 3
|
79
80
|
summary: Attendease event helper for Jekyll
|
80
81
|
test_files: []
|
82
|
+
has_rdoc:
|