Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.addDataAttr = exports.extractId = void 0;
|
---|
| 4 | function extractId(href) {
|
---|
| 5 | return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain
|
---|
| 6 | .replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebuster
|
---|
| 7 | .replace(/^\//, '') // Remove root /
|
---|
| 8 | .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension
|
---|
| 9 | .replace(/[^\.\w-]+/g, '-') // Replace illegal characters
|
---|
| 10 | .replace(/\./g, ':'); // Replace dots with colons(for valid id)
|
---|
| 11 | }
|
---|
| 12 | exports.extractId = extractId;
|
---|
| 13 | function addDataAttr(options, tag) {
|
---|
| 14 | for (var opt in tag.dataset) {
|
---|
| 15 | if (tag.dataset.hasOwnProperty(opt)) {
|
---|
| 16 | if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') {
|
---|
| 17 | options[opt] = tag.dataset[opt];
|
---|
| 18 | }
|
---|
| 19 | else {
|
---|
| 20 | try {
|
---|
| 21 | options[opt] = JSON.parse(tag.dataset[opt]);
|
---|
| 22 | }
|
---|
| 23 | catch (_) { }
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 | exports.addDataAttr = addDataAttr;
|
---|
| 29 | //# sourceMappingURL=utils.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.