Fandom

Wikia Developers Wiki

AddInsights

823pages on
this wiki
Add New Page
Talk0 Share

Introduction

As the name implies, this is a script that assists you in adding your own insights to your wiki, like linking to categories like

  • Anti-bias Cleanup
  • Grammatical Improvement
  • General Improvement

This guide will help you get it set up on your wiki with little to no Javascript knowledge. Almost none.

Before we begin

At this point in time, custom Javascript is on lockdown for most small wikis. If your wiki has JS disabled, then you will have to wait before applying this script. Trust me, I hate it just as much as you do. Also, scripts unfortunately do cache, so if I update the source on this end or you update your configuration, you will need to instruct your users to break their cache.

Instructions

Step 1 - Getting to your wiki's custom JS page

At this point in time, all wiki's global JS pages are:

  • MediaWiki:Common.js
  • MediaWiki:Wikia.js
  • MediaWiki:Monobook.js

If there are any more, don't be hesitant to contact me

We'll be using Common.js, as I am going to try to keep support running for all themes. Note that I can change my mind at any time if I find this too difficult.

To visit common.js, you would go to "YOURWIKINAME.wikia.com/wiki/MediaWiki:Common.js". Without quotations

Step 2 - Installation

Now that you are at your wiki's Common.js, add this code snippet to the page:

ItemsToAdd = [
  {
    'Name': 'Sample Page',
    'Page': '',
    'Description': 'You should edit this'
  },
];
AffectsSidebar = true;
 
importScriptPage('MediaWiki:AddInsights.js', 'dev');

Don't hit the publish button yet - follow the next step before doing so.

Step 3 - Configure

Well, now that you have that code snippet on the page, what do you next? You can configure the values you've just added to fit your needs.

AffectsSidebar


  • Setting this to true will enable the custom insights to be displayed on the Wiki Activity page sidebar.
  • Setting this to false will disallow the custom insights to be displayed on the Wiki Activity page sidebar.

ItemsToAdd


This array is where you place all of your custom insights. A sample is already included so you can easily get started. But, what if you wanted to add another? To do this, you just need to copy and paste the sample insight, like this:

ItemsToAdd = [
  {
    'Name': 'Sample Page',
    'Page': '',
    'Description': 'You should edit this'
  },
  {
    'Name': 'Sample Page',
    'Page': '',
    'Description': 'You should edit this'
  },
];

You can add as many of these as you'd like.

Name

This value specifies the insight's display name. If no name is specified, it's placeholder is [ Unnamed ].

Page

This value specifies the page that the insight links to. Wiki interlinking is supported.

Description

This value specifies the description that is shown on the "More Insights" page. If unspecified, it's placeholder is [ No Description ].

Override

Implemented on 10/14/15 at 6:30PM EST

This value is only for use if AffectsSidebar is set to false.

Setting this to true will allow an item to be shown on the Wiki Activity Page even if AffectsSidebar is set to false.

Step 4 - Publish

Once you are done, go ahead and click the publish button. If done correctly, your items should be added to the Insights menu.

Sample Configuration

If you found this a bit confusing, then here's a sample script I made. You can modify it to fit your needs.

ItemsToAdd = [
  {
    'Name': 'General Improvement',
    'Page': 'Category:General_Improvement',
    'Description': 'These articles need some cleanup work done on them.'
  },
  {
    'Name': 'Grammatical Cleanup',
    'Page': 'Category:Grammar_Cleanup',
    'Description': 'These articles need to be checked for grammar mistakes.'
  },
];
AffectsSidebar = true;
 
importScriptPage('MediaWiki:AddInsights.js', 'dev');

Suggest Revisions

User talk:UncoveredAgent200 Think this page needs an edit? Leave me a message on my wall and make the suggestion there.

The source is at MediaWiki:AddInsights.js. If you have any improvement suggestions, don't be afraid to message me about that either.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.