Last active
July 24, 2016 16:19
-
-
Save TheCjw/7593511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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