Help:Quick licence

Quick licence is a JavaScript tool that allows users to quickly and easily add file licence templates to file pages on the wiki. The tool appears as a dropdown menu at the top of every file page, along with an "Add licence" button adjacent to it. It was first developed by Lost Labyrinth in 2012 and was for a time available as a user gadget. It is now available to all autoconfirmed users by default.

How do I use this tool?
Using the tool to add a licence is easy. Simply click on the dropdown menu, select the appropriate licence option, and click "Add licence". The tool will then automatically add the selected file licence template to the page.

If you see a " This page has a licence template. ", it means that the tool has detected that a file licence template already exists on the page. If this is the case, please do not simply add another template using this tool. If the existing licence template is wrong, please edit the page manually and remove the incorrect template before using the tool to add another one.

If you see a " This page does not have a licence template! Consider adding one. ", it means that the tool has detected that the file page does not have a file licence template, and encourages you to add one.

The tool doesn't load for me, why?
The tool will not load for users who are not currently autoconfirmed. To be autoconfirmed, your account must be at least four days old. Additionally, you need to have JavaScript enabled in your browser for the tool to load. See this page on how to enable it.

The licence template on the page is incorrect. How do I change it?
Do not simply run the licence adder tool on the page, ignoring the incorrect licence. This will add a new licence template below the one you deem is incorrect, and will result in the page having both licence templates. To change an incorrect licence, first edit the page and remove the existing licence template, including the heading that says "Licencing". Publish your edit and then use the licence adder tool to add the correct licence.

What happens if I just click the "Add licence" button, without selecting a licence?
You will simply perform a on the page, and nothing special will happen. Don't worry—you won't break anything by doing it.

How come the tool says that the file does not have a licence template, even when it does?
The tool checks to see if the page has a heading titled "Licencing" on the page, written exactly as is (no colons or other punctuation). If it does not find one, even if the page has a licence template on it, it will report back as saying the file doesn't have a licence template on it.

To fix this problem, simply edit the page and add a Level 2 heading above the file licence template and name it "Licencing". In practice, all licence templates should be preceded by such a heading.

How come the tool says that the file has a licence template, even when it doesn't?
As mentioned above, the tool checks for a heading titled "Licencing" on the page, and will say the file is licenced if it finds such a heading, even if the page doesn't actually have a licence template on it.

I selected a licence and clicked "Add licence". When the page refreshed, I was taken to a page that said the file did not exist! What happened?
This is caused when the file name contains certain characters, such as a plus (+) sign. In this case, the licence is added correctly, but the script winds up redirecting you to the wrong page. In this case, do not panic, because you did not "delete" the file, and the licence you added is still there. Simply click on the "Back" button of your browser (or press ) to go back. If the file licence doesn't appear, try refreshing the page, or purge the cache.

How come the tool added two of the same licence?
This is an odd quirk of the tool, but may be caused by double-clicking the "Add licence" button, or by browser lag. In this case, two requests get sent to the server, and in turn two edits are made, resulting in two of the same template appearing on the page. This is an easy fix: just undo the latest edit.

Code
The tool was written in JavaScript. The code for it can be found at MediaWiki:Wikia.js/quicklicence.js.