Falcon / 置顶每日乱弹

// ==UserScript==
// @name         置顶每日乱弹
// @namespace    https://hi.cellmean.com/
// @version      0.7
// @description  May the Tweets Daily be always on the Top without this script. 🙏🙏🙏
// @author       Falcon
// @match        https://www.oschina.net/tweets
// @match        https://my.oschina.net/*
// @icon         https://static.oschina.net/uploads/user/714/1428332_50.jpg
// @run-at       document-body
// @grant        GM_addStyle
// @license MIT

// ==/UserScript==
/*jshint esversion: 6 */
(function() {
    'use strict';
    if(document.querySelector('.web-tweet-common') || document.querySelector('.tweet-detail-page') ){



        fetch('https://wwwosc.cellmean.com/daily-tweets?scope=entity&p=1&type=ajax',{
            method: 'GET',
            headers:{
                "Content-Type": "text/html"
            },
            mode: 'cors'
        })
        .then(res=> {
            if(res.ok) { // 此处加入响应状态码判断
                return res.text()
            }else{
                console.log('Fail:', JSON.stringify(res))
            }

        })
        .then(html=>{
            const parser=new DOMParser()
            const htmlDoc=parser.parseFromString(html, "text/html")
            const tweetItem = htmlDoc.querySelector('.tweet-item')
            const feed = document.querySelector('.sidebar .feed')
            feed.prepend(tweetItem)
            GM_addStyle(`
            .ui.feed>div[data-tweet-owner-id='1428332'].event>.content{margin-top: -.5em;}
            .ui.feed>div[data-tweet-owner-id='1428332'].event>.content .extra{word-break: break-all;}
            .ui.feed>div[data-tweet-owner-id='1428332'].event>.content .summary>.date{ display:block;margin-left:0 }
            `);

        })
        .catch(error=>console.log('Error:',error))
    }
})();