Skip to content

Instantly share code, notes, and snippets.

@Inquisitor-Sasha
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Inquisitor-Sasha/9594232 to your computer and use it in GitHub Desktop.
Save Inquisitor-Sasha/9594232 to your computer and use it in GitHub Desktop.
/* **********************************************************************************************
* Wiki mass attribution import script
*
* Author: User:Inquisitor Sasha
* Created for Orain wikis to import content from Wikia
* This script is freely available for reuse and modification under CC-BY-SA
*
* To use this script, copy it into the MediaWiki:Vector.js file on your wiki. You will need
* to change the domain in the variable wikiDomain to the full domain of the wiki that you
* are importing content from.
*
************************************************************************************************ */
// Set the domain of the wiki that the content is copied and attributed from
var wikiDomain = 'www.wikia.com'
// You do not need to configure anything past this point for the attribution to work -------------
// If your are comfortable with making changes to the HTML, you can configure the
// variable below to alter the appearance of the attribution notice in the wiki.
// Code for the attribution notice
var attributionCode = '<div class="attributionNotice" style="border: 2px solid #444444; padding: 10px; background: #DDDDDD;"><p>This page has been imported from the page <a href="http:\/\/'+wikiDomain+'/wiki/'+wgPageName+'">'+wgPageName+'</a> at <a href="http:\/\/www.wikia.com">Wikia</a> under the <a href="http:\/\/creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> license.</p></div>';
// No configuration is needed beyond this point! -------------------------------------------------
// Get the ID to insert the notice before
var attributionRef = document.getElementById('catlinks');
var attributionParent = attributionRef.parentNode;
// Set up the notice insertation
var attributionNotice = document.createElement('div');
attributionNotice.id = 'attributionNotice';
attributionNotice.innerHTML = attributionCode;
// Insert the attribution notice
attributionParent.insertBefore(attributionNotice, attributionRef);
/* ********* End attribution script ********* */
@Inquisitor-Sasha
Copy link
Author

I looked into ways of determining the age of the page as a way of determining whether it was imported or not. I didn't find any obvious way of quickly determining the age of the page in an automated fashion. If anyone knows how to check the page age with a script, it would be very useful. I can add you as a contributor in the credits for the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment