MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
do you not like let
(cycling)
(do you not like let)
 
(2 intermediate revisions by the same user not shown)
Line 52: Line 52:
     if (!!$('.cyclist').filter(function() { return $(this).is(":hover"); }).length) return;
     if (!!$('.cyclist').filter(function() { return $(this).is(":hover"); }).length) return;
     $('.cyclist > :not(:hidden)').hide().each(function() {
     $('.cyclist > :not(:hidden)').hide().each(function() {
       var elem = $(this)
       var elem = $(this);
       elem.next().show();
       elem.next().show();
       if (elem.is(':last-child')) elem.siblings().first().show();
       if (elem.is(':last-child')) elem.siblings().first().show();
Line 63: Line 63:
   var res = '';
   var res = '';
   for (var i = 0; i < text.length; i++) {
   for (var i = 0; i < text.length; i++) {
     if ((text[i] == '&') && /[0-9a-fl-or]/.test(text[i + 1])) continue;
     if (text[i] == '\\') {
     else if (text[i] == '/') {
      res += text[i+1];
      i++;
    } else if (/&[0-9a-fl-o]/.test(text.substring(i,i+2))) {
      res += '<span class="format-' + text[i+1] + '">';
      spans++;
      i++;
    } else if (text.substring(i,i+2) == '&r') {
      res += '</span>'.repeat(spans);
      spans = 0;
      i++;
    } else if (/&#[0-9A-Fa-f]{6}/.test(text.substring(i,i+8))) {
      res += '<span style="color: ' + text.substring(i+1,i+8) + '">';
      spans++;
      i += 7;
     } else if (text[i] == '/') {
       res += '<br>';
       res += '<br>';
       continue;
    } else {
       res += text[i];
     }
     }
    else if ((text[i - 1] == '&') && /[0-9a-fl-or]/.test(text[i])) {
      if (text[i] == 'r') {
        res += '</span>'.repeat(spans);
        spans = 0;
      } else {
        res += '<span class="format-' + text[i] + '">';
        spans++;
      }
    } else res += text[i];
   }
   }
   return res + '</span>'.repeat(spans);
   return res + '</span>'.repeat(spans);
}
}
184

edits

Navigation menu