Skip to content

Instantly share code, notes, and snippets.

@TheCjw
Last active July 24, 2016 16:19
Show Gist options
  • Save TheCjw/7593511 to your computer and use it in GitHub Desktop.
Save TheCjw/7593511 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name ITPub downloader
// @author TheCjw
// @description test
// @namespace http://github.com/thecjw
// @updateURL
// @downloadURL
// @include http://www.itpub.net/*
// @version 1.03
// @require http://libs.useso.com/js/jquery/2.1.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
$(document).ready(function() {
$('ignore_js_op').find('a').click(function() {
var downloadLink = $(this).attr('href');
var re = /(?:attachment\.php\?aid\=)(\w{58})/i;
var result = re.exec(downloadLink);
if (result !== null) {
var fileId = result[1];
var url = "http://www.itpub.net/" + 'forum.php?mod=attachment&aid=' + fileId;
console.log(url);
window.open(url);
return false;
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment