Last active
August 29, 2015 13:57
-
-
Save Inquisitor-Sasha/9594232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ********************************************************************************************** | |
* 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 ********* */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.