forked from LockerProject/Locker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
locker.js
33 lines (31 loc) · 924 Bytes
/
locker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Locker = (function() {
function connectService(evt) {
evt.preventDefault();
var $el = $(evt.currentTarget);
var options =
'width=' + $el.data('width') +
',height=' + $el.data('height') +
',status=no,scrollbars=no,resizable=no';
var popup = window.open('/auth/' + $el.data('provider'),
'account', options);
// create a ga event for adding a new service
popup.focus();
return false;
}
function syncService(provider, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof options.force === 'undefined') options.force = true;
$.get('/Me/' + provider + '/run', options, function(r) {
callback(r === true);
}).error(function(r) {
callback(false);
});
}
return {
connectService : connectService,
syncService : syncService
};
})();