Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Twingamerdudes authored Jul 26, 2023
2 parents 1ec0c96 + 378f3e9 commit 68b5ae6
Show file tree
Hide file tree
Showing 51 changed files with 2,756 additions and 59 deletions.
39 changes: 38 additions & 1 deletion development/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,39 @@ class SVGFile extends ImageFile {
}
}

class SitemapFile extends DiskFile {
constructor (build) {
super(null);
this.getDiskPath = null;
this.build = build;
}

getType () {
return '.xml';
}

read () {
let xml = '';
xml += '<?xml version="1.0" encoding="UTF-8"?>\n';
xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';

xml += Object.keys(this.build.files)
.filter(file => file.endsWith('.html'))
.map(file => file.replace('index.html', '').replace('.html', ''))
.sort((a, b) => {
if (a.length < b.length) return -1;
if (a.length > b.length) return 1;
return a - b;
})
.map(path => `https://extensions.turbowarp.org${path}`)
.map(absoluteURL => `<url><loc>${absoluteURL}</loc></url>`)
.join('\n');

xml += '</urlset>\n';
return xml;
}
}

const IMAGE_FORMATS = new Map();
IMAGE_FORMATS.set('.png', ImageFile);
IMAGE_FORMATS.set('.jpg', ImageFile);
Expand All @@ -116,7 +149,7 @@ class Build {
}

getFile (path) {
return this.files[path] || this.files[`${path}index.html`] || null;
return this.files[path] || this.files[`${path}.html`] || this.files[`${path}index.html`] || null;
}

export (root) {
Expand Down Expand Up @@ -192,6 +225,10 @@ class Builder {
build.files[oldPath] = build.files[newPath];
}

if (this.mode !== 'desktop') {
build.files['/sitemap.xml'] = new SitemapFile(build);
}

const mostRecentExtensions = extensionFiles
.sort((a, b) => b.getLastModified() - a.getLastModified())
.slice(0, 5)
Expand Down
73 changes: 73 additions & 0 deletions extensions/Alestore/nfcwarp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
(function(Scratch) {
'use strict';

/* globals NDEFReader */

const extIcon = 'data:image/png;base64,iVBORw0KGgoAAAAN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mZmZmZiIvPgo8L2c+Cjwvc3ZnPg==';

class NFCWarp {
getInfo() {
return {
id: 'alestorenfc',
name: 'NFCWarp',
color1: '#FF4646',
color2: '#FF0000',
color3: '#990033',
menuIconURI: extIcon,
blockIconURI: blocksIcon,
blocks: [
{
blockType: Scratch.BlockType.LABEL,
text: 'Only works in Chrome on Android'
},
{
opcode: 'supported',
blockType: Scratch.BlockType.BOOLEAN,
text: 'NFC supported?'
},
{
opcode: 'nfcRead',
blockType: Scratch.BlockType.REPORTER,
text: 'read NFC tag',
disableMonitor: true
}
]
};
}

supported () {
return typeof NDEFReader !== 'undefined';
}

nfcRead() {
if (!this.supported()) {
return 'NFC not supported';
}
return new Promise((resolve, reject) => {
const ndef = new NDEFReader();
ndef.scan()
.then(() => {
ndef.onreadingerror = event => {
console.log('Reading error', event);
resolve('Tag not supported');
};
ndef.onreading = evt => {
const decoder = new TextDecoder();
const record = evt.message.records[0];
console.log('Record type: ' + record.recordType);
console.log('Record encoding: ' + record.encoding);
console.log('Record data: ' + decoder.decode(record.data));
resolve(decoder.decode(record.data));
};
})
.catch(error => {
console.log('Scan error', error);
resolve(`Error: ${error}`);
});
});
}
}

Scratch.extensions.register(new NFCWarp());
})(Scratch);
885 changes: 885 additions & 0 deletions extensions/CST1229/zip.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions extensions/DT/cameracontrols.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

vm.runtime.runtimeOptions.fencing = false;
vm.renderer.offscreenTouching = true;
vm.setInterpolation(false);

function updateCamera(x = cameraX, y = cameraY, scale = cameraZoom / 100, rot = -cameraDirection + 90) {
rot = rot / 180 * Math.PI;
Expand Down Expand Up @@ -347,6 +348,7 @@
setCol(args, util) {
const rgb = Scratch.Cast.toRgbColorList(args.val);
Scratch.vm.renderer.setBackgroundColor(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
cameraBG = args.val;
}
getCol() {
return cameraBG;
Expand Down
73 changes: 73 additions & 0 deletions extensions/Lily/Cast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
(function (Scratch) {
'use strict';

const Cast = Scratch.Cast;

class CastUtil {
getInfo() {
return {
id: 'lmsCast',
name: 'Cast',
blocks: [
{
opcode: 'toType',
blockType: Scratch.BlockType.REPORTER,
text: 'cast [INPUT] to [TYPE]',
allowDropAnywhere: true,
disableMonitor: true,
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'apple'
},
TYPE: {
type: Scratch.ArgumentType.STRING,
menu: 'type'
}
}
},
{
opcode: 'typeOf',
blockType: Scratch.BlockType.REPORTER,
text: 'type of [INPUT]',
disableMonitor: true,
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'apple'
}
}
}
],
menus: {
type: {
acceptReporters: true,
items: ['number', 'string', 'boolean', 'default']
}
}
};
}

toType(args) {
const input = args.INPUT;
switch (args.TYPE) {
case ('number'): return Cast.toNumber(input);
case ('string'): return Cast.toString(input);
case ('boolean'): return Cast.toBoolean(input);
default: return input;
}
}

typeOf(args) {
const input = args.INPUT;
switch (typeof input) {
case ('number'): return 'number';
case ('string'): return 'string';
case ('boolean'): return 'boolean';
default: return '';
}
}
}

Scratch.extensions.register(new CastUtil());
})(Scratch);
1 change: 0 additions & 1 deletion extensions/Lily/TempVariables2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
});

function resetRuntimeVariables() {
console.log('runtime variables cleared');
runtimeVariables = Object.create(null);
}

Expand Down
Loading

0 comments on commit 68b5ae6

Please sign in to comment.