MediaWiki:Guidedtour-tour-newtour.js: Difference between revisions
From ChemWiki
(Added to the wiki via WikiImport-Script.) |
(Added to the wiki via WikiImport-Script.) |
||
Line 5: | Line 5: | ||
( function ( window, document, $, mw, gt ) { | ( function ( window, document, $, mw, gt ) { | ||
var isnav_open = $('#ce-side-panel-content | var isnav_open = $('#ce-side-panel-content')[0].attributes.style ; | ||
var navbarstate = '#ce-side-panel-content-collapsed'; | var navbarstate = '#ce-side-panel-content-collapsed'; | ||
if (isnav_open == "display:none") { | if (isnav_open == "display:none;") { | ||
navbarstate = "#ce-topic-element"; | navbarstate = "#ce-topic-element"; | ||
}; | }; | ||
console.log(navbarstate) | console.log(isnav_open) | ||
console.log(navbarstate); | |||
// Declare a variable for use later | // Declare a variable for use later | ||
var pageName = 'Help:Guided tours/newtour', | var pageName = 'Help:Guided tours/newtour', | ||
tour; | tour; | ||
function open_nav(){ | |||
$('#ce-side-panel-content-collapsed').hide(); | |||
$('#ce-side-panel-content').show(); | |||
$('div.container-fluid div.row').attr('style', 'margin-left: 400px !important;'); | |||
navbarstate = "#ce-topic-element" | |||
console.log("yes"); | |||
return "m_topic" | |||
} | |||
tour = new gt.TourBuilder( { | tour = new gt.TourBuilder( { | ||
/* | /* | ||
Line 84: | Line 93: | ||
overlay: false, | overlay: false, | ||
attachTo: 'table tr:nth-child(2) td:nth-child(2)', | attachTo: 'table tr:nth-child(2) td:nth-child(2)', | ||
position: 'left' | position: 'left', | ||
// '#mw-content-text.mw-parser-output.tbody.tr:nth-child(7)' | // '#mw-content-text.mw-parser-output.tbody.tr:nth-child(7)' | ||
// This means the wikitext for the description will be loaded from the | // This means the wikitext for the description will be loaded from the | ||
// page name in the description field. | // page name in the description field. | ||
// onShow: gt.getPageAsDescription, | // onShow: gt.getPageAsDescription, | ||
// buttons: [ { | // buttons: [ { | ||
// // This makes a button which acts like a wikilink to 'Help:Guided tours/mytest' | // // This makes a button which acts like a wikilink to 'Help:Guided tours/mytest' | ||
// action: ' | // // action: 'next', | ||
// onclick: function () { | |||
// $('#ce-side-panel-content-collapsed').hide(); | |||
// $('#ce-side-panel-content').show(); | |||
// $('div.container-fluid div.row').attr('style', 'margin-left: 400px !important;'); | |||
// navbarstate = "#ce-topic-element" | |||
// console.log("yes"); | |||
// // if (tools.getCookie(NAVBAR_STATUS_COOKIE) !== 'expanded') { | |||
// // tools.createCookie(NAVBAR_STATUS_COOKIE, 'expanded'); | |||
// // } | |||
// }, | |||
// action: "next", | |||
// page: pageName, | // page: pageName, | ||
// name: ' | // name: 'next', | ||
// // This specifies that the button takes you to the next step of a process, | // // This specifies that the button takes you to the next step of a process, | ||
// // which affects its appearance. | // // which affects its appearance. | ||
// type: 'progressive' | // type: 'progressive' | ||
// }, { | |||
// }, | |||
// { | |||
// // This makes the okay button on this step end the tour. | // // This makes the okay button on this step end the tour. | ||
// action: ' | // action: 'next' | ||
// } ] | // } | ||
} ) | // ] | ||
.next( | // | ||
} | |||
) | |||
.next(open_nav()) | |||
.back( 'homebutton' ); | .back( 'homebutton' ); | ||
Line 132: | Line 156: | ||
tour.step( { | tour.step( { | ||
name: "testa", | name: "testa", | ||
title: " | title: "topic attacment", | ||
description:"this is the highest level of the Organization" , | description:"this is the highest level of the Organization" , | ||
// overlay: true, | // overlay: true, | ||
// attachTo: "#ce-side-panel-content-collapsed" , | // attachTo: "#ce-side-panel-content-collapsed" , | ||
attachTo: navbarstate, | attachTo: navbarstate, | ||
position: 'right', | |||
}) | |||
.next("pub_nav") | |||
.back("pub"); | |||
tour.step( { | |||
name: "pub_nav", | |||
title: "Publications", | |||
description:"This is the publication level. Papers are stored here with each investigation splitting into the next level" , | |||
// overlay: true, | |||
// attachTo: "#ce-side-panel-content-collapsed" , | |||
attachTo: '#ce-publication-element', | |||
position: 'right', | position: 'right', | ||
Revision as of 13:39, 9 February 2024
/*
* Guided Tour to test guided tour features.
*/
// Copy the next line into the start of your tour.
( function ( window, document, $, mw, gt ) {
var isnav_open = $('#ce-side-panel-content')[0].attributes.style ;
var navbarstate = '#ce-side-panel-content-collapsed';
if (isnav_open == "display:none;") {
navbarstate = "#ce-topic-element";
};
console.log(isnav_open)
console.log(navbarstate);
// Declare a variable for use later
var pageName = 'Help:Guided tours/newtour',
tour;
function open_nav(){
$('#ce-side-panel-content-collapsed').hide();
$('#ce-side-panel-content').show();
$('div.container-fluid div.row').attr('style', 'margin-left: 400px !important;');
navbarstate = "#ce-topic-element"
console.log("yes");
return "m_topic"
}
tour = new gt.TourBuilder( {
/*
* This is the name of the tour. It must be lowercase, without any hyphen (-) or
* period (.) characters.
*
* The page where you save an on-wiki tour must be named
* MediaWiki:Guidedtour-tour-{name}.js , in this example MediaWiki:Guidedtour-tour-mytest.js
*/
name: 'newtour'
} );
// Information defining each tour step
// This tour shows a central overlay at the start of the tour.
// Guiders appear in the center if another position is not specified.
// To specify the first step of the tour, use .firstStep instead of .step
tour.firstStep( {
name: 'intro',
// Note that for on-wiki tours, we use title and description with the actual text.
// The title appears in the title bar of the guider.
title: 'Welcome',
// The description appears in the body
description: 'Welcome to the Introduction tour for MediaWiki',
// This specifies that there is an overlay behind the guider.
overlay: true
} )
// This specifies the next step of the tour, and will automatically generate a next button.
// 'callout' refers to the name used in the step immediately below. Although putting the steps
// in a meaningful order is recommended, any step can be specified as next/back.
.next( 'homebutton' );
tour.step( {
/*
* Callout of left menu
*/
name: 'homebutton',
title: 'Home Button',
description: 'Here is the home buttton click here to return to the home page',
// This positions the guider next to a page element, in this
// case the portal link (which is "Community portal" on English
// Wikipedia, but varies by site).
// The string is a jQuery selector. "#n-portal" means the HTML
// element with this id attribute, and "a" means an a, or link,
// element inside that.
attachTo: '#mw-navigation a',
// This means the guider shows to the right of the Community Portal link
position: 'right',
} )
.next( 'feat_mol' )
// The 'back' property specifies that you can go back from this step, and where to go
// if the back button is clicked.
.back( 'intro' );
tour.step( {
/*
* Test out mediawiki description pages
*/
name: 'feat_mol',
title: 'Featured Molecule',
// Name of the page to parse
description: 'Clicking this will bring you to the relevant molecule page. From here you can see experiments that use the selected molecule.',
overlay: false,
attachTo: 'table tr:nth-child(2) td:nth-child(2)',
position: 'left',
// '#mw-content-text.mw-parser-output.tbody.tr:nth-child(7)'
// This means the wikitext for the description will be loaded from the
// page name in the description field.
// onShow: gt.getPageAsDescription,
// buttons: [ {
// // This makes a button which acts like a wikilink to 'Help:Guided tours/mytest'
// // action: 'next',
// onclick: function () {
// $('#ce-side-panel-content-collapsed').hide();
// $('#ce-side-panel-content').show();
// $('div.container-fluid div.row').attr('style', 'margin-left: 400px !important;');
// navbarstate = "#ce-topic-element"
// console.log("yes");
// // if (tools.getCookie(NAVBAR_STATUS_COOKIE) !== 'expanded') {
// // tools.createCookie(NAVBAR_STATUS_COOKIE, 'expanded');
// // }
// },
// action: "next",
// page: pageName,
// name: 'next',
// // This specifies that the button takes you to the next step of a process,
// // which affects its appearance.
// type: 'progressive'
// },
// {
// // This makes the okay button on this step end the tour.
// action: 'next'
// }
// ]
//
}
)
.next(open_nav())
.back( 'homebutton' );
tour.step( {
name: "m_topic",
title: "Main Topic",
description:"Here is the main topic inside it are sub topics that organize papers on stricter criteria" ,
overlay: true,
attachTo: 'table tr:nth-child(2) td:nth-child(1) div.CategoryTreeItem:first-child' ,
position: 'right'
})
.next("pub")
.back("feat_mol");
tour.step( {
name: "pub",
title: "Publication",
description:"Here is the level at which papers are stored" ,
overlay: true,
attachTo: 'table tr:nth-child(2) td:nth-child(1) div.CategoryTreeChildren div.CategoryTreeSection ' ,
position: 'right'
})
.next("testa")
.back("m_topic");
tour.step( {
name: "testa",
title: "topic attacment",
description:"this is the highest level of the Organization" ,
// overlay: true,
// attachTo: "#ce-side-panel-content-collapsed" ,
attachTo: navbarstate,
position: 'right',
})
.next("pub_nav")
.back("pub");
tour.step( {
name: "pub_nav",
title: "Publications",
description:"This is the publication level. Papers are stored here with each investigation splitting into the next level" ,
// overlay: true,
// attachTo: "#ce-side-panel-content-collapsed" ,
attachTo: '#ce-publication-element',
position: 'right',
})
// .next()
.back("pub");
// The following should be the last line of your tour.
} ( window, document, jQuery, mediaWiki, mediaWiki.guidedTour ) );