MediaWiki:Common.js

Revision as of 15:32, 22 February 2023 by Jeremi (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
mw.loader.load( 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=EB+Garamond', 'text/css' );
mw.loader.load( 'https://pro.fontawesome.com/releases/v5.5.0/css/all.css', 'text/css' );
mw.loader.load( 'mediawiki.ui.button' );

// Download Unicode RTF functions
$(document).ready(function(){
    $( '.text-breadcrumb-content' ).append('&nbsp;-&nbsp;<a href="#" id="downloadUnicode">Download Tibetan Text</a>');
});

/*     RTZ Main Page Functions     */

$(document).ready(function(){
	$('#section-links').hover(
		function(){ $('#tsdlogo').addClass('hide') },
		function(){ $('#tsdlogo').removeClass('hide') }
	);
	$('#bios-trigger').click(function() {
		window.location = "Biographies";
	}).hover(
		function(){ $('#bios-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#bios-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#indexes-trigger').click(function() {
		window.location = "Indexes and Lineage Histories";
	}).hover(
		function(){ $('#indexes-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#indexes-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#maha-trigger').click(function() {
		window.location = "Mahayoga";
	}).hover(
		function(){ $('#maha-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#maha-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#anu-trigger').click(function() {
		window.location = "Anuyoga";
	}).hover(
		function(){ $('#anu-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#anu-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#ati-trigger').click(function() {
		window.location = "Atiyoga";
	}).hover(
		function(){ $('#ati-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#ati-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#sup-trigger').click(function() {
		window.location = "Supplementary Volumes";
	}).hover(
		function(){ $('#sup-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#sup-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#ill-trigger').click(function() {
		window.location = "RTZ Volume 72";
	}).hover(
		function(){ $('#ill-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#ill-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('#out-trigger').click(function() {
		window.location = "RTZ Outline";
	}).hover(
		function(){ $('#out-back').css('z-index','999').addClass('animated fadeIn') },
		function(){ $('#out-back').css('z-index','-999').removeClass('animated fadeIn') }
	);
	$('.more-trigger').click(function() {
		$(this).siblings('div#more-text').toggleClass('more-text-display');
		$(this).toggleClass('fa-ellipsis-h fa-ellipsis-v');
	});
});

/*     RTZ Outline Page Functions     */

$(document).ready(function(){
	$('.mw-customtoggle-textQuery .fa-plus-circle').click(function(){
    	$(this).toggleClass("rotated");
    });
});





/*     RTZ Biographies Page Functions     */

$(document).ready(function(){
	$('.info-tab-header').click(function() {
		$(this).siblings('#info-text').css('display','block');
		$(this).removeClass('inactive-header');
		$(this).siblings('#tibetan-text').css('display', 'none');
		$(this).siblings('#wylie-text').css('display', 'none');
		$(this).siblings('.tibetan-tab-header').addClass('inactive-header');
		$(this).siblings('.wylie-tab-header').addClass('inactive-header')
	});
	$('.wylie-tab-header').click(function() {
		$(this).siblings('#wylie-text').css('display','block');
		$(this).removeClass('inactive-header');
		$(this).siblings('#info-text').css('display', 'none');
		$(this).siblings('#tibetan-text').css('display', 'none');
		$(this).siblings('.info-tab-header').addClass('inactive-header');
		$(this).siblings('.tibetan-tab-header').addClass('inactive-header')
	});
	$('.tibetan-tab-header').click(function() {
		$(this).siblings('#tibetan-text').css('display','block');
		$(this).removeClass('inactive-header');
		$(this).siblings('#info-text').css('display', 'none');
		$(this).siblings('#wylie-text').css('display', 'none');
		$(this).siblings('.info-tab-header').addClass('inactive-header');
		$(this).siblings('.wylie-tab-header').addClass('inactive-header')
	});
	$('.smw-template-furtherresults').addClass('plainlinks')
});


// Download Unicode RTF functions
function downloadInnerHtml(filename, elId, mimeType) {
    var elHtml = document.getElementById(elId).innerHTML;
    var link = document.createElement('a');
    mimeType = mimeType || 'text/plain';

    link.setAttribute('download', filename);
    link.setAttribute('href', 'data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(elHtml));
    link.click(); 
}

var fileName =  'UnicodeContent.txt'; // You can use the .html extension if you want

$('#downloadUnicode').click(function(){
    downloadInnerHtml(fileName, 'tibetan','text/html');
});




// Delay hiding the loader overlay 

$("#loaderOutline").load("RTZ_Outline/content #outlineContent", function() {
    $(this).children("#loader").fadeOut("fast");
    $(this).css('min-height', '0px');
	$('.outline-modal-trigger').click(function() {
		$(this).siblings('.outline-item-table').toggleClass('show');
	});
});

$("#loaderMahayoga").load("Mahayoga/content #mahayogaContent", function() {
    $(this).children("#loader").fadeOut("fast");
    $(this).css('min-height', '0px');
	$('.outline-modal-trigger').click(function() {
		$(this).siblings('.outline-item-table').toggleClass('show');
	});
});

$("#loaderAtiyoga").load("Atiyoga/content #atiyogaContent", function() {
    $(this).children("#loader").fadeOut("fast");
    $(this).css('min-height', '0px');
	$('.outline-modal-trigger').click(function() {
		$(this).siblings('.outline-item-table').toggleClass('show');
	});
});

$("#loaderSupplement").load("Supplementary_Volumes/content #supplementContent", function() {
    $(this).children("#loader").fadeOut("fast");
    $(this).css('min-height', '0px');
	$('.outline-modal-trigger').click(function() {
		$(this).siblings('.outline-item-table').toggleClass('show');
	});
});