Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Jayprakash (talk | contribs) |
Jayprakash (talk | contribs) |
||
| Line 1: | Line 1: | ||
| + | window.protectedNamespace = [ "2020", "2021", "2022", "2023", "2024", "2025" ]; | ||
| + | |||
$( document ).ready( function(){ | $( document ).ready( function(){ | ||
if( mw.config.get('wgIsMainPage') ) | if( mw.config.get('wgIsMainPage') ) | ||
| Line 8: | Line 10: | ||
$('#p-UIF').children().find('a').attr('target', '_blank'); | $('#p-UIF').children().find('a').attr('target', '_blank'); | ||
| − | |||
if ( mw.config.get( 'wgPageName' ) === "Special:Badtitle" ){ | if ( mw.config.get( 'wgPageName' ) === "Special:Badtitle" ){ | ||
$('#pt-login').hide(); | $('#pt-login').hide(); | ||
| Line 59: | Line 60: | ||
ModifySidebar( 'Resources', 'Stakeholder Meeting', 'https://universityinnovation.org/wiki/2020:Training/Stakeholder_Meeting' ); | ModifySidebar( 'Resources', 'Stakeholder Meeting', 'https://universityinnovation.org/wiki/2020:Training/Stakeholder_Meeting' ); | ||
ModifySidebar( 'Resources', 'Silicon Valley Meetup 2021', 'https://universityinnovation.org/wiki/2020:Training/Silicon_Valley_Meetup_2021' ); | ModifySidebar( 'Resources', 'Silicon Valley Meetup 2021', 'https://universityinnovation.org/wiki/2020:Training/Silicon_Valley_Meetup_2021' ); | ||
| + | |||
| + | // Make Scurrent page non clickable | ||
| + | $('.portal .body > ul').children().each( function(){ | ||
| + | link = $( this ).children()[0].href; | ||
| + | if ( link === window.location.href ) { | ||
| + | $( $( this ).children()[0]).css({ | ||
| + | "pointer-events": "none", | ||
| + | "cursor": "default", | ||
| + | "color": "#000", | ||
| + | "font-weight": "bold" | ||
| + | }) | ||
| + | } | ||
| + | } ); | ||
| + | |||
} else { | } else { | ||
$('#p-Session').remove(); | $('#p-Session').remove(); | ||
Revision as of 20:05, 13 March 2020
window.protectedNamespace = [ "2020", "2021", "2022", "2023", "2024", "2025" ];
$( document ).ready( function(){
if( mw.config.get('wgIsMainPage') )
{
$('#sbl-breadcrumbs').remove();
}
// Open all UIF link in new tab
$('#p-UIF').children().find('a').attr('target', '_blank');
if ( mw.config.get( 'wgPageName' ) === "Special:Badtitle" ){
$('#pt-login').hide();
}
});
// Sidebar
$( document ).ready(function(){
function ModifySidebar( section, name, link ) {
var node = document.getElementById( 'p-'+ section )
.getElementsByTagName( 'div' )[0]
.getElementsByTagName( 'ul' )[0];
var aNode = document.createElement( 'a' );
var liNode = document.createElement( 'li' );
aNode.appendChild( document.createTextNode( name ) );
aNode.setAttribute( 'href', link );
liNode.appendChild( aNode );
liNode.className = 'plainlinks';
node.appendChild( liNode );
}
if( mw.config.get('wgCanonicalNamespace') === "2020"){
$('#p-navigation > .body ul').empty();
$('#p-tb').remove();
$('#p-UIF').remove();
// Navigation Links
ModifySidebar( 'navigation', 'Back to Main Page', 'https://universityinnovation.org/wiki/Main_Page' );
// Session Links
ModifySidebar( 'Session', 'Your Mission', 'https://universityinnovation.org/wiki/2020:Training/Your_Mission' );
ModifySidebar( 'Session', 'Session 0', 'https://universityinnovation.org/wiki/2020:Training/Session_0_(Orientation)' );
ModifySidebar( 'Session', 'Session 1', 'https://universityinnovation.org/wiki/2020:Training/Session_1_(Inspiration_Week)' );
ModifySidebar( 'Session', 'Session 2', 'https://universityinnovation.org/wiki/2020:Training/Session_2_(Design_Thinking)' );
ModifySidebar( 'Session', 'Session 3', 'https://universityinnovation.org/wiki/2020:Training/Session_3_(Landscape_Canvas)' );
ModifySidebar( 'Session', 'Session 4', 'https://universityinnovation.org/wiki/2020:Training/Session_4_(Strategic_Priorities)' );
ModifySidebar( 'Session', 'Session 5', 'https://universityinnovation.org/wiki/2020:Training/Session_5_(Lean_Startup)' );
ModifySidebar( 'Session', 'Session 6', 'https://universityinnovation.org/wiki/2020:Training/Session_6_(Storytelling)' );
// Resources Links
ModifySidebar( 'Resources', 'Submitting Assignments', 'https://universityinnovation.org/wiki/2020:Training/Submitting_Assignments' );
ModifySidebar( 'Resources', 'Roadmap', 'https://universityinnovation.org/wiki/2020:Training/Roadmap' );
ModifySidebar( 'Resources', 'Leadership Circle', 'https://universityinnovation.org/wiki/2020:Training/Leadership_Circle' );
ModifySidebar( 'Resources', 'Ask Us Anything', 'https://universityinnovation.org/wiki/2020:Training/Ask_Us_Anything' );
ModifySidebar( 'Resources', 'Community Agreements', 'https://universityinnovation.org/wiki/2020:Training/Community_Agreements' );
ModifySidebar( 'Resources', 'Stakeholder Meeting', 'https://universityinnovation.org/wiki/2020:Training/Stakeholder_Meeting' );
ModifySidebar( 'Resources', 'Silicon Valley Meetup 2021', 'https://universityinnovation.org/wiki/2020:Training/Silicon_Valley_Meetup_2021' );
// Make Scurrent page non clickable
$('.portal .body > ul').children().each( function(){
link = $( this ).children()[0].href;
if ( link === window.location.href ) {
$( $( this ).children()[0]).css({
"pointer-events": "none",
"cursor": "default",
"color": "#000",
"font-weight": "bold"
})
}
} );
} else {
$('#p-Session').remove();
$('#p-Resources').remove();
}
});
// Gadget-HotCat
mw.loader.load( '/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
// Gadget - QRCode
mw.loader.load('/index.php?title=MediaWiki:QRCode.js&action=raw&ctype=text/javascript');