MediaWiki:Gadget-summarised-editing.js: Difference between revisions

From WikiMSK

(Created page with "wpSummaryButtons = new Array(); function insertSummary(text) { wpSummary = document.getElementById('wpSummary'); if (wpSummary.value.indexOf(text) != -1) return; if...")
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 38: Line 38:
   
   
   wpSummaryLegend = document.createElement('b');
   wpSummaryLegend = document.createElement('b');
   wpSummaryLegend.appendChild(document.createTextNode(" Náměty pro shrnutí editace: "));
   wpSummaryLegend.appendChild(document.createTextNode("Suggestions for editing summary: "));
   wpSummaryBtnP.appendChild(wpSummaryLegend);
   wpSummaryBtnP.appendChild(wpSummaryLegend);
   
   
Line 52: Line 52:
}
}


addSummaryButton("redakce", "redakce", "Redakční úpravy");
addSummaryButton ("general", "general content addition", "General content addition");
addSummaryButton("kategorie", "kategorie", "Úpravy kategorií");
addSummaryButton ("editing", "general content editing", "General content editing");
addSummaryButton("typografie", "typo", "Opravy typografie");
addSummaryButton ("category", "categories", "edit categories");
addSummaryButton("pravopis", "pravopis", "Opravy pravopisu");
addSummaryButton ("typography", "typo", "typography fixes");
addSummaryButton("prolinkování", "prolinkování", "Přidání odkazů do článku");
addSummaryButton ("spelling", "spelling", "spelling corrections");
addSummaryButton("wikifikace", "wikifikace", "Celkové zpřehlednění a uhlazení článku");
addSummaryButton ("linking", "linking", "Add links to article");
addSummaryButton("obrázek", "obrázek", "Přidání/úprava obrázku");
addSummaryButton ("image", "image", "add / edit image");
addSummaryButton("licence", "licence", "Úprava licencování");
addSummaryButton ("license", "license", "Modify licensing");
addSummaryButton("členění", "členění", "Uprava členění článku");
addSummaryButton ("headings", "headings", "Edit headings");
addSummaryButton("nadpisy", "nadpisy", "Úprava nadpisů");
addSummaryButton ("portals", "portals", "Portal control");
addSummaryButton("portály", "portály", "Kontrola portálů");
addSummaryButton ("citations", "citations", "Edit citations in an article");
addSummaryButton("citace", "citace", "Úprava citací v článku");
addSummaryButton ("redirect", "redirect", "article redirect created");
addSummaryButton("zdroje", "zdroje", "Kontrola zdrojů článku");
addSummaryButton ("typo", "typo", "typo fixed");
addSummaryButton("odpověď", "odpověď", "Odpověď v diskusi");
addSummaryButton ("template", "template", "Added or modified template");
addSummaryButton("návrh", "návrh", "Podání návrhu");
addSummaryButton("přesměrování", "přesměrování", "Založeno přesměrování článku");
addSummaryButton("překlep", "překlep", "Opraven překlep");
addSummaryButton("šablona", "šablona", "Přidána či upravena šablona");
addSummaryButton("šablona „Redakce“", "šablona „Redakce“", "přidána šablona „Redakce“");


$(function() {createSummaryButtons();});
$(function() {createSummaryButtons();});


/* </pre> */
/* </pre> */

Latest revision as of 00:18, 23 August 2020

wpSummaryButtons = new Array();

function insertSummary(text) {
  wpSummary = document.getElementById('wpSummary');
 
  if (wpSummary.value.indexOf(text) != -1) return;
 
  if(wpSummaryButtons.length == 0) return;
 
  if (wpSummary.value.match(/[^,; \/•]$/)) wpSummary.value += ';';
  if (wpSummary.value.match(/[^ ]$/)) wpSummary.value += ' ';
 

  wpSummary.value += text;
}

function addSummaryButton(name, text, title) {

  buttonSummary = document.createElement('a');
  buttonSummary.appendChild(document.createTextNode(name));
  buttonSummary.href = "#";
  buttonSummary.title = title;
  buttonSummary.onclick = function(){insertSummary(text); return false;};
 
  wpSummaryButtons[wpSummaryButtons.length] = buttonSummary;
}

function createSummaryButtons(){
  // pokud pole Shrnutí editace neexistuje, nemá smysl pokračovat
  if(!document.getElementById('wpSummary')) return;
  var wpSummary = document.getElementById('wpSummary');
  if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return;
 
  wpSummaryBtn = document.createElement('div');
  wpSummaryBtn.className = 'mw-editSummary';
  wpSummaryBtnP = document.createElement('p');
  wpSummaryBtn.appendChild(wpSummaryBtnP);
 
  wpSummaryLegend = document.createElement('b');
  wpSummaryLegend.appendChild(document.createTextNode("Suggestions for editing summary: "));
  wpSummaryBtnP.appendChild(wpSummaryLegend);
 
  for(var i in wpSummaryButtons) {
    wpSummaryBtnP.appendChild(wpSummaryButtons[i]);
    wpSummaryBtnMezera = document.createElement('span');
    if(i != (wpSummaryButtons.length - 1)) wpSummaryBtnMezera.appendChild(document.createTextNode(' • '));
    wpSummaryBtnP.appendChild(wpSummaryBtnMezera);
  }
 
   wpInsert = $(".mw-editTools")[0];
   wpInsert.parentNode.insertBefore(wpSummaryBtn, wpInsert.nextSibling);
}

addSummaryButton ("general", "general content addition", "General content addition");
addSummaryButton ("editing", "general content editing", "General content editing");
addSummaryButton ("category", "categories", "edit categories");
addSummaryButton ("typography", "typo", "typography fixes");
addSummaryButton ("spelling", "spelling", "spelling corrections");
addSummaryButton ("linking", "linking", "Add links to article");
addSummaryButton ("image", "image", "add / edit image");
addSummaryButton ("license", "license", "Modify licensing");
addSummaryButton ("headings", "headings", "Edit headings");
addSummaryButton ("portals", "portals", "Portal control");
addSummaryButton ("citations", "citations", "Edit citations in an article");
addSummaryButton ("redirect", "redirect", "article redirect created");
addSummaryButton ("typo", "typo", "typo fixed");
addSummaryButton ("template", "template", "Added or modified template");

$(function() {createSummaryButtons();});

/* </pre> */