Intent share URL Query string for Pinafore

recieve "text" and overwrite compose-box

01.02.2023 itibariyledir. En son verisyonu görün.

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           Intent share URL Query string for Pinafore
// @name:ja        共有URLクエリ文字列 for Pinafore
// @namespace      https://greasyfork.org/ja/users/747568-yomosu
// @description    recieve "text" and overwrite compose-box
// @description:ja 「text」を受け取り投稿ボックスを上書きする
// @version        0.1.20230201.1
// @license        CC0-1.0
// @match          *://pinafore.social/?text=*
// @grant          none
// @run-at         document-start
// ==/UserScript==

(function() {
    'use strict';
    const params = (new URL(document.location)).searchParams;
    console.log(params);
    const encoded = params.get('text');
    if (!encoded) return;

    const currentInstance = localStorage.getItem("store_currentInstance").slice(1,-1);
    if (!currentInstance) return;
    const savedData = localStorage.getItem("store_composeData");
    let tmpJson = {};
    if (savedData) {
        tmpJson = JSON.parse(savedData);
    } else {
        tmpJson[currentInstance] = {"home": {"ts" : 0}};
    }
    const decoded = decodeURIComponent(encoded);
    tmpJson[currentInstance].home.text = decoded;
    const newData = JSON.stringify(tmpJson);
    localStorage.setItem("store_composeData", newData);
})();