-
-
Save giiska/022c9f3af686f7cb8044d1b42c68a7c9 to your computer and use it in GitHub Desktop.
Revisions
-
肖建锋 created this gist
Jun 22, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ // ==UserScript== // @name 顶部显示知乎专栏文章日期 // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author zoffy zhang, bammoo // @match https://zhuanlan.zhihu.com/* // @grant none // ==/UserScript== (function () { 'use strict'; var target = document.querySelector('.ContentItem-time'); var date1 = target.innerText; target.click(); var date2 = target.innerText; var newContent = `<span style="margin-right: 20px;">${date1}</span>` if(date2 && (date2 !== date1)) { newContent += `<span>${date2}</span>` } var insertPosition = document.querySelector('.Post-Title'); insertPosition.insertAdjacentHTML('afterend', `<div style="margin-bottom: 15px; font-size:14px; color: #1a1a1a;">${newContent}</div>`); })();