Compare commits
No commits in common. "5d2fb7b1077cc4d2ec1dc479af25fdea925b8bdb" and "6687d61966974464e911f00b1c28679f569b7603" have entirely different histories.
5d2fb7b107
...
6687d61966
16
DOCS.md
16
DOCS.md
@ -107,20 +107,6 @@ app.render("com.example");
|
|||||||
// Эквивалентно
|
// Эквивалентно
|
||||||
app.draw();
|
app.draw();
|
||||||
```
|
```
|
||||||
## stable / unstable
|
|
||||||
Стабильный обьек отрисовывается всегда, например:
|
|
||||||
```js
|
|
||||||
import Find from "/home/user/Find_js/Find.js";
|
|
||||||
const root = Find.search("my_app");
|
|
||||||
const app = new Find(root);
|
|
||||||
app.select(0);
|
|
||||||
app.stable();
|
|
||||||
// Добавление
|
|
||||||
app.add(['<button>123</button>']);
|
|
||||||
app.select(1);
|
|
||||||
app.add(['<button>123</button>']);
|
|
||||||
app.render();
|
|
||||||
```
|
|
||||||
## Map
|
## Map
|
||||||
Map - обьект на странице. Использует следующие функции:
|
Map - обьект на странице. Использует следующие функции:
|
||||||
```js
|
```js
|
||||||
@ -144,8 +130,6 @@ map.value(/* value для замены */); // Без аргументов ве
|
|||||||
map.id(/* ID элемента */); // Вернет экземпляр map для выбранного элемента
|
map.id(/* ID элемента */); // Вернет экземпляр map для выбранного элемента
|
||||||
map.tag(/* TAG элемента */); // Вернет экземпляр map для выбранного элемента
|
map.tag(/* TAG элемента */); // Вернет экземпляр map для выбранного элемента
|
||||||
map.attach(/* событие */, /* функция */); // EventHandler
|
map.attach(/* событие */, /* функция */); // EventHandler
|
||||||
map.attribute(/* Имя */, /* Значение */); // Задание атрибута
|
|
||||||
map.add(/* HTML */);
|
|
||||||
/*
|
/*
|
||||||
* Функция в attach может принимать параметр.
|
* Функция в attach может принимать параметр.
|
||||||
* Этот параметр - обьект Find, map которого был вызван
|
* Этот параметр - обьект Find, map которого был вызван
|
||||||
|
|||||||
86
Find/Find.js
86
Find/Find.js
@ -56,10 +56,6 @@ class FindObjectMap {
|
|||||||
this.root.innerHTML = t;
|
this.root.innerHTML = t;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
add(h) {
|
|
||||||
const t = this.html();
|
|
||||||
return this.html(t + String(h));
|
|
||||||
}
|
|
||||||
value(t) {
|
value(t) {
|
||||||
if (arguments.length == 0) {
|
if (arguments.length == 0) {
|
||||||
return this.root.value;
|
return this.root.value;
|
||||||
@ -109,10 +105,6 @@ class FindObjectMap {
|
|||||||
main() {
|
main() {
|
||||||
return new FindObjectMap(this._app.root, this._app, 0);
|
return new FindObjectMap(this._app.root, this._app, 0);
|
||||||
}
|
}
|
||||||
attribute(name, val) {
|
|
||||||
this.root.setAttribute(name, val);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Find {
|
export default class Find {
|
||||||
@ -120,7 +112,6 @@ export default class Find {
|
|||||||
/* Public section */
|
/* Public section */
|
||||||
|
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
this._lll = "";
|
|
||||||
this.root = root;
|
this.root = root;
|
||||||
this.iter = 0;
|
this.iter = 0;
|
||||||
this.groups = new Array();
|
this.groups = new Array();
|
||||||
@ -184,13 +175,11 @@ export default class Find {
|
|||||||
meta = new Array();
|
meta = new Array();
|
||||||
}
|
}
|
||||||
if (addr != -1) {
|
if (addr != -1) {
|
||||||
const every = this.groups[addr].every;
|
|
||||||
this.groups[addr] = {
|
this.groups[addr] = {
|
||||||
id: id,
|
id: id,
|
||||||
html: html,
|
html: html,
|
||||||
meta: meta,
|
meta: meta,
|
||||||
title: document.title,
|
title: document.title
|
||||||
every: every
|
|
||||||
};
|
};
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -207,8 +196,7 @@ export default class Find {
|
|||||||
this.groups[this.groups_count] = {
|
this.groups[this.groups_count] = {
|
||||||
id: id,
|
id: id,
|
||||||
html: html,
|
html: html,
|
||||||
meta: meta,
|
meta: meta
|
||||||
every: false
|
|
||||||
};
|
};
|
||||||
this.groups_count ++;
|
this.groups_count ++;
|
||||||
return this;
|
return this;
|
||||||
@ -243,37 +231,6 @@ export default class Find {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
stable(id_, html_) {
|
|
||||||
let id = undefined;
|
|
||||||
let html = undefined;
|
|
||||||
if (arguments.length == 1 || arguments.length == 0) {
|
|
||||||
id = this.__id;
|
|
||||||
if (arguments.length != 0) {
|
|
||||||
html = id_;
|
|
||||||
} else {
|
|
||||||
html = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
id = id_;
|
|
||||||
html = html_;
|
|
||||||
}
|
|
||||||
if (this.groups.length == 0 || this.getNumberOfGroupFromId(id, false) == -1) {
|
|
||||||
this.group(id, [], []);
|
|
||||||
}
|
|
||||||
const stable = html;
|
|
||||||
this.groups[this.getNumberOfGroupFromId(id)]
|
|
||||||
.every = stable;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
unstable(id_) {
|
|
||||||
let id = id_;
|
|
||||||
if (arguments.length == 0) {
|
|
||||||
id = this.__id;
|
|
||||||
}
|
|
||||||
return this.stable(id, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
correct(groupid_, elementid_, telement_) {
|
correct(groupid_, elementid_, telement_) {
|
||||||
let groupid = undefined;
|
let groupid = undefined;
|
||||||
let elementid = undefined;
|
let elementid = undefined;
|
||||||
@ -371,14 +328,7 @@ export default class Find {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw(...args) {
|
draw() {
|
||||||
this._lll = "";
|
|
||||||
this.__draw(...args);
|
|
||||||
this.root.innerHTML = this._lll;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
__draw(__use) {
|
|
||||||
if (typeof this.__id === "undefined") {
|
if (typeof this.__id === "undefined") {
|
||||||
PrivateFind.error("Use select, before draw. Or you can use render.");
|
PrivateFind.error("Use select, before draw. Or you can use render.");
|
||||||
}
|
}
|
||||||
@ -391,15 +341,7 @@ export default class Find {
|
|||||||
PrivateFind.findTypeError(group.html, "object");
|
PrivateFind.findTypeError(group.html, "object");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
const isRecursive = (typeof __use === "string" && __use === '__undstta');
|
this.root.innerHTML = "";
|
||||||
if (!isRecursive) {
|
|
||||||
for (let i = 0; i < this.groups.length; i ++) {
|
|
||||||
if (typeof this.groups[i].every === "boolean" && this.groups[i].every) {
|
|
||||||
this.render(this.groups[i].id, '__undstta');
|
|
||||||
this.iter --;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeof group.title !== "undefined" && document.title !== group.title) {
|
if (typeof group.title !== "undefined" && document.title !== group.title) {
|
||||||
document.title = group.title;
|
document.title = group.title;
|
||||||
}
|
}
|
||||||
@ -408,34 +350,22 @@ export default class Find {
|
|||||||
Array.isArray(group.meta) &&
|
Array.isArray(group.meta) &&
|
||||||
group.meta.length > 0 && this.iter === 0
|
group.meta.length > 0 && this.iter === 0
|
||||||
) {
|
) {
|
||||||
let n = document.head.innerHTML;
|
|
||||||
for (let i = 0; i < group.meta.length; i ++) {
|
for (let i = 0; i < group.meta.length; i ++) {
|
||||||
if (typeof group.meta[i] === "string") {
|
if (typeof group.meta[i] === "string") {
|
||||||
n += group.meta[i];
|
this.root.innerHTML += group.meta[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.head.innerHTML = n;
|
|
||||||
}
|
}
|
||||||
let drawer = "";
|
|
||||||
for (let i = 0; i < group.html.length; i ++) {
|
for (let i = 0; i < group.html.length; i ++) {
|
||||||
if (typeof group.html[i] === "string") {
|
if (typeof group.html[i] === "string") {
|
||||||
drawer += group.html[i];
|
this.root.innerHTML += group.html[i];
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.root.innerHTML !== drawer) {
|
|
||||||
if (isRecursive) {
|
|
||||||
if (drawer.length !== 0) {
|
|
||||||
this._lll += drawer;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this._lll += drawer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.iter ++;
|
this.iter ++;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(id_, __use) {
|
render(id_) {
|
||||||
let id = undefined;
|
let id = undefined;
|
||||||
if (arguments.length == 0) {
|
if (arguments.length == 0) {
|
||||||
id = this.__id;
|
id = this.__id;
|
||||||
@ -445,7 +375,7 @@ export default class Find {
|
|||||||
|
|
||||||
const sv = this.__id;
|
const sv = this.__id;
|
||||||
this.select(id);
|
this.select(id);
|
||||||
this.draw(__use);
|
this.draw();
|
||||||
this.__id = sv;
|
this.__id = sv;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
3
demos/Quiz/bulma.min.css
vendored
3
demos/Quiz/bulma.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,41 +0,0 @@
|
|||||||
<!--
|
|
||||||
index.html
|
|
||||||
|
|
||||||
Copyright 2026 Lida <lida@lida-laptol>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
||||||
MA 02110-1301, USA.
|
|
||||||
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Find</title>
|
|
||||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
|
||||||
<meta name="generator" content="Geany 2.0" />
|
|
||||||
<link rel="stylesheet" href="bulma.min.css" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
<script src="nomodule-find.min.js"></script>
|
|
||||||
<script src="index.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@ -1,114 +0,0 @@
|
|||||||
const qestions = [
|
|
||||||
{
|
|
||||||
qestion: "Мой вопрос",
|
|
||||||
variants: [
|
|
||||||
"Вариант 1",
|
|
||||||
"Вариант 2",
|
|
||||||
"Вариант 3"
|
|
||||||
],
|
|
||||||
correct: 0
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
class Quiz extends Find.createApp() {
|
|
||||||
constructor(qestions) {
|
|
||||||
const root = Find.search('root');
|
|
||||||
super(root);
|
|
||||||
this.qestions = qestions;
|
|
||||||
}
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this.select('com.find.demos.quiz');
|
|
||||||
this.setMeta();
|
|
||||||
this.setCard();
|
|
||||||
this.stable();
|
|
||||||
this.createQestions();
|
|
||||||
}
|
|
||||||
|
|
||||||
setCard() {
|
|
||||||
this.add([
|
|
||||||
Find.content(
|
|
||||||
`<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<p class="card-header-title">
|
|
||||||
<span id="title">
|
|
||||||
Загрузка...
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="content" id="content"></div>
|
|
||||||
<button
|
|
||||||
class="button"
|
|
||||||
style="width: 100%;"
|
|
||||||
id="test"
|
|
||||||
>Проверить</button>
|
|
||||||
</div>
|
|
||||||
</div>`
|
|
||||||
)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
setMeta() {
|
|
||||||
this.meta([
|
|
||||||
Find.content('<meta name="viewport" content="width=device-width, initial-scale=1">'),
|
|
||||||
Find.content('<style>body { margin: 20px; } </style>')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
createQestions() {
|
|
||||||
this.number = 0;
|
|
||||||
for (let i = 0; i < this.qestions.length; i ++) {
|
|
||||||
this.select('qestion' + this.number);
|
|
||||||
this.setTitle();
|
|
||||||
this.render();
|
|
||||||
this.setForms(this.qestions[i]);
|
|
||||||
this.setEvents(this.qestions[i])
|
|
||||||
.then((result) => {
|
|
||||||
this.number ++;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
|
|
||||||
});
|
|
||||||
this.number ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setEvents() {}
|
|
||||||
|
|
||||||
setTitle() {
|
|
||||||
this.title('Quiz qestion ' + this.number + ' - Find.js demo');
|
|
||||||
}
|
|
||||||
|
|
||||||
setForms(qe) {
|
|
||||||
let input_id = 0;
|
|
||||||
const root = this.component();
|
|
||||||
const content = root.id("content");
|
|
||||||
const title = root.id("title");
|
|
||||||
title.text(qe.qestion);
|
|
||||||
for (let val in (qe.variants)) {
|
|
||||||
content.add(
|
|
||||||
Find.content(
|
|
||||||
`<input
|
|
||||||
type="radio"
|
|
||||||
id="variant${input_id}"
|
|
||||||
name="radiobutton">
|
|
||||||
<label class="radio" for="variant${input_id}">
|
|
||||||
<span class="has-text-weight-medium" id="text${input_id}"></span>
|
|
||||||
</label>
|
|
||||||
</input>
|
|
||||||
<br>`
|
|
||||||
)
|
|
||||||
);
|
|
||||||
content.id('text' + input_id).text(qe.variants[val]);
|
|
||||||
input_id ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setEvents(r) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const quiz = new Quiz(qestions);
|
|
||||||
quiz.init();
|
|
||||||
1
demos/Quiz/nomodule-find.min.js
vendored
1
demos/Quiz/nomodule-find.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
favicon.ico
BIN
favicon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
@ -23,13 +23,12 @@
|
|||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Find</title>
|
<title>Find</title>
|
||||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||||
<meta name="generator" content="Geany 2.0" />
|
<meta name="generator" content="Geany 2.0" />
|
||||||
<link rel="stylesheet" href="bulma.min.css" />
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
87
index.js
87
index.js
@ -2,17 +2,14 @@ import Find from './Find/Find.js';
|
|||||||
|
|
||||||
const ROOT_OBJECT = 'root';
|
const ROOT_OBJECT = 'root';
|
||||||
|
|
||||||
const STANDARD = 0;
|
class MyApp extends Find.createApp() {
|
||||||
const NO_MODULE = 1;
|
|
||||||
|
|
||||||
class App extends Find.createApp() {
|
|
||||||
constructor(name) {
|
constructor(name) {
|
||||||
const root = Find.search(name);
|
const root = Find.search(name);
|
||||||
super(root);
|
super(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.select('com.find.minify');
|
this.select('com.example');
|
||||||
this.setMeta();
|
this.setMeta();
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
this.setForms();
|
this.setForms();
|
||||||
@ -22,14 +19,20 @@ class App extends Find.createApp() {
|
|||||||
|
|
||||||
setMeta() {
|
setMeta() {
|
||||||
this.meta([
|
this.meta([
|
||||||
|
Find.css('bulma.min.css'),
|
||||||
Find.content('<meta name="viewport" content="width=device-width, initial-scale=1">'),
|
Find.content('<meta name="viewport" content="width=device-width, initial-scale=1">'),
|
||||||
Find.content('<style>body { margin: 20px; } </style>'),
|
Find.content(
|
||||||
Find.content('<link rel="icon" href="favicon.ico" type="image/x-icon" />')
|
`<style>
|
||||||
|
body {
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
</style>`
|
||||||
|
)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle() {
|
setTitle() {
|
||||||
this.title('Минификатор Find.js на Find.js');
|
this.title('Минификатор FInd.js на Find.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
setForms() {
|
setForms() {
|
||||||
@ -37,29 +40,15 @@ class App extends Find.createApp() {
|
|||||||
Find.content(
|
Find.content(
|
||||||
`<div class="card">
|
`<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<p class="card-header-title">
|
<p id="title" class="card-header-title">Минификация Find.js</p>
|
||||||
<span id="title">Минификация Find.js</span>
|
|
||||||
<span id="hand_error" class="has-text-danger"></span>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<span class="has-text-weight-bold">
|
|
||||||
Минифицируйте Find.js прямо сейчас!
|
|
||||||
</span>
|
|
||||||
<button
|
<button
|
||||||
class="button"
|
class="button"
|
||||||
id="minify"
|
id="minify"
|
||||||
style="width: 100%; margin-top: 10px; margin-bottom: 10px;"
|
style="width: 100%"
|
||||||
>Минифицировать</button>
|
>Минифицировать</button>
|
||||||
<span class="has-text-weight-bold">
|
|
||||||
Или же скачайте no-module версию:
|
|
||||||
</span>
|
|
||||||
<button
|
|
||||||
class="button"
|
|
||||||
id="no-module"
|
|
||||||
style="width: 100%; margin-top: 10px;"
|
|
||||||
>Скачать</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
@ -67,18 +56,14 @@ class App extends Find.createApp() {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mwait(t, x) {
|
mwait(t) {
|
||||||
const root = this.component();
|
const root = app.component();
|
||||||
const title = root.id('title');
|
const title = root.id('title');
|
||||||
root.id("hand_error").text('');
|
|
||||||
if (t === true) {
|
if (t === true) {
|
||||||
title.text('Минификация Find.js в процессе...');
|
title.text('Минификация Find.js в процессе...');
|
||||||
} else {
|
} else {
|
||||||
if (typeof t === "string") {
|
if (typeof t === "string") {
|
||||||
title.text(t);
|
title.text(t);
|
||||||
if (arguments.length > 1) {
|
|
||||||
root.id("hand_error").text(x);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
title.text('Минификация Find.js');
|
title.text('Минификация Find.js');
|
||||||
}
|
}
|
||||||
@ -87,39 +72,27 @@ class App extends Find.createApp() {
|
|||||||
|
|
||||||
attachEvents() {
|
attachEvents() {
|
||||||
const root = this.component();
|
const root = this.component();
|
||||||
root.id('minify').attach('click', () => {
|
const button = root.id('minify');
|
||||||
|
button.attach('click', (app) => {
|
||||||
this.mwait(true);
|
this.mwait(true);
|
||||||
this.minifyFind(STANDARD);
|
this.minifyFind();
|
||||||
});
|
|
||||||
root.id('no-module').attach('click', () => {
|
|
||||||
this.mwait(true);
|
|
||||||
this.minifyFind(NO_MODULE);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async minifyFind(mode) {
|
async minifyFind() {
|
||||||
try {
|
let response = await fetch('Find/Find.js');
|
||||||
let response = await fetch('Find/Find.js');
|
if (response.ok) {
|
||||||
if (response.ok) {
|
let code = await response.text();
|
||||||
let code = await response.text();
|
let minif = await Terser.minify(code, { sourceMap: false });
|
||||||
let name = 'find.min.js';
|
this.uploadJS("find.min.js", minif.code);
|
||||||
if (mode == NO_MODULE) {
|
this.mwait(false);
|
||||||
code = code.replace('export default class Find', 'class Find');
|
} else {
|
||||||
name = 'nomodule-' + name;
|
this.mwait("Ошибка HTTP: " + response.status);
|
||||||
}
|
|
||||||
let minif = await Terser.minify(code, { sourceMap: false });
|
|
||||||
this.uploadFile(name, 'application/javascript', minif.code);
|
|
||||||
this.mwait(false);
|
|
||||||
} else {
|
|
||||||
this.mwait('Ошибка HTTP', response.status);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
this.mwait('Ошибка: ', err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFile(filename, mime, content) {
|
uploadJS(filename, content) {
|
||||||
const blob = new Blob([content], { type: mime });
|
const blob = new Blob([content], { type: 'application/javascript' });
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = URL.createObjectURL(blob);
|
link.href = URL.createObjectURL(blob);
|
||||||
link.download = filename;
|
link.download = filename;
|
||||||
@ -128,5 +101,5 @@ class App extends Find.createApp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = new App(ROOT_OBJECT);
|
const app = new MyApp(ROOT_OBJECT);
|
||||||
app.init();
|
app.init();
|
||||||
Loading…
x
Reference in New Issue
Block a user