Jump to content

User:Omegatron/monobook.js/unverified.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Omegatron (talk | contribs) at 06:59, 14 January 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* 

Unverified image

Adds an unverified image tag when you press a tab, if the tag isn't already there.  Depends on addLink() function.  Otherwise should be self-contained.

<pre><nowiki> */

function unverified() {
    document.editform.wpSummary.value = 'needs a source and copyright tag - see [[Wikipedia:Image copyright tags]]';

    // Find the edit box
    var txt = document.editform.wpTextbox1;

    // Add a tag to the edit box, if it doesn't have one already
    var summary = '{{unverified}}';
    if (txt.value.indexOf(summary) == -1) {
        txt.value += summary;
    }

    // Focus the edit box?
    txt.focus();
    
    // Press the Save page button
    document.editform.wpSave.click()
}

// Create a tab that calls this function when pressed
addOnloadHook(function () {
    if(document.forms.editform) {
        addLink('p-cactions', 'javascript:unverified()', 'tag', 'ca-unverified', 'Adds a tag to an unverified image', '', '');
    }
});

// </nowiki></pre>