Machine Learning – Part 2

‘, type: ‘inline’ } }); // $.click won’t work, because .social-send button is created dynamically // de-attach other callbacks first $(document).off(‘click’, ‘.social-send’); $(document).on(‘click’, ‘.social-send’, function(){ // Replace the record’s url and @CDS Social with placeholders var message = $(‘.social-text’).val() var newMessage = message.replace(‘https://cds.cern.ch/record/2202367’, ‘{0}’) var newMessage = newMessage.replace(‘@CDS Social’, ‘@{1}’) // Disable the button and put a loader image inside $(‘.social-send’).disabled = true $(‘.social-send’).html(”) authenticateOnSocial(function(){ postOnSocial(newMessage); }); }); } jQuery( document ).ready(function() { // Determine if user is logged in or not based on the existence of // either ‘cern-account’ class or ‘cern-signout’ if($(‘.cern-account’).length) { // User NOT logged in $(‘.social-button’).click(function(){ alert(‘You have to be signed in to do this!’); }); } else if($(‘.cern-signout’).length) { // User logged in $(‘.social-button’).click(function(){ createMagnificPopup(); }); // attach the magnific popup now createMagnificPopup(); }…


Link to Full Article: Machine Learning – Part 2

Pin It on Pinterest

Share This