script.io.js 1.0.916 → 1.0.1152
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 +72 -78
- package/package.json +1 -1
package/index.js
CHANGED
package/node_packages/script.js
CHANGED
|
@@ -117,17 +117,9 @@ Define (String.prototype, "join", function (string) { return this + string; });
|
|
|
117
117
|
* xxx://xxx.xxx.xxx/xxx
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
* title
|
|
124
|
-
* description
|
|
125
|
-
* sub description
|
|
126
|
-
*
|
|
127
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
JSON.pretty = function (json) { return JSON.stringify (json, null, "\t"); }
|
|
120
|
+
Define (Date, "time", function () { return Date.now (); });
|
|
121
|
+
Define (Date, "timeout", function (context, second = 1) { return setTimeout (context, (second * 1000)); });
|
|
122
|
+
Define (Date.timeout, "clear", function (context) { return clearTimeout (context); });
|
|
131
123
|
|
|
132
124
|
/**
|
|
133
125
|
* url
|
|
@@ -179,72 +171,66 @@ Define (URL.header, "status", {
|
|
|
179
171
|
OK: 200, success: 200,
|
|
180
172
|
error: {request: 400, forbidden: 403, found: 404, timeout: 408, legal: 451, internal: 500},
|
|
181
173
|
code: {
|
|
182
|
-
100: "Continue",
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
202: "Accepted",
|
|
188
|
-
203: "Non-authoritative Information",
|
|
189
|
-
204: "No Content",
|
|
190
|
-
205: "Reset Content",
|
|
191
|
-
206: "Partial Content",
|
|
192
|
-
207: "Multi-Status",
|
|
193
|
-
208: "Already Reported",
|
|
194
|
-
226: "IM Used",
|
|
195
|
-
300: "Multiple Choices",
|
|
196
|
-
301: "Moved Permanently",
|
|
197
|
-
302: "Found",
|
|
198
|
-
303: "See Other",
|
|
199
|
-
304: "Not Modified",
|
|
200
|
-
305: "Use Proxy",
|
|
201
|
-
307: "Temporary Redirect",
|
|
202
|
-
308: "Permanent Redirect",
|
|
203
|
-
400: "Bad Request",
|
|
204
|
-
401: "Unauthorized",
|
|
205
|
-
402: "Payment Required",
|
|
206
|
-
403: "Forbidden",
|
|
207
|
-
404: "Not Found",
|
|
208
|
-
405: "Method Not Allowed",
|
|
209
|
-
406: "Not Acceptable",
|
|
210
|
-
407: "Proxy Authentication Required",
|
|
211
|
-
408: "Request Timeout",
|
|
212
|
-
409: "Conflict",
|
|
213
|
-
410: "Gone",
|
|
214
|
-
411: "Length Required",
|
|
215
|
-
412: "Precondition Failed",
|
|
216
|
-
413: "Payload Too Large",
|
|
217
|
-
414: "Request-URI Too Long",
|
|
218
|
-
415: "Unsupported Media Type",
|
|
219
|
-
416: "Requested Range Not Satisfiable",
|
|
220
|
-
417: "Expectation Failed",
|
|
221
|
-
418: "I'm a teapot",
|
|
222
|
-
421: "Misdirected Request",
|
|
223
|
-
422: "Unprocessable Entity",
|
|
224
|
-
423: "Locked",
|
|
225
|
-
424: "Failed Dependency",
|
|
226
|
-
426: "Upgrade Required",
|
|
227
|
-
428: "Precondition Required",
|
|
228
|
-
429: "Too Many Requests",
|
|
229
|
-
431: "Request Header Fields Too Large",
|
|
230
|
-
444: "Connection Closed Without Response",
|
|
231
|
-
451: "Unavailable For Legal Reasons",
|
|
232
|
-
499: "Client Closed Request",
|
|
233
|
-
500: "Internal Server Error",
|
|
234
|
-
501: "Not Implemented",
|
|
235
|
-
502: "Bad Gateway",
|
|
236
|
-
503: "Service Unavailable",
|
|
237
|
-
504: "Gateway Timeout",
|
|
238
|
-
505: "HTTP Version Not Supported",
|
|
239
|
-
506: "Variant Also Negotiates",
|
|
240
|
-
507: "Insufficient Storage",
|
|
241
|
-
508: "Loop Detected",
|
|
242
|
-
510: "Not Extended",
|
|
243
|
-
511: "Network Authentication Required",
|
|
244
|
-
599: "Network Connect Timeout Error",
|
|
174
|
+
100: "Continue", 101: "Switching Protocols", 102: "Processing",
|
|
175
|
+
200: "OK", 201: "Created", 202: "Accepted", 203: "Non-authoritative Information", 204: "No Content", 205: "Reset Content", 206: "Partial Content", 207: "Multi-Status", 208: "Already Reported", 226: "IM Used",
|
|
176
|
+
300: "Multiple Choices", 301: "Moved Permanently", 302: "Found", 303: "See Other", 304: "Not Modified", 305: "Use Proxy", 307: "Temporary Redirect", 308: "Permanent Redirect",
|
|
177
|
+
400: "Bad Request", 401: "Unauthorized", 402: "Payment Required", 403: "Forbidden", 404: "Not Found", 405: "Method Not Allowed", 406: "Not Acceptable", 407: "Proxy Authentication Required", 408: "Request Timeout", 409: "Conflict", 410: "Gone", 411: "Length Required", 412: "Precondition Failed", 413: "Payload Too Large", 414: "Request-URI Too Long", 415: "Unsupported Media Type", 416: "Requested Range Not Satisfiable", 417: "Expectation Failed", 418: "I'm a teapot", 421: "Misdirected Request", 422: "Unprocessable Entity", 423: "Locked", 424: "Failed Dependency", 426: "Upgrade Required", 428: "Precondition Required", 429: "Too Many Requests", 431: "Request Header Fields Too Large", 444: "Connection Closed Without Response", 451: "Unavailable For Legal Reasons", 499: "Client Closed Request",
|
|
178
|
+
500: "Internal Server Error", 501: "Not Implemented", 502: "Bad Gateway", 503: "Service Unavailable", 504: "Gateway Timeout", 505: "HTTP Version Not Supported", 506: "Variant Also Negotiates", 507: "Insufficient Storage", 508: "Loop Detected", 510: "Not Extended", 511: "Network Authentication Required", 599: "Network Connect Timeout Error",
|
|
245
179
|
},
|
|
246
180
|
});
|
|
247
181
|
|
|
182
|
+
/**
|
|
183
|
+
* json
|
|
184
|
+
*
|
|
185
|
+
* title
|
|
186
|
+
* description
|
|
187
|
+
* sub description
|
|
188
|
+
*
|
|
189
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
Define (JSON, "pretty", function (json) { return JSON.stringify (json, null, "\t"); });
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* miscellaneous
|
|
196
|
+
*
|
|
197
|
+
* title
|
|
198
|
+
* description
|
|
199
|
+
* sub description
|
|
200
|
+
*
|
|
201
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* path
|
|
206
|
+
*
|
|
207
|
+
* title
|
|
208
|
+
* description
|
|
209
|
+
* sub description
|
|
210
|
+
*
|
|
211
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
Define (Function, "path", function () {});
|
|
215
|
+
Define (Function.path, "r", function (path) { return "./" + path; });
|
|
216
|
+
Define (Function.path, "require", function () { return Function.path.api = require ("path"); });
|
|
217
|
+
Define (Function.path, "join", function (... path) { return Function.path.api.join (... path); });
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* file
|
|
221
|
+
*
|
|
222
|
+
* title
|
|
223
|
+
* description
|
|
224
|
+
* sub description
|
|
225
|
+
*
|
|
226
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
Define (Function, "file", function () {});
|
|
230
|
+
Define (Function.file, "require", function () { return Function.file.api = require ("fs"); });
|
|
231
|
+
Define (Function.file, "write", function (file, content, context) { if (context) return Function.file.api.writeFile (file, content, context); else return Function.file.api.writeFileSync (file, content); });
|
|
232
|
+
Define (Function.file, "read", function (file, context) { if (context) return Function.file.api.readFile (file, context); else return Function.file.api.readFileSync (file); });
|
|
233
|
+
|
|
248
234
|
/**
|
|
249
235
|
* html
|
|
250
236
|
*
|
|
@@ -346,13 +332,16 @@ Define (Function, "html", class {
|
|
|
346
332
|
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})}>`);
|
|
347
333
|
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})}>`);
|
|
348
334
|
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>`);
|
|
335
|
+
for (var i in this.head.data.style) this.markup.push (2, `<style${Function.html.attribute (this.head.data.style [i].attribute, {space: true, prop: this.head.data.style [i].prop})}>${this.head.data.style [i].css}</style>`);
|
|
349
336
|
this.markup.push (1, `</head>`);
|
|
350
337
|
this.markup.push (1, `<body>`);
|
|
351
338
|
this.markup.push (1, `</body>`);
|
|
352
339
|
this.markup.push (0, `</html>`);
|
|
353
|
-
this.
|
|
354
|
-
|
|
355
|
-
|
|
340
|
+
if (this.var.debug) {
|
|
341
|
+
this.markup.push (0, `<!--`);
|
|
342
|
+
this.markup.push (0, (this.var.debug || ""));
|
|
343
|
+
this.markup.push (0, `-->`);
|
|
344
|
+
}
|
|
356
345
|
return this.markup.string ().format (variable);
|
|
357
346
|
}
|
|
358
347
|
});
|
|
@@ -369,6 +358,10 @@ Define (Function.html, "head", class {
|
|
|
369
358
|
this.data.link.push ({attribute, prop});
|
|
370
359
|
return this;
|
|
371
360
|
}
|
|
361
|
+
style (attribute, prop, css) {
|
|
362
|
+
this.data.style.push ({attribute, prop, css});
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
372
365
|
script (attribute, prop) {
|
|
373
366
|
this.data.script.push ({attribute, prop});
|
|
374
367
|
return this;
|
|
@@ -438,7 +431,8 @@ Define (Function.html, "markup", class {
|
|
|
438
431
|
Symbol.export = {
|
|
439
432
|
define: Object.define,
|
|
440
433
|
object: Object, array: Array, string: String, number: Number, function: Function,
|
|
441
|
-
date: Date, time: Date.time, url: URL,
|
|
434
|
+
date: Date, time: Date.time, url: URL, json: JSON,
|
|
435
|
+
path: Function.path, file: Function.file, dir: Function.dir,
|
|
442
436
|
html: Function.html,
|
|
443
437
|
}
|
|
444
438
|
|