Skip to content

Commit 51ab92a

Browse files
author
ccwmoran
committed
🎉auto update by Gmeek action
1 parent faa9171 commit 51ab92a

File tree

8 files changed

+1107
-17
lines changed

8 files changed

+1107
-17
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 慕然科技Scratch积木扩展库 :link: https://ccwmoran.github.io/code
2-
### :page_facing_up: [15](https://ccwmoran.github.io/code/tag.html)
2+
### :page_facing_up: [16](https://ccwmoran.github.io/code/tag.html)
33
### :speech_balloon: 0
4-
### :hibiscus: 177529
5-
### :alarm_clock: 2025-12-01 22:42:05
4+
### :hibiscus: 181914
5+
### :alarm_clock: 2025-12-01 22:45:09
66
### Powered by :heart: [Gmeek](https://github.com/Meekdai/Gmeek)
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
> 隐藏编辑器中所有积木
2+
`慕然科技官网ccwmoran.github.io`
3+
```
4+
(function(Scratch) {
5+
'use strict';
6+
const Blockly = Scratch.Blockly;
7+
8+
class BiyuanExtension {
9+
constructor() {
10+
this.workspace = null;
11+
this.original = {
12+
domToBlock: null,
13+
setVisible: null,
14+
contextMenu: null
15+
};
16+
this.observer = null;
17+
this.checkInterval = null;
18+
}
19+
20+
getInfo() {
21+
return {
22+
id: 'hide',
23+
name: '慕然科技的积木隐藏',
24+
color: '#00704A',
25+
blocks: []
26+
};
27+
}
28+
29+
applyProtection() {
30+
// 保存原始引用
31+
const originalContextMenu = Blockly.ContextMenu;
32+
33+
// 劫持积木创建
34+
this.original.domToBlock = Blockly.Xml.domToBlock;
35+
Blockly.Xml.domToBlock = (xml, ws) => {
36+
const block = this.original.domToBlock(xml, ws);
37+
this.superHide(block);
38+
return block;
39+
};
40+
41+
// 重写可见性设置
42+
this.original.setVisible = Blockly.Block.prototype.setVisible;
43+
Blockly.Block.prototype.setVisible = function(visible) {
44+
return this.original.setVisible.call(this, visible && false);
45+
};
46+
47+
// 监控DOM变化
48+
this.observer = new MutationObserver(mutations => {
49+
mutations.forEach(mutation => {
50+
const element = mutation.target;
51+
if (element.classList?.contains('blocklyBlockCanvas') &&
52+
element.style.display !== 'none') {
53+
element.style.display = 'none';
54+
}
55+
});
56+
});
57+
58+
// 修复this指向问题
59+
const self = this;
60+
this.original.contextMenu = originalContextMenu;
61+
Blockly.ContextMenu = function(...args) {
62+
const instance = new originalContextMenu(...args);
63+
instance.show = () => {};
64+
return instance;
65+
};
66+
}
67+
68+
superHide(block) {
69+
// 多层隐藏技术
70+
block.setVisible(false);
71+
const svgRoot = block.getSvgRoot();
72+
if (svgRoot) {
73+
svgRoot.style.display = 'none';
74+
svgRoot.setAttribute('visibility', 'hidden');
75+
76+
// 添加DOM监控
77+
this.observer.observe(svgRoot, {
78+
attributes: true,
79+
attributeFilter: ['style', 'visibility']
80+
});
81+
}
82+
}
83+
84+
onInit() {
85+
this.workspace = Scratch.vm.runtime.work  space;
86+
this.applyProtection();
87+
88+
// 初始隐藏
89+
this.workspace.getAllBlocks().forEach(block => {
90+
this.superHide(block);
91+
});
92+
93+
// 定时检查
94+
this.checkInterval = setInterval(() => {
95+
this.workspace.getAllBlocks().forEach(block => {
96+
if (block.isVisible() ||
97+
(block.getSvgRoot()?.style.display !== 'none') ||
98+
(block.getSvgRoot()?.getAttribute('visibility') === 'visible')) {
99+
this.superHide(block);
100+
}
101+
});
102+
}, 50);
103+
}
104+
105+
onUnload() {
106+
// 恢复原始环境
107+
Blockly.Xml.domToBlock = this.original.domToBlock;
108+
if (Blockly.Block.prototype.setVisible) {
109+
Blockly.Block.prototype.setVisible = this.original.setVisible;
110+
}
111+
Blockly.ContextMenu = this.original.contextMenu;
112+
113+
clearInterval(this.checkInterval);
114+
this.observer?.disconnect();
115+
116+
// 恢复所有元素
117+
this.workspace.getAllBlocks().forEach(block => {
118+
const svgRoot = block.getSvgRoot();
119+
if (svgRoot) {
120+
svgRoot.style.display = '';
121+
svgRoot.removeAttribute('visibility');
122+
}
123+
block.setVisible(true);
124+
});
125+
this.workspace.resize();
126+
}
127+
}
128+
129+
const ext = new BiyuanExtension();
130+
Scratch.extensions.register(ext);
131+
ext.runtime.once('PROJECT_LOADED', () => ext.onInit());
132+
ext.runtime.once('EXTENSION_UNLOADED', () => ext.onUnload());
133+
})(Scratch);
134+
```

blogBase.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/index.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ <h1>
9191
<span class="Label LabelName" style="background-color:#5cff6e"><object><a style="color:#fff" href="tag.html#适配GandiIDE">适配GandiIDE</a></object></span><span class="Label LabelName" style="background-color:#e2284a"><object><a style="color:#fff" href="tag.html#适配TurboWarp">适配TurboWarp</a></object></span><span class="Label LabelName" style="background-color:#1d76db"><object><a style="color:#fff" href="tag.html#适配Scratch3.0">适配Scratch3.0</a></object></span><span class="Label LabelName" style="background-color:#a5d296"><object><a style="color:#fff" href="tag.html#未进行适配测试">未进行适配测试</a></object></span><span class="Label LabelName" style="background-color:#5ca05c"><object><a style="color:#fff" href="tag.html#适配其他编辑器">适配其他编辑器</a></object></span>
9292
<span class="Label LabelTime" style="background-color:#0969da">2025-11-30</span>
9393
</div>
94+
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/mu-ran-ke-ji-de-ji-mu-yin-cang.html">
95+
<div class="d-flex flex-items-center">
96+
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
97+
</svg>
98+
<span class="listTitle">慕然科技的积木隐藏</span>
99+
</div>
100+
<div class="listLabels">
101+
102+
<span class="Label LabelName" style="background-color:#5cff6e"><object><a style="color:#fff" href="tag.html#适配GandiIDE">适配GandiIDE</a></object></span><span class="Label LabelName" style="background-color:#e2284a"><object><a style="color:#fff" href="tag.html#适配TurboWarp">适配TurboWarp</a></object></span><span class="Label LabelName" style="background-color:#1d76db"><object><a style="color:#fff" href="tag.html#适配Scratch3.0">适配Scratch3.0</a></object></span><span class="Label LabelName" style="background-color:#5ca05c"><object><a style="color:#fff" href="tag.html#适配其他编辑器">适配其他编辑器</a></object></span>
103+
<span class="Label LabelTime" style="background-color:#0969da">2025-12-01</span>
104+
</div>
94105
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/mu-ran-ke-ji-de-wei-xin-feng-ge-dan-chuang.html">
95106
<div class="d-flex flex-items-center">
96107
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
@@ -234,18 +245,10 @@ <h1>
234245
<span class="Label LabelName" style="background-color:#5cff6e"><object><a style="color:#fff" href="tag.html#适配GandiIDE">适配GandiIDE</a></object></span>
235246
<span class="Label LabelTime" style="background-color:#0969da">2025-11-30</span>
236247
</div>
237-
</a><a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Morgan-de-gong-ju-xiang-V8.html">
238-
<div class="d-flex flex-items-center">
239-
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
240-
</svg>
241-
<span class="listTitle">Morgan的工具箱V8</span>
242-
</div>
243-
<div class="listLabels">
244-
245-
<span class="Label LabelName" style="background-color:#5cff6e"><object><a style="color:#fff" href="tag.html#适配GandiIDE">适配GandiIDE</a></object></span><span class="Label LabelName" style="background-color:#e2284a"><object><a style="color:#fff" href="tag.html#适配TurboWarp">适配TurboWarp</a></object></span><span class="Label LabelName" style="background-color:#5ca05c"><object><a style="color:#fff" href="tag.html#适配其他编辑器">适配其他编辑器</a></object></span>
246-
<span class="Label LabelTime" style="background-color:#0969da">2025-11-30</span>
247-
</div>
248248
</a>
249+
</nav><nav class="paginate-container" aria-label="Pagination">
250+
<div class="pagination"><span class="previous_page" aria-disabled="true">上一页</span>
251+
<a class="next_page" rel="next" href="https://ccwmoran.github.io/code/page2.html" aria-label="Next Page">下一页</a></div>
249252
</nav>
250253
</div>
251254
<div id="footer"><div id="footer1">Copyright © <span id="copyrightYear"></span> <a href="https://ccwmoran.github.io/code">慕然科技Scratch积木扩展库</a></div>

docs/page2.html

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<!DOCTYPE html>
2+
<html data-color-mode="light" data-dark-theme="dark" data-light-theme="light" lang="zh-CN">
3+
<head>
4+
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<link href='https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/Primer/21.0.7/primer.css' rel='stylesheet' />
8+
9+
<link rel="icon" href="https://gpo.saobby.com/i/BA9EN3Rw3fzRUJmu.jpg"><script>
10+
let theme = localStorage.getItem("meek_theme") || "light";
11+
document.documentElement.setAttribute("data-color-mode", theme);
12+
</script>
13+
<meta name="description" content="慕然科技官网https://ccwmoran.github.io">
14+
<meta property="og:title" content="慕然科技Scratch积木扩展库">
15+
<meta property="og:description" content="慕然科技官网https://ccwmoran.github.io">
16+
<meta property="og:type" content="blog">
17+
<meta property="og:url" content="https://ccwmoran.github.io/code">
18+
<meta property="og:image" content="https://gpo.saobby.com/i/BA9EN3Rw3fzRUJmu.jpg">
19+
<title>慕然科技Scratch积木扩展库</title>
20+
21+
</head>
22+
<style>
23+
body{box-sizing: border-box;min-width: 200px;max-width: 900px;margin: 20px auto;padding: 45px;font-size: 16px;font-family: sans-serif;line-height: 1.25;}
24+
#header{display:flex;padding-bottom:8px;border-bottom: 1px solid var(--borderColor-muted, var(--color-border-muted));margin-bottom: 16px;}
25+
#footer {margin-top:64px; text-align: center;font-size: small;}
26+
27+
</style>
28+
29+
<style>
30+
.avatar {transition: 0.8s;width:64px;height:64px;object-fit: cover;}
31+
.avatar:hover{transform: scale(1.15) rotate(360deg);}
32+
#header h1 a{color:inherit;text-decoration:none;vertical-align: bottom;font-size:40px;font-family:Monaco;margin-left:8px;}
33+
.title-right{display:flex;margin:auto 0 0 auto;}
34+
.title-right button{margin-right:8px;padding:16px;}
35+
.title-right .circle{padding: 14px 16px;}
36+
37+
.SideNav{min-width: 360px;}
38+
.SideNav-icon{margin-right: 16px}
39+
.SideNav-item .Label{color: #fff;margin-left:4px;}
40+
.d-flex{min-width:0;}
41+
.listTitle{overflow:hidden;white-space:nowrap;text-overflow: ellipsis;max-width: 100%;}
42+
.listLabels{white-space:nowrap;display:flex;}
43+
.listLabels object{max-height:16px;max-width:24px;}
44+
45+
@media (max-width: 600px) {
46+
body {padding: 8px;}
47+
.avatar {width:40px;height:40px;}
48+
.blogTitle{display:none;}
49+
#buttonRSS{display:none;}
50+
.LabelTime{display:none;}
51+
}
52+
</style>
53+
54+
55+
56+
<body>
57+
<div id="header">
58+
<h1>
59+
<img src="https://gpo.saobby.com/i/BA9EN3Rw3fzRUJmu.jpg" class="avatar circle" id="avatarImg" alt="avatar"><a class="blogTitle">慕然科技Scratch积木扩展库</a></h1>
60+
<div class="title-right">
61+
<a href="https://ccwmoran.github.io/code/tag.html" id="buttonSearch" class="btn btn-invisible circle" title="搜索">
62+
<svg class="octicon" width="16" height="16" >
63+
<path id="pathSearch" fill-rule="evenodd"></path>
64+
</svg>
65+
</a>
66+
67+
68+
<a href="https://ccwmoran.github.io/code/rss.xml" target="_blank" id="buttonRSS" class="btn btn-invisible circle" title="RSS">
69+
<svg class="octicon" width="16" height="16" >
70+
<path id="pathRSS" fill-rule="evenodd"></path>
71+
</svg>
72+
</a>
73+
<a class="btn btn-invisible circle" onclick="modeSwitch()" title="切换主题">
74+
<svg class="octicon" width="16" height="16" >
75+
<path id="themeSwitch" fill-rule="evenodd"></path>
76+
</svg>
77+
</a>
78+
</div>
79+
</div>
80+
<div id="content">
81+
<div style="margin-bottom: 16px;">慕然科技官网https://ccwmoran.github.io</div>
82+
<nav class="SideNav border">
83+
<a class="SideNav-item d-flex flex-items-center flex-justify-between" href="post/Morgan-de-gong-ju-xiang-V8.html">
84+
<div class="d-flex flex-items-center">
85+
<svg class="SideNav-icon octicon" style="witdh:16px;height:16px"><path class="svgTop0" d=""></path>
86+
</svg>
87+
<span class="listTitle">Morgan的工具箱V8</span>
88+
</div>
89+
<div class="listLabels">
90+
91+
<span class="Label LabelName" style="background-color:#5cff6e"><object><a style="color:#fff" href="tag.html#适配GandiIDE">适配GandiIDE</a></object></span><span class="Label LabelName" style="background-color:#e2284a"><object><a style="color:#fff" href="tag.html#适配TurboWarp">适配TurboWarp</a></object></span><span class="Label LabelName" style="background-color:#5ca05c"><object><a style="color:#fff" href="tag.html#适配其他编辑器">适配其他编辑器</a></object></span>
92+
<span class="Label LabelTime" style="background-color:#0969da">2025-11-30</span>
93+
</div>
94+
</a>
95+
</nav><nav class="paginate-container" aria-label="Pagination">
96+
<div class="pagination"><a class="previous_page" rel="previous" href="https://ccwmoran.github.io/code/index.html" aria-label="Previous Page">上一页</a><span class="next_page" aria-disabled="true">下一页</span>
97+
</div>
98+
</nav>
99+
</div>
100+
<div id="footer"><div id="footer1">Copyright © <span id="copyrightYear"></span> <a href="https://ccwmoran.github.io/code">慕然科技Scratch积木扩展库</a></div>
101+
<div id="footer2">
102+
<span id="runday"></span><span>Powered by <a href="https://meekdai.com/Gmeek.html" target="_blank">Gmeek</a></span>
103+
</div>
104+
105+
<script>
106+
var now=new Date();
107+
document.getElementById("copyrightYear").innerHTML=now.getFullYear();
108+
109+
if(""!=""){
110+
var startSite=new Date("");
111+
var diff=now.getTime()-startSite.getTime();
112+
var diffDay=Math.floor(diff/(1000*60*60*24));
113+
document.getElementById("runday").innerHTML="网站运行"+diffDay+"天"+" • ";
114+
}
115+
</script></div>
116+
</body>
117+
<script>
118+
var IconList={'sun': 'M8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zM8 12a4 4 0 100-8 4 4 0 000 8zM8 0a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0V.75A.75.75 0 018 0zm0 13a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 018 13zM2.343 2.343a.75.75 0 011.061 0l1.06 1.061a.75.75 0 01-1.06 1.06l-1.06-1.06a.75.75 0 010-1.06zm9.193 9.193a.75.75 0 011.06 0l1.061 1.06a.75.75 0 01-1.06 1.061l-1.061-1.06a.75.75 0 010-1.061zM16 8a.75.75 0 01-.75.75h-1.5a.75.75 0 010-1.5h1.5A.75.75 0 0116 8zM3 8a.75.75 0 01-.75.75H.75a.75.75 0 010-1.5h1.5A.75.75 0 013 8zm10.657-5.657a.75.75 0 010 1.061l-1.061 1.06a.75.75 0 11-1.06-1.06l1.06-1.06a.75.75 0 011.06 0zm-9.193 9.193a.75.75 0 010 1.06l-1.06 1.061a.75.75 0 11-1.061-1.06l1.06-1.061a.75.75 0 011.061 0z', 'moon': 'M9.598 1.591a.75.75 0 01.785-.175 7 7 0 11-8.967 8.967.75.75 0 01.961-.96 5.5 5.5 0 007.046-7.046.75.75 0 01.175-.786zm1.616 1.945a7 7 0 01-7.678 7.678 5.5 5.5 0 107.678-7.678z', 'sync': 'M1.705 8.005a.75.75 0 0 1 .834.656 5.5 5.5 0 0 0 9.592 2.97l-1.204-1.204a.25.25 0 0 1 .177-.427h3.646a.25.25 0 0 1 .25.25v3.646a.25.25 0 0 1-.427.177l-1.38-1.38A7.002 7.002 0 0 1 1.05 8.84a.75.75 0 0 1 .656-.834ZM8 2.5a5.487 5.487 0 0 0-4.131 1.869l1.204 1.204A.25.25 0 0 1 4.896 6H1.25A.25.25 0 0 1 1 5.75V2.104a.25.25 0 0 1 .427-.177l1.38 1.38A7.002 7.002 0 0 1 14.95 7.16a.75.75 0 0 1-1.49.178A5.5 5.5 0 0 0 8 2.5Z', 'search': 'M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z', 'rss': 'M2.002 2.725a.75.75 0 0 1 .797-.699C8.79 2.42 13.58 7.21 13.974 13.201a.75.75 0 0 1-1.497.098 10.502 10.502 0 0 0-9.776-9.776.747.747 0 0 1-.7-.798ZM2.84 7.05h-.002a7.002 7.002 0 0 1 6.113 6.111.75.75 0 0 1-1.49.178 5.503 5.503 0 0 0-4.8-4.8.75.75 0 0 1 .179-1.489ZM2 13a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z', 'upload': 'M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z M11.78 4.72a.749.749 0 1 1-1.06 1.06L8.75 3.811V9.5a.75.75 0 0 1-1.5 0V3.811L5.28 5.78a.749.749 0 1 1-1.06-1.06l3.25-3.25a.749.749 0 0 1 1.06 0l3.25 3.25Z', 'post': 'M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25Zm1.75-.25a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25ZM3.5 6.25a.75.75 0 0 1 .75-.75h7a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1-.75-.75Zm.75 2.25h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1 0-1.5Z'};
119+
var utterancesLoad=0;
120+
121+
let themeSettings={
122+
"dark": ["dark","moon","#00f0ff","dark-blue"],
123+
"light": ["light","sun","#ff5000","github-light"],
124+
"auto": ["auto","sync","","preferred-color-scheme"]
125+
};
126+
function changeTheme(mode, icon, color, utheme){
127+
document.documentElement.setAttribute("data-color-mode",mode);
128+
document.getElementById("themeSwitch").setAttribute("d",value=IconList[icon]);
129+
document.getElementById("themeSwitch").parentNode.style.color=color;
130+
if(utterancesLoad==1){utterancesTheme(utheme);}
131+
}
132+
function modeSwitch(){
133+
let currentMode=document.documentElement.getAttribute('data-color-mode');
134+
let newMode = currentMode === "light" ? "dark" : currentMode === "dark" ? "auto" : "light";
135+
localStorage.setItem("meek_theme", newMode);
136+
if(themeSettings[newMode]){
137+
changeTheme(...themeSettings[newMode]);
138+
}
139+
}
140+
function utterancesTheme(theme){
141+
const message={type:'set-theme',theme: theme};
142+
const iframe=document.getElementsByClassName('utterances-frame')[0];
143+
iframe.contentWindow.postMessage(message,'https://utteranc.es');
144+
}
145+
if(themeSettings[theme]){changeTheme(...themeSettings[theme]);}
146+
console.log("\n %c Gmeek last https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#02d81d;color:#fff");
147+
</script>
148+
149+
<script>
150+
document.getElementById("pathSearch").setAttribute("d",IconList["search"]);
151+
document.getElementById("pathRSS").setAttribute("d",IconList["rss"]);
152+
iconTOP=document.getElementsByClassName("svgTop1");
153+
iconPost=document.getElementsByClassName("svgTop0");
154+
for(var i=0;i<iconTOP.length;i++){
155+
iconTOP[i].setAttribute("d",IconList["upload"]);
156+
iconTOP[i].parentNode.style.color="red";
157+
}
158+
for(var i=0;i<iconPost.length;i++){
159+
iconPost[i].setAttribute("d",IconList["post"]);
160+
}
161+
162+
163+
164+
165+
</script>
166+
167+
168+
</html>

0 commit comments

Comments
 (0)