Twitter Persian Date

this script convert all date of twitte to shamsi date

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Twitter Persian Date
// @namespace    http://soozanchi.ir/
// @version      0.3.0
// @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');
        });
        document.querySelectorAll("article[role='article'] > div > div > div >div >div:nth-of-type(4) 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);
})();