Advertisement
Guest User

Inyect embeded song forumotion

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