Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// <source lang="javascript">
/*
  Implementation for quick-deletion user notification links.

  Author: [[User:Lupo]], January 2009
  License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)

  Choose whichever license of these you like best :-)
 */


if (typeof(Notifier1) == 'undefined') {
    // Guard against double inclusions
    importScript('MediaWiki:Utilities.js');
    importScript('MediaWiki:QuickModify.js');
    importScript('MediaWiki:TextCleaner.js');

    if (typeof(notification_definitions) != 'object')
    var notification_definitions = {};

    notification_definitions.copyvio =
    {
        img_template: '{{copyvio|1=$1}}'
        ,
        talk_template: '{{subst:copyvionote|1=$F}}~~~~'
        ,
        img_summary: 'Marking as possible copyright violation'
        ,
        talk_summary: 'Notification of possible copyright violation'
        ,
        prompt_text: 'Why is this file a copyright violation?n'
        + 'Give a reason and/or external source (URL or such).'
    };
    notification_definitions.nosource =
    {
        img_template: '{{crop}}'
        ,
        talk_template: '{{subst:image source|1=$F}}~~~~'
        ,
        img_summary: 'Marking for crop'
        ,
        talk_summary: 'Where does [[:$F]] come from?'
    };
    notification_definitions.nolicense =
    {
        img_template: '{{no license since|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}|year={{subst:CURRENTYEAR}}}}'
        ,
        talk_template: '{{subst:image license|1=$F}}~~~~'
        ,
        img_summary: 'Missing license'
        ,
        talk_summary: 'File [[:$F]] does not have a license'
    };
    notification_definitions.nopermission =
    {
        img_template: '{{no permission since|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}|year={{subst:CURRENTYEAR}}}}'
        ,
        talk_template: '{{subst:image permission|1=$F}}~~~~'
        ,
        img_summary: 'Missing permission'
        ,
        talk_summary: 'Please send a permission for [[:$F]] to [[COM:OTRS|OTRS]]'
    };

    var nfd_delReq = "Commons:Deletion_requests";
    var nfd_deleteTemplate = "delete";
    var nfd_idwTemplate = "subst:idw";

    if (typeof(notifier_timeout) == 'undefined')
    var notifier_timeout = 4000;
    // 1.5 seconds
    
    var Notifier =
    {
     /* $1 = input from user (prompt)
     $F = title (which should include the namespace)
     $U = user name, if given or found

     img_template is mandatory.
     if not talk_template exists, user will not be notified, even if given.
     if talk_template exists, but no user is given, and we're on a page in the File namespace, try to
     get uploader's name from the topmost entry in the file history on the page.

     if $1 is used, optional prompt_text may be specified. Default if none given is "Reason:"
   */

        mark: function(what, title, user, revision, dont_save, dont_close)
        {
            if (!what) return;
            title = wgPageName;
            var is_edit_page = (wgAction == 'edit' && document.getElementById('editform') != null);
            var same_window = (wgAction == 'view' || is_edit_page);

            if (!notification_definitions[what]) {
                alert('Unknown notification for "' + what + '"; aborted.');
                return;
            }
            var img_template = notification_definitions[what].img_template;
            if (!img_template) return;
            var talk_template = notification_definitions[what].talk_template;
            var img_summary = notification_definitions[what].img_summary || "";
            var talk_summary = notification_definitions[what].talk_summary || "";
            var reason = "";
            if ((img_template + ' ' + talk_template + ' ' + img_summary + ' ' + talk_summary).indexOf('$1') >= 0)
            {
                reason = Notifier.safe_prompt(notification_definitions[what].prompt_text || 'Reason:');
                if (!reason || reason.length == 0) return;
                // Cancelled
            }
            if (talk_template) {
                if (!user || user.length == 0) {
                    user = Notifier.get_user_from_page();
                    if (!user) {
                        Notifier.get_user_from_server
                        (title
                        ,
                        function(user) {
                            Notifier.do_mark
                            (title, user, reason
                            , img_template, img_summary, talk_template, talk_summary, revision
                            , dont_save, dont_close, same_window, is_edit_page);
                        }
                        );
                        return;
                    }
                }
            } else
            user = null;

            Notifier.do_mark
            (title, user, reason
            , img_template, img_summary, talk_template, talk_summary, revision
            , dont_save, dont_close, same_window, is_edit_page);
        },

        do_mark: function(title, user, reason, img_template, img_summary, talk_template, talk_summary, revision, dont_save, dont_close, same_window, is_edit_page)
        {
            function subst(str)
            {
                return replaceVars(str, '$', '1FU', reason, title, user);
            }

            var user_action = "";
            if (user) {
                user_action =
                QuickModify.actions(
                ['a', 'n' + subst(talk_template)]
                , [(dont_save ? 'e': (dont_close ? 's': 'c')), subst(talk_summary)]
                );
            }
            if (is_edit_page) {
                var text = document.getElementById('wpTextbox1');
                text.value = subst(img_template) + 'n' + text.value;
                scrollTextArea(text, true);
                setEditSummary(subst(img_summary));
                if (user) {
                    var edit_lk = wgServer + wgScript
                    + '?title=User_talk:' + encodeURIComponent(user) + '&action=edit';
                    QuickModify.execute(
                    edit_lk
                    , user_action
                    );
                }
            } else {
                var edit_lk = wgServer + wgScript
                + '?title=' + encodeURIComponent(title) + '&action=edit';
                QuickModify.execute(
                edit_lk
                , QuickModify.actions(
                (revision ? ['h', revision] : null)
                , ['i', subst(img_template) + 'n']
                , [(dont_save ? 'e': (user && !dont_close && !same_window ? 'c': 's')), subst(img_summary)]
                )
                + (user ? QuickModify.join(
                'User talk:' + user
                , user_action
                )
                : ""
                )
                , same_window
                );
            }
            // end if
        },


        notify: function(text, user, edit_comment, dont_save, dont_close, same_window)
        {
            if (!text || text.length == 0) return;
            if (!user || user.length == 0) user = Notifier.get_user_from_page();
            if (!user) return;
            var edit_lk = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=User_talk:' + encodeURIComponent(user) + '&action=edit';
            if (same_window) dont_close = true;
            QuickModify.execute(
            edit_lk
            , QuickModify.actions(
            ['a', 'n' + text]
            , (dont_save
            ? (edit_comment ? ['e', edit_comment] : null)
            : (edit_comment ? [(dont_close ? 's': 'c'), edit_comment]
            : [(dont_close ? 's': 'c')]
            )
            )
            )
            , same_window
            );
        },

}
// end Notifier
// Hook for localizations
if (wgUserLanguage != 'en') importScript('MediaWiki:Notifier.js/' + wgUserLanguage);

}
// end if (guard against double inclusion)
// </source>