Last active
April 22, 2022 19:37
-
-
Save holys/5849795 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 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; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment