MediaViki:Gadget-Adiutor-COV.js — Vikipediya

MediaViki:Gadget-Adiutor-COV.js

Qeyd: Dəyişiklikləri yayımladıqdan sonra etdiyiniz dəyişikliklərin görünməsi üçün brauzerinizin keşinin təmizlənməsi lazım ola bilər.

  • Firefox / Safari: Reload düyməsinə basılı tutarkən Shift düyməsinə basın, və ya Ctrl+F5 və ya Ctrl+R (Mac üçün ⌘-R )
  • Google Chrome: Ctrl-Shift-R (Mac üçün ⌘-Shift-R)
  • Edge: Ctrl düyməsini basılı tutarkən Refresh düyməsinə basın, və ya sadəcə Ctrl+F5.
/*
 * Adiutor: Adiutor enables versatile editing options and modules to assist a variety of user actions to enhance the Wikipedia editing experience.
 * Author: Vikipolimer
 * Learn more at: https://meta.wikimedia.org/wiki/Adiutor
 * Licensing and Attribution: Licensed under Creative Commons Attribution-ShareAlike 4.0 International ()
 * Module: Copyright checker
 * Earwig's Copyvio Detector (https://copyvios.toolforge.org/) api used in MediaWiki:Gadget-Adiutor-COV.js
 */
/* <nowiki> */
// Get essential configuration from MediaWiki
var mwConfig = mw.config.get(["skin", "wgAction", "wgArticleId", "wgPageName", "wgNamespaceNumber", "wgTitle", "wgUserGroups", "wgUserName", "wgUserEditCount", "wgUserRegistration", "wgCanonicalNamespace"]);
var api = new mw.Api();
var adiutorUserOptions = JSON.parse(mw.user.options.get('userjs-adiutor'));
var messageDialog = new OO.ui.MessageDialog();
var windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
windowManager.addWindows([messageDialog]);
var progressBar = new OO.ui.ProgressBarWidget({
	progress: false
});
windowManager.openWindow(messageDialog, {
	title: mw.msg('copyvio-checking'),
	message: progressBar.$element
});
// Fetch data from Copyvio Detector API
$.get("https://copyvios.toolforge.org/api.json?", {
	action: "search",
	lang: "az",
	project: "wikipedia",
	title: mwConfig.wgPageName,
	oldid: "",
	use_engine: "1",
	use_links: "1",
	turnitin: "0",
}, function(data) {
	messageDialog.close();

	function CopyVioDialog(config) {
		CopyVioDialog.super.call(this, config);
	}
	OO.inheritClass(CopyVioDialog, OO.ui.ProcessDialog);
	var copVioRatio = (data.best.confidence * 100).toFixed(2);
	CopyVioDialog.static.title = mw.msg('copyvio-result', copVioRatio),
		CopyVioDialog.static.name = 'CopyVioDialog';
	var headerTitle;
	if(copVioRatio > 45) {
		headerTitle = new OO.ui.MessageWidget({
			type: 'error',
			inline: true,
			label: mw.msg('copyvio-potential-violation', copVioRatio),
		});
		CopyVioDialog.static.actions = [{
			action: 'continue',
			modes: 'edit',
			label: mw.msg('create-speedy-deletion-request'),
			flags: ['primary', 'destructive']
		}, {
			modes: 'edit',
			label: mw.msg('close'),
			flags: 'safe'
		}, {
			action: 'analysis',
			modes: 'edit',
			label: mw.msg('detailed-analysis'),
			framed: false,
		}];
	} else if(copVioRatio < 10) {
		headerTitle = new OO.ui.MessageWidget({
			type: 'success',
			inline: true,
			label: mw.msg('copyvio-potential-violation', copVioRatio),
		});
		CopyVioDialog.static.actions = [{
			action: 'close',
			modes: 'edit',
			label: mw.msg('okay'),
			flags: ['primary', 'progressive']
		}, {
			modes: 'edit',
			label: mw.msg('close'),
			flags: 'safe'
		}, {
			action: 'analysis',
			modes: 'edit',
			label: mw.msg('detailed-analysis'),
			framed: false,
		}];
	} else {
		headerTitle = new OO.ui.MessageWidget({
			type: 'warning',
			inline: true,
			label: mw.msg('copyvio-potential-violation-low', copVioRatio),
		});
		CopyVioDialog.static.actions = [{
			action: 'close',
			modes: 'edit',
			label: mw.msg('okay'),
			flags: ['primary', 'progressive']
		}, {
			modes: 'edit',
			label: mw.msg('close'),
			flags: 'safe'
		}, {
			action: 'analysis',
			modes: 'edit',
			label: mw.msg('detailed-analysis'),
			framed: false,
		}];
	}
	CopyVioDialog.prototype.initialize = function() {
		CopyVioDialog.super.prototype.initialize.apply(this, arguments);
		var cvRelSource = data.sources.filter(function(source) {
			return !source.excluded;
		});
		var CopyVioLinks = cvRelSource.map(function(source) {
			var messageWidgetConfig = {
				icon: 'link',
				label: new OO.ui.HtmlSnippet('<a target="_blank" href="' + source.url + '">' + source.url + '</a>')
			};
			if((source.confidence * 100).toFixed(2) > 40) {
				messageWidgetConfig.type = 'error';
				messageWidgetConfig.label = new OO.ui.HtmlSnippet('<strong>' + mw.msg('high-violation-link') + ' (' + (source.confidence * 100).toFixed(2) + ')</strong><br><a target="_blank" href="' + source.url + '">' + source.url + '</a>');
			} else {
				messageWidgetConfig.type = 'notice';
			}
			return new OO.ui.MessageWidget(messageWidgetConfig);
		});
		this.panel1 = new OO.ui.PanelLayout({
			padded: true,
			expanded: false
		});
		this.panel1.$element.append(headerTitle.$element);
		CopyVioLinks.forEach(function(link) {
			this.panel1.$element.append(link.$element);
		}, this);
		this.$body.append(this.panel1.$element);
	};
	CopyVioDialog.prototype.getSetupProcess = function(data) {
		return CopyVioDialog.super.prototype.getSetupProcess.call(this, data).next(function() {
			this.actions.setMode('edit');
		}, this);
	};
	CopyVioDialog.prototype.getActionProcess = function(action) {
		var dialog = this;
		if(action === 'continue') {
			return new OO.ui.Process(function() {
				dialog.close();
				mw.loader.load(mw.util.getUrl('MediaWiki:Gadget-Adiutor-CSD.js', {
					action: 'raw'
				}) + '&ctype=text/javascript', 'text/javascript');
			});
		} else if(action === 'analysis') {
			var targetURL = "https://copyvios.toolforge.org/?lang=az&project=wikipedia&title=" + mwConfig.wgPageName;
			window.open(targetURL, '_blank');
		} else if(action === 'close') {
			dialog.close();
		}
		return CopyVioDialog.super.prototype.getActionProcess.call(this, action);
	};
	var windowManager = new OO.ui.WindowManager();
	$(document.body).append(windowManager.$element);
	var dialog = new CopyVioDialog({
		size: 'larger'
	});
	windowManager.addWindows([dialog]);
	windowManager.openWindow(dialog);
});
/* </nowiki> */

Informasiya Melumat Axtar

Anarim.Az

Sayt Rehberliyi ile Elaqe

Saytdan Istifade Qaydalari

Anarim.Az 2004-2023