src/hp_assets/js/main.js
// Once we have populated our apps in the config variable, render them properly
Once we have populated our apps in the config variable, render them properly
Once we have populated our apps in the config variable render them properly
function renderLinks() {
  const wrapperEl = document.getElementById("links-wrap");
  $.config.all_links.map((app) => {
    const appName = app.title;
    const newTabStr = $.config.open_links_in_new_tab ? " target=\"_blank\" rel=\"noopener noreferrer\"" : "";
    const iconOrImage = app.image ?
      `<img src="${app.image}" height="80" width="80" alt="${appName}" />`
      :
      `<i class="fa fa-${app.icon}"></i>`;
    const appDiv = `<div class="link col-md-4 col-sm-6 col-xs-12"><a href="${httpize(app.url)}" title="${appName}"${newTabStr}>${iconOrImage}</a></div>`;
    wrapperEl.innerHTML += appDiv;
  });
  let appsLengthOrNine = $.config.all_links.length >= 9 ? 9 : $.config.all_links.length;
  for (let i = 0; i < appsLengthOrNine; i++) {
    let oneBasedIndex = i + 1;
    Mousetrap.bind(`${oneBasedIndex}`, function() {
      if (!menuHidden) {
        let link = $(`.link:eq(${i}) a`).attr("href");
        if ($.config.open_links_in_new_tab) {
          window.open(link, '_blank');
        } else {
          window.location = link;
        }
      }
    });
  }
}
function renderLinks ( ) { const wrapperEl = document . getElementById ( "links-wrap" ) ; $ . config . all_links . map ( ( app ) => { const appName = app . title ; const newTabStr = $ . config . open_links_in_new_tab ? " target=\"_blank\" rel=\"noopener noreferrer\"" : "" ; const iconOrImage = app . image ? ` ${ app . image } ${ appName } ` : ` ${ app . icon } ` ; const appDiv = ` ${ httpize ( app . url ) } ${ appName } ${ newTabStr } ${ iconOrImage } ` ; wrapperEl . innerHTML += appDiv ; } ) ; let appsLengthOrNine = $ . config . all_links . length >= 9 ? 9 : $ . config . all_links . length ; for ( let i = 0 ; i < appsLengthOrNine ; i ++ ) { let oneBasedIndex = i + 1 ; Mousetrap . bind ( ` ${ oneBasedIndex } ` , function ( ) { if ( ! menuHidden ) { let link = $ ( ` ${ i } ` ) . attr ( "href" ) ; if ( $ . config . open_links_in_new_tab ) { window . open ( link , '_blank' ) ; } else { window . location = link ; } } } ) ; } }
Once we have populated our apps in the config variable, render them properly
Once we have populated our apps in the config variable render them properly
// Set key bindings for the first 9 apps