Advertisement
Guest User

Inyect embeded song forumotion JQ

a guest
Dec 8th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.75 KB | None | 0 0
  1. jQuery(document).ready(() => {
  2.   if(typeof profileFields !== 'undefined'){
  3.     profileFields.forEach(obj => {
  4.       if(obj.id === '1'){
  5.         const songIn = obj.content.indexOf('/track/');
  6.     const song = (songIn != -1) && obj.content.substring(songIn);
  7.         if(!!song){
  8.           $('.spoti-song').append('<iframe src="https://open.spotify.com/embed' + song + '" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>');
  9.         }else{
  10.           $('.spoti-song').append('<iframe src="https://open.spotify.com/embed/track/2zYzyRzz6pRmhPzyfMEC8s" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>');
  11.         };
  12.       };
  13.     });                    
  14.   };
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement