src/pyams_security/resources/js/security.js
changeset 0 f04e1d0a0723
child 2 94e76f8e9828
equal deleted inserted replaced
-1:000000000000 0:f04e1d0a0723
       
     1 (function($) {
       
     2 
       
     3 	window.PyAMS_security = {
       
     4 
       
     5 		/**
       
     6 		 * Init social plug-in
       
     7 		 */
       
     8 		init_social: function (element) {
       
     9 
       
    10 			MyAMS.ajax.check(window.authomatic,
       
    11 							'/--static--/pyams_security/js/authomatic' + (MyAMS.devmode ? '.min.js' : '.js'),
       
    12 							function (first_load) {
       
    13 								authomatic.setup({
       
    14 									popupWidth: 800,
       
    15 									popupHeight: 400,
       
    16 									onLoginComplete: function(result) {
       
    17 										console.log(result);
       
    18 										if (result.error) {
       
    19 
       
    20 										} else if (result.user) {
       
    21 											alert(result.user);
       
    22 										}
       
    23 									}
       
    24 								});
       
    25 								authomatic.popupInit();
       
    26 							});
       
    27 		},
       
    28 
       
    29 		/**
       
    30 		 * Ordered plug-ins callback
       
    31 		 */
       
    32 		plugins: {
       
    33 
       
    34 			/**
       
    35 			 * Change plug-ins names order
       
    36 			 */
       
    37 			changeOrder: function(table, names) {
       
    38 				var input = $('input[name="' + $(this).data('ams-input-name') + '"]', $(this));
       
    39 				input.val(names.join(';'));
       
    40 			}
       
    41 		}
       
    42 	};
       
    43 
       
    44 })(jQuery);