common.js 648 B

1234567891011121314151617181920212223
  1. $(function () {
  2. $('h1').find('a')
  3. .attr('target', '_blank')
  4. .addClass('edit-page-link')
  5. .text('Edit on GitHub');
  6. // languages
  7. $('[data-language]').each(function (i) {
  8. var $this = $(this),
  9. language = $this.data('language');
  10. // default
  11. if (i === 0) {
  12. $this.addClass('active');
  13. }
  14. $this.find('a').attr('href', '/' + (language === 'en' ? '' : language));
  15. if (location.href.indexOf(language) !== -1) {
  16. $this.addClass('active').siblings().removeClass('active');
  17. $('.language').text($(this).text());
  18. }
  19. });
  20. });