Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    MegaApuTurkUltra
    @MegaApuTurkUltra
    that's why I made my extension loader
    no extension userscripts needed. It detects extensions in the project code and loads them
    // ==UserScript==
    // @name         Extension Loader
    // @version      0.1
    // @description  Loads extensions saved in Scratch projects
    // @author       MegaApuTurkUltra & nXIII (mostly nXIII :P)
    // @match        http://scratch.mit.edu/projects/*
    // @match        https://scratch.mit.edu/projects/*
    // @run-at       document-end
    // @grant        none
    // ==/UserScript==
    
    var script = document.createElement('script');
    script.id = "swag";
    script.textContent = '('+function() {
      var old = window.JSsetProjectStats;
      if (old) {
        var times = 0;
        window.JSsetProjectStats = function() {
          old.apply(this, arguments);
          if (times++){
              var id = location.pathname.match(/[0-9]+/)[0];
              $.get("https://cdn.projects.scratch.mit.edu/internalapi/project/"+id+"/get/", function(data){
                  if(data.info.hasOwnProperty("savedExtensions")){
                      for(var x in data.info.savedExtensions){
                          if(!confirm("Load extension '" + data.info.savedExtensions[x].extensionName + "'?") continue;
                          console.log("EXTENSION LOADER: loading extension", data.info.savedExtensions[x].extensionName);
                          ScratchExtensions.loadExternalJS(data.info.savedExtensions[x].javascriptURL);
                      }
                  }
              });
          }
        };
      }
    }+')()';
    
    document.body.appendChild(script);
    this
    bleush
    @bleush38p
    Wow
    Granted, I'd be a little scared to use that as there's no confirmation or anything, and I don't really want anyone loading any code from anywhere to run in Scratch's context
    MegaApuTurkUltra
    @MegaApuTurkUltra
    good point
    see it now ^^
    what about that
    bleush
    @bleush38p
    Ugh, confirm :P
    It'll do, certainly
    That's partially why easyextend needs a manifest for each extension
    bleush
    @bleush38p
    hey, apu
    you know what's a pain?
    MegaApuTurkUltra
    @MegaApuTurkUltra
    no
    bleush
    @bleush38p
    detecting whether the editor is in fullscreen or not
    biglittle.gif
    bleush
    @bleush38p
    oooh, hold on
    don't run that code
    webstorm made serious crud out of the indentation
    MegaApuTurkUltra
    @MegaApuTurkUltra
    just test location.hash
    bleush
    @bleush38p
    it doesn't change
    try it
    not when you're in the editor
    MegaApuTurkUltra
    @MegaApuTurkUltra
    huh
    ohhh
    wow
    so you detect the tips bar
    much haxx
    bleush
    @bleush38p
    yeah, the style property
    which goes from block to none
    MegaApuTurkUltra
    @MegaApuTurkUltra
    such code
    much haxx
    so wow
    <font color="blue">GFM?</font>
    nuuuuuuuu
    bleush
    @bleush38p
    okay, fixed the indentation, turns out you don't want "refactor code: on" when you git push (surprise!)
    Anyway, it's IE11+
    Which I think is about as good as I can hope to get from this mess