Twitter Persian Date

this script convert all date of twitte to shamsi date

当前为 2021-09-07 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Twitter Persian Date
// @namespace    http://soozanchi.ir/
// @version      0.21
// @description  this script convert all date of twitte to shamsi date
// @author       Saleh Souzanchi(https://twitter.com/zoghal)
// @include     https://twitter.com/*
// @include     http://twitter.com/*
// @icon         https://www.google.com/s2/favicons?domain=twitter.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setInterval(function(){
        document.querySelectorAll('time[datetime]:not([jalalized]').forEach(item=>{
            var d=item.getAttribute('datetime');
            d = new Date(d);
            d = new Intl.DateTimeFormat('fa-IR', { dateStyle: 'short', timeStyle: 'short' }).format(d)
            //            console.log(d);
            item.innerText =d;
            item.setAttribute('jalalized',"");
            item.setAttribute('dir','ltr');
        });

        document.querySelectorAll('article[role="article"] > div > div > div >div >div:nth-of-type(3) a[href^="/"][role="link"] > span:not([jalalized]').forEach(item=>{
            var d=item.innerText;
            d =d.replace('·','');
            d = new Date(d);
            d = new Intl.DateTimeFormat('fa-IR', { dateStyle: 'short', timeStyle: 'short' }).format(d)
            console.log(d);
             item.innerText =d;
            item.setAttribute('jalalized',"");
            item.setAttribute('dir','ltr');
        });
    }, 3000);
})();