Discuss Scratch

20251002
Scratcher
30 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

bambibambambi0081 wrote:

e1bfd762321e409cee4a wrote:

#936
Sporkによるバグです。
バグトラッカーのP1の5番目をご覧ください。
これらはバグなので、じきに修正されます。
バグのバグが修正される…?
それともJSONハック関連は存在を認知しつつ生かされているバグ?(追記)
ご指摘の通り、バグが修正されるのか、あるいは技術的な仕様としてあえて残されているのかは重要な視点だと思います。J
-popcorn_yummy-
Scratcher
63 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

20251002 wrote:

bambibambambi0081 wrote:

e1bfd762321e409cee4a wrote:

#936
Sporkによるバグです。
バグトラッカーのP1の5番目をご覧ください。
これらはバグなので、じきに修正されます。
バグのバグが修正される…?
それともJSONハック関連は存在を認知しつつ生かされているバグ?(追記)
ご指摘の通り、バグが修正されるのか、あるいは技術的な仕様としてあえて残されているのかは重要な視点だと思います。J
僕は残されてほしいですね。たまにJSONコードをいじったりしていたから…
ioqj
Scratcher
500+ posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

Scratch への提案 #9257 を見ていて思ったことなのですが、
トップページの「最新の情報」欄は、どこから情報を取得しているのでしょうか?
何らかの API が用意されているのでしょうか?
e1bfd762321e409cee4a
Scratcher
100+ posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

#943
ここからいっぱい見ることができます。
URLの最後に ?max=数字 をつけると上限突破できます。
Ryb-cham
Scratcher
60 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

scratchの翻訳データを見ていたのですが、
<online? :: sensing>
のブロック、
英語の場合 “SENSING_ONLINE”: “is online?”
日本語の場合 “SENSING_ONLINE”: “はオンライン?”
とあるのですが、実際上のようにonline?と表示されています。
“is online?”や“はオンライン?”と表示されていないあたり、この辺の翻訳データが反映されてなかったりするのでしょうか。
また、そうだった場合なぜ“online?”となっているのでしょうか。
有識者の方お願いします。
inoking
Scratcher
1000+ posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

Ryb-cham wrote:

scratchの翻訳データを見ていたのですが、
<online? :: sensing>
のブロック、
英語の場合 “SENSING_ONLINE”: “is online?”
日本語の場合 “SENSING_ONLINE”: “はオンライン?”
とあるのですが、
〜略〜
まず、どこの情報を見ているのかを明示お願いします。
Ryb-cham
Scratcher
60 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

#946
GitHubに公開されてあるscratchfoundation/scratch-l10nです。
TNTSuperMan
Scratcher
100+ posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

実際にブロックに表示される翻訳はscratch-blocks/msg/scratch_msgs.jsにあるようで、
まだそのscratch-l10nの新しい翻訳は反映されていませんでした。

要するにまだ反映されてないから“online?”になるってことです
inoking
Scratcher
1000+ posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

TNTSuperMan wrote:

実際にブロックに表示される翻訳はscratch-blocks/msg/scratch_msgs.jsにあるようで、
まだそのscratch-l10nの新しい翻訳は反映されていませんでした。

要するにまだ反映されてないから“online?”になるってことです
その辺の構造は、最近のソースコード一新により大きく変わっています。

オンラインに関係する処理をユーザー名との対比で調べましたが、
調べた限りではユーザー名だけが翻訳される理由は見つけられませんでした。

以下、関係処理を載せておきます。

VM側:
https://github.com/scratchfoundation/scratch-editor/blob/develop/packages/scratch-vm/src/blocks/scratch3_sensing.js
    getOnline (args, util) {
        const status = window.navigator.onLine;
        if (typeof status === 'boolean') {
            return status;
        }
        // an empty string will evaluate as false in a Boolean context,
        // but it allows distinguishing between "false" and "unknown" if needed
        return '';
    }
    getUsername (args, util) {
        return util.ioQuery('userData', 'getUsername');
    }

GUI 側(ブロック定義 XML を生成?):
https://github.com/scratchfoundation/scratch-editor/blob/develop/packages/scratch-gui/src/lib/make-toolbox-xml.js
        <block id="online" type="sensing_online" />
        <block type="sensing_username"/>
    sensing_online: {
        defaultMessage: 'online',
        description: 'Label for the online status monitor when shown on the stage',
        id: 'gui.opcodeLabels.online'
    },
    sensing_username: {
        defaultMessage: 'username',
        description: 'Label for the username monitor when shown on the stage',
        id: 'gui.opcodeLabels.username'
    },

GUI 側(ラベルの設定):
https://github.com/scratchfoundation/scratch-editor/blob/develop/packages/scratch-gui/src/lib/opcode-labels.js
        this._translator = message => message.defaultMessage;
        this._opcodeMap.sensing_online.labelFn = () => this._translator(messages.sensing_online);
        this._opcodeMap.sensing_username.labelFn = () => this._translator(messages.sensing_username);


ブロック側(現在は使われていない?):
https://github.com/scratchfoundation/scratch-blocks/blob/develop/msg/messages.js
Blockly.Msg.SENSING_ONLINE = 'online?'
Blockly.Msg.SENSING_USERNAME = 'username'

Last edited by inoking (June 28, 2026 03:27:49)

llIlllIl
Scratcher
20 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

scratchのユーザー情報(参加日、ユーザーIDなど)は https://api.scratch.mit.edu/users/ユーザー名 から閲覧できますが、ユーザー名から情報を閲覧するのではなくユーザーIDから閲覧できるAPIは実際用意できるのでしょうか?
追記:また、削除されたコメントをapiで見ることはできるのでしょうか?そして、書こうとしたコメントが悪い言葉検知器に引っかからないかということをAPIで見ることはできますか?

Last edited by llIlllIl (July 3, 2026 06:54:26)

llIlllIl
Scratcher
20 posts

Scratch 3.0 をハック(動作や構造を解析すること)しよう!

Powered by DjangoBB