Added contact link, commented Bandcamp related stuff
This commit is contained in:
		
							
								
								
									
										40
									
								
								js/main.js
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								js/main.js
									
									
									
									
									
								
							@@ -54,6 +54,7 @@ class player {
 | 
			
		||||
        let resp = check_url(url);
 | 
			
		||||
 | 
			
		||||
        if (resp < 0) {
 | 
			
		||||
          alert('Wrong URL...');
 | 
			
		||||
          console.log('Nothing to load!');
 | 
			
		||||
        } else if (resp == 0) {
 | 
			
		||||
          let newTrackID = get_video_id(url);
 | 
			
		||||
@@ -66,10 +67,13 @@ class player {
 | 
			
		||||
            console.log('track to load: ' + newTrackID);
 | 
			
		||||
            this.load(newTrackID);
 | 
			
		||||
          } else {
 | 
			
		||||
            alert('Wrong URL...');
 | 
			
		||||
            console.log('Nothing to load!');
 | 
			
		||||
          }
 | 
			
		||||
        } else if (resp == 1) {
 | 
			
		||||
          fetch_bandcamp_url(url);
 | 
			
		||||
          // fetch_bandcamp_url(url);
 | 
			
		||||
          alert('Wrong URL...');
 | 
			
		||||
          console.log('Nothing to load!');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -181,12 +185,15 @@ function get_playlist_id(url) {
 | 
			
		||||
    let regPlaylist = /[?&]list=([^#\&\?]+)/;
 | 
			
		||||
    let regIndex = /[?&]index=([^#]+)/;
 | 
			
		||||
    let match = url.match(regPlaylist);
 | 
			
		||||
    console.log('match ' + match);
 | 
			
		||||
    let matchIndex = url.match(regIndex);
 | 
			
		||||
    console.log('matchindex ' + matchIndex);
 | 
			
		||||
    // console.log('regexp ' + match.match(/=LL([^#\&\?]*)/));
 | 
			
		||||
    let index = 0;
 | 
			
		||||
    if (matchIndex != null) {
 | 
			
		||||
      index = matchIndex[1] - 1;
 | 
			
		||||
    }
 | 
			
		||||
    if (match != null) {
 | 
			
		||||
    if (match != null && match[1].lenght > 2) { // lenght > 2 prevents from trying to load a "list=LL" (liked videos of signed-in user)
 | 
			
		||||
      return [match[1], index];
 | 
			
		||||
    } else {
 | 
			
		||||
      return [0,0];
 | 
			
		||||
@@ -225,6 +232,12 @@ function componentToHex(c) {
 | 
			
		||||
// -----------------------------------
 | 
			
		||||
// BANDCAMP Tests
 | 
			
		||||
// -----------------------------------
 | 
			
		||||
// let surl = 'https://bandcamp.com/api/bcsearch_public_api/1/autocomplete_elastic';
 | 
			
		||||
// let req = {"search_text": "techno",
 | 
			
		||||
//             "search_filter": "",
 | 
			
		||||
//           	"full_page": false,
 | 
			
		||||
//           	"fan_id": null
 | 
			
		||||
//           };
 | 
			
		||||
// let bcURL = 'https://clett.bandcamp.com/track/placenta';
 | 
			
		||||
// let request = new Request(bcURL);
 | 
			
		||||
// let headers = new Headers({
 | 
			
		||||
@@ -309,9 +322,9 @@ function newShootingStar() {
 | 
			
		||||
newShootingStar();
 | 
			
		||||
 | 
			
		||||
// Enable/disable shooting stars
 | 
			
		||||
let separatorSpan = document.createElement('span');
 | 
			
		||||
separatorSpan.innerHTML = ' - ';
 | 
			
		||||
document.getElementById('shooting-stars-enable').after(separatorSpan);
 | 
			
		||||
// let separatorSpan = document.createElement('span');
 | 
			
		||||
// separatorSpan.innerHTML = ' - ';
 | 
			
		||||
// document.getElementById('shooting-stars-enable').after(separatorSpan);
 | 
			
		||||
document.getElementById('shooting-stars-enable').innerHTML = '⭐️Disable shooting stars⭐️';
 | 
			
		||||
 | 
			
		||||
document.getElementById('shooting-stars-enable').addEventListener('click', () => {
 | 
			
		||||
@@ -345,3 +358,20 @@ document.getElementById('shooting-stars-enable').addEventListener('click', () =>
 | 
			
		||||
//     processingIsOn = true;
 | 
			
		||||
//   }
 | 
			
		||||
// });
 | 
			
		||||
 | 
			
		||||
/*-------------------------------------------------------
 | 
			
		||||
- EMAIL OBFUSCATION - found here http://www.grall.name/posts/1/antiSpam-emailAddressObfuscation.html
 | 
			
		||||
-------------------------------------------------------*/
 | 
			
		||||
document.getElementById('contact-me').addEventListener('click', (e) => {
 | 
			
		||||
  console.log('okay');
 | 
			
		||||
  var y = decode("pbagnpg@gsypy.klm"); //https://rot13.com/
 | 
			
		||||
  e.target.setAttribute("href", "mailto:" + y);
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
function decode(a) {
 | 
			
		||||
  // ROT13 : a Caesar cipher
 | 
			
		||||
  // letter -> letter' such that code(letter') = (code(letter) + 13) modulo 26
 | 
			
		||||
  return a.replace(/[a-zA-Z]/g, function(c){
 | 
			
		||||
    return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
 | 
			
		||||
  })
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user