Commit 6b374529 by Paul Klimov

Auth clients "Choice" widget javascript advanced.

parent ba1c5d60
jQuery(function($) { jQuery(function($) {
var authChoicePopup;
$.fn.authchoice = function(options) { $.fn.authchoice = function(options) {
options = $.extend({ options = $.extend({
popup: { popup: {
...@@ -17,13 +15,17 @@ jQuery(function($) { ...@@ -17,13 +15,17 @@ jQuery(function($) {
}, options); }, options);
return this.each(function() { return this.each(function() {
var container = $(this); var $container = $(this);
container.find('a').on('click', function(e) { $container.find('a').on('click', function(e) {
e.preventDefault(); e.preventDefault();
if (authChoicePopup !== undefined) {
var authChoicePopup = null;
if (authChoicePopup = $container.data('authChoicePopup')) {
authChoicePopup.close(); authChoicePopup.close();
} }
var url = this.href; var url = this.href;
var popupOptions = options.popup; var popupOptions = options.popup;
...@@ -47,6 +49,8 @@ jQuery(function($) { ...@@ -47,6 +49,8 @@ jQuery(function($) {
authChoicePopup = window.open(url, 'yii_auth_choice', popupFeature); authChoicePopup = window.open(url, 'yii_auth_choice', popupFeature);
authChoicePopup.focus(); authChoicePopup.focus();
$container.data('authChoicePopup', authChoicePopup);
}); });
}); });
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment