mockLibrary

Shared methods for generating mock data

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greasyfork.org/scripts/401830/1103359/mockLibrary.js

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.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

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!)

var mock = {
    sentence: (max = 4) => {
        const spc = ` `;
        const src = [
            `make it bark`, `rub face`, `always hungry`,
            `rub face`, `make it bark`, `midnight zoomies`,
            `cough hairball`, `chase mice`, `run in circles`,
            `destroy dog`, `spit up`, `let me out`, `let me in`,
        ];
        let output = ``;
        for (let i = 0; i < max; i++) {
            output += src[mock.rnd(src.length - 1)] + spc;
        }
        return output;
    },
    user: function () {
        var firstName = ["Roosevelt", "Kacy", "Wilbert", "Kory", "Freddy", "Addie", "Cherie", "Troy", "Iluminada", "Scot", "Tona", "Orval", "Shondra", "Monica", "Shauna", "Kimbery", "Waylon", "Pura", "Brian", "Emilee"];
        var lastName = ["Lomanto", "Deckert", "Arrowood", "Juhasz", "Kennan", "Pizzo", "Canales", "Choe", "Pavlick", "Weatherford", "Pentz", "Hughey", "Kieser", "Stabile", "Griffy", "Lechuga", "Langlais", "Mcguigan", "Niday", "Bridgeforth"];
        var randomFirst = mock.rnd(firstName.length);
        var randomLast = mock.rnd(lastName.length);
        var randomPhone = mock.rnd();
        var randomDate = mock.rnd(10);
        return {
            id: mock.uuid(),
            first: firstName[randomFirst],
            last: lastName[randomLast],
            full: firstName[randomFirst] + " " + lastName[randomLast],
            email: firstName[randomFirst] + "." + lastName[randomLast] + "@gmail.com",
            phone: randomPhone,
            date: (randomDate + 1) + "/15/201" + randomDate
        };
    },
    rnd: (mx = 10000000) => {
        return Math.floor(Math.random() * mx);
    },
    uuid: () => {
        const windowObj = window;
        const winCrypto = windowObj.crypto || windowObj.msCrypto;
        if (winCrypto) {
            let index = winCrypto.getRandomValues(new Uint32Array(1))[0];
            index = +`${index}`.substr(0, 1);
            const uuid = winCrypto.getRandomValues(new Uint32Array(10))[index];
            return uuid;
        } else {
            return mock.rnd();
        }
    },
    tableRow: function (howMany) {
        if (howMany == null) howMany = 1;
        var dataArray = [];
        for (var intI = 0; intI < howMany; intI++) {
            var user = mock.user();
            dataArray.push({
                data: [
                    user.id,
                    user.full,
                    "Eget Incorporated",
                    "9557",
                    user.date,
                    user.email,
                    user.phone,
                    "<a href='//www.dell.com'>Dell Home Page</a>"
                ],
                details: user.full + " details"
            });
        }
        return dataArray;
    }
};