MediaWiki:Guidedtour-tour-wbreferences.js
Note: After publishing, 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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*
* @see [[Wikidata:Tours/References]]
*
* @author NavinoEvans
*/
( function( $, mw, gt, wb ) {
$.ajax( {
async: false,
url: mw.util.wikiScript() + '?title=MediaWiki:Guidedtour-lib.js&action=raw&ctype=text/javascript',
dataType: 'script'
} );
var tourName = 'wbreferences', // test.wikidata 'wbreferences2'
tourEntityId = 'Q85408509', // test.wikidata 'Q211911'
newData = {
"labels": {
"en": {
"language": "en",
"value": "Earth"
}
},
"descriptions": {
"en": {
"language": "en",
"value": "Test item for References tours only"
}
},
"claims": [
{
"mainsnak": {
"snaktype": "value",
"property": "P1082", // test.wikidata "P63"
"datavalue": {
"value": {
"amount": "+7000000000",
"unit": "1",
"upperBound": "+7001000000",
"lowerBound": "+6999000000"
},
"type": "quantity"
},
"datatype": "quantity"
},
"type": "statement",
"rank": "normal",
"qualifiers": {
"P585": [
{
"snaktype": "value",
"property": "P585", // test.wikidata "P66"
"datavalue": {
"value": {
"time": "+2012-03-12T00:00:00Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
},
"type": "time"
},
"datatype": "time"
}
]
},
"qualifiers-order": ["P585"],
},
{
"mainsnak": {
"snaktype": "value",
"property": "P1082", // test.wikidata "P63"
"datavalue": {
"value": {
"amount": "+7000000000",
"unit": "1",
"upperBound": "+7001000000",
"lowerBound": "+6999000000"
},
"type": "quantity"
},
"datatype": "quantity"
},
"type": "statement",
"rank": "normal",
"qualifiers": {
"P585": [
{
"snaktype": "value",
"property": "P585", // test.wikidata "P66"
"datavalue": {
"value": {
"time": "+2011-10-31T00:00:00Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
},
"type": "time"
},
"datatype": "time"
}
]
},
"qualifiers-order": ["P585"],
}
]
};
gt.init( tourName, tourEntityId, newData, {
/**
* The page from where the tour texts should be loaded.
*/
pageName: 'Wikidata:Tours/References',
/**
* The steps of the tour.
*/
steps: [ {
// 1. Welcome to the References Tour
}, {
// 2. Note
}, {
// 3. Why Wikidata uses references
}, {
// 4. Statements
}, {
// 5. Multiple perspectives
}, {
// 6. Recording multiple perspectives
}, {
// 7. More on references
}, {
// 8. Types of reference source
}, {
// 9. Creating a URL reference
position: 'bottom',
attachTo: '.wikibase-statementview-references:nth(0) .wikibase-toolbar-button-add',
actionBtn2: '.wikibase-statementview-references:nth(0) .wikibase-toolbar-button-add a'
}, {
// 10. Reference URL
position: 'top',
attachTo: '.wikibase-statementview-references:nth(0) .ui-suggester-input',
}, {
// 11. Add a URL
position: 'top',
attachTo: '.wikibase-statementview-references:nth(0) .wikibase-snakview-value',
}, {
// 12. Improving a reference
attachTo: '.wb-reference-new .wikibase-toolbar-button-add',
actionBtn2: '.wb-reference-new .wikibase-toolbar-button-add a'
}, {
// 13. Publisher of URL
position: 'top',
attachTo: '.wikibase-statementview-references:nth(0) .ui-suggester-input:nth(1)',
}, {
// 14. Publisher of URL
position: 'top',
attachTo: '.wikibase-statementview-references:nth(0) .wikibase-snakview-value:nth(1)',
}, {
// 15. Publish
position: 'top',
attachTo: '.wikibase-statementview .wikibase-toolbar-button-save',
actionBtn2: '.wikibase-statementview .wikibase-toolbar-button-save a'
}, {
// 16. Adding a Reference from a Wikidata item
}, {
// 17. Find or create the item for the source
position: 'top',
attachTo: '.wikibase-statementview-references:nth(1) .wikibase-toolbar-button-add',
actionBtn2: '.wikibase-statementview-references:nth(1) .wikibase-toolbar-button-add a'
}, {
// 18. Stated in
position: 'top',
attachTo: '.wikibase-statementview-references:nth(1) .ui-suggester-input',
}, {
// 19. Reference source
position: 'top',
attachTo: '.wikibase-statementview-references:nth(1) .wikibase-snakview-value',
}, {
// 20. Publish
attachTo: '.wikibase-statementview .wikibase-toolbar-button-save',
actionBtn2: '.wikibase-statementview .wikibase-toolbar-button-save a'
}, {
// 21. Congratulations!
onShow: function() {
// Quick hack to redirect to Tours page.
// Todo: should be the default action for clicking the "end tour" button on any Wikidata
$('.guidedtour-end-button').off('click').on('click', function() {
window.location = window.location.origin + '/wiki/Wikidata:tours';
});
}
} ]
} );
} )( jQuery, mediaWiki, mediaWiki.guidedTour, wikibase );