Twitter Persian Date

this script convert all date of twitte to shamsi date

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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);
})();