1/** 2 * Yii auth choice widget. 3 * 4 * This is the JavaScript widget used by the yii\authclient\widgets\AuthChoice widget. 5 * 6 * @link https://www.yiiframework.com/ 7 * @copyright Copyright (c) 2008 Yii Software LLC 8 * @license https://www.yiiframework.com/license/ 9 * @author Paul Klimov <[email protected]> 10 * @since 2.0 11 */ 12jQuery(function($) { 13 $.fn.authchoice = function(options) { 14 options = $.extend({ 15 triggerSelector: 'a.auth-link', 16 popup: { 17 resizable: 'yes', 18 scrollbars: 'no', 19 toolbar: 'no', 20 menubar: 'no', 21 location: 'no', 22 directories: 'no', 23 status: 'yes', 24 width: 450, 25 height: 380 26 } 27 }, options); 28 29 return this.each(function() { 30 var $container = $(this); 31 32 $container.find(options.triggerSelector).on('click', function(e) { 33 e.preventDefault(); 34 35 var authChoicePopup = $container.data('authChoicePopup'); 36 37 if (authChoicePopup) { 38 authChoicePopup.close(); 39 } 40 41 var url = this.href; 42 var popupOptions = $.extend({}, options.popup); // clone 43 44 var localPopupWidth = this.getAttribute('data-popup-width'); 45 if (localPopupWidth) { 46 popupOptions.width = localPopupWidth; 47 } 48 var localPopupHeight = this.getAttribute('data-popup-height'); 49 if (localPopupWidth) { 50 popupOptions.height = localPopupHeight; 51 } 52 53 popupOptions.left = (window.screen.width - popupOptions.width) / 2; 54 popupOptions.top = (window.screen.height - popupOptions.height) / 2; 55 56 var popupFeatureParts = []; 57 for (var propName in popupOptions) { 58 if (popupOptions.hasOwnProperty(propName)) { 59 popupFeatureParts.push(propName + '=' + popupOptions[propName]); 60 } 61 } 62 var popupFeature = popupFeatureParts.join(','); 63 64 authChoicePopup = window.open(url, 'yii_auth_choice', popupFeature); 65 authChoicePopup.focus(); 66 67 $container.data('authChoicePopup', authChoicePopup); 68 }); 69 }); 70 }; 71});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.