Code.org Data Editor Console

Execute a code to edit the data while you're in a code.org fullscreen project (a code.org project link that does not have /edit or /view or anything on the last part.). You can execute data functions for example createRecord(), readRecords(), setKeyValue(), getKeyValue(), etc.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

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

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Code.org Data Editor Console
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Execute a code to edit the data while you're in a code.org fullscreen project (a code.org project link that does not have /edit or /view or anything on the last part.). You can execute data functions for example createRecord(), readRecords(), setKeyValue(), getKeyValue(), etc.
// @author       cool
// @match        https://studio.code.org/projects/*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=code.org
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    var style = document.createElement("style");
    style.textContent = `
    #ci {
      outline: 0px;
      position: fixed;
      left: 5px;
      bottom: 5px;
      width: calc(100% - 20px);
    }
    `;
    document.head.appendChild(style);
    var loadIn = setInterval(function() {
        if (document.querySelector(".WireframeButtons_containerRight") != null) {
            clearInterval(loadIn);
            var odc = document.createElement("span");
            odc.style.display = "inline-block";
            odc.style.cursor = "pointer";
            var odca = document.createElement("a");
            odca.className = "WireframeButtons_button";
            odca.innerHTML = "<i class=\"fa fa-code\"></i>Open Data Console";
            odc.appendChild(odca);
            odc.addEventListener("click", function() {
                odca.innerHTML = odca.innerHTML == "<i class=\"fa fa-code\"></i>Open Data Console" ? "<i class=\"fa fa-code\"></i>Close Data Console" : "<i class=\"fa fa-code\"></i>Open Data Console";
                ci.hidden = !ci.hidden;
                if (!ci.hidden) {
                    ci.focus();
                }
            });
            document.querySelector(".WireframeButtons_containerRight").childNodes[0].appendChild(odc);
            var ci = document.createElement("input");
            ci.id = "ci";
            ci.placeholder = "Press enter to execute";
            ci.hidden = true;
            ci.addEventListener("keydown", function(event) {
                if (event.key == "Enter") {
                    (function() {
                        'use strict';
                        eval(ci.value);
                        ci.value = "";
                    })();
                }
            });
            document.body.appendChild(ci);
            if (location.href.split("/")[4] == "applab") {
                for (var i = 0; i < Object.keys(Applab.storage).length; i++) {
                    window[Object.keys(Applab.storage)[i]] = Applab.storage[Object.keys(Applab.storage)[i]];
                }
            } else if (location.href.split("/")[4] == "gamelab") {
                for (i = 0; i < Object.keys(__mostRecentGameLabInstance.apiJS).length; i++) {
                    window[Object.keys(__mostRecentGameLabInstance.apiJS)[i]] = __mostRecentGameLabInstance.apiJS[Object.keys(__mostRecentGameLabInstance.apiJS)[i]];
                }
            }
        }
    }, 100);
})();