Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ponali committed Dec 18, 2023
1 parent bef4d27 commit df8fbad
Show file tree
Hide file tree
Showing 33 changed files with 624 additions and 0 deletions.
Binary file added files/scratch-exp/alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/antisound.wav
Binary file not shown.
1 change: 1 addition & 0 deletions files/scratch-exp/code/empty.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions files/scratch-exp/code/lucky.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(location.pathname.includes("/search/")){
console.log("I'm feeling lucky!");
let luckybtn = document.createElement("button");
luckybtn.innerHTML="I'm feeling lucky";
luckybtn.style="background-color:black;color:white;"
luckybtn.addEventListener("click",function(){
fetch("https://api.scratch.mit.edu/search/projects?limit=32&offset=0&language=fr&mode=popular"+location.search.replace("?","&")).then((data)=>data.text()).then((body)=>{location.assign("https://scratch.mit.edu/projects/"+JSON.parse(body)[Math.floor(Math.random()*(JSON.parse(body).length-1))].id)})
},false)
$(".sort-controls")[0].appendChild(luckybtn);
}
42 changes: 42 additions & 0 deletions files/scratch-exp/code/pipfs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
if(location.pathname.includes("/projects/")){
console.log("PiP mode activated!");
let pipbutton = document.createElement("img")
pipbutton.src='data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxOC40MzY0MiIgaGVpZ2h0PSIxNy42Njg3OSIgdmlld0JveD0iMCwwLDE4LjQzNjQyLDE3LjY2ODc5Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjMwLjg3MzQ3LC0xNzAuNzE0NzYpIj48ZyBkYXRhLXBhcGVyLWRhdGE9InsmcXVvdDtpc1BhaW50aW5nTGF5ZXImcXVvdDs6dHJ1ZX0iIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlPSIjMDA2YmZmIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49Im1pdGVyIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS1kYXNoYXJyYXk9IiIgc3Ryb2tlLWRhc2hvZmZzZXQ9IjAiIHN0eWxlPSJtaXgtYmxlbmQtbW9kZTogbm9ybWFsIj48cGF0aCBkPSJNMjQwLjkwMTU0LDE4My45NDQwMmwtOS4yNzgwNywtMC4wNTQyNXYtMTIuNDI1MDFoMTMuMTg0NjNsLTAuMDU0MjYsNy42NTAzNCIvPjxnPjxwYXRoIGQ9Ik0yNDQuMjExMjMsMTgzLjIzODY4bC00LjQ0OTEyLC00LjUwMzM5Ii8+PHBhdGggZD0iTTI0OC41NTE4NiwxODcuNjMzNTVsLTQuMzk0ODcsLTAuMDU0MjYiLz48cGF0aCBkPSJNMjQ4LjUxMDI1LDE4My4xOTQ3MmwwLjA0OTY0LDQuMzk0OTMiLz48cGF0aCBkPSJNMjQ4LjE4MjM5LDE4Ny4yNjQwOGwtNC40NDkxMywtNC41MDMzOSIvPjwvZz48L2c+PC9nPjwvc3ZnPg==';
pipbutton.setAttribute("id","pictureinpicture")
pipbutton.style="background-color: transparent;width:2rem;height:2rem;padding: 0.375rem;cursor:pointer;"
let video = document.createElement("video");
let clicked = 0;
let pipon = false;
function pipbtnclick(){
pipon=(!pipon);
pipbutton.style.backgroundColor="hsla(215, 100%, 65%, 0.35)";
if(!pipon){
pipbutton.style.backgroundColor="transparent";
document.exitPictureInPicture();
} else {
setTimeout(()=>{
let piptry = video.requestPictureInPicture();
console.log(piptry)
window.dapiptry=piptry;
video.play()
},500)
}
clicked++;
if(clicked==1){
let stream = document.querySelectorAll("canvas")[0].captureStream();
video.srcObject = stream;
}
}
pipbutton.addEventListener("click",pipbtnclick,false)
function uploadBtn(){
if(!document.querySelectorAll(".stage-header_stage-menu-wrapper_15JJt")[0].children[0].innerHTML.includes('id="pictureinpicture"')){
document.querySelectorAll(".stage-header_stage-menu-wrapper_15JJt")[0].children[0].appendChild(pipbutton)
}
}
function wait(){
if(document.querySelectorAll(".stage-header_stage-menu-wrapper_15JJt")){
uploadBtn()
}
}
let waitinterv = setInterval(wait,100)
}
5 changes: 5 additions & 0 deletions files/scratch-exp/code/scratch2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$("#navigation")[0].style="height: 35px;background-color: #0f8bc0;-webkit-box-shadow: 0 1px 1px #ccc;-moz-box-shadow: 0 1px 1px #ccc;-o-box-shadow: 0 1px 1px #ccc;box-shadow: 0 1px 1px #ccc;";
var navelems = $("#navigation div ul li");
for(i=0;i<navelems.length;i++){
navelems[i].style="border-left: 1px solid #149acb;height: 35px;margin: 0;line-height: 35px;cursor: pointer;position:relative;bottom:"+(5+(5*(navelems[i].getAttribute("class").includes("link"))))+"px;"
}
37 changes: 37 additions & 0 deletions files/scratch-exp/diy/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head><title>D.I.Y. SB3 hacking Beta v0.1</title><script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.7.1/jszip.min.js"></script><style>
body{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
float: left;
margin: 0px;
padding: 0px;
border:none;
width:100vw;
height:100vh;
background-color:#000000;
color:white;
overflow: hidden;
}
#left{
background-color:white;
width:75vw;
}
#right{
background-color: red;
width:25vw;
}
header{
height:1.5rem;
}
#left, #right{
height: calc( 100vh - 1.5rem );
float:left;
margin:0;
}
</style></style><script src="script.js" type="text/javascript"></script></head>
<body>
<header>D.I.Y. SB3 Hacking Beta v0.1 <button id="upload">Upload SB3</button><button id="save">Save SB3</button></header>
<div id="left"></div><div id="right"></div>
</body>
</html>
20 changes: 20 additions & 0 deletions files/scratch-exp/diy/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
onload=(()=>{

var zip = new JSZip();
let upload = document.createElement("input")
upload.setAttribute("type","file")
upload.setAttribute("accept",".sb3,application/x.scratch.sb3")
document.querySelector("button#upload").addEventListener("click",function(){
upload.click();
},false)

upload.addEventListener('change',function(){
fetch(window.URL.createObjectURL(upload.files[0])).then(data=>data.text()).then(body=>{
zip.loadAsync(unescape(btoa(escape(body))),{base64:true})
zip.file("project.json").async("string").then(function (data) {
document.querySelector("#left").innerText=data;
});
})
});

})
Binary file added files/scratch-exp/examples/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/examples/paused1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/examples/pip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/examples/project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions files/scratch-exp/experiments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"Picture In Picture","description":"Helpful for very long animations.","how":"Insert the code in your JS injector, load a project and wait for a PiP icon to appear next to the stop button. Once you click it, it will start a PiP window with the project's current screen.","code":"/code/pipfs.js","working":false,"project":false,"different":false,"dangerous":false,"reccomended":true,"type":"js","img":"/examples/pip.png"},{"name":"I'm feeling lucky","description":"Just like the famous button Google has.","how":"<div class=\"alert\">This is currently discontinued. Please expect some bugs.</div>Insert the code into your JS injector, search anything then click on the \"I'm feeling lucky\" button.","code":"/code/lucky.js","working":true,"project":false,"different":false,"dangerous":false,"reccomended":false,"type":"js","img":"/examples/paused1.png"},{"name":"Crash Scratch!","description":"Might get you with an error! :P","project":true,"projectId":647611128,"how":"It worked by simply removing the sprites and the scenes, then publish.<br>I tried in TurboWarp, and the error is a little unrelated: It's about comments that are not found! To try it yourself, You need to rename from .sb3 to .zip, learn JSON then edit the JSON, save it on the zip then rename it back from .zip to .sb3","different":true,"unshared":false,"dangerous":true,"reccomended":false,"type":"project"},{"name":"DDoS","description":"Too many requests!!! HELP!!!!","project":true,"projectId":647908885,"how":"It uses any extention possible in Scratch using WiFi. Click the cat to fire up the DDoS","different":true,"unshared":true,"dangerous":true,"reccomended":false,"type":"project"},{"name":"Scratch 2.0 view","description":"Find yourself back in time from nostalgia","how":"You need to use <a href='https://chrome.google.com/webstore/detail/run-javascript/lmilalhkkdhfieeienjbiicclobibjao' target='_blank'>this chrome extention</a> and put the code in the text field. Then, you can use Scratch with a scratch 2.0 theme!","code":"/code/scratch2.js","working":true,"project":false,"different":true,"dangerous":false,"reccomended":false,"type":"js","img":"/examples/paused1.png"},{"name":"'No message' message in message box","description":"Add a message when your message box is empty anywhere","how":"Make sure you have <a href='https://chrome.google.com/webstore/detail/live-editor-for-css-less/ifhikkcafabcgolfjegfcgloomalapol'>this extension</a>, get the code, open it in notepad, replace [your empty text here] with the text you want your message to look.","code":"/code/empty.css","working":false,"project":false,"different":true,"reccomended":true,"type":"css","img":"/examples/empty.png"}]
Binary file added files/scratch-exp/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added files/scratch-exp/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions files/scratch-exp/favicon/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
19 changes: 19 additions & 0 deletions files/scratch-exp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Ponali's Scratch Experiments v2</title>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<div id="page-header">
<span id="main-logo"><a href="https://scratch.mit.edu/users/Ponali">@Ponali</a>'s Scratch Experiments v2</span>
</div>
<div id="main-content">
<div id="alerts"></div>
<div id="experiments">Loading page...</div>
</div>
<div id="popup" class="hidden">
</div>
</body>
</html>
Binary file added files/scratch-exp/nimbus-sans-l.regular.otf
Binary file not shown.
30 changes: 30 additions & 0 deletions files/scratch-exp/old/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Ponali's Scratch Experimentation Zone</title>
<meta name="description" content="Welcome to Ponali's Scratch Experiments! You will find Scratch features coded by Ponali. Visit the site and get ready to control Scratch!" />
<meta property="og:image" content="https://ScratchExperimentation.ponali.repl.co/favicon/android-chrome-512x512.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="512" />
<meta property="og:image:height" content="512" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
<link rel="manifest" href="/favicon/site.webmanifest">
</head>
<body>
<center id="header">Ponali's Scratch Experiments Zone v1 <a href="https://scratch.mit.edu/users/Ponali" target="_blank">Check him out</a> <a href="javascript:popupMessage(scratch)">What is Scratch?</a><br><font size="3">Visited
<script type="text/javascript" src="//counter.websiteout.net/js/2/0/2/1"></script> times</font></center>
<div id="experiments"><center>Loading Experiments...</center></div>
<div id="popup" class="inactive">
<div id="popupmsg">
<br><div></div>
<button onclick="document.getElementById('popup').classList.add('inactive');">OK</button>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
51 changes: 51 additions & 0 deletions files/scratch-exp/old/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
let scratch = "Scratch is a website that helps you how to code and using a social network, made by MIT.<br>More information at <a href='https://scratch.mit.edu/about' target='_blank'>scratch.mit.edu/about</a>"
function updateExperiments(){
fetch("/experiments.json").then(data=>data.text()).then(function(jsont){
let json = JSON.parse(jsont);
window.experimentsjson=json;
experiments.innerHTML="";
console.log(json);
json.sort((a, b)=>{
return b.reccomended - a.reccomended;
});
console.log(json)
for(i=0;i<json.length;i++){
let locali = i;
console.log(json[i])
let elem = document.createElement("div");
elem.setAttribute("class","experiment")
elem.innerHTML="<br><span title=\""+json[i].name+"\"'>"+json[i].name+"</span>"+" <img src='https://turbowarp.org/favicon.ico' height='16' alt='Unshared Scratch Project' title='Unshared Scratch Project'></img>".repeat(json[i].project&&json[i].unshared)+" <img src='https://scratch.mit.edu/favicon.ico' height='16' alt='Scratch Project' title='Scratch Project'></img>".repeat(json[i].project&&(!json[i].unshared))+" <img src='/wheel.png' height='16' alt='Might be different for some users' title='Might be different for some users'></img>".repeat(json[i].different)+" <img src='/alert.png' height='16' alt='Run it at your own risk!' title='Run it at your own risk!'></img>".repeat(json[i].dangerous||json[i].working)+" <img src='/workinprgss.png' height='16' alt='Experiment in Work in progress' title='Experiment in Work in progress'></img>".repeat(json[i].working)+" <img src='https://cdn.scratch.mit.edu/scratchr2/static/__631147950d9c399250074fc214591758__/djangobb_forum/img/smilies/smile.png' height='16' alt='Reccomended' title='Reccomended'></img>".repeat(json[i].reccomended)+"<br><br><small>"+json[i].description+"</small><br>";
let btnhow = document.createElement("button");
btnhow.addEventListener("click",function(){
popupMessage(json[locali].how);
},false)
btnhow.innerHTML="How does it work?";
elem.appendChild(btnhow)
if(!json[i].project){
let btncode = document.createElement("button");
btncode.addEventListener("click",function(){
if(json[locali].working){
popupMessage("<font size='5'>Are you sure?</font><br>This is in work in progress, it could make your scratch experience worser!<br><button onclick='window.location.assign(experimentsjson["+locali+"].code);'>Take me</button>")
} else {
window.location.assign(json[locali].code);
}
},false)
btncode.innerHTML="Code";
elem.appendChild(btncode)
} else {
let btntake = document.createElement("button");
btntake.addEventListener("click",function(){
window.location.assign("https://scratch.mit.edu/projects/".repeat(!json[locali].unshared)+"https://turbowarp.org/".repeat(json[locali].unshared)+json[locali]["projectId"]+"/");
},false)
btntake.innerHTML="Take me";
elem.appendChild(btntake)
}
experiments.appendChild(elem);
}
})
}
setTimeout(()=>{updateExperiments();setInterval(updateExperiments,60000)},1000);
function popupMessage(msg){
document.getElementById("popup").classList.remove("inactive");
document.querySelector("#popupmsg div").innerHTML=msg;
}
87 changes: 87 additions & 0 deletions files/scratch-exp/old/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
body{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
float: left;
margin: 0px;
padding: 0px;
border:none;
width:100vw;
height:100vh;
background-color:#ffab1960;
}
center#header{
font-size: 30px;
background-color:#eee; /* E */
}
center#header a{
font-size: 20px;
}

.experiment{
margin: 10px;
width:250px;
min-height:110px;
padding-bottom:15px;
background-color:lightgray;
text-align: center;
font-style: italic;
float:left;
transition: background 0.4s, box-shadow 0.4s;
box-shadow: black 5px 5px 5px;
}

.experiment:hover{
background-color:white;
box-shadow: black 10px 10px 10px;
}

.experiment:active{
margin-top: 12px;
margin-bottom: 8px;
}

.experiment small{
font-style: normal;
}

.inactive{
display:none;
width:0px;
height:0px;
opacity:0;
margin:0;
padding:0;
border:none;
float:left;
}

#popup{
background-color: #00000080;
float: left;
position: fixed;
top:0px;
left:0px;
width:100vw;
height:100vh;
margin:0px;
padding:0px;
border:none;
}

#popupmsg{
background-color:white;
width:240px;
height:180px;
top:calc( (100vh - 180px) / 2 );
left:calc( (100vw - 240px) / 2 );
position:fixed;
text-align: center;
}

#popupmsg div{
height: 135px;
overflow-y: auto;
}

img{
image-rendering: pixelated;
}
47 changes: 47 additions & 0 deletions files/scratch-exp/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
function run(){
let exprs = document.querySelector("#experiments");
fetch("/experiments.json").then(data=>data.text()).then((body)=>{
try{
exprs.innerHTML="";
let json = JSON.parse(body);
json.sort((a,b)=>{ if(a.reccomended==false&&b.reccomended==true){return 1;} if(a.reccomended==true&&b.reccomended==false){return -1}; return 0; })
for(i=0;i<json.length;i++){
let elem = document.createElement("div");
let item = json[i];
elem.setAttribute("class","expr-box");
if(item.type=="project"){item.img="/examples/project.png"}
if(item.img){elem.setAttribute("style",`background:url("${item.img}"); background-size:cover;`)}
elem.innerHTML=`<div class="expr-hvname"><span>${item.name}</span></div>`;
let requirements = "You need a(n) "+(item.type=="css" ? "CSS injector" : (item.type=="js" ? "JS Injector" : (item.type=="project" ? "working scratch client" : "[unknown]") ) );
let code = (item.type=="css" ? `Use the code <pre>@import url("https://scratchexperimentation.ponali.repl.co${item.code}");</pre> to launch the experiment.` : (item.type=="js" ? `Use the code <pre>fetch("https://scratchexperimentation.ponali.repl.co${item.code}").then(d=>d.text()).then(b=>eval(b));</pre> to launch the experiment.` : (item.type=="project" ? `Use the link <a href='https://turbowarp.org/${item.projectId}'>here</a> to run the project.` : "[unknown]") ) );
elem.addEventListener("click",(()=>{popup({display:1,title:item.name,description:item.how+"<br><span class='popup-title'>Requirements</span>"+requirements+"<br>"+code});}),false)
exprs.appendChild(elem);
}
} catch (e) {
exprs.innerHTML="<div id='error'>Error: "+e.stack+"</div>";
}
})

function popup(data){
if(data.display==0){
let ppelem = document.querySelector("#popup");
ppelem.innerHTML="<div id='classic-popup-box'><span class='popup-title'>"+data.title+"</span><span class='popup-description'>"+data.description+"</span><span class='popup-close'>Close</span></div>";
ppelem.classList.remove("hidden")
document.querySelector(".popup-close").addEventListener("click",closePopup,false)
} else if(data.display==1){
let ppelem = document.querySelector("#popup");
ppelem.innerHTML="<div id='popup-box'><span class='popup-title'>"+data.title+"</span><span class='popup-description'>"+data.description+"</span><span class='popup-close'>Close</span></div>";
ppelem.classList.remove("hidden")
document.querySelector(".popup-close").addEventListener("click",closePopup,false)
} else { throw "invalid display type"; }
}

function closePopup(){
document.querySelector("#popup").classList.add("hidden");
document.querySelector("#popup").innerHTML="";
}

popup({display:0,title:"Welcome",description:"We have updated the UI and rewritten all the code to make a much more modern look to the website. If you prefer the old look, click <a href='/old'>here</a>."})
}

window.onload=run;
1 change: 1 addition & 0 deletions files/scratch-exp/spdata/lang/ideas.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions files/scratch-exp/spdata/spinit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function wineval(code) { return (() => { })["constructor"](code)() };
console.group("ScratchPlug")
console.log("scratchplug activated.")
let langcodelink = "https://scratchexperimentation.ponali.repl.co/spdata/lang/";
if (true/*soon*/) { langcodelink += "ideas.json" };
console.log(langcodelink)
fetch(langcodelink).then(data => { data.text() }).then(body => { console.log("loaded language code");console.log(body.slice(0,40));window._messages = wineval("return "+body); fetch("https://scratch.mit.edu/js/ideas.bundle.js").then(data => {console.log(data); data.text() }).then(body => { console.log("loaded scratch booter"); console.log(wineval(body)); }) })
49 changes: 49 additions & 0 deletions files/scratch-exp/spdata/starter.js

Large diffs are not rendered by default.

Loading

0 comments on commit df8fbad

Please sign in to comment.