content: simplify content directory structure

Removes separate directory for TypeScript files and
updates frontend tools to match updated directory
structure. TypeScript files will be co-located with
the JavaScript files making easier to identify files
that have already been migrated to TypeScript.

Change-Id: I4deb5b22c550fc34c98529bbe19bec6d28759a02
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/282377
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Jamal Carvalho 2021-01-07 17:44:10 -05:00
Родитель db2e9f3344
Коммит 2b20326fa5
8 изменённых файлов: 36 добавлений и 30 удалений

Просмотреть файл

@ -1,2 +1,4 @@
content/static
third_party
third_party
# Ignore files generated by TypeScript compiler.
content/static/js/clipboard.js

Просмотреть файл

@ -1,2 +1,5 @@
content/static
third_party
content/static/js/*.min.js
# Ignore files generated by TypeScript compiler.
content/static/js/clipboard.js

Просмотреть файл

@ -5,30 +5,30 @@
* license that can be found in the LICENSE file.
*/
export class CopyToClipboardController {
constructor(el) {
this._el = el;
this._data = el.dataset['toCopy'] ?? '';
el.addEventListener('click', e => this.handleCopyClick(e));
}
handleCopyClick(e) {
e.preventDefault();
const TOOLTIP_SHOW_DURATION_MS = 1000;
if (!navigator.clipboard) {
this.showTooltipText('Unable to copy', TOOLTIP_SHOW_DURATION_MS);
return;
constructor(el) {
this._el = el;
this._data = el.dataset['toCopy'] ?? '';
el.addEventListener('click', e => this.handleCopyClick(e));
}
handleCopyClick(e) {
e.preventDefault();
const TOOLTIP_SHOW_DURATION_MS = 1000;
if (!navigator.clipboard) {
this.showTooltipText('Unable to copy', TOOLTIP_SHOW_DURATION_MS);
return;
}
navigator.clipboard
.writeText(this._data)
.then(() => {
this.showTooltipText('Copied!', TOOLTIP_SHOW_DURATION_MS);
})
.catch(() => {
this.showTooltipText('Unable to copy', TOOLTIP_SHOW_DURATION_MS);
});
}
showTooltipText(text, durationMs) {
this._el.setAttribute('data-tooltip', text);
setTimeout(() => this._el.setAttribute('data-tooltip', ''), durationMs);
}
navigator.clipboard
.writeText(this._data)
.then(() => {
this.showTooltipText('Copied!', TOOLTIP_SHOW_DURATION_MS);
})
.catch(() => {
this.showTooltipText('Unable to copy', TOOLTIP_SHOW_DURATION_MS);
});
}
showTooltipText(text, durationMs) {
this._el.setAttribute('data-tooltip', text);
setTimeout(() => this._el.setAttribute('data-tooltip', ''), durationMs);
}
}
//# sourceMappingURL=clipboard.js.map
//# sourceMappingURL=clipboard.js.map

Просмотреть файл

@ -1 +1 @@
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../lib/ts/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,OAAO,yBAAyB;IAWpC,YAAY,EAAqB;QAC/B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAKD,eAAe,CAAC,CAAa;QAC3B,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,MAAM,wBAAwB,GAAG,IAAI,CAAC;QAGtC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;YACjE,OAAO;SACR;QACD,SAAS,CAAC,SAAS;aAChB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;aACrB,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;QAC5D,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,wBAAwB,CAAC,CA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AAkB;QAC9C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAC5C,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;CACF"}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -7,4 +7,5 @@ module.exports = {
isolatedModules: true,
},
},
moduleFileExtensions: ['ts', 'js'],
};

Просмотреть файл

@ -67,7 +67,7 @@
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": [
"content/lib/ts"
"content/static/js"
],
"exclude": [
"**/*.test.ts"