MediaWiki:Common.js: Difference between revisions

Disabled the [hide heading summaries after putting them in the considerations table] functionality.
(Undo revision 1163 by Elie (talk))
Tag: Undo
(Disabled the [hide heading summaries after putting them in the considerations table] functionality.)
 
(2 intermediate revisions by the same user not shown)
Line 312: Line 312:
   str += e[i].innerHTML;
   str += e[i].innerHTML;
   str += "</td></tr>";
   str += "</td></tr>";
   e[i].style.display = "none";
   //e[i].style.display = "none";
   }
   }
   str += "</table>";
   str += "</table>";
Line 331: Line 331:
   for (var j=0; j<lines.length; j++) {
   for (var j=0; j<lines.length; j++) {
   var n=0; while (lines[j][n]==' ') n++;
   var n=0; while (lines[j][n]==' ') n++;
  var font = (n%2)?"serif":"sans";
   var k = Math.exp(-0.16*n);
   var k = Math.exp(-0.16*n);
   str += "<div style='font-size:"+(1.4*size*k+6)+"px; margin-left:"+(size*(n*0.5 + 12-12*k))+"px; font-family:"+font+"; color:RGB(0,"+(255-255*k)+",0); padding:0.15em 0; line-height:1.1em'>"+(lines[j].substr(n)||"&nbsp;")+"</div>";
   str += "<div style='font-size:" +(1.4*size*k+6)
                +"px; margin-left:"+(size*(n*0.5 + 12-12*k))
                +"px; font-family:"+((n%2)?"serif":"sans")
                + "; color:RGB(0,"+(255-255*k)+",0)"
                +  "; padding:0.15em 0; line-height:1.1em'>"
      +(lines[j].substr(n) || (j==lines.length-1 ? "":"&nbsp;"))+"</div>";
   }
   }
   e[i].innerHTML = str;
   e[i].innerHTML = str;
Line 345: Line 349:
function changeWords(ev) { // to next option
function changeWords(ev) { // to next option
  var hide = ev.currentTarget;
  var hide = ev.currentTarget;
  if(!hide || !hide.classList.contains("altWords")) return;
  if(!hide || !hide.classList.contains("altOuter")) return;
  var show = hide.nextElementSibling;
  var show = hide.nextElementSibling;
  if(!show || !show.classList.contains("altWords") || !show.innerHTML) {
  if(!show || !show.classList.contains("altOuter") || !show.innerHTML) {
   var find = hide;
   var find = hide;
   do { // seek back to the first of list
   do { // seek back to the first of list
   show = find;
   show = find;
   find = find.previousElementSibling;
   find = find.previousElementSibling;
   } while (find && find.classList.contains("altWords"));
   } while (find && find.classList.contains("altOuter"));
  }
  }
  hide.style.display = "none";
  hide.style.display = "none";
Line 358: Line 362:
}
}
function parseWordChangers() { // init
function parseWordChangers() { // init
  var e = document.getElementsByClassName("altWords");
  var e = document.getElementsByClassName("altOuter");
  for (var i=0; i<e.length; i++) {
  for (var i=0; i<e.length; i++) {
   var str = e[i].innerHTML;
   var str = e[i].innerHTML;
   if (str) {
   if (str) {
   e[i].innerHTML = "<span style='color:#7F7'>&#8597;</span>"+str+"<span style='color:#7F7'>&#8597</span>";
   e[i].innerHTML = "&#8597;<span class='altInner'>"+str+"</span>&#8597;";
   e[i].onclick = changeWords;
   e[i].onclick = changeWords;
   }
   }