Difference between revisions of "MediaWiki:Common.js"

Line 7: Line 7:
 
var headerText = $('.allset-page-heading h1').text();
 
var headerText = $('.allset-page-heading h1').text();
 
var header = $('.allset-page-heading h1');
 
var header = $('.allset-page-heading h1');
header.html(headerText + "<span style='float:right'>" + cfer + "/" + hsk + "<a href='/chinese/vocabulary/" + link + "' title='" + link + "'><img src='https://resources.allsetlearning.com/gramwiki/images/silk/link.png'></a></span>");
+
if(cfer !== "") {
 
+
  header.html(headerText + "<span style='float:right'>" + cfer + "/" + hsk + "<a href='/chinese/vocabulary/" + link + "' title='" + link + "'><img src='https://resources.allsetlearning.com/gramwiki/images/silk/link.png'></a></span>");  
// modify settings cog location so it aligns with the right-floated header items
+
  // modify settings cog location so it aligns with the right-floated header items
$('#settings-button').css('margin', '-0.5em 0 0 0.5em');
+
  $('#settings-button').css('margin', '-0.5em 0 0 0.5em');
 +
}
  
 
/* END */
 
/* END */
  
 
});
 
});

Revision as of 18:01, 26 September 2021

$(function() {

/* START Change DisplayTitle */
var cfer = $('#info-cfer').text();
var hsk = $('#info-hsk').text();
var link = $('#info-link').text();
var headerText = $('.allset-page-heading h1').text();
var header = $('.allset-page-heading h1');
if(cfer !== "") {
   header.html(headerText + "<span style='float:right'>" + cfer + "/" + hsk + "<a href='/chinese/vocabulary/" + link + "' title='" + link + "'><img src='https://resources.allsetlearning.com/gramwiki/images/silk/link.png'></a></span>"); 
   // modify settings cog location so it aligns with the right-floated header items
   $('#settings-button').css('margin', '-0.5em 0 0 0.5em');
}

/* END */

});