View source for MediaWiki:Gadget-fix-schedule-times.js

Jump to navigation Jump to search
You do not have permission to edit this page, for the following reasons:
  • The action you have requested is limited to users in the group: Users.
  • This page provides interface text for the software on this wiki, and is protected to prevent abuse. To add or change translations for all wikis, please use translatewiki.net, the MediaWiki localisation project.
  • You do not have permission to edit this JavaScript page because it may affect all visitors.

You can view and copy the source of this page.

// vim: ts=4 sw=4 et ai si
// HOW TO USE: you really should know at least a little javascript for this... (find someone who does if not). Copy this page to your wiki. The title must be the same. Or you can use a different title, but it MUST start with "MediaWiki:" and end in ".js", and you'll have to edit the snippet. Then, on your wiki's MediaWiki:Common.js page (VERY DANGEROUS), determine the page ID of your schedule (click "Page information" under "Tools" in the sidebar), then insert this snippet onto that MediaWiki:Common.js page (don't include the slash and star on their own lines at the beginning and end... actually, you should only be doing this if you have at least minimal JavaScript knowledge...). Make sure to replace BOTH occurrences of REPLACE_ME_WITH_THE_PAGE_ID_OF_YOUR_SCHEDULE_PAGE with that page ID you found. The snippet loads in this gadget and also automatically reloads the page when the schedule changes. (It checks every 2 minutes.) You must also update CONFERENCE_DAYS and WRITTEN_SCHEDULE_OFFSET_SECONDS in this page with the appropriate values for your conference. You will also want to, in your schedule, include a link to the schedule page itself but with the text ?dontFixSchedule at the end of the URL right after the title of the schedule page. That disables these two features and is useful when you're working on the schedule itself. The schedule is assumed to USE 24-HOUR TIME with TWO DIGITS ALWAYS FOR THE HOUR. If you DON'T DO THAT, it WILL NOT WORK. This script was originally created for WikiConference North America 2021. Please see https://wikiconference.org/wiki/2021/Schedule for an example of a schedule that is formatted for use with this script. Note that events with no ending times are indicated like this: 12:34+ with a plus sign after just one time. Although note that due to this script running, you won't see the original formatting unless you edit the page or append ?dontFixSchedule to the URL!
/* DELETE THIS LINE WHEN COPYING. This is the start of the stuff that goes in MediaWiki:Common.js
if ( ( mw.config.get( "wgArticleId" ) === REPLACE_ME_WITH_THE_PAGE_ID_OF_YOUR_SCHEDULE_PAGE ) && ( mw.config.get( 'wgAction' ) === 'view' ) ) {
mw.loader.load( '/index.php?title=MediaWiki%3AGadget-fix-schedule-times.js&action=raw&ctype=text/javascript' );
mw.loader.using( ['mediawiki.api'], function () {
if(window.location.search.indexOf("dontFixSchedule")>=0)return;
var api = new mw.Api();
window.setInterval(function(){
api.get({
action:'query',
pageids:REPLACE_ME_WITH_THE_PAGE_ID_OF_YOUR_SCHEDULE_PAGE,
prop:'revisions',
rvprop:'ids',
uselang:'content',
format:'json',
formatversion:'2'
}).then(function(res){
var revid = res.query.pages[0].revisions[0].revid;
if(revid !== mw.config.get('wgRevisionId')){
mw.notify('Schedule changed. Reloading.');
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
000
1:0

Return to MediaWiki:Gadget-fix-schedule-times.js.