Post
Topic
Board Other languages/locations
Merits 1 from 1 user
Re: Pakistan
by
Zaka1221
on 23/08/2025, 18:49:50 UTC
⭐ Merited by ThemePen (1)
Well dear awesome keep it up, yeh bohout behtareen cheez ha like direct image upload karo aur us Sy link generate hooky post Mai paste hojai ga right?. But main issues yaha pa yeh ha ky hamary community Mai around 60% user phone pa work karty ha bohout km ha ko laptop ya PC pa kam kary toh just PC walo ka faida Howa phone ka nahi. Ya both la Howa as Mai NY main post para nahi just yeh apki baato ko daikh ky Mai NY Baat Keh de.
ZAINmalik75 bhai keisei hain! Khariyet se hun gen!

Well late reply ke lee ye sorry or es ky peche reason bii thi aap ka guess 100% correct hai ye tutorial PC user ke lee ye hai aab me ap ku quote ker rahah houn Android Tutorial ke sath tab PC user ke lee ye he ye script create kee gai thi but kuch den pehlee Royal Cap user ny is ka mobile tutorial b meta section my post kiya hai aur PC users ki tadad kam he forum par but android users ziada h to te tutorial android user ke leye faidy mand hune wala h ab ap direct image ko uplaod kar ky uska bbcode post my add ker sakhte hai apny broswer ko leave keye bagair. Ap or abar user ko es script ka use kerna chahte hai wou neeche deye gay steps ko follow karen ap ke wo option a jay ga.

Tutorial Steps:

  • Es scriptko use kar ne ke lee ye ap ku Via Broswer, Kiwi Broswer ka use kar na huu ga.
  • Mei Via Browser use ker raha hu es per kaafei easy hai simple apne right Corner per 3 lines per click ker na hai ager ap Kiwi Broswer per ye enable ker na chahte hai tu Tampermonkey es extension ku install ker leen.
  • Via Broswer: 3 lines per jaa ne ke baad "+" per click ker ke "New Script" per click kaa ren. Kiwi Broswer: extension per jay jo installki hai New Script Create per clcik kren.
  • neeche deye gei script ko copy kren aur waha paste ker den or save ker den dono Broswer per ye step same aur automatic te pption enable hu jaey ga.
  • Done pher aap ke Image Uplaod ka option a jey ga.

Code:
// ==UserScript==
// @name         Bitcointalk Image Uploader
// @namespace    https://bitcointalk.org
// @version      2025-07-31
// @description  Upload image to hostmeme.com and insert BBCode in Bitcointalk post.
// @author       Litte Mouse
// @match        https://bitcointalk.org/index.php?action=post2
// @match        https://bitcointalk.org/index.php?action=post;msg=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bitcointalk.org
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function addUploadButton() {
        const postBtn = document.querySelector("input[name='post']");
        if (!postBtn || document.getElementById("uploadImageBtn")) return;

        const uploadBtn = document.createElement("button");
        uploadBtn.id = "uploadImageBtn";
        uploadBtn.innerText = "Upload Image";
        uploadBtn.type = "button";
        uploadBtn.style.marginLeft = "10px";
        uploadBtn.style.padding = "5px 10px";

        postBtn.parentNode.insertBefore(uploadBtn, postBtn.nextSibling);

        uploadBtn.addEventListener("click", () => {
            const input = document.createElement("input");
            input.type = "file";
            input.accept = "image/*";

            input.onchange = async () => {
                const file = input.files[0];
                if (!file) return;

                const formData = new FormData();
                formData.append("image", file);

                uploadBtn.innerText = "Uploading...";

                try {
                    const response = await fetch("https://hostmeme.com/bitcointalk.php", {
                        method: "POST",
                        body: formData
                    });

                    const data = await response.json();
                    if (data.success && data.url && data.width && data.height) {
                        const bbcode = `[img height=${data.height} width=${data.width}]${data.url}[/img]`;
                        const textarea = document.querySelector("textarea[name='message']");
                        if (textarea) {
                            textarea.value += `\n${bbcode}\n`;
                        }
                    } else {
                        alert("Upload failed: " + (data.error || "Unknown error"));
                    }
                } catch (err) {
                    alert("Upload error: " + err.message);
                } finally {
                    uploadBtn.innerText = "Upload Image";
                }
            };

            input.click();
        });
    }

    addUploadButton();

})();