@@ -2,15 +2,15 @@ $(function() {
2
2
var $window = $ ( window )
3
3
4
4
$ ( "#news-feed" ) . PaRSS ( "http://openworm.tumblr.com/rss" , // url to the feed
5
- 6 , // number of items to retrieve
6
- "M jS Y, g:i a" , // date format
7
- false , // include descriptions
8
- function ( ) {
9
- /*
10
- * optional callback function performed after list is appended to the
11
- * page
12
- */
13
- } ) ;
5
+ 6 , // number of items to retrieve
6
+ "M jS Y, g:i a" , // date format
7
+ false , // include descriptions
8
+ function ( ) {
9
+ /*
10
+ * optional callback function performed after list is appended to the
11
+ * page
12
+ */
13
+ } ) ;
14
14
15
15
// side bar
16
16
$ ( '.bs-docs-sidenav' ) . affix ( {
@@ -31,27 +31,27 @@ $(function() {
31
31
} ) ;
32
32
33
33
$ ( '.minilogo' ) . tooltip ( ) ;
34
-
34
+
35
35
$ ( ".donation" ) . click ( function ( ) {
36
36
$ ( ".donation" ) . removeClass ( "active" ) ;
37
37
$ ( "#otherAmount" ) . removeClass ( "active" ) ;
38
38
$ ( "#amountSent" ) . attr ( "value" , $ ( this ) . html ( ) . replace ( "$" , "" ) ) ;
39
39
$ ( this ) . addClass ( "active" ) ;
40
40
} ) ;
41
-
41
+
42
42
$ ( ".other" ) . click ( function ( ) {
43
43
$ ( "#otherAmount" ) . addClass ( "active" ) ;
44
44
$ ( "#amountSent" ) . attr ( "value" , $ ( this ) . val ( ) ) ;
45
45
$ ( "#otherAmount" ) . focus ( ) ;
46
46
} ) ;
47
-
47
+
48
48
$ ( "#otherAmount" ) . click ( function ( ) {
49
49
$ ( "#otherAmount" ) . addClass ( "active" ) ;
50
50
$ ( ".donation" ) . removeClass ( "active" ) ;
51
51
$ ( "#amountSent" ) . attr ( "value" , $ ( this ) . val ( ) ) ;
52
52
$ ( ".other" ) . addClass ( "active" ) ;
53
53
} ) ;
54
-
54
+
55
55
$ ( "#otherAmount" ) . on ( "input" , function ( ) {
56
56
$ ( "#amountSent" ) . attr ( "value" , $ ( this ) . val ( ) ) ;
57
57
} ) ;
@@ -66,17 +66,17 @@ $(function() {
66
66
else if ( amount == "25" ) {
67
67
$ ( "#d25" ) . click ( ) ;
68
68
}
69
- else if ( amount == "50" ) {
70
- $ ( "#d50" ) . click ( ) ;
71
- }
72
- else if ( amount == "100" ) {
73
- $ ( "#d100" ) . click ( ) ;
74
- }
75
- else {
76
- $ ( ".other" ) . click ( ) ;
77
- $ ( "#otherAmount" ) . val ( amount ) ;
78
- $ ( "#amountSent" ) . attr ( "value" , amount ) ;
79
- }
69
+ else if ( amount == "50" ) {
70
+ $ ( "#d50" ) . click ( ) ;
71
+ }
72
+ else if ( amount == "100" ) {
73
+ $ ( "#d100" ) . click ( ) ;
74
+ }
75
+ else {
76
+ $ ( ".other" ) . click ( ) ;
77
+ $ ( "#otherAmount" ) . val ( amount ) ;
78
+ $ ( "#amountSent" ) . attr ( "value" , amount ) ;
79
+ }
80
80
81
81
} ) ;
82
82
@@ -100,15 +100,6 @@ window.___gcfg = {
100
100
lang : 'en-GB'
101
101
} ;
102
102
103
- ( function ( ) {
104
- var po = document . createElement ( 'script' ) ;
105
- po . type = 'text/javascript' ;
106
- po . async = true ;
107
- po . src = 'https://apis.google.com/js/plusone.js' ;
108
- var s = document . getElementsByTagName ( 'script' ) [ 0 ] ;
109
- s . parentNode . insertBefore ( po , s ) ;
110
- } ) ( ) ;
111
-
112
103
function donate ( ) {
113
104
var amount = $ ( ".donation.active" ) ;
114
105
if ( amount . hasClass ( "other" ) ) {
@@ -120,31 +111,86 @@ function donate(){
120
111
window . location = "\donate.html?amount=" + amount ;
121
112
}
122
113
123
- // countdown time to kickstarter
124
- function showRemainingDays ( end ) {
125
- var _second = 1000 ;
126
- var _minute = _second * 60 ;
127
- var _hour = _minute * 60 ;
128
- var _day = _hour * 24 ;
129
-
130
- var now = new Date ( ) ;
131
- var distance = end - now ;
132
- if ( distance < 0 ) {
133
- document . getElementById ( 'countdown' ) . innerHTML = 'EXPIRED!' ;
134
- return ;
135
- }
136
- var days = Math . floor ( distance / _day ) ;
137
- var hours = Math . floor ( ( distance % _day ) / _hour ) ;
138
- var minutes = Math . floor ( ( distance % _hour ) / _minute ) ;
139
- var seconds = Math . floor ( ( distance % _minute ) / _second ) ;
140
-
141
- document . getElementById ( 'countdown' ) . innerHTML = days + ' days' ;
142
- }
143
-
144
114
function detectmob ( ) {
145
115
if ( window . innerWidth <= 800 && window . innerHeight <= 600 ) {
146
116
return true ;
147
117
} else {
148
118
return false ;
149
119
}
150
120
}
121
+
122
+ var _gaq = _gaq || [ ] ;
123
+ _gaq . push ( [ '_setAccount' , 'UA-29668455-1' ] ) ;
124
+ _gaq . push ( [ '_trackPageview' ] ) ;
125
+
126
+
127
+
128
+
129
+ function loadGoogleAnalytics ( ) {
130
+ var ga = document . createElement ( 'script' ) ;
131
+ ga . type = 'text/javascript' ;
132
+ ga . id = 'googleWidget' ;
133
+ ga . async = true ;
134
+ ga . src = ( 'https:' == document . location . protocol ? 'https://ssl' : 'http://www' ) +
135
+ '.google-analytics.com/ga.js' ;
136
+ var s = document . getElementsByTagName ( 'script' ) [ 0 ] ;
137
+ s . parentNode . insertBefore ( ga , s ) ;
138
+ }
139
+
140
+ function loadFacebook ( ) {
141
+ var js , fjs = document . getElementsByTagName ( 'script' ) [ 0 ] ;
142
+ if ( document . getElementById ( 'facebook-jssdk' ) ) return ;
143
+ js = document . createElement ( 'script' ) ;
144
+ //js.async = true;
145
+ js . id = 'facebook-jssdk' ;
146
+ js . src = "//connect.facebook.net/en_US/all.js#xfbml=1" ;
147
+ fjs . parentNode . insertBefore ( js , fjs ) ;
148
+ }
149
+
150
+ function loadTwitterWidget ( ) {
151
+ var js , fjs = document . getElementsByTagName ( "script" ) [ 0 ] ;
152
+ if ( document . getElementById ( "twitter-wjs" ) ) return ;
153
+ js = document . createElement ( "script" ) ;
154
+ js . async = true ;
155
+ js . id = "twitter-wjs" ;
156
+ js . src = "//platform.twitter.com/widgets.js" ;
157
+ fjs . parentNode . insertBefore ( js , fjs ) ;
158
+ }
159
+
160
+
161
+ function loadGooglePlus ( ) {
162
+ var po = document . createElement ( 'script' ) ;
163
+ po . type = 'text/javascript' ;
164
+ po . async = true ;
165
+ po . src = 'https://apis.google.com/js/plusone.js' ;
166
+ var s = document . getElementsByTagName ( 'script' ) [ 0 ] ;
167
+ s . parentNode . insertBefore ( po , s ) ;
168
+ }
169
+
170
+
171
+ function reloadSocial ( ) {
172
+ // http://www.blackfishweb.com/blog/asynchronously-loading-twitter-google-facebook-and-linkedin-buttons-and-widgets-ajax-bonus
173
+
174
+ // Twitter widget
175
+ if ( typeof ( twttr ) != 'undefined' ) {
176
+ twttr . widgets . load ( ) ;
177
+ } else {
178
+ $ . getScript ( '//platform.twitter.com/widgets.js' ) ;
179
+ }
180
+
181
+ // Facebook
182
+ if ( typeof ( FB ) != 'undefined' ) {
183
+ delete FB ;
184
+ $ ( '#facebook-jssdk' ) . remove ( ) ;
185
+ $ . getScript ( "http://connect.facebook.net/en_US/all.js#xfbml=1" , function ( ) {
186
+ FB . init ( { status : true , cookie : true , xfbml : true } ) ;
187
+ } )
188
+ }
189
+
190
+ // Google - Note that the google button will not show if you are opening the page from disk
191
+ // it needs to be http(s)
192
+ if ( typeof ( gapi ) != 'undefined' ) {
193
+ delete gapi ;
194
+ $ . getScript ( '//apis.google.com/js/plusone.js' ) ;
195
+ }
196
+ }
0 commit comments