Skip to content

Instantly share code, notes, and snippets.

@holys
Last active April 22, 2022 19:37
Show Gist options
  • Save holys/5849795 to your computer and use it in GitHub Desktop.
Save holys/5849795 to your computer and use it in GitHub Desktop.
勉强能用吧
// ==UserScript==
// @name douban topic search
// @namespace http://www.douban.com/update/
// @version 0.1
// @description provide a topic search entry
// @match http://www.douban.com/update/*
// @match http://www.douban.com/*
// @match http://www.douban.com/*/*/statuses
// @copyright holys
// ==/UserScript==
var searchForm = '<input type="text" name="q" id="inp-topic" class="j a_search_text search-query" style="width:242px;font-size:14px;" \
maxlength="36" value="" title="话题">\
<input type="hidden" name="cat" value="1005">\
<input type="submit" class="btn butt topic-btn" value="搜索话题">';
$(document).ready(function(){
if (document.URL.indexOf('statuses') != -1){
$('.aside').after(searchForm);
}
else {
$('.extra').before(searchForm);
}
});
$(".topic-btn").unbind('click').click(function(){
//window.open("http://www.douban.com/update/topic/"+ document.getElementById('inp-topic').value);
window.location.href = "http://www.douban.com/update/topic/"+ document.getElementById('inp-topic').value;
});
@holys
Copy link
Author

holys commented Jun 24, 2013

@holys
Copy link
Author

holys commented Jun 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment