Skip to content

Instantly share code, notes, and snippets.

@jijiechen
Last active October 17, 2015 02:52
Show Gist options
  • Save jijiechen/1d92918d9e1f71723150 to your computer and use it in GitHub Desktop.
Save jijiechen/1d92918d9e1f71723150 to your computer and use it in GitHub Desktop.
javascript code to clean up Zhihu anwser page
// javascript code to clean up Zhihu anwser page
$('#zh-question-answer-wrap .zm-item-rich-text .zm-editable-content').first().prepend('<p>作者:<strong>' + $.trim($('.zm-item-answer-author-info:first').text()).replace(/,/, ' </strong>').replace(/收起/g, '') + '</p>');
[".zu-top",
"#zh-footer",
".zu-main-sidebar",
".zm-tag-editor",
"#zh-question-meta-wrap",
".zm-votebar",
".zm-item-answer-author-info",
".zm-item-vote-info",
".zm-item-link-avatar",
".more-awesome",
".awesome-answer-list",
".zh-answers-title",
".zh-backtotop",
".zm-item-meta.answer-actions"].forEach(function(className){
$(className).remove();
});
$('.zu-main-content-inner').css('margin', 'auto');
// bookmarklet:
// javascript:$("#zh-question-answer-wrap .zm-item-rich-text .zm-editable-content").first().prepend("<p>\u4f5c\u8005\uff1a<strong>"+$.trim($(".zm-item-answer-author-info:first").text()).replace(/\uff0c/," </strong>").replace(/\u6536\u8d77/g,"")+"</p>"),[".zu-top","#zh-footer",".zu-main-sidebar",".zm-tag-editor","#zh-question-meta-wrap",".zm-votebar",".zm-item-answer-author-info",".zm-item-vote-info",".zm-item-link-avatar",".more-awesome",".awesome-answer-list",".zh-answers-title",".zh-backtotop",".zm-item-meta.answer-actions"].forEach(function(a){$(a).remove()}),$(".zu-main-content-inner").css("margin","auto");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment