prototype.exe 0.0.3 → 0.0.5
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/package.json +1 -1
- package/src/prototype.js +246 -4
package/package.json
CHANGED
package/src/prototype.js
CHANGED
|
@@ -909,7 +909,7 @@ Define (Function, "html", class {
|
|
|
909
909
|
if (false) if (this.var ["google:auth"]) this.markup.push (2, `<script src="https://accounts.google.com/gsi/client" async></script>`);
|
|
910
910
|
this.markup.script (2, {src: "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"});
|
|
911
911
|
this.markup.script (2, {src: "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"});
|
|
912
|
-
if (
|
|
912
|
+
if (this.var ["prototype.js"]) this.markup.script (2, {src: this.var ["prototype.js"]});
|
|
913
913
|
this.markup.push (2, `<script type="module" src="${this.var ['vue.js:bundle']}" crossorigin></script>`);
|
|
914
914
|
this.markup.push (2, `<script type="application/ld+json">{"@context": "https://schema.org", "@type": "WebPage", "name": "${this.var.site.name}", "alternateName": "${this.var ['site:alternate-name']}", "url": "${this.var ['canonical']}", "description": "${this.var ['description']}"}</script>`);
|
|
915
915
|
this.markup.push (2, `<script type="application/ld+json">{"@context": "https://schema.org", "@graph": [{"@type": "website", "@id": "${this.var ['canonical']}", "name": "${this.var.site.name}", "url": "${this.var ['canonical']}", "description": "${this.var ['description']}"}]}</script>`);
|
|
@@ -917,6 +917,7 @@ Define (Function, "html", class {
|
|
|
917
917
|
this.markup.push (2, `<script>$.app.id = "{{ $.app.id }}"</script>`);
|
|
918
918
|
this.markup.push (2, `<script>$.app.reference = {{ $.app.reference }}</script>`);
|
|
919
919
|
this.markup.push (2, `<script>$.app.var = {{ $.app.var }}</script>`);
|
|
920
|
+
this.markup.push (2, `<script>$.app.config = {{ $.app.config }}</script>`);
|
|
920
921
|
this.markup.push (2, `<script>$.app.document = {{ $.app.document }}</script>`);
|
|
921
922
|
this.markup.push (2, `<script>$.app.theme = {{ $.app.theme }}</script>`);
|
|
922
923
|
this.markup.push (2, `<script>$.app.router = {{ $.app.router }}</script>`);
|
|
@@ -1038,6 +1039,182 @@ Define (Function.html, "markup", class {
|
|
|
1038
1039
|
}
|
|
1039
1040
|
});
|
|
1040
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* sitemap
|
|
1044
|
+
*
|
|
1045
|
+
* title
|
|
1046
|
+
* description
|
|
1047
|
+
* sub description
|
|
1048
|
+
*
|
|
1049
|
+
* xxx://xxx.xxx.xxx/xxx
|
|
1050
|
+
*/
|
|
1051
|
+
|
|
1052
|
+
Define (Function, "sitemap", function () {});
|
|
1053
|
+
Define (Function.sitemap, "index", function (data, style) {
|
|
1054
|
+
var sitemap = [`<?xml version="1.0" encoding="UTF-8"?>`];
|
|
1055
|
+
if (style) sitemap.push (`<?xml-stylesheet type="text/xsl" href="${style}"?>`);
|
|
1056
|
+
sitemap.push (`<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`);
|
|
1057
|
+
for (var i in data) {
|
|
1058
|
+
sitemap.push (("\t").repeat (1) + `<sitemap>`);
|
|
1059
|
+
sitemap.push (("\t").repeat (2) + `<loc>${data [i].url}</loc>`);
|
|
1060
|
+
sitemap.push (("\t").repeat (2) + `<lastmod>${data [i].date.modified}</lastmod>`);
|
|
1061
|
+
sitemap.push (("\t").repeat (1) + `</sitemap>`);
|
|
1062
|
+
}
|
|
1063
|
+
sitemap.push (`</sitemapindex>`);
|
|
1064
|
+
return sitemap.join ("\n");
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
Define (Function, "sitemap.xsl", `<?xml version="1.0" encoding="UTF-8"?>
|
|
1068
|
+
<xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1069
|
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
|
1070
|
+
<xsl:template match="/">
|
|
1071
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
1072
|
+
<head>
|
|
1073
|
+
<title>XML Sitemap</title>
|
|
1074
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
1075
|
+
<style type="text/css">
|
|
1076
|
+
body { font: 14px "Open Sans", Helvetica, Arial, sans-serif; margin: 0; }
|
|
1077
|
+
a { color: #3498db; text-decoration: none; }
|
|
1078
|
+
h1 { margin: 0; }
|
|
1079
|
+
#description { background-color: #f0f2eb; color: #000; padding: 30px 30px 20px; }
|
|
1080
|
+
#description a { color: #008710; }
|
|
1081
|
+
#content { padding: 10px 30px 30px; background: #fff; }
|
|
1082
|
+
a:hover { border-bottom: 1px solid; }
|
|
1083
|
+
th, td { font-size: 12px; }
|
|
1084
|
+
th { text-align: left; border-bottom: 1px solid #ccc; }
|
|
1085
|
+
th, td { padding: 10px 15px; }
|
|
1086
|
+
.odd { background: linear-gradient(159.87deg, #f6f6f4 7.24%, #f7f4ea 64.73%, #ddedd5 116.53%); }
|
|
1087
|
+
#footer { margin: 20px 30px; font-size: 12px; color: #999; }
|
|
1088
|
+
#footer a { color: inherit; }
|
|
1089
|
+
#description a, #footer a { border-bottom: 1px solid; }
|
|
1090
|
+
#description a:hover, #footer a:hover { border-bottom: none; }
|
|
1091
|
+
img { max-height: 100px; max-width: 100px; }
|
|
1092
|
+
</style>
|
|
1093
|
+
</head>
|
|
1094
|
+
<body>
|
|
1095
|
+
<div id="description">
|
|
1096
|
+
<h1>XML Sitemap</h1>
|
|
1097
|
+
<p>This is an XML Sitemap generated by <a href="{{ url }}">{{ name }}</a>, meant to be consumed by search engines like <a href="https://www.google.com">Google</a> or <a href="https://www.bing.com">Bing</a>.</p>
|
|
1098
|
+
<p>You can find more information on XML sitemaps at <a href="https://sitemaps.org">sitemaps.org</a></p>
|
|
1099
|
+
</div>
|
|
1100
|
+
<div id="content">
|
|
1101
|
+
<table>
|
|
1102
|
+
<tr>
|
|
1103
|
+
<th>#</th>
|
|
1104
|
+
<th>URL</th>
|
|
1105
|
+
<th>Last Modified</th>
|
|
1106
|
+
</tr>
|
|
1107
|
+
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
|
1108
|
+
<tr>
|
|
1109
|
+
<xsl:choose>
|
|
1110
|
+
<xsl:when test="position() mod 2 != 1">
|
|
1111
|
+
<xsl:attribute name="class">odd</xsl:attribute>
|
|
1112
|
+
</xsl:when>
|
|
1113
|
+
</xsl:choose>
|
|
1114
|
+
<td>
|
|
1115
|
+
<xsl:value-of select = "position()"/>
|
|
1116
|
+
</td>
|
|
1117
|
+
<td>
|
|
1118
|
+
<xsl:variable name="itemURL">
|
|
1119
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
1120
|
+
</xsl:variable>
|
|
1121
|
+
<a href="{$itemURL}">
|
|
1122
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
1123
|
+
</a>
|
|
1124
|
+
</td>
|
|
1125
|
+
<td>
|
|
1126
|
+
<xsl:value-of select="sitemap:lastmod"/>
|
|
1127
|
+
</td>
|
|
1128
|
+
</tr>
|
|
1129
|
+
</xsl:for-each>
|
|
1130
|
+
</table>
|
|
1131
|
+
</div>
|
|
1132
|
+
<div id="footer">
|
|
1133
|
+
<p>Generated by <a href="{{ url }}">{{ name }} for {{ alternate:name }}</a></p>
|
|
1134
|
+
</div>
|
|
1135
|
+
</body>
|
|
1136
|
+
</html>
|
|
1137
|
+
</xsl:template>
|
|
1138
|
+
</xsl:stylesheet>`);
|
|
1139
|
+
|
|
1140
|
+
Define (Function, "sitemap.xsl:index", `<?xml version="1.0" encoding="UTF-8"?>
|
|
1141
|
+
<xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1142
|
+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
|
1143
|
+
<xsl:template match="/">
|
|
1144
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
1145
|
+
<head>
|
|
1146
|
+
<title>XML Sitemap Index</title>
|
|
1147
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
1148
|
+
<style type="text/css">
|
|
1149
|
+
body { font: 14px "Open Sans", Helvetica, Arial, sans-serif; margin: 0; }
|
|
1150
|
+
a { color: #3498db; text-decoration: none; }
|
|
1151
|
+
h1 { margin: 0; }
|
|
1152
|
+
#description { background-color: #f0f2eb; color: #000; padding: 30px 30px 20px; }
|
|
1153
|
+
#description a { color: #008710; }
|
|
1154
|
+
#content { padding: 10px 30px 30px; background: #fff; }
|
|
1155
|
+
a:hover { border-bottom: 1px solid; }
|
|
1156
|
+
th, td { font-size: 12px; }
|
|
1157
|
+
th { text-align: left; border-bottom: 1px solid #ccc; }
|
|
1158
|
+
th, td { padding: 10px 15px; }
|
|
1159
|
+
.odd { background: linear-gradient(159.87deg, #f6f6f4 7.24%, #f7f4ea 64.73%, #ddedd5 116.53%); }
|
|
1160
|
+
#footer { margin: 20px 30px; font-size: 12px; color: #999; }
|
|
1161
|
+
#footer a { color: inherit; }
|
|
1162
|
+
#description a, #footer a { border-bottom: 1px solid; }
|
|
1163
|
+
#description a:hover, #footer a:hover { border-bottom: none; }
|
|
1164
|
+
img { max-height: 100px; max-width: 100px; }
|
|
1165
|
+
</style>
|
|
1166
|
+
</head>
|
|
1167
|
+
<body>
|
|
1168
|
+
<div id="description">
|
|
1169
|
+
<h1>XML Sitemap Index</h1>
|
|
1170
|
+
<xsl:choose>
|
|
1171
|
+
<xsl:when test="not(sitemap:sitemapindex/sitemap:sitemap)">
|
|
1172
|
+
<p><strong></strong></p>
|
|
1173
|
+
</xsl:when>
|
|
1174
|
+
</xsl:choose>
|
|
1175
|
+
<p>This is an XML Sitemap Index generated by <a href="{{ url }}">{{ name }}</a>, meant to be consumed by search engines like <a href="https://www.google.com">Google</a> or <a href="https://www.bing.com">Bing</a>.</p>
|
|
1176
|
+
<p>You can find more information on XML sitemaps at <a href="https://sitemaps.org">sitemaps.org</a></p>
|
|
1177
|
+
</div>
|
|
1178
|
+
<div id="content">
|
|
1179
|
+
<table>
|
|
1180
|
+
<tr>
|
|
1181
|
+
<th>#</th>
|
|
1182
|
+
<th>Sitemap URL</th>
|
|
1183
|
+
<th>Last Modified</th>
|
|
1184
|
+
</tr>
|
|
1185
|
+
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
|
1186
|
+
<tr>
|
|
1187
|
+
<xsl:choose>
|
|
1188
|
+
<xsl:when test="position() mod 2 != 1">
|
|
1189
|
+
<xsl:attribute name="class">odd</xsl:attribute>
|
|
1190
|
+
</xsl:when>
|
|
1191
|
+
</xsl:choose>
|
|
1192
|
+
<td>
|
|
1193
|
+
<xsl:value-of select = "position()"/>
|
|
1194
|
+
</td>
|
|
1195
|
+
<td>
|
|
1196
|
+
<xsl:variable name="itemURL">
|
|
1197
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
1198
|
+
</xsl:variable>
|
|
1199
|
+
<a href="{$itemURL}">
|
|
1200
|
+
<xsl:value-of select="sitemap:loc"/>
|
|
1201
|
+
</a>
|
|
1202
|
+
</td>
|
|
1203
|
+
<td>
|
|
1204
|
+
<xsl:value-of select="sitemap:lastmod"/>
|
|
1205
|
+
</td>
|
|
1206
|
+
</tr>
|
|
1207
|
+
</xsl:for-each>
|
|
1208
|
+
</table>
|
|
1209
|
+
</div>
|
|
1210
|
+
<div id="footer">
|
|
1211
|
+
<p>Generated by <a href="{{ url }}">{{ name }} for {{ alternate:name }}</a></p>
|
|
1212
|
+
</div>
|
|
1213
|
+
</body>
|
|
1214
|
+
</html>
|
|
1215
|
+
</xsl:template>
|
|
1216
|
+
</xsl:stylesheet>`);
|
|
1217
|
+
|
|
1041
1218
|
/**
|
|
1042
1219
|
* 3rd party
|
|
1043
1220
|
*
|
|
@@ -1069,6 +1246,70 @@ Define (Function.help, "argument", function () {
|
|
|
1069
1246
|
return result;
|
|
1070
1247
|
});
|
|
1071
1248
|
|
|
1249
|
+
Function.j_son = function () {}
|
|
1250
|
+
|
|
1251
|
+
Function.j_son.config = function (key, value) {
|
|
1252
|
+
return Function.j_son.config [key] = value;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
Function.j_son.url = function (url) {
|
|
1256
|
+
if (Function.j_son) {
|
|
1257
|
+
if (url.startsWith ("/") === false) url = "/" + url;
|
|
1258
|
+
if (Function.j_son.config.host) return Function.j_son.config.host + url;
|
|
1259
|
+
else return url;
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
if (typeof url === "string") {}
|
|
1263
|
+
else {
|
|
1264
|
+
if (url.host) if (Function.j_son.config.host) url = Function.j_son.config.host + url.path;
|
|
1265
|
+
else url = url.url || url.path;
|
|
1266
|
+
else url = url.url || url.path;
|
|
1267
|
+
}
|
|
1268
|
+
return url;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
Function.j_son.get = function (url, context) {
|
|
1273
|
+
url = Function.j_son.url (url);
|
|
1274
|
+
return $.ajax ({
|
|
1275
|
+
url,
|
|
1276
|
+
headers: {j_son: Function.j_son.id (), reference: URL.referer ()},
|
|
1277
|
+
success (j_son) {
|
|
1278
|
+
if (typeof j_son === "object") {}
|
|
1279
|
+
else j_son = {}
|
|
1280
|
+
if (context.success) context.success ({}, j_son);
|
|
1281
|
+
URL.referer (url);
|
|
1282
|
+
},
|
|
1283
|
+
error (error) {
|
|
1284
|
+
if (context.error) context.error (error.responseJSON || {});
|
|
1285
|
+
},
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
Function.j_son.post = function (url, data, context) {
|
|
1290
|
+
url = Function.j_son.url (url);
|
|
1291
|
+
return $.ajax ({
|
|
1292
|
+
url,
|
|
1293
|
+
headers: {j_son: Function.j_son.id (), reference: URL.referer ()},
|
|
1294
|
+
data: JSON.stringify (data),
|
|
1295
|
+
type: "POST",
|
|
1296
|
+
dataType: "json",
|
|
1297
|
+
success (j_son) {
|
|
1298
|
+
if (typeof j_son === "object") {}
|
|
1299
|
+
else j_son = {}
|
|
1300
|
+
if (context.success) context.success ({}, j_son);
|
|
1301
|
+
URL.referer (url);
|
|
1302
|
+
},
|
|
1303
|
+
error (error) {
|
|
1304
|
+
if (context.error) context.error (error.responseJSON || {});
|
|
1305
|
+
},
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
Function.j_son.id = function () {
|
|
1310
|
+
return (Function.unique.id () || Function.cookie.get ("j_son")).toUpperCase ();
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1072
1313
|
Function.ajax = function () {}
|
|
1073
1314
|
|
|
1074
1315
|
Function.ajax.config = function (key, value) {
|
|
@@ -1395,21 +1636,22 @@ Symbol.export = {
|
|
|
1395
1636
|
define: Object.define, un_define: Object.un_define, un_set: Object.un_set,
|
|
1396
1637
|
object: Object, array: Array, string: String, number: Number, function: Function,
|
|
1397
1638
|
date: Date, time: Date.time, timeout: Date.timeout, datetime: new Date.io,
|
|
1398
|
-
event: Event, promise: Promise,
|
|
1639
|
+
event: Event, promise: Promise, resolve: Promise.resolve, reject: Promise.reject,
|
|
1399
1640
|
url: URL, path: Function.path, file: Function.file, dir: Function.dir, http: Function.http,
|
|
1400
1641
|
db: Function.db, database: Function.database,
|
|
1401
1642
|
cookie: Function.cookie, session: Function.session, ls: Function.ls,
|
|
1402
1643
|
markup: Function.markup, html: Function.html, css: Function.css, js: Function.js, json: JSON, xml: Function.xml, serialize: Function.serialize,
|
|
1403
1644
|
help: Function.help, log: Function.log,
|
|
1404
1645
|
hash: Function.hash, unique: Function.unique,
|
|
1405
|
-
socket: Function.socket, ajax: Function.ajax,
|
|
1646
|
+
socket: Function.socket, ajax: Function.ajax, j_son: Function.j_son,
|
|
1406
1647
|
require: Function.require, base_dir: Function.base_dir,
|
|
1407
1648
|
layout: Function.layout, component: Function.component, element: Function.element,
|
|
1408
1649
|
google: Function.google,
|
|
1409
1650
|
body: Function.body,
|
|
1410
1651
|
owl: Function.owl,
|
|
1411
1652
|
is: Object.is, parse_url: URL.parse,
|
|
1412
|
-
asset: Function.asset, theme: Function.theme,
|
|
1653
|
+
asset: Function.asset, theme: Function.theme, template: Function.template,
|
|
1654
|
+
sitemap: Function.sitemap, "sitemap.xsl": Function ["sitemap.xsl"], "sitemap.xsl:index": Function ["sitemap.xsl:index"],
|
|
1413
1655
|
zero: 0, one: 1,
|
|
1414
1656
|
}
|
|
1415
1657
|
|