1/** 2* @package com_spauthorarchive 3* 4* @author JoomShaper http://www.joomshaper.com 5* @copyright Copyright (c) 2010 - 2019 JoomShaper 6* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later 7*/ 8 9jQuery(function($) { 10 // onclick bookmark action button 11 $('.sp-bookmark-form .btn-spbookmark-action').on('click', function (e) { 12 e.preventDefault(); 13 var that = $(this).parent('form.sp-bookmark-form'); 14 var values = that.serializeArray(); 15 16 $.ajax({ 17 type: 'POST', 18 url: 'index.php?option=com_spauthorarchive&task=bookmarks.addBookmark', 19 format: 'json', 20 data: values, 21 beforeSend: function () { 22 that.find('span.spbookmark-icon').removeClass('fa-bookmark-o').addClass('fa-spinner fa-pulse'); 23 }, 24 success: function (res) { 25 var response = typeof res === 'string' && res.length > 0 ? JSON.parse(res) : false; 26 if ( response ) { 27 if ( response.status ) { 28 // if add bookmark item 29 if( response.action_type == 'add' || response.action_type == 'update' ) { 30 that.find('span.spbookmark-icon').removeClass('fa-spinner fa-pulse').addClass('fa-bookmark'); 31 } else { // if remove bookmark item 32 that.find('span.spbookmark-icon').removeClass('fa-spinner fa-pulse').addClass('fa-bookmark-o'); 33 } 34 } else { 35 // if status is false 36 that.find('span.spbookmark-icon').removeClass('fa-spinner fa-pulse').addClass('fa-bookmark-o'); 37 38 // if user isn't loggedin then direct to login url 39 if ( !response.loggedin ) { 40 if(response.message) { 41 Joomla.renderMessages({"success":[response.message]}); 42 } 43 window.location.href = response.loginurl; 44 } else if(response.message) { 45 Joomla.renderMessages({"success":[response.message]}); 46 } 47 } 48 49 // if has message then render Joomla! alert message 50 if(response.message) { 51 Joomla.renderMessages({"success":[response.message]}); 52 } 53 } else { 54 // if has message then render Joomla! alert message 55 if(response.message) { 56 Joomla.renderMessages({"danger":[response.message]}); 57 } 58 } 59 } 60 }); 61 }); 62});
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.