User:Dixtosa/autoSummary.js

function GenerateSummary{ let oldText = $("#wpTextbox1").text.split("\n"); let newText = $("#wpTextbox1").val.split("\n"); let diff = newText.filter((val, ind) => oldText.indexOf(val) == -1).join(";"); let oldSummary = $("#wpSummary").val; $("#wpSummary").val(oldSummary + diff); }

autoSummaryConfig = window.autoSummaryConfig || {insertAutomatically: true};

$(function{	//$("#wpSummaryLabel").after($("Insert auto summary ").css("border", "1px solid black").click(GenerateSummary));	if (autoSummaryConfig.insertAutomatically === true)		$("#wpSave").click( => { if ((/^\/\*.*?\*\/ $/.test($("#wpSummary").val) || $("#wpSummary").val === "")				&& (["", "Project"].indexOf(mw.config.values.wgCanonicalNamespace) >= 0)) GenerateSummary; }); });