script.io.js 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/node_packages/script.js +434 -2
- package/package.json +3 -3
- package/library/script.js +0 -434
package/index.js
ADDED
package/node_packages/script.js
CHANGED
|
@@ -1,2 +1,434 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* xxx
|
|
3
|
+
*
|
|
4
|
+
* title
|
|
5
|
+
* description
|
|
6
|
+
* sub description
|
|
7
|
+
*
|
|
8
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function Define ($, key, value, option = {}) {
|
|
12
|
+
if (key) Object.defineProperty ($, key, {enumerable: option.enumerable || false, configurable: option.configurable || false, writable: option.writable || false, value});
|
|
13
|
+
else return new Define.properties ($);
|
|
14
|
+
}
|
|
15
|
+
Define.properties = class {
|
|
16
|
+
constructor (property) {
|
|
17
|
+
this.property = property;
|
|
18
|
+
}
|
|
19
|
+
export (data) {
|
|
20
|
+
return this.property.exports = data;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* object
|
|
26
|
+
*
|
|
27
|
+
* title
|
|
28
|
+
* description
|
|
29
|
+
* sub description
|
|
30
|
+
*
|
|
31
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
Define (Object, "define", Define);
|
|
35
|
+
|
|
36
|
+
Define (Object, "type", function (input) { return typeof input; });
|
|
37
|
+
Define (Object.type, "array", function (input) { if (arguments.length) return input instanceof Array || typeof input === "array"; else return Array; });
|
|
38
|
+
Define (Object.type, "boolean", function (input) { if (arguments.length) return input instanceof Boolean || typeof input === "boolean"; else return Boolean; });
|
|
39
|
+
Define (Object.type, "buffer", function (input) { if (arguments.length) return input instanceof Buffer || typeof input === "buffer"; else return Boolean; });
|
|
40
|
+
Define (Object.type, "date", function (input) { if (arguments.length) return input instanceof Date || typeof input === "date"; else return Date; });
|
|
41
|
+
Define (Object.type, "error", function (input) { if (arguments.length) return input instanceof Error || typeof input === "error"; else return Error; });
|
|
42
|
+
Define (Object.type, "function", function (input) { if (arguments.length) return input instanceof Function || typeof input === "function"; else return Function; });
|
|
43
|
+
Define (Object.type, "number", function (input) { if (arguments.length) return input instanceof Number || typeof input === "number"; else return Number; });
|
|
44
|
+
Define (Object.type, "object", function (input) { if (arguments.length) return input instanceof Object || typeof input === "object"; else return Object; });
|
|
45
|
+
Define (Object.type, "promise", function (input) { if (arguments.length) return input instanceof Promise || typeof input === "promise"; else return Promise; });
|
|
46
|
+
Define (Object.type, "regex", function (input) { if (arguments.length) return input instanceof RegExp || typeof input === "regex"; else return RegExp; });
|
|
47
|
+
Define (Object.type, "string", function (input) { if (arguments.length) return input instanceof String || typeof input === "string"; else return String; });
|
|
48
|
+
|
|
49
|
+
Define (Object, "type_of", function (input) { return Object.prototype.toString.call (input); });
|
|
50
|
+
Define (Object.type_of, "array", function (input) { if (arguments.length) return Object.type_of (input) === "[object Array]"; else return "[object Array]"; });
|
|
51
|
+
Define (Object.type_of, "boolean", function (input) { if (arguments.length) return Object.type_of (input) === "[object Boolean]"; else return "[object Boolean]"; });
|
|
52
|
+
Define (Object.type_of, "buffer", function (input) { if (arguments.length) return Object.type_of (input) === "[object Buffer]"; else return "[object Buffer]"; });
|
|
53
|
+
Define (Object.type_of, "date", function (input) { if (arguments.length) return Object.type_of (input) === "[object Date]"; else return "[object Date]"; });
|
|
54
|
+
Define (Object.type_of, "function", function (input) { if (arguments.length) return Object.type_of (input) === "[object Function]"; else return "[object Function]"; });
|
|
55
|
+
Define (Object.type_of, "null", function (input) { if (arguments.length) return Object.type_of (input) === "[object Null]"; else return "[object Null]"; });
|
|
56
|
+
Define (Object.type_of, "number", function (input) { if (arguments.length) return Object.type_of (input) === "[object Number]"; else return "[object Number]"; });
|
|
57
|
+
Define (Object.type_of, "object", function (input) { if (arguments.length) return Object.type_of (input) === "[object Object]"; else return "[object Object]"; });
|
|
58
|
+
Define (Object.type_of, "promise", function (input) { if (arguments.length) return Object.type_of (input) === "[object Promise]"; else return "[object Promise]"; });
|
|
59
|
+
Define (Object.type_of, "regex", function (input) { if (arguments.length) return Object.type_of (input) === "[object RegExp]"; else return "[object RegExp]"; });
|
|
60
|
+
Define (Object.type_of, "string", function (input) { if (arguments.length) return Object.type_of (input) === "[object String]"; else return "[object String]"; });
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* array
|
|
64
|
+
*
|
|
65
|
+
* title
|
|
66
|
+
* description
|
|
67
|
+
* sub description
|
|
68
|
+
*
|
|
69
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
Define (Array.prototype, "json", function () { return JSON.stringify (this); });
|
|
73
|
+
Define (Array.prototype, "exist", function (input, offset) { return this.includes (input, offset); });
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* string
|
|
77
|
+
*
|
|
78
|
+
* title
|
|
79
|
+
* description
|
|
80
|
+
* sub description
|
|
81
|
+
*
|
|
82
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
Define (String.prototype, "number", function () { return Number (this); });
|
|
86
|
+
Define (String.prototype, "integer", function () { return parseInt (this); });
|
|
87
|
+
Define (String.prototype, "float", function () { return parseFloat (this); });
|
|
88
|
+
Define (String.prototype, "json", function (type = "object") { try { return JSON.parse (this); } catch (e) { return type === "object" ? {} : []; } });
|
|
89
|
+
Define (String.prototype, "clone", function () { return this.trim (); });
|
|
90
|
+
Define (String.prototype, "format", function (format) { var string = this.trim (); for (var i in format) string = string.split (`{{ ${i} }}`).join (format [i]); return string; });
|
|
91
|
+
Define (String.prototype, "small", function () { return this.toLowerCase (); });
|
|
92
|
+
Define (String.prototype, "big", function () { return this.toUpperCase (); });
|
|
93
|
+
Define (String.prototype, "after", function (input, offset) { if ((offset = this.indexOf (input, offset)) >= 0) return this.substr (offset + input.length); else return ""; });
|
|
94
|
+
Define (String.prototype, "before", function (input, offset) { if ((offset = this.indexOf (input, offset)) >= 0) return this.substr (0, offset); else return ""; });
|
|
95
|
+
Define (String.prototype, "pop", function (length = 1) { return this.substr (0, (this.length - length)); });
|
|
96
|
+
Define (String.prototype, "exist", function (input, offset) { return this.includes (input, offset); });
|
|
97
|
+
Define (String.prototype, "reverse", function () { return this.split ("").reverse ().join (""); });
|
|
98
|
+
Define (String.prototype, "join", function (string) { return this + string; });
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* number
|
|
102
|
+
*
|
|
103
|
+
* title
|
|
104
|
+
* description
|
|
105
|
+
* sub description
|
|
106
|
+
*
|
|
107
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* date
|
|
112
|
+
*
|
|
113
|
+
* title
|
|
114
|
+
* description
|
|
115
|
+
* sub description
|
|
116
|
+
*
|
|
117
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* url
|
|
122
|
+
*
|
|
123
|
+
* title
|
|
124
|
+
* description
|
|
125
|
+
* sub description
|
|
126
|
+
*
|
|
127
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
Define (URL, "parse", function (url) {
|
|
131
|
+
var parse_url, result = {
|
|
132
|
+
host: {address: "", name: ""},
|
|
133
|
+
domain: {name: "", base: {name: ""}, sub: "www", extension: ""},
|
|
134
|
+
protocol: "http", port: "", user: "", password: "",
|
|
135
|
+
path: "", tag: "",
|
|
136
|
+
queries: {},
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
var parse_url = new URL (url);
|
|
140
|
+
result.host = {address: parse_url.host, name: parse_url.hostname}
|
|
141
|
+
result.domain = {name: "", base: {name: ""}, sub: "www", extension: ""}
|
|
142
|
+
result.protocol = parse_url.protocol.pop ();
|
|
143
|
+
result.port = parse_url.port ? parse_url.port.integer () : "";
|
|
144
|
+
result.user = parse_url.username;
|
|
145
|
+
result.password = parse_url.password;
|
|
146
|
+
result.path = parse_url.pathname;
|
|
147
|
+
result.tag = parse_url.hash;
|
|
148
|
+
result.query = function (key) { return result.queries [key] || ""; }
|
|
149
|
+
result.queries = {}
|
|
150
|
+
var queries = parse_url.search.after ("?").split ("&");
|
|
151
|
+
for (var i in queries) {
|
|
152
|
+
if (queries [i]) {
|
|
153
|
+
var key = queries [i].before ("=");
|
|
154
|
+
var value = queries [i].after ("=");
|
|
155
|
+
if (key) if (value) result.queries [key] = value;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
Define (URL, "header", function () {});
|
|
166
|
+
Define (URL.header, "status", {
|
|
167
|
+
OK: 200, success: 200,
|
|
168
|
+
error: {request: 400, forbidden: 403, found: 404, timeout: 408, legal: 451, internal: 500},
|
|
169
|
+
code: {
|
|
170
|
+
100: "Continue",
|
|
171
|
+
101: "Switching Protocols",
|
|
172
|
+
102: "Processing",
|
|
173
|
+
200: "OK",
|
|
174
|
+
201: "Created",
|
|
175
|
+
202: "Accepted",
|
|
176
|
+
203: "Non-authoritative Information",
|
|
177
|
+
204: "No Content",
|
|
178
|
+
205: "Reset Content",
|
|
179
|
+
206: "Partial Content",
|
|
180
|
+
207: "Multi-Status",
|
|
181
|
+
208: "Already Reported",
|
|
182
|
+
226: "IM Used",
|
|
183
|
+
300: "Multiple Choices",
|
|
184
|
+
301: "Moved Permanently",
|
|
185
|
+
302: "Found",
|
|
186
|
+
303: "See Other",
|
|
187
|
+
304: "Not Modified",
|
|
188
|
+
305: "Use Proxy",
|
|
189
|
+
307: "Temporary Redirect",
|
|
190
|
+
308: "Permanent Redirect",
|
|
191
|
+
400: "Bad Request",
|
|
192
|
+
401: "Unauthorized",
|
|
193
|
+
402: "Payment Required",
|
|
194
|
+
403: "Forbidden",
|
|
195
|
+
404: "Not Found",
|
|
196
|
+
405: "Method Not Allowed",
|
|
197
|
+
406: "Not Acceptable",
|
|
198
|
+
407: "Proxy Authentication Required",
|
|
199
|
+
408: "Request Timeout",
|
|
200
|
+
409: "Conflict",
|
|
201
|
+
410: "Gone",
|
|
202
|
+
411: "Length Required",
|
|
203
|
+
412: "Precondition Failed",
|
|
204
|
+
413: "Payload Too Large",
|
|
205
|
+
414: "Request-URI Too Long",
|
|
206
|
+
415: "Unsupported Media Type",
|
|
207
|
+
416: "Requested Range Not Satisfiable",
|
|
208
|
+
417: "Expectation Failed",
|
|
209
|
+
418: "I'm a teapot",
|
|
210
|
+
421: "Misdirected Request",
|
|
211
|
+
422: "Unprocessable Entity",
|
|
212
|
+
423: "Locked",
|
|
213
|
+
424: "Failed Dependency",
|
|
214
|
+
426: "Upgrade Required",
|
|
215
|
+
428: "Precondition Required",
|
|
216
|
+
429: "Too Many Requests",
|
|
217
|
+
431: "Request Header Fields Too Large",
|
|
218
|
+
444: "Connection Closed Without Response",
|
|
219
|
+
451: "Unavailable For Legal Reasons",
|
|
220
|
+
499: "Client Closed Request",
|
|
221
|
+
500: "Internal Server Error",
|
|
222
|
+
501: "Not Implemented",
|
|
223
|
+
502: "Bad Gateway",
|
|
224
|
+
503: "Service Unavailable",
|
|
225
|
+
504: "Gateway Timeout",
|
|
226
|
+
505: "HTTP Version Not Supported",
|
|
227
|
+
506: "Variant Also Negotiates",
|
|
228
|
+
507: "Insufficient Storage",
|
|
229
|
+
508: "Loop Detected",
|
|
230
|
+
510: "Not Extended",
|
|
231
|
+
511: "Network Authentication Required",
|
|
232
|
+
599: "Network Connect Timeout Error",
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* html
|
|
238
|
+
*
|
|
239
|
+
* title
|
|
240
|
+
* description
|
|
241
|
+
* sub description
|
|
242
|
+
*
|
|
243
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
Define (Function, "html", class {
|
|
247
|
+
constructor () {
|
|
248
|
+
this.head = new Function.html.head (this);
|
|
249
|
+
this.var = {
|
|
250
|
+
"html:attribute": {},
|
|
251
|
+
title: "UnTitled",
|
|
252
|
+
description: "",
|
|
253
|
+
charset: "UTF-8",
|
|
254
|
+
meta: [],
|
|
255
|
+
link: {style: []},
|
|
256
|
+
google: {font: [], "tag:manager": "G-6JM1DVVQPT"},
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
set (key, value) {
|
|
260
|
+
if (key === "html:attribute") for (var i in value) this.var ["html:attribute"][i] = value [i];
|
|
261
|
+
else if (key === "html:language") this.var ["html:attribute"]["lang"] = value;
|
|
262
|
+
else if (key === "meta") this.var.meta.push (value);
|
|
263
|
+
else if (key === "link:style") this.var.link.style.push (value);
|
|
264
|
+
else if (key === "google:font") this.var.google.font.push (value);
|
|
265
|
+
else this.var [key] = value;
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
delete (key, value) {
|
|
269
|
+
if (key === "html:attribute") delete this.var ["html:attribute"][value];
|
|
270
|
+
else if (key === "html:language") delete this.var ["html:attribute"]["lang"];
|
|
271
|
+
else delete this.var [key];
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
populate () {
|
|
275
|
+
this.populated = true;
|
|
276
|
+
this.head.meta ({charset: this.var.charset});
|
|
277
|
+
this.head.meta ({"http-equiv": "X-UA-Compatible", content: "IE=edge"});
|
|
278
|
+
this.head.meta ({"http-equiv": "X-Cross-Origin", content: "*"});
|
|
279
|
+
this.head.meta ({name: "viewport", content: this.var ["viewport"] || "width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=1"});
|
|
280
|
+
this.head.meta ({name: "generator", content: this.var ["generator"] || "Express (5.2.1) Vue (3.5.27)"});
|
|
281
|
+
this.head.meta ({name: "author", content: this.var ["author"] || "Netizen"});
|
|
282
|
+
this.head.meta ({name: "description", content: this.var.description});
|
|
283
|
+
this.head.meta ({name: "keywords", content: this.var ["keyword"]});
|
|
284
|
+
this.head.meta ({name: "robots", content: this.var ["robot"] || "index, follow, max-snippet:-1, max-video-preview:-1, max-image-preview:large"});
|
|
285
|
+
this.head.meta ({name: "rating", content: this.var ["rating"] || "general"});
|
|
286
|
+
this.head.meta ({name: "google", content: "notranslate"});
|
|
287
|
+
this.head.meta ({name: "googlebot", content: "notranslate"});
|
|
288
|
+
this.head.meta ({name: "googlebot-news", content: this.var ["google-bot:article"] || "index, follow"});
|
|
289
|
+
if (this.var ["google-site-verification"]) this.head.meta ({name: "google-site-verification", content: this.var ["google-site-verification"]});
|
|
290
|
+
if (this.var ["yandex-verification"]) this.head.meta ({name: "yandex-verification", content: this.var ["yandex-verification"]});
|
|
291
|
+
this.head.meta ({name: "twitter:card", content: this.var ["twitter:card"] || "summary_large_image"});
|
|
292
|
+
this.head.meta ({name: "twitter:title", content: this.var ["twitter:title"]});
|
|
293
|
+
this.head.meta ({name: "twitter:description", content: this.var ["twitter:description"] || this.var.description});
|
|
294
|
+
this.head.meta ({name: "twitter:image", content: this.var ["twitter:image"]});
|
|
295
|
+
this.head.meta ({property: "og:site_name", content: this.var ["og:site_name"]});
|
|
296
|
+
this.head.meta ({property: "og:site_description", content: this.var ["og:site_description"]});
|
|
297
|
+
this.head.meta ({property: "og:title", content: this.var ["og:title"] || this.var.title});
|
|
298
|
+
this.head.meta ({property: "og:description", content: this.var ["og:description"] || this.var.description});
|
|
299
|
+
this.head.meta ({property: "og:url", content: this.var ["og:url"] || this.var.canonical});
|
|
300
|
+
this.head.meta ({property: "og:image", content: this.var ["og:image"]});
|
|
301
|
+
this.head.meta ({property: "og:type", content: this.var ["og:type"] || "website"});
|
|
302
|
+
this.head.meta ({property: "og:locale", content: this.var ["og:locale"] || this.var ["html:attribute"]["lang"] || "en"});
|
|
303
|
+
for (var i in this.var.meta) this.head.meta (this.var.meta [i].attribute, this.var.meta [i].prop);
|
|
304
|
+
this.head.link ({rel: "icon", href: this.var ["favorite.ico"] || "/favicon.ico"});
|
|
305
|
+
this.head.link ({rel: "canonical", href: this.var.canonical || "/"});
|
|
306
|
+
if (this.var.manifest) this.head.link ({rel: "manifest", href: this.var.manifest || "/manifest.json"});
|
|
307
|
+
this.head.link ({rel: "dns-prefetch", href: "https://www.google-analytics.com"});
|
|
308
|
+
this.head.link ({rel: "dns-prefetch", href: "https://www.googletagmanager.com"});
|
|
309
|
+
this.head.link ({rel: "preconnect", href: "https://fonts.gstatic.com"}, "crossorigin");
|
|
310
|
+
this.head.link ({rel: "preconnect", href: "https://fonts.googleapis.com"}, "crossorigin");
|
|
311
|
+
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
312
|
+
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
313
|
+
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
314
|
+
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"});
|
|
315
|
+
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Google+Sans+Flex:opsz,slnt,wdth,wght,GRAD,ROND@6..144,-10..0,25..151,1..1000,0..100,0..100&display=swap"});
|
|
316
|
+
for (var i in this.var.google.font) this.head.link ({rel: "stylesheet", href: this.var.google.font [i]});
|
|
317
|
+
for (var i in this.var.link.style) this.head.link ({rel: "stylesheet", href: this.var.link.style [i]});
|
|
318
|
+
this.head.link ({rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css"});
|
|
319
|
+
this.head.link ({rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css"});
|
|
320
|
+
if (this.var.google ["tag:manager"]) this.head.script ({src: "https://www.googletagmanager.com/gtag/js?id=" + this.var.google ["tag:manager"]}, "async");
|
|
321
|
+
this.head.script ({src: "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"});
|
|
322
|
+
this.head.script ({src: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"});
|
|
323
|
+
this.head.script ({src: "https://unpkg.com/lodash@4.17.21/core.min.js"});
|
|
324
|
+
this.head.script ({src: "https://unpkg.com/vue@3.5.27/dist/vue.global.prod.js"});
|
|
325
|
+
this.head.script ({src: "https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js"});
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
render (variable = {}) {
|
|
329
|
+
if (!this.populated) this.populate ();
|
|
330
|
+
this.markup = new Function.html.markup (`<!DOCTYPE html>`);
|
|
331
|
+
this.markup.push (0, `<html${Function.html.attribute (this.var ["html:attribute"], {space: true})}>`);
|
|
332
|
+
this.markup.push (1, `<head>`);
|
|
333
|
+
this.markup.push (2, `<title>${this.var.title}</title>`);
|
|
334
|
+
for (var i in this.head.data.meta) this.markup.push (2, `<meta${Function.html.attribute (this.head.data.meta [i].attribute, {space: true, prop: this.head.data.meta [i].prop})}>`);
|
|
335
|
+
for (var i in this.head.data.link) this.markup.push (2, `<link${Function.html.attribute (this.head.data.link [i].attribute, {space: true, prop: this.head.data.link [i].prop})}>`);
|
|
336
|
+
for (var i in this.head.data.script) this.markup.push (2, `<script${Function.html.attribute (this.head.data.script [i].attribute, {space: true, prop: this.head.data.script [i].prop})}></script>`);
|
|
337
|
+
this.markup.push (1, `</head>`);
|
|
338
|
+
this.markup.push (1, `<body>`);
|
|
339
|
+
this.markup.push (1, `</body>`);
|
|
340
|
+
this.markup.push (0, `</html>`);
|
|
341
|
+
return this.markup.string ().format (variable);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
Define (Function.html, "head", class {
|
|
346
|
+
constructor () {
|
|
347
|
+
this.data = {meta: [], link: [], style: [], script: []}
|
|
348
|
+
}
|
|
349
|
+
meta (attribute, prop) {
|
|
350
|
+
this.data.meta.push ({attribute, prop});
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
link (attribute, prop) {
|
|
354
|
+
this.data.link.push ({attribute, prop});
|
|
355
|
+
return this;
|
|
356
|
+
}
|
|
357
|
+
script (attribute, prop) {
|
|
358
|
+
this.data.script.push ({attribute, prop});
|
|
359
|
+
return this;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
Define (Function.html, "attribute", function (attribute, option = {}) {
|
|
364
|
+
var result = [];
|
|
365
|
+
for (var i in attribute) result.push (`${i}="${attribute [i] || ''}"`);
|
|
366
|
+
if (option.prop) result.push (option.prop);
|
|
367
|
+
if (result = result.join (" ")) return (option.space ? " " : "") + result;
|
|
368
|
+
else return "";
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
Define (Function.html, "markup", class {
|
|
372
|
+
constructor (... markup) {
|
|
373
|
+
this.markup = [... markup];
|
|
374
|
+
}
|
|
375
|
+
push (tab, content) {
|
|
376
|
+
this.markup.push (("\t").repeat (tab) + content);
|
|
377
|
+
}
|
|
378
|
+
string (ln = "\n") {
|
|
379
|
+
return this.markup.join (ln);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* xxx
|
|
385
|
+
*
|
|
386
|
+
* title
|
|
387
|
+
* description
|
|
388
|
+
* sub description
|
|
389
|
+
*
|
|
390
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
391
|
+
*/
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* xxx
|
|
395
|
+
*
|
|
396
|
+
* title
|
|
397
|
+
* description
|
|
398
|
+
* sub description
|
|
399
|
+
*
|
|
400
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* xxx
|
|
405
|
+
*
|
|
406
|
+
* title
|
|
407
|
+
* description
|
|
408
|
+
* sub description
|
|
409
|
+
*
|
|
410
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
411
|
+
*/
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* xxx
|
|
415
|
+
*
|
|
416
|
+
* title
|
|
417
|
+
* description
|
|
418
|
+
* sub description
|
|
419
|
+
*
|
|
420
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
Symbol.export = {
|
|
424
|
+
define: Object.define,
|
|
425
|
+
object: Object, array: Array, string: String, number: Number, function: Function,
|
|
426
|
+
date: Date, time: Date.time, url: URL,
|
|
427
|
+
html: Function.html,
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* the end
|
|
432
|
+
*
|
|
433
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
434
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "script.io.js",
|
|
3
3
|
"description": "Hello World",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"author": "Seindi Rahmat Barus <xseindi@gmail.com>",
|
|
6
6
|
"contributors": ["Seindi Rahmat Barus <xseindi@gmail.com>"],
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"keywords": ["express", "vue", "mongodb"],
|
|
9
|
-
"main": "
|
|
9
|
+
"main": "index.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"LICENSE",
|
|
12
12
|
"README.md",
|
|
13
13
|
"HISTORY.md",
|
|
14
14
|
"SECURITY.md",
|
|
15
|
-
"
|
|
15
|
+
"index.js",
|
|
16
16
|
"node_packages/"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {}
|
package/library/script.js
DELETED
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* xxx
|
|
3
|
-
*
|
|
4
|
-
* title
|
|
5
|
-
* description
|
|
6
|
-
* sub description
|
|
7
|
-
*
|
|
8
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
function Define ($, key, value, option = {}) {
|
|
12
|
-
if (key) Object.defineProperty ($, key, {enumerable: option.enumerable || false, configurable: option.configurable || false, writable: option.writable || false, value});
|
|
13
|
-
else return new Define.properties ($);
|
|
14
|
-
}
|
|
15
|
-
Define.properties = class {
|
|
16
|
-
constructor (property) {
|
|
17
|
-
this.property = property;
|
|
18
|
-
}
|
|
19
|
-
export (data) {
|
|
20
|
-
return this.property.exports = data;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* object
|
|
26
|
-
*
|
|
27
|
-
* title
|
|
28
|
-
* description
|
|
29
|
-
* sub description
|
|
30
|
-
*
|
|
31
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
Define (Object, "define", Define);
|
|
35
|
-
|
|
36
|
-
Define (Object, "type", function (input) { return typeof input; });
|
|
37
|
-
Define (Object.type, "array", function (input) { if (arguments.length) return input instanceof Array || typeof input === "array"; else return Array; });
|
|
38
|
-
Define (Object.type, "boolean", function (input) { if (arguments.length) return input instanceof Boolean || typeof input === "boolean"; else return Boolean; });
|
|
39
|
-
Define (Object.type, "buffer", function (input) { if (arguments.length) return input instanceof Buffer || typeof input === "buffer"; else return Boolean; });
|
|
40
|
-
Define (Object.type, "date", function (input) { if (arguments.length) return input instanceof Date || typeof input === "date"; else return Date; });
|
|
41
|
-
Define (Object.type, "error", function (input) { if (arguments.length) return input instanceof Error || typeof input === "error"; else return Error; });
|
|
42
|
-
Define (Object.type, "function", function (input) { if (arguments.length) return input instanceof Function || typeof input === "function"; else return Function; });
|
|
43
|
-
Define (Object.type, "number", function (input) { if (arguments.length) return input instanceof Number || typeof input === "number"; else return Number; });
|
|
44
|
-
Define (Object.type, "object", function (input) { if (arguments.length) return input instanceof Object || typeof input === "object"; else return Object; });
|
|
45
|
-
Define (Object.type, "promise", function (input) { if (arguments.length) return input instanceof Promise || typeof input === "promise"; else return Promise; });
|
|
46
|
-
Define (Object.type, "regex", function (input) { if (arguments.length) return input instanceof RegExp || typeof input === "regex"; else return RegExp; });
|
|
47
|
-
Define (Object.type, "string", function (input) { if (arguments.length) return input instanceof String || typeof input === "string"; else return String; });
|
|
48
|
-
|
|
49
|
-
Define (Object, "type_of", function (input) { return Object.prototype.toString.call (input); });
|
|
50
|
-
Define (Object.type_of, "array", function (input) { if (arguments.length) return Object.type_of (input) === "[object Array]"; else return "[object Array]"; });
|
|
51
|
-
Define (Object.type_of, "boolean", function (input) { if (arguments.length) return Object.type_of (input) === "[object Boolean]"; else return "[object Boolean]"; });
|
|
52
|
-
Define (Object.type_of, "buffer", function (input) { if (arguments.length) return Object.type_of (input) === "[object Buffer]"; else return "[object Buffer]"; });
|
|
53
|
-
Define (Object.type_of, "date", function (input) { if (arguments.length) return Object.type_of (input) === "[object Date]"; else return "[object Date]"; });
|
|
54
|
-
Define (Object.type_of, "function", function (input) { if (arguments.length) return Object.type_of (input) === "[object Function]"; else return "[object Function]"; });
|
|
55
|
-
Define (Object.type_of, "null", function (input) { if (arguments.length) return Object.type_of (input) === "[object Null]"; else return "[object Null]"; });
|
|
56
|
-
Define (Object.type_of, "number", function (input) { if (arguments.length) return Object.type_of (input) === "[object Number]"; else return "[object Number]"; });
|
|
57
|
-
Define (Object.type_of, "object", function (input) { if (arguments.length) return Object.type_of (input) === "[object Object]"; else return "[object Object]"; });
|
|
58
|
-
Define (Object.type_of, "promise", function (input) { if (arguments.length) return Object.type_of (input) === "[object Promise]"; else return "[object Promise]"; });
|
|
59
|
-
Define (Object.type_of, "regex", function (input) { if (arguments.length) return Object.type_of (input) === "[object RegExp]"; else return "[object RegExp]"; });
|
|
60
|
-
Define (Object.type_of, "string", function (input) { if (arguments.length) return Object.type_of (input) === "[object String]"; else return "[object String]"; });
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* array
|
|
64
|
-
*
|
|
65
|
-
* title
|
|
66
|
-
* description
|
|
67
|
-
* sub description
|
|
68
|
-
*
|
|
69
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
Define (Array.prototype, "json", function () { return JSON.stringify (this); });
|
|
73
|
-
Define (Array.prototype, "exist", function (input, offset) { return this.includes (input, offset); });
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* string
|
|
77
|
-
*
|
|
78
|
-
* title
|
|
79
|
-
* description
|
|
80
|
-
* sub description
|
|
81
|
-
*
|
|
82
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
Define (String.prototype, "number", function () { return Number (this); });
|
|
86
|
-
Define (String.prototype, "integer", function () { return parseInt (this); });
|
|
87
|
-
Define (String.prototype, "float", function () { return parseFloat (this); });
|
|
88
|
-
Define (String.prototype, "json", function (type = "object") { try { return JSON.parse (this); } catch (e) { return type === "object" ? {} : []; } });
|
|
89
|
-
Define (String.prototype, "clone", function () { return this.trim (); });
|
|
90
|
-
Define (String.prototype, "format", function (format) { var string = this.trim (); for (var i in format) string = string.split (`{{ ${i} }}`).join (format [i]); return string; });
|
|
91
|
-
Define (String.prototype, "small", function () { return this.toLowerCase (); });
|
|
92
|
-
Define (String.prototype, "big", function () { return this.toUpperCase (); });
|
|
93
|
-
Define (String.prototype, "after", function (input, offset) { if ((offset = this.indexOf (input, offset)) >= 0) return this.substr (offset + input.length); else return ""; });
|
|
94
|
-
Define (String.prototype, "before", function (input, offset) { if ((offset = this.indexOf (input, offset)) >= 0) return this.substr (0, offset); else return ""; });
|
|
95
|
-
Define (String.prototype, "pop", function (length = 1) { return this.substr (0, (this.length - length)); });
|
|
96
|
-
Define (String.prototype, "exist", function (input, offset) { return this.includes (input, offset); });
|
|
97
|
-
Define (String.prototype, "reverse", function () { return this.split ("").reverse ().join (""); });
|
|
98
|
-
Define (String.prototype, "join", function (string) { return this + string; });
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* number
|
|
102
|
-
*
|
|
103
|
-
* title
|
|
104
|
-
* description
|
|
105
|
-
* sub description
|
|
106
|
-
*
|
|
107
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* date
|
|
112
|
-
*
|
|
113
|
-
* title
|
|
114
|
-
* description
|
|
115
|
-
* sub description
|
|
116
|
-
*
|
|
117
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* url
|
|
122
|
-
*
|
|
123
|
-
* title
|
|
124
|
-
* description
|
|
125
|
-
* sub description
|
|
126
|
-
*
|
|
127
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
Define (URL, "parse", function (url) {
|
|
131
|
-
var parse_url, result = {
|
|
132
|
-
host: {address: "", name: ""},
|
|
133
|
-
domain: {name: "", base: {name: ""}, sub: "www", extension: ""},
|
|
134
|
-
protocol: "http", port: "", user: "", password: "",
|
|
135
|
-
path: "", tag: "",
|
|
136
|
-
queries: {},
|
|
137
|
-
}
|
|
138
|
-
try {
|
|
139
|
-
var parse_url = new URL (url);
|
|
140
|
-
result.host = {address: parse_url.host, name: parse_url.hostname}
|
|
141
|
-
result.domain = {name: "", base: {name: ""}, sub: "www", extension: ""}
|
|
142
|
-
result.protocol = parse_url.protocol.pop ();
|
|
143
|
-
result.port = parse_url.port ? parse_url.port.integer () : "";
|
|
144
|
-
result.user = parse_url.username;
|
|
145
|
-
result.password = parse_url.password;
|
|
146
|
-
result.path = parse_url.pathname;
|
|
147
|
-
result.tag = parse_url.hash;
|
|
148
|
-
result.query = function (key) { return result.queries [key] || ""; }
|
|
149
|
-
result.queries = {}
|
|
150
|
-
var queries = parse_url.search.after ("?").split ("&");
|
|
151
|
-
for (var i in queries) {
|
|
152
|
-
if (queries [i]) {
|
|
153
|
-
var key = queries [i].before ("=");
|
|
154
|
-
var value = queries [i].after ("=");
|
|
155
|
-
if (key) if (value) result.queries [key] = value;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return result;
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
Define (URL, "header", function () {});
|
|
166
|
-
Define (URL.header, "status", {
|
|
167
|
-
OK: 200, success: 200,
|
|
168
|
-
error: {request: 400, forbidden: 403, found: 404, timeout: 408, legal: 451, internal: 500},
|
|
169
|
-
code: {
|
|
170
|
-
100: "Continue",
|
|
171
|
-
101: "Switching Protocols",
|
|
172
|
-
102: "Processing",
|
|
173
|
-
200: "OK",
|
|
174
|
-
201: "Created",
|
|
175
|
-
202: "Accepted",
|
|
176
|
-
203: "Non-authoritative Information",
|
|
177
|
-
204: "No Content",
|
|
178
|
-
205: "Reset Content",
|
|
179
|
-
206: "Partial Content",
|
|
180
|
-
207: "Multi-Status",
|
|
181
|
-
208: "Already Reported",
|
|
182
|
-
226: "IM Used",
|
|
183
|
-
300: "Multiple Choices",
|
|
184
|
-
301: "Moved Permanently",
|
|
185
|
-
302: "Found",
|
|
186
|
-
303: "See Other",
|
|
187
|
-
304: "Not Modified",
|
|
188
|
-
305: "Use Proxy",
|
|
189
|
-
307: "Temporary Redirect",
|
|
190
|
-
308: "Permanent Redirect",
|
|
191
|
-
400: "Bad Request",
|
|
192
|
-
401: "Unauthorized",
|
|
193
|
-
402: "Payment Required",
|
|
194
|
-
403: "Forbidden",
|
|
195
|
-
404: "Not Found",
|
|
196
|
-
405: "Method Not Allowed",
|
|
197
|
-
406: "Not Acceptable",
|
|
198
|
-
407: "Proxy Authentication Required",
|
|
199
|
-
408: "Request Timeout",
|
|
200
|
-
409: "Conflict",
|
|
201
|
-
410: "Gone",
|
|
202
|
-
411: "Length Required",
|
|
203
|
-
412: "Precondition Failed",
|
|
204
|
-
413: "Payload Too Large",
|
|
205
|
-
414: "Request-URI Too Long",
|
|
206
|
-
415: "Unsupported Media Type",
|
|
207
|
-
416: "Requested Range Not Satisfiable",
|
|
208
|
-
417: "Expectation Failed",
|
|
209
|
-
418: "I'm a teapot",
|
|
210
|
-
421: "Misdirected Request",
|
|
211
|
-
422: "Unprocessable Entity",
|
|
212
|
-
423: "Locked",
|
|
213
|
-
424: "Failed Dependency",
|
|
214
|
-
426: "Upgrade Required",
|
|
215
|
-
428: "Precondition Required",
|
|
216
|
-
429: "Too Many Requests",
|
|
217
|
-
431: "Request Header Fields Too Large",
|
|
218
|
-
444: "Connection Closed Without Response",
|
|
219
|
-
451: "Unavailable For Legal Reasons",
|
|
220
|
-
499: "Client Closed Request",
|
|
221
|
-
500: "Internal Server Error",
|
|
222
|
-
501: "Not Implemented",
|
|
223
|
-
502: "Bad Gateway",
|
|
224
|
-
503: "Service Unavailable",
|
|
225
|
-
504: "Gateway Timeout",
|
|
226
|
-
505: "HTTP Version Not Supported",
|
|
227
|
-
506: "Variant Also Negotiates",
|
|
228
|
-
507: "Insufficient Storage",
|
|
229
|
-
508: "Loop Detected",
|
|
230
|
-
510: "Not Extended",
|
|
231
|
-
511: "Network Authentication Required",
|
|
232
|
-
599: "Network Connect Timeout Error",
|
|
233
|
-
},
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* html
|
|
238
|
-
*
|
|
239
|
-
* title
|
|
240
|
-
* description
|
|
241
|
-
* sub description
|
|
242
|
-
*
|
|
243
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
Define (Function, "html", class {
|
|
247
|
-
constructor () {
|
|
248
|
-
this.head = new Function.html.head (this);
|
|
249
|
-
this.var = {
|
|
250
|
-
"html:attribute": {},
|
|
251
|
-
title: "UnTitled",
|
|
252
|
-
description: "",
|
|
253
|
-
charset: "UTF-8",
|
|
254
|
-
meta: [],
|
|
255
|
-
link: {style: []},
|
|
256
|
-
google: {font: [], "tag:manager": "G-6JM1DVVQPT"},
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
set (key, value) {
|
|
260
|
-
if (key === "html:attribute") for (var i in value) this.var ["html:attribute"][i] = value [i];
|
|
261
|
-
else if (key === "html:language") this.var ["html:attribute"]["lang"] = value;
|
|
262
|
-
else if (key === "meta") this.var.meta.push (value);
|
|
263
|
-
else if (key === "link:style") this.var.link.style.push (value);
|
|
264
|
-
else if (key === "google:font") this.var.google.font.push (value);
|
|
265
|
-
else this.var [key] = value;
|
|
266
|
-
return this;
|
|
267
|
-
}
|
|
268
|
-
delete (key, value) {
|
|
269
|
-
if (key === "html:attribute") delete this.var ["html:attribute"][value];
|
|
270
|
-
else if (key === "html:language") delete this.var ["html:attribute"]["lang"];
|
|
271
|
-
else delete this.var [key];
|
|
272
|
-
return this;
|
|
273
|
-
}
|
|
274
|
-
populate () {
|
|
275
|
-
this.populated = true;
|
|
276
|
-
this.head.meta ({charset: this.var.charset});
|
|
277
|
-
this.head.meta ({"http-equiv": "X-UA-Compatible", content: "IE=edge"});
|
|
278
|
-
this.head.meta ({"http-equiv": "X-Cross-Origin", content: "*"});
|
|
279
|
-
this.head.meta ({name: "viewport", content: this.var ["viewport"] || "width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=1"});
|
|
280
|
-
this.head.meta ({name: "generator", content: this.var ["generator"] || "Express (5.2.1) Vue (3.5.27)"});
|
|
281
|
-
this.head.meta ({name: "author", content: this.var ["author"] || "Netizen"});
|
|
282
|
-
this.head.meta ({name: "description", content: this.var.description});
|
|
283
|
-
this.head.meta ({name: "keywords", content: this.var ["keyword"]});
|
|
284
|
-
this.head.meta ({name: "robots", content: this.var ["robot"] || "index, follow, max-snippet:-1, max-video-preview:-1, max-image-preview:large"});
|
|
285
|
-
this.head.meta ({name: "rating", content: this.var ["rating"] || "general"});
|
|
286
|
-
this.head.meta ({name: "google", content: "notranslate"});
|
|
287
|
-
this.head.meta ({name: "googlebot", content: "notranslate"});
|
|
288
|
-
this.head.meta ({name: "googlebot-news", content: this.var ["google-bot:article"] || "index, follow"});
|
|
289
|
-
if (this.var ["google-site-verification"]) this.head.meta ({name: "google-site-verification", content: this.var ["google-site-verification"]});
|
|
290
|
-
if (this.var ["yandex-verification"]) this.head.meta ({name: "yandex-verification", content: this.var ["yandex-verification"]});
|
|
291
|
-
this.head.meta ({name: "twitter:card", content: this.var ["twitter:card"] || "summary_large_image"});
|
|
292
|
-
this.head.meta ({name: "twitter:title", content: this.var ["twitter:title"]});
|
|
293
|
-
this.head.meta ({name: "twitter:description", content: this.var ["twitter:description"] || this.var.description});
|
|
294
|
-
this.head.meta ({name: "twitter:image", content: this.var ["twitter:image"]});
|
|
295
|
-
this.head.meta ({property: "og:site_name", content: this.var ["og:site_name"]});
|
|
296
|
-
this.head.meta ({property: "og:site_description", content: this.var ["og:site_description"]});
|
|
297
|
-
this.head.meta ({property: "og:title", content: this.var ["og:title"] || this.var.title});
|
|
298
|
-
this.head.meta ({property: "og:description", content: this.var ["og:description"] || this.var.description});
|
|
299
|
-
this.head.meta ({property: "og:url", content: this.var ["og:url"] || this.var.canonical});
|
|
300
|
-
this.head.meta ({property: "og:image", content: this.var ["og:image"]});
|
|
301
|
-
this.head.meta ({property: "og:type", content: this.var ["og:type"] || "website"});
|
|
302
|
-
this.head.meta ({property: "og:locale", content: this.var ["og:locale"] || this.var ["html:attribute"]["lang"] || "en"});
|
|
303
|
-
for (var i in this.var.meta) this.head.meta (this.var.meta [i].attribute, this.var.meta [i].prop);
|
|
304
|
-
this.head.link ({rel: "icon", href: this.var ["favorite.ico"] || "/favicon.ico"});
|
|
305
|
-
this.head.link ({rel: "canonical", href: this.var.canonical || "/"});
|
|
306
|
-
if (this.var.manifest) this.head.link ({rel: "manifest", href: this.var.manifest || "/manifest.json"});
|
|
307
|
-
this.head.link ({rel: "dns-prefetch", href: "https://www.google-analytics.com"});
|
|
308
|
-
this.head.link ({rel: "dns-prefetch", href: "https://www.googletagmanager.com"});
|
|
309
|
-
this.head.link ({rel: "preconnect", href: "https://fonts.gstatic.com"}, "crossorigin");
|
|
310
|
-
this.head.link ({rel: "preconnect", href: "https://fonts.googleapis.com"}, "crossorigin");
|
|
311
|
-
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
312
|
-
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
313
|
-
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"});
|
|
314
|
-
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"});
|
|
315
|
-
this.head.link ({rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Google+Sans+Flex:opsz,slnt,wdth,wght,GRAD,ROND@6..144,-10..0,25..151,1..1000,0..100,0..100&display=swap"});
|
|
316
|
-
for (var i in this.var.google.font) this.head.link ({rel: "stylesheet", href: this.var.google.font [i]});
|
|
317
|
-
for (var i in this.var.link.style) this.head.link ({rel: "stylesheet", href: this.var.link.style [i]});
|
|
318
|
-
this.head.link ({rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css"});
|
|
319
|
-
this.head.link ({rel: "stylesheet", href: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css"});
|
|
320
|
-
if (this.var.google ["tag:manager"]) this.head.script ({src: "https://www.googletagmanager.com/gtag/js?id=" + this.var.google ["tag:manager"]}, "async");
|
|
321
|
-
this.head.script ({src: "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"});
|
|
322
|
-
this.head.script ({src: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"});
|
|
323
|
-
this.head.script ({src: "https://unpkg.com/lodash@4.17.21/core.min.js"});
|
|
324
|
-
this.head.script ({src: "https://unpkg.com/vue@3.5.27/dist/vue.global.prod.js"});
|
|
325
|
-
this.head.script ({src: "https://unpkg.com/vue-router@4.6.4/dist/vue-router.global.prod.js"});
|
|
326
|
-
return this;
|
|
327
|
-
}
|
|
328
|
-
render (variable = {}) {
|
|
329
|
-
if (!this.populated) this.populate ();
|
|
330
|
-
this.markup = new Function.html.markup (`<!DOCTYPE html>`);
|
|
331
|
-
this.markup.push (0, `<html${Function.html.attribute (this.var ["html:attribute"], {space: true})}>`);
|
|
332
|
-
this.markup.push (1, `<head>`);
|
|
333
|
-
this.markup.push (2, `<title>${this.var.title}</title>`);
|
|
334
|
-
for (var i in this.head.data.meta) this.markup.push (2, `<meta${Function.html.attribute (this.head.data.meta [i].attribute, {space: true, prop: this.head.data.meta [i].prop})}>`);
|
|
335
|
-
for (var i in this.head.data.link) this.markup.push (2, `<link${Function.html.attribute (this.head.data.link [i].attribute, {space: true, prop: this.head.data.link [i].prop})}>`);
|
|
336
|
-
for (var i in this.head.data.script) this.markup.push (2, `<script${Function.html.attribute (this.head.data.script [i].attribute, {space: true, prop: this.head.data.script [i].prop})}></script>`);
|
|
337
|
-
this.markup.push (1, `</head>`);
|
|
338
|
-
this.markup.push (1, `<body>`);
|
|
339
|
-
this.markup.push (1, `</body>`);
|
|
340
|
-
this.markup.push (0, `</html>`);
|
|
341
|
-
return this.markup.string ().format (variable);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
Define (Function.html, "head", class {
|
|
346
|
-
constructor () {
|
|
347
|
-
this.data = {meta: [], link: [], style: [], script: []}
|
|
348
|
-
}
|
|
349
|
-
meta (attribute, prop) {
|
|
350
|
-
this.data.meta.push ({attribute, prop});
|
|
351
|
-
return this;
|
|
352
|
-
}
|
|
353
|
-
link (attribute, prop) {
|
|
354
|
-
this.data.link.push ({attribute, prop});
|
|
355
|
-
return this;
|
|
356
|
-
}
|
|
357
|
-
script (attribute, prop) {
|
|
358
|
-
this.data.script.push ({attribute, prop});
|
|
359
|
-
return this;
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
Define (Function.html, "attribute", function (attribute, option = {}) {
|
|
364
|
-
var result = [];
|
|
365
|
-
for (var i in attribute) result.push (`${i}="${attribute [i] || ''}"`);
|
|
366
|
-
if (option.prop) result.push (option.prop);
|
|
367
|
-
if (result = result.join (" ")) return (option.space ? " " : "") + result;
|
|
368
|
-
else return "";
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
Define (Function.html, "markup", class {
|
|
372
|
-
constructor (... markup) {
|
|
373
|
-
this.markup = [... markup];
|
|
374
|
-
}
|
|
375
|
-
push (tab, content) {
|
|
376
|
-
this.markup.push (("\t").repeat (tab) + content);
|
|
377
|
-
}
|
|
378
|
-
string (ln = "\n") {
|
|
379
|
-
return this.markup.join (ln);
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* xxx
|
|
385
|
-
*
|
|
386
|
-
* title
|
|
387
|
-
* description
|
|
388
|
-
* sub description
|
|
389
|
-
*
|
|
390
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* xxx
|
|
395
|
-
*
|
|
396
|
-
* title
|
|
397
|
-
* description
|
|
398
|
-
* sub description
|
|
399
|
-
*
|
|
400
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* xxx
|
|
405
|
-
*
|
|
406
|
-
* title
|
|
407
|
-
* description
|
|
408
|
-
* sub description
|
|
409
|
-
*
|
|
410
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
411
|
-
*/
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* xxx
|
|
415
|
-
*
|
|
416
|
-
* title
|
|
417
|
-
* description
|
|
418
|
-
* sub description
|
|
419
|
-
*
|
|
420
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
421
|
-
*/
|
|
422
|
-
|
|
423
|
-
Symbol.export = {
|
|
424
|
-
define: Object.define,
|
|
425
|
-
object: Object, array: Array, string: String, number: Number, function: Function,
|
|
426
|
-
date: Date, time: Date.time, url: URL,
|
|
427
|
-
html: Function.html,
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* the end
|
|
432
|
-
*
|
|
433
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
434
|
-
*/
|