Created
June 1, 2014 16:17
-
-
Save TheCjw/bbb9952943f35380005e 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 Bttiantang directly download. | |
// @author TheCjw | |
// @description // | |
// @namespace http://github.com/thecjw | |
// @updateURL | |
// @downloadURL | |
// @include http://www.bttiantang.com/subject/* | |
// @version 1.01 | |
// @require http://libs.baidu.com/jquery/1.9.0/jquery.min.js | |
// ==/UserScript== | |
$(document).ready(function() { | |
$.each($('.tinfo'), function(n, value) { | |
var href_data = $(this).find('a').attr('href'); | |
if (href_data != null) { | |
var re = /(?:.id\=)(\d+)(?:.uhash\=)(.+)/i | |
var result = re.exec(href_data); | |
if (result != null) { | |
var tid = result[1]; | |
var uhash = result[2]; | |
var download_button = '<form action="/download.php" method="post">'; | |
download_button += '<input type="hidden" value="download" name="action">'; | |
download_button += '<input type="hidden" value="' + tid + '" name="id">'; | |
download_button += '<input type="hidden" value="' + uhash + '" name="uhash">'; | |
download_button += '<input name="imageField" type="image" width="140" height="55" src="/style/download.gif" style="cursor:pointer;">'; | |
download_button += '</form>'; | |
$(this).append(download_button); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment