|
|
(같은 사용자의 중간 판 8개는 보이지 않습니다) |
1번째 줄: |
1번째 줄: |
| mw.loader.load('//librewiki.net/index.php?title=사용자:Utolee90/status.js&action=raw&ctype=text/javascript'); | | mw.loader.load('//librewiki.net/index.php?title=사용자:Utolee90/status.js&action=raw&ctype=text/javascript'); |
|
| |
| $(function () {
| |
| // generate n random integers from 0 to max - 1
| |
| function randomArray(n, max) {
| |
| var arr = [];
| |
| while (arr.length < n) {
| |
| var r = Math.floor(Math.random() * max);
| |
| if (arr.indexOf(r) === -1) arr.push(r);
| |
| }
| |
| }
| |
| $('.libre-random').each(function () {
| |
| var limit = parseInt($(this).data('limit'));
| |
| var $items = $(this).find('.libre-tab-item');
| |
| var activeIds = randomArray(limit, $items.length)
| |
| $items.each(function (index) {
| |
| if (activeIds.indexOf(index) !== -1) {
| |
| $(this).addClass('libre-random-item-active')
| |
| }
| |
| })
| |
| })
| |
| });
| |