MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
(ok epyon, this should have fixed it) |
m (or not, maybe this will?) |
||
Line 29: | Line 29: | ||
// Hide the stupid empty newlines after crafting grids | // Hide the stupid empty newlines after crafting grids | ||
$('.crafting + p br:only-child').parent().hide(); | $('.crafting + p br:only-child').parent().hide(); | ||
setupPage($(page)) | //Code For books | ||
$('.pageactive').each((_, page) => { | |||
setupPage($(page)); | |||
}); | }); | ||
$('.book_leftarrow').click(function() { | $('.book_leftarrow').click(function() { | ||
let active = $(this).siblings('.pageactive'); | let active = $(this).siblings('.pageactive'); | ||
active.removeClass('pageactive'); | active.removeClass('pageactive'); | ||
active = active.prev() | active = active.prev(); | ||
setupPage(active); | setupPage(active); | ||
}); | }); | ||
Line 42: | Line 44: | ||
let active = $(this).siblings('.pageactive'); | let active = $(this).siblings('.pageactive'); | ||
active.removeClass('pageactive'); | active.removeClass('pageactive'); | ||
active = active.next() | active = active.next(); | ||
setupPage(active); | setupPage(active); | ||
}); | }); | ||
Line 78: | Line 80: | ||
let length = (active.siblings().length - 2); | let length = (active.siblings().length - 2); | ||
active.siblings('.book_pagenum').text('Page ' + index + ' of ' + length); | active.siblings('.book_pagenum').text('Page ' + index + ' of ' + length); | ||
active.siblings('.book_leftarrow, .book_rightarrow').show() | active.siblings('.book_leftarrow, .book_rightarrow').show(); | ||
if (index == 1) { | if (index == 1) { | ||
active.siblings('.book_leftarrow').hide() | active.siblings('.book_leftarrow').hide(); | ||
} | } | ||
if (index == length) { | if (index == length) { | ||
active.siblings('.book_rightarrow').hide() | active.siblings('.book_rightarrow').hide(); | ||
} | } | ||
} | } |