multiauth 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -0,0 +1,33 @@
1
+ <div id="openid_btns">
2
+ <div id="carousel">
3
+ <div id="buttons">
4
+ <a href="#" id="prev">prev</a>
5
+ <a href="#" id="next">next</a>
6
+ </div>
7
+ Choose your account provider
8
+ <div class="clear"></div>
9
+ <div id="slides">
10
+ <ul class="list">
11
+ <% count = 0 %>
12
+ <% Multiauth::PROVIDERS.each_slice(6) do |providers| %>
13
+ <li class="page">
14
+ <% providers.each_slice(3) do |column| %>
15
+ <div class="column">
16
+ <% column.each do |provider| %>
17
+ <a id="btn_<%= count+=1 %>" class="<%= provider[:name] %> openid_btn" title="<%= provider[:name] %>" href="<%= provider[:url] %>" data-real="<%= provider[:real] || false %>"></a>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ <div class="clear"></div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <div id="openid_inputarea">
29
+ <span class="oidlabel">username</span>
30
+ <%= text_field_tag "user_name", "", :id => "openid_username" %>
31
+ <%= submit_tag "Sign In", :id => "openid_inputarea_submit" %>
32
+ <a href="#" id="close_openid_inputarea">cancel</a>
33
+ </div>
@@ -5,14 +5,12 @@ module Multiauth
5
5
  namespace 'multiauth'
6
6
  desc "initializes the required files"
7
7
 
8
- def copy_js
8
+ def copy_assets
9
+ directory "images", "public/images/"
10
+ copy_file "multiauth.css", "public/stylesheets/multiauth.css"
9
11
  copy_file "multiauth.js", "public/javascripts/multiauth.js"
10
12
  end
11
13
 
12
- def copy_openid
13
- directory "openid-realselector", "public/javascripts/openid-realselector"
14
- end
15
-
16
14
  def copy_twitter
17
15
  copy_file "devise_twitter.rb", "config/initializers/devise_twitter.rb"
18
16
  end
@@ -0,0 +1,189 @@
1
+ #openid {
2
+ background: url(/images/indicator.gif) center center no-repeat;
3
+ margin: 0 auto;
4
+ }
5
+
6
+ #openid_btns {
7
+ height: 200px;
8
+ }
9
+
10
+ #openid_btns #title {
11
+ font-size: 16px;
12
+ font-weight: bold;
13
+ margin-top: -10px;
14
+ }
15
+
16
+ #openid_inputarea {
17
+ display: none;
18
+ background: url(/images/balloon.png) no-repeat;
19
+ width: 410px;
20
+ height: 48px;
21
+ color: white;
22
+ text-align: center;
23
+ margin-top: 35px;
24
+ padding-top: 17px;
25
+ z-index: 5000;
26
+ position: absolute;
27
+ }
28
+
29
+ #openid_inputarea #openid_username {
30
+ margin: 0 4px 0 8px;
31
+ width: 120px;
32
+ }
33
+
34
+ #openid_highlight {
35
+ -moz-border-radius: 10px;
36
+ -webkit-border-radius: 10px;
37
+ padding: 2px;
38
+ background-color: #FFFCC9;
39
+ float: left;
40
+ }
41
+
42
+ .openid_btn {
43
+ background: url(/images/openid-icons.png) no-repeat;
44
+ margin: 3px;
45
+ display: block;
46
+ height: 48px;
47
+ width: 150px;
48
+ }
49
+
50
+ .OpenID { background-position: 0 0; }
51
+ .Verisign { background-position: 0 -48px; }
52
+ .Facebook { background-position: 0 -96px; }
53
+ .Flickr { background-position: 0 -144px; }
54
+ .Github { background-position: 0 -192px; }
55
+ .Twitter { background-position: 0 -240px; }
56
+ .Google { background-position: 0 -288px; }
57
+ .AOL { background-position: 0 -336px; }
58
+ .Blogger { background-position: 0 -384px; }
59
+ .LinkedIn { background-position: 0 -432px; }
60
+ .WindowsLive { background-position: 0 -480px; }
61
+ .Yahoo { background-position: 0 -528px; }
62
+ .MyOpenID { background-position: 0 -576px; }
63
+ .MySpace { background-position: 0 -624px; }
64
+ .Wordpress { background-position: 0 -672px; }
65
+ .Technorati { background-position: 0 -720px; }
66
+ .ClaimID { background-position: 0 -767px; }
67
+ .Launchpad { background-position: 0px -814px; }
68
+ .LiveJournal { background-position: 0px -861px; }
69
+ .Vidoop { background-position: 0px -908px; }
70
+
71
+ .OpenID.oselected { background-position: -300px 0; }
72
+ .Verisign.oselected { background-position: -300px -48px; }
73
+ .Facebook.oselected { background-position: -300px -96px; }
74
+ .Flickr.oselected { background-position: -300px -144px; }
75
+ .Github.oselected { background-position: -300px -192px; }
76
+ .Twitter.oselected { background-position: -300px -240px; }
77
+ .Google.oselected { background-position: -300px -288px; }
78
+ .AOL.oselected { background-position: -300px -336px; }
79
+ .Blogger.oselected { background-position: -300px -384px; }
80
+ .LinkedIn.oselected { background-position: -300px -432px; }
81
+ .WindowsLive.oselected { background-position: -300px -480px; }
82
+ .Yahoo.oselected { background-position: -300px -528px; }
83
+ .MyOpenID.oselected { background-position: -300px -576px; }
84
+ .MySpace.oselected { background-position: -300px -624px; }
85
+ .Wordpress.oselected { background-position: -300px -672px; }
86
+ .Technorati.oselected { background-position: -300px -720px; }
87
+ .ClaimID.oselected { background-position: -300px -767px; }
88
+ .Launchpad.oselected { background-position: -300px -814px; }
89
+ .LiveJournal.oselected { background-position: -300px -861px; }
90
+ .Vidoop.oselected { background-position: -300px -908px; }
91
+
92
+ .OpenID:hover { background-position: -150px 0; }
93
+ .Verisign:hover { background-position: -150px -48px; }
94
+ .Facebook:hover { background-position: -150px -96px; }
95
+ .Flickr:hover { background-position: -150px -144px; }
96
+ .Github:hover { background-position: -150px -192px; }
97
+ .Twitter:hover { background-position: -150px -240px; }
98
+ .Google:hover { background-position: -150px -288px; }
99
+ .AOL:hover { background-position: -150px -336px; }
100
+ .Blogger:hover { background-position: -150px -384px; }
101
+ .LinkedIn:hover { background-position: -150px -432px; }
102
+ .WindowsLive:hover { background-position: -150px -480px; }
103
+ .Yahoo:hover { background-position: -150px -528px; }
104
+ .MyOpenID:hover { background-position: -150px -576px; }
105
+ .MySpace:hover { background-position: -150px -624px; }
106
+ .Wordpress:hover { background-position: -150px -672px; }
107
+ .Technorati:hover { background-position: -150px -720px; }
108
+ .ClaimID:hover { background-position: -150px -767px; }
109
+ .Launchpad:hover { background-position: -150px -814px; }
110
+ .LiveJournal:hover { background-position: -150px -861px; }
111
+ .Vidoop:hover { background-position: -150px -908px; }
112
+
113
+ a.openid_large_btn:focus {
114
+ outline: none;
115
+ -moz-outline-style: none;
116
+ }
117
+
118
+
119
+ #carousel {
120
+ margin:0 auto;
121
+ overflow:hidden;
122
+ width: 337px;
123
+
124
+ }
125
+
126
+ #slides {
127
+ overflow:hidden;
128
+ /* fix ie overflow issue */
129
+ position:relative;
130
+ border:1px solid #ccc;
131
+ }
132
+
133
+ #slides .list {
134
+ position: relative;
135
+ left: 0;
136
+ top: 0;
137
+ list-style: none;
138
+ margin: 0;
139
+ padding: 0;
140
+ width: 1100px;
141
+ }
142
+
143
+ #slides .page {
144
+ float: left;
145
+ display: inline;
146
+ position: relative;
147
+ width: 33%;
148
+ }
149
+
150
+ #slides .list .page .column {
151
+ float: left;
152
+ margin: 0 5px 5px 5px;
153
+ list-style-type: none;
154
+ padding: 0px;
155
+ width: 41%;
156
+ }
157
+
158
+ #buttons {
159
+ padding:0 0 5px 0;
160
+ float:right;
161
+ }
162
+
163
+ #buttons a {
164
+ display:block;
165
+ width:31px;
166
+ height:32px;
167
+ text-indent:-999em;
168
+ float:left;
169
+ outline:0;
170
+ }
171
+
172
+ a#prev {
173
+ background:url(/images/arrow.gif) 0 -31px no-repeat;
174
+ }
175
+
176
+ a#prev:hover {
177
+ background:url(/images/arrow.gif) 0 0 no-repeat;
178
+ }
179
+
180
+ a#next {
181
+ background:url(/images/arrow.gif) -32px -31px no-repeat;
182
+ }
183
+
184
+ a#next:hover {
185
+ background:url(/images/arrow.gif) -32px 0 no-repeat;
186
+ }
187
+
188
+ .clear {clear:both}
189
+
@@ -1,11 +1,90 @@
1
+ function openidCarouselEffect() {
2
+ var rotate = function() {
3
+ $('#next').click();
4
+ }
5
+
6
+ var speed = 5000;
7
+ var run = setInterval(rotate, speed);
8
+
9
+ var item_width = $('#slides .list .page').outerWidth();
10
+ var left_value = item_width * (-1);
11
+
12
+ $('#slides .page:first').before($('#slides .list .page:last'));
13
+ $('#slides .list').css({'left' : left_value});
14
+
15
+ $('#prev').click(function() {
16
+ var left_indent = parseInt($('#slides .list').css('left')) + item_width;
17
+ $('#slides .list:not(:animated)').animate({'left' : left_indent}, 200,function(){
18
+ $('#slides .page:first').before($('#slides .page:last'));
19
+ $('#slides .list').css({'left' : left_value});
20
+ });
21
+ return false;
22
+ });
23
+
24
+ $('#next').click(function() {
25
+ var left_indent = parseInt($('#slides .list').css('left')) - item_width;
26
+
27
+ $('#slides .list:not(:animated)').animate({'left' : left_indent}, 200, function () {
28
+ $('#slides .page:last').after($('#slides .page:first'));
29
+ $('#slides .list').css({'left' : left_value});
30
+ });
31
+
32
+ return false;
33
+ });
34
+
35
+ $('#slides').hover(
36
+ function() {
37
+ clearInterval(run);
38
+ },
39
+ function() {
40
+ run = setInterval(rotate, speed);
41
+ }
42
+ );
43
+ }
44
+
45
+
1
46
  jQuery(function ($) {
2
- var oid = $("#openid");
3
-
4
- if(oid.length > 0) {
5
- $("form#openid #nojsopenid").remove();
6
- $("#openid").openid({
7
- img_path: '/javascripts/openid-realselector/img/',
8
- param: 'user[identity_url]'
9
- })
10
- }
47
+ var $form = $("form#openid");
48
+ var $identity_url = $form.find("input#identity_url");
49
+ var $input_area = $form.find("#openid_inputarea");
50
+ var $input_username = $input_area.find("input#openid_username");
51
+
52
+ $form.find("#nojsopenid").hide();
53
+
54
+ $form.css({'background-image': 'none'});
55
+
56
+ $input_area.find("#close_openid_inputarea").click(function() {
57
+ $input_area.fadeOut();
58
+ return false;
59
+ });
60
+
61
+ $form.find(".openid_btn").click(function(e){
62
+ var a = $(this);
63
+
64
+ if(a.attr("href").match("{user_name}")) {
65
+ $input_username.attr("data-provider", a.attr("href"));
66
+ $(".oidlabel").text(a.attr("title")+" id:");
67
+
68
+ $input_area.css({left:e.pageX-20, top:e.pageY-25});
69
+ $input_area.fadeIn();
70
+ return false;
71
+ }
72
+
73
+ if(a.attr("data-real") == "false") {
74
+ $identity_url.val(a.attr("href"));
75
+ $form.submit();
76
+ return false;
77
+ }
78
+
79
+ return true;
80
+ });
81
+
82
+ $form.find("#openid_inputarea_submit").click(function() {
83
+ var v = $input_username.val();
84
+ if(v) {
85
+ $identity_url.val($input_username.attr("data-provider").replace("{user_name}",v ));
86
+ }
87
+ });
88
+
89
+ openidCarouselEffect();
11
90
  });
data/lib/multiauth.rb CHANGED
@@ -1,3 +1,83 @@
1
1
  require 'multiauth/rails'
2
2
  require 'multiauth/views_helper'
3
3
 
4
+ module Multiauth
5
+ PROVIDERS = [
6
+ {
7
+ :name => 'Google',
8
+ :url => 'https://www.google.com/accounts/o8/id'
9
+ },
10
+ {
11
+ :name => 'Yahoo',
12
+ :url => 'http://yahoo.com/'
13
+ },
14
+ {
15
+ :name => 'Twitter',
16
+ :url => '/users/sign_in/twitter',
17
+ :real => true
18
+ },
19
+ {
20
+ :name => 'Facebook',
21
+ :selector => '#facebook_signin', # FIXME
22
+ :real => true
23
+ },
24
+ {
25
+ :name => 'Launchpad',
26
+ :url => 'https://launchpad.net/~{user_name}'
27
+ },
28
+ {
29
+ :name => 'Github',
30
+ :url => '#github_signin', # FIXME
31
+ :real => true
32
+ },
33
+ {
34
+ :name => 'AOL',
35
+ :user_name_txt => 'screen:name',
36
+ :url => 'http://openid.aol.com/{user_name}'
37
+ },
38
+ {
39
+ :name => 'OpenID',
40
+ :user_name_txt => ':url'
41
+ },
42
+ {
43
+ :name => 'MyOpenID',
44
+ :url => 'http://{user_name}.myopenid.com/'
45
+ },
46
+ {
47
+ :name => 'Flickr',
48
+ :url => 'http://flickr.com/{user_name}/'
49
+ },
50
+ {
51
+ :name => 'Vidoop',
52
+ :url => 'http://{user_name}.myvidoop.com/'
53
+ },
54
+ {
55
+ :name => 'ClaimID',
56
+ :url => 'http://claimid.com/{user_name}'
57
+ },
58
+ {
59
+ :name => 'Technorati',
60
+ :url => 'http://technorati.com/people/technorati/{user_name}/'
61
+ },
62
+ {
63
+ :name => 'Wordpress',
64
+ :url => 'http://{user_name}.wordpress.com/'
65
+ },
66
+ {
67
+ :name => 'Blogger',
68
+ :url => 'http://{user_name}.blogspot.com/'
69
+ },
70
+ {
71
+ :name => 'Verisign',
72
+ :url => 'http://{user_name}.pip.verisignlabs.com/'
73
+ },
74
+ {
75
+ :name => 'LiveJournal',
76
+ :url => 'http://{user_name}.livejournal.com'
77
+ },
78
+ {
79
+ :name => 'MySpace',
80
+ :url => 'http://www.myspace.com/{user_name}'
81
+ }
82
+ ]
83
+ end
@@ -0,0 +1 @@
1
+ ActionController::Base.append_view_path File.expand_path("../../../app/views", __FILE__)
@@ -4,14 +4,14 @@ module Multiauth
4
4
  url = session_path(resource_name) if !url
5
5
 
6
6
  form_for(resource, :as => resource_name, :url => url, :html => {:id => "openid"}) do |f|
7
- %@<div id="nojsopenid">#{f.text_field(:identity_url)}#{f.submit('Sign in')}</div>@
7
+ %@<div id="nojsopenid">#{f.text_field(:identity_url, :id => "identity_url")}#{f.submit('Sign in')}</div>@+
8
+ render(:partial => "multiauth/box")
8
9
  end
9
10
  end
10
11
 
11
12
  def multiauth_assets
12
- javascript_include_tag('openid-realselector/js/jquery.openid.js')+
13
13
  javascript_include_tag('multiauth')+
14
- stylesheet_link_tag('/javascripts/openid-realselector/css/style')
14
+ stylesheet_link_tag('multiauth')
15
15
  end
16
16
  end
17
17
  end
data/multiauth.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{multiauth}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David A. Cuadrado"]
12
- s.date = %q{2010-09-16}
12
+ s.date = %q{2010-09-18}
13
13
  s.description = %q{multi authentication gem using devise & co}
14
14
  s.email = %q{krawek@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -25,16 +25,16 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
+ "app/views/multiauth/_box.html.erb",
28
29
  "lib/generators/multiauth/multiauth_generator.rb",
29
30
  "lib/generators/templates/README",
30
31
  "lib/generators/templates/devise_twitter.rb",
32
+ "lib/generators/templates/images/arrow.gif",
33
+ "lib/generators/templates/images/balloon.png",
34
+ "lib/generators/templates/images/indicator.gif",
35
+ "lib/generators/templates/images/openid-icons.png",
36
+ "lib/generators/templates/multiauth.css",
31
37
  "lib/generators/templates/multiauth.js",
32
- "lib/generators/templates/openid-realselector/css/style.css",
33
- "lib/generators/templates/openid-realselector/img/balloon.png",
34
- "lib/generators/templates/openid-realselector/img/indicator.gif",
35
- "lib/generators/templates/openid-realselector/img/openid-icons.png",
36
- "lib/generators/templates/openid-realselector/js/jquery.openid.js",
37
- "lib/generators/templates/openid-realselector/js/jquery.openid.min.js",
38
38
  "lib/multiauth.rb",
39
39
  "lib/multiauth/rails.rb",
40
40
  "lib/multiauth/views_helper.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - David A. Cuadrado
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-16 00:00:00 -05:00
17
+ date: 2010-09-18 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -141,16 +141,16 @@ files:
141
141
  - README.rdoc
142
142
  - Rakefile
143
143
  - VERSION
144
+ - app/views/multiauth/_box.html.erb
144
145
  - lib/generators/multiauth/multiauth_generator.rb
145
146
  - lib/generators/templates/README
146
147
  - lib/generators/templates/devise_twitter.rb
148
+ - lib/generators/templates/images/arrow.gif
149
+ - lib/generators/templates/images/balloon.png
150
+ - lib/generators/templates/images/indicator.gif
151
+ - lib/generators/templates/images/openid-icons.png
152
+ - lib/generators/templates/multiauth.css
147
153
  - lib/generators/templates/multiauth.js
148
- - lib/generators/templates/openid-realselector/css/style.css
149
- - lib/generators/templates/openid-realselector/img/balloon.png
150
- - lib/generators/templates/openid-realselector/img/indicator.gif
151
- - lib/generators/templates/openid-realselector/img/openid-icons.png
152
- - lib/generators/templates/openid-realselector/js/jquery.openid.js
153
- - lib/generators/templates/openid-realselector/js/jquery.openid.min.js
154
154
  - lib/multiauth.rb
155
155
  - lib/multiauth/rails.rb
156
156
  - lib/multiauth/views_helper.rb
@@ -1,79 +0,0 @@
1
- body {
2
- font: 14px 'Arial';
3
- }
4
-
5
- #openid {
6
- background: url(../img/indicator.gif) center center no-repeat;
7
- margin: 0 auto;
8
- width: 440px;
9
- height: 162px;
10
- }
11
-
12
- #openid_inputarea {
13
- clear: both;
14
- display: none;
15
- background: url(../img/balloon.png) no-repeat;
16
- width: 410px;
17
- height: 48px;
18
- color: white;
19
- text-align: center;
20
- margin-top: 35px;
21
- padding-top: 17px;
22
- }
23
-
24
- #openid_inputarea #openid_username {
25
- margin: 0 4px 0 8px;
26
- width: 120px;
27
- }
28
-
29
- #openid_btns, #openid_btns br {
30
- clear: both;
31
- }
32
-
33
- #openid_highlight {
34
- -moz-border-radius: 10px;
35
- -webkit-border-radius: 10px;
36
- padding: 2px;
37
- background-color: #FFFCC9;
38
- float: left;
39
- }
40
-
41
- .openid_large_btn, .openid_small_btn {
42
- background: url(../img/openid-icons.png) no-repeat;
43
- margin: 3px;
44
- float: left;
45
- }
46
-
47
- .openid_large_btn {
48
- width: 91px;
49
- height: 51px;
50
- }
51
-
52
- .openid_small_btn {
53
- width: 16px;
54
- height: 16px;
55
- }
56
-
57
- .Google { background-position: 0 0; }
58
- .Yahoo { background-position: 0 -51px; }
59
- .AOL { background-position: 0 -102px; }
60
- .OpenID { background-position: 0 -153px; }
61
- .MyOpenID { background-position: 0 -204px; }
62
- .Flickr { background-position: 0 -220px; }
63
- .Technorati { background-position: -17px -220px; }
64
- .Wordpress { background-position: -17px -204px; }
65
- .Blogger { background-position: -34px -204px; }
66
- .Verisign { background-position: -51px -220px; }
67
- .Vidoop { background-position: -34px -220px; }
68
- .ClaimID { background-position: -68px -204px; }
69
- .LiveJournal { background-position: -51px -204px; }
70
- .Launchpad { background-position: 0 -236.9px; }
71
- .Facebook { background-position: 0 -287px; }
72
- .Twitter { background-position: 0 -338px; }
73
- .Github { background-position: 0 -389px; }
74
- .MySpace { background-position: 0px -220px; }
75
-
76
- a.openid_large_btn:focus {
77
- outline: none;
78
- -moz-outline-style: none;
79
- }
@@ -1,217 +0,0 @@
1
- /*
2
- OpenID Plugin
3
- http://code.google.com/p/openid-realselector/
4
-
5
- Martin Conte Mac Donell <Reflejo@gmail.com>
6
- */
7
-
8
- (function($) {
9
- $.fn.openid = function(opt) {
10
- var gprovider;
11
- var INPUTID = 'openid_username';
12
- var inputarea = $('#openid_inputarea').length ? $('#openid_inputarea'): $('<div id="openid_inputarea" />');
13
-
14
- var defaults = {
15
- txt: {
16
- label: 'Enter your {provider} {username}',
17
- username: 'username',
18
- title: 'Select your openID provider',
19
- sign: 'Sign-In'
20
- },
21
- /*
22
- Default providers with url. "big" variable means that icon
23
- will be big.
24
- */
25
- providers: [
26
- {
27
- name: 'Google',
28
- url: 'https://www.google.com/accounts/o8/id',
29
- label: null,
30
- big: true
31
- },
32
- {
33
- name: 'Yahoo',
34
- url: 'http://yahoo.com/',
35
- label: null,
36
- big: true
37
- },
38
- {
39
- name: 'Twitter',
40
- url: '/users/sign_in/twitter',
41
- real: true,
42
- big: true
43
- },
44
- {
45
- name: 'Facebook',
46
- selector: '#facebook_signin',
47
- real: true,
48
- big: true
49
- },
50
- {
51
- name: 'MyOpenID',
52
- url: 'http://{username}.myopenid.com/'
53
- },
54
- {
55
- name: 'Flickr',
56
- url: 'http://flickr.com/{username}/'
57
- },
58
- {
59
- name: 'AOL',
60
- username_txt: 'screenname',
61
- url: 'http://openid.aol.com/{username}',
62
- big: true
63
- },
64
- {
65
- name: 'OpenID',
66
- username_txt: 'url',
67
- big: true
68
- },
69
- {
70
- name: 'Vidoop',
71
- url: 'http://{username}.myvidoop.com/'
72
- },
73
- {
74
- name: 'ClaimID',
75
- url: 'http://claimid.com/{username}'
76
- },
77
- {
78
- name: 'Technorati',
79
- url: 'http://technorati.com/people/technorati/{username}/'
80
- },
81
- {
82
- name: 'Wordpress',
83
- url: 'http://{username}.wordpress.com/'
84
- },
85
- {
86
- name: 'Blogger',
87
- url: 'http://{username}.blogspot.com/'
88
- },
89
- {
90
- name: 'Verisign',
91
- url: 'http://{username}.pip.verisignlabs.com/'
92
- },
93
- {
94
- name: 'LiveJournal',
95
- url: 'http://{username}.livejournal.com'
96
- },
97
- {
98
- name: 'MySpace',
99
- url: 'http://www.myspace.com/{username}'
100
- },
101
- {
102
- name: 'Launchpad',
103
- url: 'https://launchpad.net/~{username}',
104
- big: true
105
- },
106
- {
107
- name: 'Github',
108
- selector: '#github_signin',
109
- real: true,
110
- big: true
111
- }
112
- ],
113
- cookie_expires: 6 * 30, // in days.
114
- cookie_path: '/',
115
- img_path: '/img/'
116
- };
117
-
118
- var getBox = function(provider, idx, box_size) {
119
- var a = $('<a title="' + provider.name + '" href="#" id="btn_' + idx +
120
- '" class="openid_' + box_size + '_btn ' + provider.name + '" />');
121
-
122
- if(provider.real) {
123
- if(provider.url){
124
- a.attr("href", provider.url);
125
- } else {
126
- var target = $(provider.selector);
127
- a.attr("href", target.attr('href'));
128
- target.remove();
129
- }
130
- return a;
131
- }
132
-
133
- return a.click(signIn);
134
- };
135
-
136
- var setCookie = function(value) {
137
- var date = new Date();
138
- date.setTime(date.getTime() + (settings.cookie_expires * 24 * 60 * 60 * 1000));
139
- document.cookie = "openid_prov=" + value + "; expires=" + date.toGMTString() +
140
- "; path=" + settings.cookie_path;
141
- };
142
-
143
- var readCookie = function(){
144
- var c = document.cookie.split(';');
145
- for(i in c){
146
- if ((pos = c[i].indexOf("openid_prov=")) != -1)
147
- return $.trim(c[i].slice(pos + 12));
148
- }
149
- };
150
-
151
- var signIn = function(obj, tidx) {
152
- var idx = $(tidx || this).attr('id').replace('btn_', '');
153
- if (!(gprovider = settings.providers[idx]))
154
- return;
155
-
156
- // Hightlight
157
- if (highlight = $('#openid_highlight'))
158
- highlight.replaceWith($('#openid_highlight a')[0]);
159
-
160
- $('#btn_' + idx).wrap('<div id="openid_highlight" />');
161
- setCookie(idx);
162
-
163
- // prompt user for input?
164
- showInputBox();
165
- if (gprovider.label === null) {
166
- inputarea.text(settings.txt.title);
167
- if (!tidx) {
168
- inputarea.fadeOut();
169
- form.submit();
170
- }
171
- }
172
- return false;
173
- };
174
-
175
- var showInputBox = function() {
176
- var lbl = (gprovider.label || settings.txt.label).replace(
177
- '{username}', (gprovider.username_txt !== undefined) ? gprovider.username_txt: settings.txt.username
178
- ).replace('{provider}', gprovider.name);
179
-
180
- inputarea.empty().show().append('<span class="oidlabel">' + lbl + '</span><input id="' + INPUTID + '" type="text" ' +
181
- ' name="username_txt" class="Verisign"/><input type="submit" value="' + settings.txt.sign + '"/>');
182
-
183
- $('#' + INPUTID).focus();
184
- };
185
-
186
- var submit = function(){
187
- var prov = (gprovider.url) ? gprovider.url.replace('{username}', $('#' + INPUTID).val()): $('#' + INPUTID).val();
188
- form.append($('<input type="hidden" name="'+settings.param+'" value="' + prov + '" />'));
189
- };
190
-
191
- var settings = $.extend(defaults, opt || {});
192
-
193
- var btns = $('<div id="openid_btns" />');
194
-
195
- // Add box for each provider
196
- var addbr = true;
197
- $.each(settings.providers, function(i, val) {
198
- if (!val.big && addbr) {
199
- btns.append('<br />');
200
- addbr = false;
201
- }
202
- btns.append(getBox(val, i, (val.big) ? 'large': 'small'));
203
- });
204
-
205
- var form = this;
206
- form.css({'background-image': 'none'});
207
- form.append(btns).submit(submit);
208
- btns.append(inputarea);
209
-
210
- if (idx = readCookie())
211
- signIn(null, '#btn_' + idx);
212
- else
213
- inputarea.text(settings.txt.title).show();
214
-
215
- return this;
216
- };
217
- })(jQuery);
@@ -1,7 +0,0 @@
1
- /*
2
- OpenID Plugin
3
- http://code.google.com/p/openid-realselector/
4
-
5
- Martin Conte Mac Donell <Reflejo@gmail.com>
6
- */
7
- (function($){$.fn.openid=function(e){var f;var g='openid_username';var h=$('#openid_inputarea').length?$('#openid_inputarea'):$('<div id="openid_inputarea" />');var j={txt:{label:'Enter your {provider} {username}',username:'username',title:'Select your openID provider',sign:'Sign-In'},providers:[{name:'Google',url:'https://www.google.com/accounts/o8/id',label:null,big:true},{name:'Yahoo',url:'http://yahoo.com/',label:null,big:true},{name:'AOL',username_txt:'screenname',url:'http://openid.aol.com/{username}',big:true},{name:'OpenID',username_txt:'url',big:true},{name:'MyOpenID',url:'http://{username}.myopenid.com/'},{name:'Flickr',url:'http://flickr.com/{username}/'},{name:'Technorati',url:'http://technorati.com/people/technorati/{username}/'},{name:'Wordpress',url:'http://{username}.wordpress.com/'},{name:'Blogger',url:'http://{username}.blogspot.com/'},{name:'Verisign',url:'http://{username}.pip.verisignlabs.com/'},{name:'Vidoop',url:'http://{username}.myvidoop.com/'},{name:'ClaimID',url:'http://claimid.com/{username}'},{name:'LiveJournal',url:'http://{username}.livejournal.com'},{name:'MySpace',url:'http://www.myspace.com/{username}'}],cookie_expires:6*30,cookie_path:'/',img_path:'/img/'};var k=function(b,c,d){var a=$('<a title="'+b+'" href="#" id="btn_'+c+'" class="openid_'+d+'_btn '+b+'" />');return a.click(n)};var l=function(a){var b=new Date();b.setTime(b.getTime()+(q.cookie_expires*24*60*60*1000));document.cookie="openid_prov="+a+"; expires="+b.toGMTString()+"; path="+q.cookie_path};var m=function(){var c=document.cookie.split(';');for(i in c){if((pos=c[i].indexOf("openid_prov="))!=-1)return $.trim(c[i].slice(pos+12))}};var n=function(a,b){var c=$(b||this).attr('id').replace('btn_','');if(!(f=q.providers[c]))return;if(highlight=$('#openid_highlight'))highlight.replaceWith($('#openid_highlight a')[0]);$('#btn_'+c).wrap('<div id="openid_highlight" />');l(c);o();if(f.label===null){h.text(q.txt.title);if(!b){h.fadeOut();t.submit()}}return false};var o=function(){var a=(f.label||q.txt.label).replace('{username}',(f.username_txt!==undefined)?f.username_txt:q.txt.username).replace('{provider}',f.name);h.empty().show().append('<span class="oidlabel">'+a+'</span><input id="'+g+'" type="text" '+' name="username_txt" class="Verisign"/><input type="submit" value="'+q.txt.sign+'"/>');$('#'+g).focus()};var p=function(){var a=(f.url)?f.url.replace('{username}',$('#'+g).val()):$('#'+g).val();t.append($('<input type="hidden" name="url" value="'+a+'" />'))};var q=$.extend(j,e||{});var r=$('<div id="openid_btns" />');var s=true;$.each(q.providers,function(i,a){if(!a.big&&s){r.append('<br />');s=false}r.append(k(a.name,i,(a.big)?'large':'small'))});var t=this;t.css({'background-image':'none'});t.append(r).submit(p);r.append(h);if(idx=m())n(null,'#btn_'+idx);else h.text(q.txt.title).show();return this}})(jQuery);