User:Kyz/common.js
From ExoticA
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
$("h3:contains('.lha')").each(function () {
var archive = $(this).text().trim();
// messy... find the first table.filetable after the h3, select all td.r
// (file size column), go to their previous sibling (file name column)
// then the last child node, which is the text node with the filename
var filetable = $(this).siblings(".filetable").first().find("td.r").prev().each(function (i, td) {
var node = $(td.lastChild), filename = node.text().trim();
// wrap all filenames in <a> tags
// - those which have no "." anywhere (instruments, "songplay" code, deliplayers...)
// - smp.*, smpl.*, *.ss, *.ssd, *.instr, *.x (samples and instruments)
// - *.asm, *.sh (assembly source code and shell scripts)
// - *.ogg, *.mp2, *.mp3 (large streaming audio files)
if (filename.match(/\./) && !filename.match(/(?:^smpl?\.|\.(?:asm|[Ii]nstr|mp[23]|ogg|sh|ssd?|x)$)/)) {
node.wrap("<a class='playable'></a>");
}
});
});