My Site/js/loaderRepository.js
/**
   * Fetch sulla repository prende il readme della repo e lo mette nel divID passato
   * @param {*repository url to fetch} url 
   * @param {*User of the repository} user 
   * @param {*div to spawn content} divID 
   */
Fetch sulla repository prende il readme della repo e lo mette nel divID passato
@param {*repository url to fetch} url
@param {*User of the repository} user
@param {*div to spawn content} divID
Fetch sulla repository prende il readme della repo e lo mette nel divID passato @param { * repository url to fetch } url @param { * User of the repository } user @param { * div to spawn content } divID
function featchRepositoryReadme(url, user, divID){
    var baseUri = 'https://github.com/';
    urlFetchProxy = "https://api.allorigins.win/raw?url="+url;
    fetch(urlFetchProxy,{
      method : 'GET',
    }).then(function (response) {
      return response.text();
    }).then(function (html) {
      var parser = new DOMParser;
      var doc = parser.parseFromString(html, 'text/html');
      var divReadme = doc.getElementById('readme');
      var links = divReadme.querySelectorAll('img');
      links.forEach(link => {
        var l = link.src.split(user)[1];
        link.src = baseUri+user+l;
        l.baseUri = baseUri;
      });
      var links = divReadme.querySelectorAll('a[target=_blank]');
      links.forEach(link => {
        var l = link.href.split(user)[1];
        link.href = baseUri+user+l;
      });
      var htmlOld = document.getElementById(divID).innerHTML;
      document.getElementById(divID).innerHTML = divReadme.innerHTML + htmlOld;
      ele = document.getElementById(divID);
      ele.querySelector("[data-target='readme-toc.content']").classList.remove('Box-body', 'px-5', 'pb-5');
    }).catch(function (err) {
      console.warn('Something went wrong.', err);
    });
  }
function featchRepositoryReadme ( url , user , divID ) { var baseUri = 'https://github.com/' ; urlFetchProxy = "https://api.allorigins.win/raw?url=" + url ; fetch ( urlFetchProxy , { method : 'GET' , } ) . then ( function ( response ) { return response . text ( ) ; } ) . then ( function ( html ) { var parser = new DOMParser ; var doc = parser . parseFromString ( html , 'text/html' ) ; var divReadme = doc . getElementById ( 'readme' ) ; var links = divReadme . querySelectorAll ( 'img' ) ; links . forEach ( link => { var l = link . src . split ( user ) [ 1 ] ; link . src = baseUri + user + l ; l . baseUri = baseUri ; } ) ; var links = divReadme . querySelectorAll ( 'a[target=_blank]' ) ; links . forEach ( link => { var l = link . href . split ( user ) [ 1 ] ; link . href = baseUri + user + l ; } ) ; var htmlOld = document . getElementById ( divID ) . innerHTML ; document . getElementById ( divID ) . innerHTML = divReadme . innerHTML + htmlOld ; ele = document . getElementById ( divID ) ; ele . querySelector ( "[data-target='readme-toc.content']" ) . classList . remove ( 'Box-body' , 'px-5' , 'pb-5' ) ; } ) . catch ( function ( err ) { console . warn ( 'Something went wrong.' , err ) ; } ) ; }
Fetch sulla repository prende il readme della repo e lo mette nel divID passato
 @param {*repository url to fetch} url
 @param {*User of the repository} user
 @param {*div to spawn content} divID
Fetch sulla repository prende il readme della repo e lo mette nel divID passato @param { * repository url to fetch } url @param { * User of the repository } user @param { * div to spawn content } divID
//var user = 'Elpiu'; //CORS Anywhere //Proxy CORS by https://github.com/Rob--W/cors-anywhere/#documentation //Video https://softauthor.com/how-to-fix-cors-issue-permanently-right-now/ //Usato questo proxy https://allorigins.win/ //headers : {'origin': window.location.href} // The API call was successful! // There was an error