ശ്രദ്ധിക്കുക: സേവ് ചെയ്തശേഷം മാറ്റങ്ങൾ കാണാനായി താങ്കൾക്ക് ബ്രൗസറിന്റെ കാഷെ ഒഴിവാക്കേണ്ടി വന്നേക്കാം.

  • ഫയർഫോക്സ് / സഫാരി: Reload ബട്ടൺ അമർത്തുമ്പോൾ Shift കീ അമർത്തി പിടിക്കുകയോ, Ctrl-F5 അല്ലെങ്കിൽ Ctrl-R (മാക്കിന്റോഷിൽ ⌘-R ) എന്ന് ഒരുമിച്ച് അമർത്തുകയോ ചെയ്യുക
  • ഗൂഗിൾ ക്രോം: Ctrl-Shift-R (മാക്കിന്റോഷിൽ ⌘-Shift-R ) അമർത്തുക
  • ഇന്റർനെറ്റ് എക്സ്പ്ലോറർ: Refresh ബട്ടൺ അമർത്തുമ്പോൾ Ctrl കീ അമർത്തിപിടിക്കുക. അല്ലെങ്കിൽ Ctrl-F5 അമർത്തുക
  • ഓപ്പറ: Menu → Settings എടുക്കുക (മാക്കിൽ Opera → Preferences) എന്നിട്ട് Privacy & security → Clear browsing data → Cached images and files ചെയ്യുക.
(function () {
    'use strict';

    /* Api functions */
    function getWikiSource(wgArticleId) {
        return $.get(mw.util.wikiScript(), {
            action: 'raw',
            curid: wgArticleId,
        });
    }

    function getApiLintErrorsOfArticle(wgArticleId) {
        return (new mw.Api()).get({
            action: 'query',
            list: 'linterrors',
            lntlimit: 'max',
            lntpageid: wgArticleId,
        }).then(function (data) {
            return data.query.linterrors;
        });
    }

    function getRestLintErrorsOfText(text, title) {
        return $.ajax({
            type: 'POST',
            url: '/api/rest_v1/transform/wikitext/to/lint',
            data: {
                wikitext: text,
                title: title,
            },
            dataType: 'json',
        });
    }

    function expandTemplates(text, title, revid) {
        return (new mw.Api()).post({
            action: 'expandtemplates',
            prop: 'wikitext',
            text: text,
            title: title,
            revid: revid,
        }).then(function (data) {
            return data.expandtemplates.wikitext;
        });
    }

    /* format functions */
    function createCategoryHelpLink(category) {
        return $('<a>').addClass('mw-helplink').text(category).
          attr('href', '//www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:Linter/' + category).
          attr('target', '_blank');
    }

    function createEditLink(wgArticleId, lintId) {
        var editLinkPath = mw.util.wikiScript() + '?' + $.param({
            action: 'edit',
            curid: wgArticleId,
            lintid: lintId,
        });
        return $('<a>').text('edit').attr('href', editLinkPath);
    }

    function selectTextarea($textarea, start, end) {
        var textarea = $textarea[0];
        textarea.focus();
        textarea.setSelectionRange(start, end);
    }

    function createLocationLink($textarea, start, end) {
        return $('<a>').text(start + ' - ' + end).
          attr('href', 'javascript:void(0)').
          on('click', function (event) {
              selectTextarea($textarea, start, end);
          });
    }

    function createTemplateLink(templateInfo) {
        var $templateLink;
        if (templateInfo) {
            if (templateInfo.name) {
                var linkPath = mw.util.getUrl(templateInfo.name);
                $templateLink = $('<a>').text(templateInfo.name).attr('href', linkPath);
            } else if ('multiPartTemplateBlock' in templateInfo) {
                $templateLink = 'multi-part-template-block';
            } else {
                $templateLink = '-';
            }
        } else {
            $templateLink = '-';
        }
        return $templateLink;
    }

    /* show linter errors */
    function showApiLinterErrors(apiLinterErrors, config, $table, $wikiSourceTextarea) {
        var $thead = $('<thead>').appendTo($table);
        $('<tr>').
          append($('<th>').text('lintId')).
          append($('<th>').text('edit')).
          append($('<th>').text('category')).
          append($('<th>').text('location')).
          append($('<th>').text('params')).
          append($('<th>').text('template')).
          append($('<th>').text('templateInfo')).
          appendTo($thead);
        var $tbody = $('<tbody>').appendTo($table);

        var appendLintError = function (linterror) {
            $('<tr>').
              append($('<td>').append(linterror.lintId)).
              append($('<td>').append(createEditLink(config.wgArticleId, linterror.lintId))).
              append($('<td>').append(createCategoryHelpLink(linterror.category))).
              append($('<td>').append(createLocationLink($wikiSourceTextarea, linterror.location[0], linterror.location[1]))).
              append($('<td>').text(JSON.stringify(linterror.params))).
              append($('<td>').append(createTemplateLink(linterror.templateInfo))).
              append($('<td>').text(JSON.stringify(linterror.templateInfo))).
              appendTo($tbody);
        };

        if (apiLinterErrors.length >= 1) {
            $.each(apiLinterErrors, function (index, linterror) {
                appendLintError(linterror);
            });
        } else {
            $('<tr>').
              append($('<td>').attr('colspan', 7).text('No lint errors')).
              appendTo($tbody);
        }
    }

    function showApiLinterErrorsForTextarea(config, $table, $wikiSourceTextarea) {
        $table.empty();
        var $loadingMsg = $('<span>').text('Loading lint errors from API...').insertAfter($table);
        getApiLintErrorsOfArticle(config.wgArticleId).then(function (apiLinterErrors) {
            $loadingMsg.remove();
            showApiLinterErrors(apiLinterErrors, config, $table, $wikiSourceTextarea);
        });
    }

    function showRestLinterErrors(restLinterErrors, config, $table, $wikiSourceTextarea) {
        var $thead = $('<thead>').appendTo($table);
        $('<tr>').
          append($('<th>').text('category')).
          append($('<th>').text('location')).
          append($('<th>').text('params')).
          append($('<th>').text('template')).
          append($('<th>').text('templateInfo')).
          appendTo($thead);
        var $tbody = $('<tbody>').appendTo($table);

        var appendLintError = function (linterror) {
            $('<tr>').
              append($('<td>').append(createCategoryHelpLink(linterror.type))).
              append($('<td>').append(createLocationLink($wikiSourceTextarea, linterror.dsr[0], linterror.dsr[1]))).
              append($('<td>').text(JSON.stringify(linterror.params))).
              append($('<td>').append(createTemplateLink(linterror.templateInfo))).
              append($('<td>').text(JSON.stringify(linterror.templateInfo))).
              appendTo($tbody);
        };

        if (restLinterErrors.length >= 1) {
            $.each(restLinterErrors, function (index, linterror) {
                appendLintError(linterror);
            });
        } else {
            $('<tr>').
              append($('<td>').attr('colspan', 5).text('No lint errors')).
              appendTo($tbody);
        }
    }

    function expandTemplatesInTextarea(config, $textarea) {
        expandTemplates($textarea.val(), config.wgPageName).then(function (result) {
            $textarea.val(result);
        });
    }

    function showRestLinterErrorsForTextarea(config, $table, $wikiSourceTextarea) {
        $table.empty();
        var $loadingMsg = $('<span>').text('Loading lint errors from REST API...').insertAfter($table);
        getRestLintErrorsOfText($wikiSourceTextarea.val(), config.wgPageName).then(function (restLinterErrors) {
            $loadingMsg.remove();
            showRestLinterErrors(restLinterErrors, config, $table, $wikiSourceTextarea);
        });
    }

    function createEditableTextarea(config, $div) {
        var $editableTextarea = $('<textarea>').css('width', '100%').css('height', '10em');
        $('<label>').append('Edit to check lint errors in text here:').
          append($editableTextarea).appendTo($div);

        var $expandTemplatesLink = $('<a>').text('Expand templates').
          attr('href', 'javascript:void(0)').
          on('click', function () {
              expandTemplatesInTextarea(config, $editableTextarea);
          }).
          appendTo($div);

        $div.append(' | ');

        var $restLinterErrorsTable = $('<table>').addClass('linter-details wikitable mw-page-info').appendTo($div);
        var $showRestLinterErrorsLink = $('<a>').text('Show lint errors').
          attr('href', 'javascript:void(0)').
          on('click', function () {
              showRestLinterErrorsForTextarea(config, $restLinterErrorsTable, $editableTextarea);
          }).
          insertBefore($restLinterErrorsTable);
    }

    function createApiLinterErrorsTableAndEditableTextarea(config, $linterDetailsTable, $wikiSourceTextarea) {
        getWikiSource(config.wgArticleId).then(function (wikiSource) {
            $wikiSourceTextarea.text(wikiSource);
            showApiLinterErrorsForTextarea(config, $linterDetailsTable, $wikiSourceTextarea);

            var $div = $('<div>').insertAfter($linterDetailsTable);
            createEditableTextarea(config, $div);
        });
    }

    function mainForInfo(config, $linterTable) {
        var $showLinterErrorsLink = $('<a>').text('Show Lint errors').
          attr('href', 'javascript:void(0)').
          on('click', function () {
              var $linterDetailsTable = $('<table>').addClass('linter-details wikitable mw-page-info').insertAfter($linterTable);
              var $wikiSourceTextarea = $('<textarea>').attr('readonly', true).css('width', '100%').css('height', '10em').insertAfter($linterTable);
              $showLinterErrorsLink.remove();

              createApiLinterErrorsTableAndEditableTextarea(config, $linterDetailsTable, $wikiSourceTextarea);
          }).
          insertAfter($linterTable);
    }

    function mainForEdit(config, $wpTextbox1, $editOptionsDiv, $editButtonsDiv, testsLinterErrorsOnEditInit, summaryMessage) {
        var $linterDetailsTable = $('<table>').addClass('linter-details wikitable mw-page-info').insertAfter($editOptionsDiv);
        var $div = $('<div>').insertAfter($linterDetailsTable);
        createEditableTextarea(config, $div);

        var $testLinterErrorsLink = $('<a>').text('Test Lint errors').
            attr('href', 'javascript:void(0)').
            on('click', function () {
                showRestLinterErrorsForTextarea(config, $linterDetailsTable, $wpTextbox1);
            }).
            insertAfter($editButtonsDiv);

        if (testsLinterErrorsOnEditInit) {
            /* initial display of lint errors */
            showRestLinterErrorsForTextarea(config, $linterDetailsTable, $wpTextbox1);
        }

        if (summaryMessage) {
            var $addSummaryMessageLink = $('<a>').text('Add summary').
                attr('href', 'javascript:void(0)').
                on('click', function () {
                    $('#wpSummary').val($('#wpSummary').val() + summaryMessage);
                }).
                insertAfter($testLinterErrorsLink);
            $testLinterErrorsLink.after(' | ');
        }
    }

    $(function () {
        if (!('ShowPageLintError' in mw.libs)) {
            mw.libs.ShowPageLintError = {
                testsLinterErrorsOnEditInit: false,
                summaryMessage: null,
            };
        }
        mw.loader.using(['mediawiki.util', 'mediawiki.api']).then(function () {
            var config = mw.config.get(['wgArticleId', 'wgAction', 'wgPageName']);
            if (config.wgAction === 'info') {
                var $linterTable = $('#mw-pageinfo-linter + table');
                if ($linterTable[0]) {
                    mainForInfo(config, $linterTable);
                }
            } else if ($('#wpTextbox1')[0]) {
                mainForEdit(config, $('#wpTextbox1'), $('.editOptions'), $('.editButtons'),
                    mw.libs.ShowPageLintError.testsLinterErrorsOnEditInit, mw.libs.ShowPageLintError.summaryMessage);
            }
        });
    });
})();
"https://ml.wikipedia.org/w/index.php?title=ഉപയോക്താവ്:Harithvh/vector.js&oldid=3828391" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്