MediaWiki:Mobile.js
Jump to navigation
Jump to search
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: 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.
/* Any JavaScript here will be loaded for users using the mobile site */
if( [ "Training" ].indexOf( mw.config.get( 'wgCanonicalNamespace' )) !== -1 ){
location.replace( mw.config.get( 'wgServer' ) + "/wiki/" + mw.config.get("wgPageName") + "?mobileaction=toggle_view_desktop" );
}
mw.loader.load('/index.php?title=MediaWiki:Gadget-2020Cohort.js&action=raw&ctype=text/javascript');
// Redirect Topic page to their parent pages
$( function(){
if( mw.config.get( 'wgNamespaceNumber') === mw.config.get( 'wgNamespaceIds' ).topic ){
location.replace( mw.config.get( 'wgServer') + $(".page-heading").next().attr( "href" ) );
}
});
/* Rahul Js Code */
var _object='<div class="_dummylogo"><div class="_logo"></div><a onclick="openmenu(this);" data-val="false" href="javascript:void(0);" class="_nav"><svg height="40" viewBox="0 0 40 40" width="40"><g> <path d="M35.7,18.04H4c-1.66,0-3,1.24-3,2.77s1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77S37.36,18.04,35.7,18.04z"/><path d="M35.7,6.98H4c-1.66,0-3,1.24-3,2.77s1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77S37.36,6.98,35.7,6.98z"/><path d="M35.7,29.11H4c-1.66,0-3,1.24-3,2.77c0,1.53,1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77C38.7,30.34,37.36,29.11,35.7,29.11z"/></g></svg></a></div>';
function addlogo(){
var width = $(window).width();
//console.log('>>>>>>>>',width);
if(width<=1200){
$('._rstring #mw-head').prepend(_object);
// console.log('<<<<<<<<<<<<',$('body').hasClass('._rstring'));
}else{
$('._rstring #mw-head').find('._dummylogo').remove();
}
}
function openmenu(ctrl){
var know = $(ctrl).attr('data-val');
console.log(know);
if(know=='false'){
$('._rstring #mw-panel').addClass('_show');
$(ctrl).attr('data-val','true');
$(ctrl).find('g').html('<path d="M33.29,28.95L10.46,6.96C9.27,5.81,7.44,5.77,6.38,6.87S5.43,9.8,6.63,10.95l22.82,21.99c1.19,1.15,3.02,1.19,4.08,0.09C34.59,31.93,34.48,30.1,33.29,28.95z"/><path d="M29.55,6.05L7.72,29.03c-1.14,1.2-1.17,3.03-0.06,4.08c1.11,1.05,2.93,0.93,4.07-0.27L33.56,9.86c1.14-1.2,1.17-3.03,0.06-4.08C32.51,4.72,30.69,4.85,29.55,6.05z"/>');
}else{
$('._rstring #mw-panel').removeClass('_show');
$(ctrl).attr('data-val','false');
$(ctrl).find('g').html('<path d="M35.7,18.04H4c-1.66,0-3,1.24-3,2.77s1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77S37.36,18.04,35.7,18.04z"/><path d="M35.7,6.98H4c-1.66,0-3,1.24-3,2.77s1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77S37.36,6.98,35.7,6.98z"/><path d="M35.7,29.11H4c-1.66,0-3,1.24-3,2.77c0,1.53,1.35,2.77,3,2.77H35.7c1.66,0,3-1.24,3-2.77C38.7,30.34,37.36,29.11,35.7,29.11z"/>');
}
}
var _leftnav= [
{name:"Overview",link:"https://universityinnovation.org/wiki/2021:Training_Overview?mobileaction=toggle_view_mobile"},
{name:"Your Mission",link:"https://universityinnovation.org/wiki/2021:Training/Your_Mission?mobileaction=toggle_view_mobile"},
{name:"Session 0",link:"https://universityinnovation.org/wiki/2021:Training/Session_0_(Orientation)?mobileaction=toggle_view_mobile"},
{name:"Session 1",link:"https://universityinnovation.org/wiki/2021:Training/Session_1_(Wayfinding)?mobileaction=toggle_view_mobile"},
{name:"Session 2",link:"https://universityinnovation.org/wiki/2021:Training/Session_2_(Design_Thinking)?mobileaction=toggle_view_mobile"},
{name:"Session 3",link:"https://universityinnovation.org/wiki/2021:Training/Session_3_(Landscape_Canvas)?mobileaction=toggle_view_mobile"},
{name:"Session 4",link:"https://universityinnovation.org/wiki/2021:Training/Session_4_(Strategic_Priorities)?mobileaction=toggle_view_mobile"},
{name:"Session 5",link:"https://universityinnovation.org/wiki/2021:Training/Session_5_(Lean_Startup)?mobileaction=toggle_view_mobile"},
{name:"Session 6",link:"https://universityinnovation.org/wiki/2021:Training/Session_6_(Storytelling)?mobileaction=toggle_view_mobile"},
]
var _html='<ul class="_setnav">';
//for(let item of _leftnav){
var i;
for (i = 0; i < _leftnav.length; i++) {
_html +='<li> <a href="'+_leftnav[i].link+'">'+_leftnav[i].name+'</a> </li>';
}
//}
_html +='</ul>';
$(document).ready(function(){
// alert();
$("._responsive").closest('body').addClass('_rstring');
var know=$("._responsive").closest('body').addClass('_rstring');
$(know).promise().done(function() {
//alert(_html);
setTimeout(function () {
// console.log('>>>>>>>', $('._responsive').closest('body').find('.nomenu').length==1);
if($('._responsive').closest('body').find('.nomenu').length!=1){
$('._responsive').closest('body').find('#mw-mf-page-left > div > .hlist').before(_html);
}
}, 2000);
// addlogo();
// $('head').append('<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">');
});
/* Rahul Js Code */
});