prototype.exe 0.0.4 → 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 +179 -2
package/package.json
CHANGED
package/src/prototype.js
CHANGED
|
@@ -1039,6 +1039,182 @@ Define (Function.html, "markup", class {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
});
|
|
1041
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
|
+
|
|
1042
1218
|
/**
|
|
1043
1219
|
* 3rd party
|
|
1044
1220
|
*
|
|
@@ -1460,7 +1636,7 @@ Symbol.export = {
|
|
|
1460
1636
|
define: Object.define, un_define: Object.un_define, un_set: Object.un_set,
|
|
1461
1637
|
object: Object, array: Array, string: String, number: Number, function: Function,
|
|
1462
1638
|
date: Date, time: Date.time, timeout: Date.timeout, datetime: new Date.io,
|
|
1463
|
-
event: Event, promise: Promise,
|
|
1639
|
+
event: Event, promise: Promise, resolve: Promise.resolve, reject: Promise.reject,
|
|
1464
1640
|
url: URL, path: Function.path, file: Function.file, dir: Function.dir, http: Function.http,
|
|
1465
1641
|
db: Function.db, database: Function.database,
|
|
1466
1642
|
cookie: Function.cookie, session: Function.session, ls: Function.ls,
|
|
@@ -1474,7 +1650,8 @@ Symbol.export = {
|
|
|
1474
1650
|
body: Function.body,
|
|
1475
1651
|
owl: Function.owl,
|
|
1476
1652
|
is: Object.is, parse_url: URL.parse,
|
|
1477
|
-
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"],
|
|
1478
1655
|
zero: 0, one: 1,
|
|
1479
1656
|
}
|
|
1480
1657
|
|