MediaWiki:Common.js: Difference between revisions

do you not like let
(Epyon should be happy about tooltips now)
(do you not like let)
 
(4 intermediate revisions by the same user not shown)
Line 20: Line 20:
       // Hover out
       // Hover out
       $('.tooltip').remove();
       $('.tooltip').remove();
     })..mousemove(
     }).mousemove(
       function(e) {
       function(e) {
         var mousex = e.pageX + 20;
         var mousex = e.pageX + 20;
Line 46: Line 46:
   });
   });


  //Code for Cycling
  $('.cyclist > :not(:first-child)').hide();
  setInterval(function() {
    if (!!$('.cyclist').filter(function() { return $(this).is(":hover"); }).length) return;
    $('.cyclist > :not(:hidden)').hide().each(function() {
      var elem = $(this);
      elem.next().show();
      if (elem.is(':last-child')) elem.siblings().first().show();
    });
  }, 2000);
});
});


Line 52: 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