GithubHelp home page GithubHelp logo

japansystemdevelopment / mediawiki-extension-jscalendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edwardspec/mediawiki-extension-jscalendar

0.0 1.0 0.0 714 KB

Extension:JsCalendar (based on https://github.com/serpent213/mediawiki-extensions-yasec )

Home Page: https://www.mediawiki.org/wiki/Extension:JsCalendar

License: GNU General Public License v2.0

PHP 4.46% JavaScript 87.47% CSS 8.07%

mediawiki-extension-jscalendar's Introduction

JsCalendar

NOTE: this is based on another extension: https://github.com/improper/mediawiki-extensions-yasec ... but doesn't aim to maintain backward compatibility with it.

Outputs a tabular calendar filled with events automatically generated from page titles in a certain namespace. Based on the intersection extension and the FullCalendar jQuery plugin.

Demo: FoodHackingBase Events

Usage

Assuming that event pages are called Event:Today_in_History/April,_12 (where Event is a namespace), the following wikitext will display a calendar of these events:

<EventCalendar>
namespace = Event
aspectratio = 1.35
prefix = Today_in_History/
suffix = 
dateFormat = F,_j
</EventCalendar>

... here F_j is the format from https://www.php.net/manual/ru/datetime.createfromformat.php - "F" means "name of month", and "j" means "day (with leading zero)".

Everything between "prefix" and "suffix" should be a date.

Alternatively, titleRegex parameter can be used to find event pages. For example, the following wikitext will find pages like Event:2020/05/15_Name_of_some_event:

<EventCalendar>
namespace = Event
titleRegex = ^([0-9]{4,4}/[0-9][0-9]/[0-9][0-9])_.*
dateFormat = Y/m/d
</EventCalendar>

When using titleRegex, the date part (in example above - [0-9]{4,4}/[0-9][0-9]/[0-9][0-9]) must be surrounded in "(" and ")" symbols (otherwise the calendar wouldn't know "which part of the title is the date").

aspectratio is optional and defaults to 1.6. CSS max-width is set to 800px and can be overridden in MediaWiki:Common.css.

Category-based coloring

The following parameters within <EventCalendar> will change the color of events to red/green based on the category into which the Event: page is included. Pages not included into any listed categories would have default color.

categorycolor.Cat-related events = red
categorycolor.Dogs = green

Keyword-based coloring

The following parameter within <EventCalendar> will change the color of event to yellow if the page contains the word "arctic" (the match is case-insensitive, so "Arctic" will work too), and to lightgreen if the page contains the word "statistically":

keywordcolor.arctic = yellow
keywordcolor.statistically = lightgreen

Requirements

  • MediaWiki 1.34
  • MySQL (this extension doesn't support PostgreSQL. Patches that add PostgreSQL support are very welcome, but maintainter of this extension won't be implementing this himself).

Installation

  1. Deploy the files to extensions/JsCalendar.
  2. Edit your LocalSettings.php:
    • Load the extension:

      wfLoadExtension( 'JsCalendar' );
    • Setup your namespace:

      $wgExtraNamespaces = array(
          100 => "Event",
          101 => "Event_talk",
      );
      $wgNamespacesToBeSearchedDefault = array(
          NS_MAIN => true,
          100     => true,
      );
    • For testing you might want to disable the cache:

      # How long to cache pages using EventCalendar in seconds. Default to 1 day.
      # Set to false to use the normal amount of page caching (most efficient),
      # set to 0 to disable cache altogether (inefficient, but results will never
      # be outdated)
      $wgECMaxCacheTime = 60*60*24;   // How long to cache pages in seconds

mediawiki-extension-jscalendar's People

Contributors

bawolff avatar edwardspec avatar mary-kate avatar reedy avatar rennerocha avatar serpent213 avatar siebrand avatar translatewiki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.