site/includes/modules.js
/**
 * Shows the module preview, after fetching the info
 * @param {number} categoryBar The track element
 * @param {string} module_id The module ID
 */
Shows the module preview, after fetching the info
@param {number} categoryBar The track element
@param {string} module_id The module ID
Shows the module preview after fetching the info @param { number } categoryBar The track element @param { string } module_id The module ID
function loadPreview(categoryBar, module_id){
  if(!$(this).hasClass("placeholderCard")){
    $.ajax({url:"https://gm4.co/includes/getmoduleinfo.php?module_id="+module_id}).done(function(data){
      data = JSON.parse(data);
      $("#browse .preview").remove();
      categoryBar.after('<div class="preview"><div class="previewMedia"></div><div class="previewInfo"></div></div>');
      const previewMedia = $("#browse .previewMedia");
      const previewInfo = $("#browse .previewInfo");
      previewInfo.append(`<h3>${data.module_name}</h3><p>${data.site_description}</p>`);
      if (data.mcversion === LATEST_VERSION) {
        previewInfo.append(`<a class="squircleLink datapackLink" target="download_frame" href="https://gm4.co/modules/download/${LATEST_VERSION}/${data.module_id.replaceAll("_", "-")}"><img src="/images/datapack.svg" alt="Datapack Icon">Download for Java ${LATEST_VERSION}</a>`)
      }
      previewInfo.append(`<a class="squircleLink moreLink" href="https://www.gm4.co/modules/${data.module_id.replaceAll("_", "-")}"><img src="/images/rightArrow.svg" alt="Info icon">More Downloads & Info</a>`);
      if (data.wiki_link){
        previewInfo.append(`<a class="squircleLink wikiLink" href="${data.wiki_link}" target="_blank"><img src="/images/wiki.svg" alt="Wiki icon">Read about this on the Wiki</a>`);
      }
      if (data.promo) {
        load_site_meta(previewMedia, module_id, data.promo);
      } else {
        previewMedia.append(`<img src="${get_module_icon(module_id)}">`)
      }
    });
  }
}
function loadPreview ( categoryBar , module_id ) { if ( ! $ ( this ) . hasClass ( "placeholderCard" ) ) { $ . ajax ( { url : "https://gm4.co/includes/getmoduleinfo.php?module_id=" + module_id } ) . done ( function ( data ) { data = JSON . parse ( data ) ; $ ( "#browse .preview" ) . remove ( ) ; categoryBar . after ( '<div class="preview"><div class="previewMedia"></div><div class="previewInfo"></div></div>' ) ; const previewMedia = $ ( "#browse .previewMedia" ) ; const previewInfo = $ ( "#browse .previewInfo" ) ; previewInfo . append ( ` ${ data . module_name } ${ data . site_description } ` ) ; if ( data . mcversion === LATEST_VERSION ) { previewInfo . append ( ` ${ LATEST_VERSION } ${ data . module_id . replaceAll ( "_" , "-" ) } ${ LATEST_VERSION } ` ) } previewInfo . append ( ` ${ data . module_id . replaceAll ( "_" , "-" ) } ` ) ; if ( data . wiki_link ) { previewInfo . append ( ` ${ data . wiki_link } ` ) ; } if ( data . promo ) { load_site_meta ( previewMedia , module_id , data . promo ) ; } else { previewMedia . append ( ` ${ get_module_icon ( module_id ) } ` ) } } ) ; } }
Shows the module preview, after fetching the info
 @param {number} categoryBar The track element
 @param {string} module_id The module ID
Shows the module preview after fetching the info @param { number } categoryBar The track element @param { string } module_id The module ID