1/* 2This file is part of the plugin Login with Vipps 3Copyright (c) 2019 WP-Hosting AS 4 5MIT License 6 7Copyright (c) 2019 WP-Hosting AS 8 9Permission is hereby granted, free of charge, to any person obtaining a copy 10of this software and associated documentation files (the "Software"), to deal 11in the Software without restriction, including without limitation the rights 12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13copies of the Software, and to permit persons to whom the Software is 14furnished to do so, subject to the following conditions: 15 16The above copyright notice and this permission notice shall be included in all 17copies or substantial portions of the Software. 18 19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25SOFTWARE. 26*/ 27 28// This can be used in buttons to login for the specified application 29var vipps_loggingin = false; 30function login_with_vipps(application, more_data) { 31 if (vipps_loggingin) return; 32 vipps_loggingin = true; 33 var ajaxUrl = vippsLoginConfig.ajax_url; 34 35 var data = (typeof more_data == 'object' && more_data !== null) ? more_data : {}; 36 data['action'] = 'vipps_login_get_link'; 37 data['application'] = application; 38 39 // Allow customizers to add more data to what is sent to the login process without it having been explicitly passed 40 if (typeof wp !== 'undefined' && typeof wp.hooks !== 'undefined') { 41 data = wp.hooks.applyFilters('loginWithVippsExtraData', data); 42 } 43 44 // for WPML. IOK 2021-08-31 45 if (vippsLoginConfig['lang']) { 46 data['lang'] = vippsLoginConfig['lang']; 47 } 48 49 50 if (!application) application='wordpress'; 51 jQuery.ajax(ajaxUrl, { 52 data: data, 53 method: 'POST', 54 dataType: 'json', 55 error: function (jqXHR,textStatus,errorThrown) { 56 vipps_loggingin = false; 57 alert("Error " + textStatus); 58 }, 59 success: function(data, textStatus, jqXHR) { 60 if (data && data['url']) { 61 window.location.href = data['url']; 62 } else { 63 vipps_loggingin = false; 64 } 65 } 66 67 }); 68} 69// This is for blocks, which can't use onclick or really any stored javascript IOK 2020-12-16 70jQuery(document).ready(function () { 71 jQuery('.vipps-button.continue-with-vipps.continue-with-vipps-action').click(function (e) { 72 login_with_vipps(jQuery(this).data('application')); 73 }); 74}); 75
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.