User:Js/markZeroEdits.js

//[[user:js/markZeroEdits]] function markZeroEdits(){ var i = -1, j, k, entry, plusminus, isHRDone var rows, td, aa, sp, step var firstEditor, thisEditor, isR

//[[user:js/markZeroEdits]]

function markZeroEdits(){

var i = -1, j, k, entry, plusminus, isHRDone
var rows, td, aa, sp, step
var firstEditor, thisEditor, isRevert

 mzRevertRegExp = window.mzRevertRegExp || /^(BOT[ -]*)?Reverted|^Reverting|^Undid revision /
 appendCSS(window.mzCSS || 'table.revert-edit *, table.zero-edit * {color:#777799; }\
table.revert-edit td {text-decoration: line-through}')

 while (entry=document.getElementById('mw-rc-closearrow-'+(++i))){//loop through all multiple edits
 //jsMsg(i + ' ' + entry)
  //check if this is a  0 size diff
  while ((entry=entry.parentNode) && entry.nodeName!='TR');
  plusminus = entry.cells[1].getElementsByTagName('span')[0]
  if (!plusminus || plusminus.className!='mw-plusminus-null') continue
  
  //get all collapsed edits inside hidden DIV
  rows = document.getElementById('mw-rc-subentries-' + (i)).firstChild.rows
  //some initial values
  firstEditor = '' //first editor (who is possibly reverted later)

  //check all edits from bottom, i.e. by the timeline
  for (j=rows.length-1; j>=0; j--){
    //find editor
    td = rows[j].cells[1]
    aa = td.getElementsByTagName('a')
    for (k=0; k<aa.length && /&oldid=/.test(aa[k].href); k++);
    thisEditor = aa[k].href
    //compare with previous editor
    if (!firstEditor){ //this is a beginning of possible edit-revert block
      firstEditor = thisEditor
      isRevert = false
      continue
    }else if (thisEditor==firstEditor && j>0){ //first editor keeps making several edits
      continue 
    }
    //we now have either a different editor of the last edit
    //find edit summary
	sp = getElementsByClassName(td, 'span', 'comment')[0]
    if (!sp) break
    //check if this was a revert
    if (!mzRevertRegExp.test(ts_getInnerText(sp).substring(1))) break
    //by default do not trust self reverts and reverts by unregs
    if (thisEditor==firstEditor && !window.mzTrustSelfRv) break
    if (/Special:Contributions/.test(thisEditor) && !window.mzTrustUnregRv) break
    //all checks done, this looks like a revert after all
    isRevert = true
    firstEditor = '' //get ready for the next block of edits
  }
  
  //categorize the entry
  while ((entry=entry.parentNode) && entry.nodeName!='TABLE');
  if (isRevert){
    entry.className += 'revert-edit'
    if (window.mzMoveReverts)
     do{
       step = entry.nextSibling; entry.parentNode.appendChild(entry); entry = step
     }while (entry && entry.nodeName != 'TABLE' && entry.nodeName != 'HR')
  }else{
    entry.className += 'zero-edit'
  }
 
 }//while

}

$(markZeroEdits)

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.