MediaWiki:Common.js: Difference between revisions

From Buddha-Nature
((by SublimeText.Mediawiker))
((by SublimeText.Mediawiker))
Line 1: Line 1:
// FontAwesome 5.0
// FontAwesome 5.0
// mw.loader.load( 'https://use.fontawesome.com/releases/v5.0.8/js/all.js' );
mw.loader.load( 'https://use.fontawesome.com/releases/v5.0.8/js/all.js' );


// Google Fonts
// Google Fonts
Line 12: Line 12:


// Animate.css
// Animate.css
// mw.loader.load( 'https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css', 'text/css' );
mw.loader.load( 'https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css', 'text/css' );


// Bootstrap 4.0 Resources
// Bootstrap 4.0 Resources
// mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css', 'text/css' );
mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css', 'text/css' );
// mw.loader.load( 'https://code.jquery.com/jquery-3.2.1.slim.min.js' );
mw.loader.load( 'https://code.jquery.com/jquery-3.2.1.slim.min.js' );
// mw.loader.load( 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js' );
mw.loader.load( 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js' );
// mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js' );
mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js' );





Revision as of 14:46, 28 March 2018

// FontAwesome 5.0
mw.loader.load( 'https://use.fontawesome.com/releases/v5.0.8/js/all.js' );

// Google Fonts
mw.loader.load( 'https://fonts.googleapis.com/css?family=Crimson+Text:400,400i,700', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Cinzel:400,700,900&subset=latin-ext', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Montserrat:200,400,600,900', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Quicksand', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Tangerine', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Lato:300,400', 'text/css' );
mw.loader.load( 'https://fonts.googleapis.com/css?family=Cormorant+Garamond', 'text/css' );

// Animate.css
mw.loader.load( 'https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css', 'text/css' );

// Bootstrap 4.0 Resources
mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css', 'text/css' );
mw.loader.load( 'https://code.jquery.com/jquery-3.2.1.slim.min.js' );
mw.loader.load( 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js' );
mw.loader.load( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js' );


// Navbar for BuNay Pages
$(document).ready(function(){
    $( '.rootpage-Buddha_Nature_Tests #bodyContent' ).prepend('<nav class="navbar navbar-expand-xl navbar-dark sticky-top" id="navbar-main"> <a class="navbar-brand" href="/index.php/Main_Page" style="font-size: 1.5rem; font-variant: small-caps;"> <img src="/images-budnat/a/a4/Tsadra_Logo_with_Large_White_Drop_Shadow.png" href="http://buddhanature.tsadra.org/" height="60" class="d-inline-block align-middle" alt=""> &nbsp;Buddha-Nature </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown"> <a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-boxes fa-fw"></i> Three Trainings </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="#"> <i class="fas fa-graduation-cap fa-fw"></i> Study </a> <a class="dropdown-item" href="#"> <i class="fas fa-comment-alt fa-fw"></i> Contemplate </a> <a class="dropdown-item" href="#"> <i class="fas fa-heart fa-fw"></i> Meditate </a> </div> </li> <li class="nav-item dropdown"> <a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-american-sign-language-interpreting fa-fw"></i> Teachings </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="#"> <i class="fas fa-video fa-fw"></i> Videos </a> <a class="dropdown-item" href="#"> <i class="fas fa-newspaper fa-fw"></i> Articles </a> <a class="dropdown-item" href="#"> <i class="fas fa-american-sign-language-interpreting fa-fw"></i> Dharma Teachings </a> </div> </li> <li class="nav-item dropdown"> <a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-search fa-fw"></i> Research </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="#"> <i class="fas fa-book fa-fw"></i> Primary Sources </a> <a class="dropdown-item" href="#"> <i class="fas fa-file-alt fa-fw"></i> Secondary Sources </a> <a class="dropdown-item" href="#"> <i class="fas fa-language fa-fw"></i> Translation Materials </a> <a class="dropdown-item" href="#"> <i class="fas fa-comments fa-fw"></i> Topics </a> </div> </li> <li class="nav-item dropdown"> <a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-fw fa-cubes" aria-hidden="true fa-fw"></i> Resources </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="#"> <i class="fas fa-graduation-cap fa-fw"></i> Study Materials </a> <a class="dropdown-item" href="#"> <i class="fas fa-american-sign-language-interpreting fa-fw"></i> Teaching Materials </a> <a class="dropdown-item" href="#"> <i class="fas fa-volume-up fa-fw"></i> Multimedia Portal </a> <a class="dropdown-item" href="#"> <i class="fas fa-list-ul fa-fw"></i> Term Search </a> </div> </li> <li class="nav-item"> <a class="nav-link" href="#"> <i class="fas fa-hashtag fa-fw"></i> About </a> </li> </ul> <ul class="navbar-nav mr-2"> <li class="nav-item dropdown"> <a class="nav-link" href="/index.php/Traditions" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-user fa-fw"></i> User </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="/index.php/Talk:Main_Page"> <i class="fas fa-comments fa-fw"></i> Talk </a> <a class="dropdown-item" href="#"> <i class="fas fa-edit fa-fw"></i> Edit </a> <a class="dropdown-item" href="#"> <i class="fas fa-sync-alt fa-fw"></i> Refresh </a> <a class="dropdown-item" href="#"> <i class="fas fa-copy fa-fw"></i> View History </a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="#"> <i class="fas fa-lock fa-fw"></i> Protect </a> <a class="dropdown-item" href="#"> <i class="fas fa-share-square fa-fw"></i> Move </a> <a class="dropdown-item" href="#"> <i class="fas fa-trash-alt fa-fw"></i> Delete </a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="#"> <i class="fas fa-sign-out-alt fa-fw"></i> Logout </a> </div> </li> </ul> <form class="form-inline my-2 my-lg-0"> <input class="form-control mr-sm-2" type="search" name="search" placeholder="Search" title="Search Buddha Nature [ctrl-option-f]" accesskey="f" id="searchInput" tabindex="1" autocomplete="off" aria-label="Search"> <input type="hidden" value="Special:Search" name="title"> <button class="btn btn-outline-danger my-2 my-sm-0" type="submit" name="go" title="Go to a page with this exact name if it exists" id="searchButton" > <i class="fas fa-search fa-fw"></i> </button> </form> </div> </nav>');
    $( '.rootpage-Main_Page #bodyContent' ).prepend('<nav class="navbar navbar-expand-xl navbar-dark sticky-top" id="navbar-main"> <a class="navbar-brand" href="/index.php/Main_Page" style="font-size: 1.5rem; font-variant: small-caps;"> <img src="/images-budnat/a/a4/Tsadra_Logo_with_Large_White_Drop_Shadow.png" href="https://tsadra-wp.tsadra.org/" height="60" class="d-inline-block align-middle" alt=""> &nbsp;Buddha-Nature </a> </nav>');
});


$(document).ready(function(){
	$('div.bnw-resources-buttons .bnw-resources-button:first-child').addClass('active');
	$('div.bnw-resources .bnw-resource-item:first-child').addClass('show');
	$('.bnw-resources-button').click(function(){
    	$(this).addClass('active');
    	$(this).siblings('.bnw-resources-button').removeClass('active');
    });
    $('#bnw-resources-button-1').click(function(){
    	$('#bnw-resource-item-1').addClass('show');
    	$('#bnw-resource-item-1').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-2').click(function(){
    	$('#bnw-resource-item-2').addClass('show');
    	$('#bnw-resource-item-2').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-3').click(function(){
    	$('#bnw-resource-item-3').addClass('show');
    	$('#bnw-resource-item-3').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-4').click(function(){
    	$('#bnw-resource-item-4').addClass('show');
    	$('#bnw-resource-item-4').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-5').click(function(){
    	$('#bnw-resource-item-5').addClass('show');
    	$('#bnw-resource-item-5').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-6').click(function(){
    	$('#bnw-resource-item-6').addClass('show');
    	$('#bnw-resource-item-6').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-7').click(function(){
    	$('#bnw-resource-item-7').addClass('show');
    	$('#bnw-resource-item-7').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-8').click(function(){
    	$('#bnw-resource-item-8').addClass('show');
    	$('#bnw-resource-item-8').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-9').click(function(){
    	$('#bnw-resource-item-9').addClass('show');
    	$('#bnw-resource-item-9').siblings('.bnw-resource-item').removeClass('show');
    });
    $('#bnw-resources-button-10').click(function(){
    	$('#bnw-resource-item-10').addClass('show');
    	$('#bnw-resource-item-10').siblings('.bnw-resource-item').removeClass('show');
    });
});


$(document).ready(function(){
    $('#headingOne').append('<a class="collapsed" data-toggle="collapse" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne"> Derge Version </a>');
    $('#headingTwo').append('<a class="collapsed" data-toggle="collapse" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Narthang Version </a>');
    $('#headingThree').append('<a class="collapsed" data-toggle="collapse" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Chone Version </a>');
    $('#headingFour').append('<a class="collapsed" data-toggle="collapse" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour"> Pe Durma Version </a>');
    $('#headingFive').append('<a class="collapsed" data-toggle="collapse" href="#collapseFive" aria-expanded="false" aria-controls="collapseFive"> Ser Drima Version </a>');
});


$(document).ready(function(){
	$(".pop-off, .pop-off-img img").hover(function(){
		$(this).toggleClass("depth-1 depth-5");
	});
});


$(document).ready(function(){
	$(".image-1").hover(function(){
		$("#description-1").toggleClass("hide show");
	});
	$(".image-2").hover(function(){
		$("#description-2").toggleClass("hide show");
	});
	$(".image-3").hover(function(){
		$("#description-3").toggleClass("hide show");
	});
	$(".image-4").hover(function(){
		$("#description-4").toggleClass("hide show");
	});
	$(".image-5").hover(function(){
		$("#description-5").toggleClass("hide show");
	});
	$(".image-6").hover(function(){
		$("#description-6").toggleClass("hide show");
	});
	$(".image-7").hover(function(){
		$("#description-7").toggleClass("hide show");
	});
	$(".image-8").hover(function(){
		$("#description-8").toggleClass("hide show");
	});
	$(".image-9").hover(function(){
		$("#description-9").toggleClass("hide show");
	});
	$(".image-10").hover(function(){
		$("#description-10").toggleClass("hide show");
	});
	$(".image-11").hover(function(){
		$("#description-11").toggleClass("hide show");
	});
});

$(document).ready(function(){
	$(".animated-caret a").hover(function(){
		$(this).children('#fadeInCaret').addClass('animated fadeInLeft').toggleClass('visible');
	});
});


// To change the site's favicon:
function change_favicon(img) {
    var favicon = document.querySelector('link[rel="shortcut icon"]');
    
    if (!favicon) {
        favicon = document.createElement('link');
        favicon.setAttribute('rel', 'shortcut icon');
        var head = document.querySelector('head');
        head.appendChild(favicon);
    }
    
    
    favicon.setAttribute('type', 'image/png');
    favicon.setAttribute('href', img);
}
change_favicon('/images-budnat/6/6b/Tsadra_Logo_Favicon_-_Jeremi.png');



// TESTS

/*
$(document).ready(function(){
	OO.ui.alert( 'Something larger happened!', { size: 'large' } );
});
*/