Categories > Coding > Javascript >

View Scripts As A List!


New Reply

Posts: 72

Threads: 11

Joined: Nov, 2018

Reputation: 6

Posted

A simple scripts which transforms your scripts page into a list!

 

1. Why Should I Use This?

  • Yes.

2. Screenshots

https://anopic.us/I3U0SPVPApVyIoZp0OKyixftMJ0wNLsNqTKxVnVx.jpg

3. Source-Code (use via TamperMonkey or you can copy-paste into the console directly everytime)

// ==UserScript==
// @name         DLCardsToList
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Just for fun.
// @author       SoundInfinity
// @match        https://wearedevs.net/scripts
// @icon         https://www.google.com/s2/favicons?domain=wearedevs.net
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    //#region JSONTOTABLE LIB
    function ConvertJsonToTable(parsedJson, tableId, tableClassName, linkText) { var italic = "<i>{0}</i>", link = linkText ? '<a href="{0}">' + linkText + "</a>" : '<a href="{0}">{0}</a>', idMarkup = tableId ? ' id="' + tableId + '"' : "", classMarkup = tableClassName ? ' class="' + tableClassName + '"' : "", tbl = '<table border="1" cellpadding="1" cellspacing="1"' + idMarkup + classMarkup + ">{0}{1}</table>", th = "<thead>{0}</thead>", tb = "<tbody>{0}</tbody>", tr = "<tr>{0}</tr>", thRow = "<th>{0}</th>", tdRow = "<td>{0}</td>", thCon = "", tbCon = "", trCon = ""; if (parsedJson) { var isStringArray = "string" == typeof parsedJson[0], headers; if (isStringArray) thCon += thRow.format("value"); else if ("object" == typeof parsedJson[0]) { headers = array_keys(parsedJson[0]); for (var i = 0; i < headers.length; i++)thCon += thRow.format(headers[i]) } if (th = th.format(tr.format(thCon)), isStringArray) for (var i = 0; i < parsedJson.length; i++)tbCon += tdRow.format(parsedJson[i]), trCon += tr.format(tbCon), tbCon = ""; else if (headers) for (var urlRegExp = new RegExp(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi), javascriptRegExp = new RegExp(/(^javascript:[\s\S]*;$)/gi), i = 0; i < parsedJson.length; i++) { for (var j = 0; j < headers.length; j++) { var value = parsedJson[i][headers[j]], isUrl = urlRegExp.test(value) || javascriptRegExp.test(value); tbCon += isUrl ? tdRow.format(link.format(value)) : value ? "object" == typeof value ? tdRow.format(ConvertJsonToTable(eval(value.data), value.tableId, value.tableClassName, value.linkText)) : tdRow.format(value) : tdRow.format(italic.format(value).toUpperCase()) } trCon += tr.format(tbCon), tbCon = "" } return tb = tb.format(trCon), tbl = tbl.format(th, tb), tbl } return null } function array_keys(t, a, e) { var r = void 0 !== a, o = [], n = !!e, l = !0, s = ""; if (t && "object" == typeof t && t.change_key_case) return t.keys(a, e); for (s in t) t.hasOwnProperty(s) && (l = !0, r && (n && t[s] !== a ? l = !1 : t[s] != a && (l = !1)), l && (o[o.length] = s)); return o } String.prototype.format = function () { var t = arguments; return this.replace(/{(\d+)}/g, function (a, e) { return void 0 !== t[e] ? t[e] : "{" + e + "}" }) };
    //#endregion

    function releases_get() {
        const collection = []
        for (let release of document.querySelectorAll('.release-card')) {
            const title = release.querySelector('.release-title').textContent
            const description = release.querySelector('.release-description > p').textContent
            const author = release.querySelector('p').textContent
            collection.push({
                Title: `<a href=" ${release.querySelector('.download-button').getAttribute('href')} ">${title}</a>`,
                Description: description,
                Author: author
            })
        }
        return collection
    }

    function resources_init() {
        const sheet = document.createElement('style')
        sheet.innerHTML = `@import url(https://wearedevs.net/css/main.css);@import url(https://wearedevs.net/css/themes/night.css);table{margin:auto;padding:2vh 3vw}td {height:2.5vh;font-size:14px;padding-right:2vw}tr:nth-child(even) {background-color: #ffffff26;color:#eaeaea}a{text-decoration:underline;color:#eaedee}`
        document.head.appendChild(sheet)
    }

    document.querySelector('main').innerHTML = ConvertJsonToTable(releases_get())
    document.querySelector('table').className = 'theme1 round'

    resources_init()
})()

credits:

(library) Json to HTML Table :: https://github.com/afshinm/Json-to-HTML-Table

 

(made this for fun, so probably won't get any updates in the future)

Got a question? Well, I got no answers.

simplydev

simply develop

Mention

Posts: 325

Threads: 27

Joined: Oct, 2020

Reputation: 3

Replied

Finally i can get scripts without hurting my eyes

simplydev | UI Designer | c2ltcGx5ZGV2ZWxvcA==#1895

i love u papi maximus <3

Rep Goal : 10

Moon

Moon

moderator Mention

Posts: 6954

Threads: 250

Joined: Aug, 2020

Reputation: 54

Replied

An update to WRD+ when

Join the Lounge: https://discord.gg/zVnT5DfAMR - Not for Exploiting
#NoMoreMods
M
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
n

MINISHXP

minishxp#9667

Mention

Posts: 1167

Threads: 35

Joined: Jan, 2021

Reputation: 4

Replied

can u explain what is the purpose of function() {}() ? i dont really do js but i dont see the point of doing the func thing

https://cdn.discordapp.com/attachments/899343529581621291/899833877756014592/twitch.png

Posts: 72

Threads: 11

Joined: Nov, 2018

Reputation: 6

Replied

@Moon Since the release of BWRD I haven't tought of putting more work into the script :p. But, I still have it as a side-project so eventually it might get an update

Got a question? Well, I got no answers.

Moon

Moon

moderator Mention

Posts: 6954

Threads: 250

Joined: Aug, 2020

Reputation: 54

Replied

Join the Lounge: https://discord.gg/zVnT5DfAMR - Not for Exploiting
#NoMoreMods
M
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
n


New Reply

Users viewing this thread:


( Members: 0, Guests: 1, Total: 1 )