|
1 | | -/* global $, Hls */ |
| 1 | +/* global $, Hls, __NETLIFY__ */ |
2 | 2 | /* eslint camelcase: 0 */ |
3 | 3 |
|
4 | 4 | import { sortObject, copyTextToClipboard } from './demo-utils'; |
5 | 5 | import { TimelineChart } from './chart/timeline-chart'; |
6 | 6 |
|
| 7 | +const NETLIFY = __NETLIFY__; // replaced in build |
| 8 | + |
7 | 9 | const STORAGE_KEYS = { |
8 | 10 | Editor_Persistence: 'hlsjs:config-editor-persist', |
9 | 11 | Hls_Config: 'hlsjs:config' |
@@ -116,14 +118,12 @@ $(document).ready(function () { |
116 | 118 | // github PR for a pr |
117 | 119 | function getVersionLink (version) { |
118 | 120 | const alphaRegex = /[-.]0\.alpha\./; |
119 | | - const prRegex = /[-.]pr\.([^.]+)/; |
120 | | - const branchRegex = /[-.]branch\.([^.]+)/; |
121 | 121 | if (alphaRegex.test(version)) { |
122 | 122 | return `https://www.npmjs.com/package/hls.js/v/${encodeURIComponent(version)}`; |
123 | | - } else if (prRegex.test(version)) { |
124 | | - return `https://github.com/video-dev/hls.js/pull/${prRegex.exec(version)[1]}`; |
125 | | - } else if (branchRegex.test(version)) { |
126 | | - return `https://github.com/video-dev/hls.js/tree/${encodeURIComponent(branchRegex.exec(version)[1])}`; |
| 123 | + } else if (NETLIFY.reviewID) { |
| 124 | + return `https://github.com/video-dev/hls.js/pull/${NETLIFY.reviewID}`; |
| 125 | + } else if (NETLIFY.branch) { |
| 126 | + return `https://github.com/video-dev/hls.js/tree/${encodeURIComponent(NETLIFY.branch)}`; |
127 | 127 | } |
128 | 128 | return `https://github.com/video-dev/hls.js/releases/tag/v${encodeURIComponent(version)}`; |
129 | 129 | } |
|
0 commit comments