Skip to content

Commit

Permalink
fix: parts of new github code view, issue #90
Browse files Browse the repository at this point in the history
  • Loading branch information
martok committed May 18, 2023
1 parent c282679 commit f7c4e67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/builtin-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ d35aaqx5ub95lt.cloudfront.net/js/app-*.js$script
! --
github.com
gist.github.com
std-PerformanceObserver,std-queueMicrotask,gh-compat,gh-turbo,gh-main-csp,sm-gh-extra,sm-cookie
std-PerformanceObserver,std-queueMicrotask,std-NavigatorClipboard,gh-compat,gh-turbo,gh-main-csp,sm-gh-extra,sm-cookie,gh-codeview
github.com/socket-worker.js$script
gist.github.com/socket-worker.js$script
github.com/assets-cdn/worker/socket-worker-*.js$script
Expand Down
8 changes: 8 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ function evaluateFix(fix, script, csp, contentReplace) {
case "std-IntlRelativeTimeFormat":
script.push(pf.Intl_RelativeTimeFormat_dummy);
break;
case "std-NavigatorClipboard":
csp["script-src"].push("unpkg.com");
script.push({"src": "https://unpkg.com/clipboard-polyfill@4.0.0/dist/es5/overwrite-globals/clipboard-polyfill.overwrite-globals.promise.es5.js",
"integrity": "sha384-5y9EbzFitRF4XTU0L+uQoWKyIAIkbKb/RV6kSZRKvilNx83HCi9ig9LP7kJqNJHX"});
break;
case "std-PerformanceObserver":
csp["script-src"].push("unpkg.com");
script.push({"src": "https://unpkg.com/@fastly/performance-observer-polyfill@2.0.0/polyfill/index.js",
Expand All @@ -77,6 +82,9 @@ function evaluateFix(fix, script, csp, contentReplace) {
case "duolingo-regexp":
contentReplace.push([String.raw`/\p{Diacritic}/gu`, `/${pf.Regex_UnicodePropertyDiacritic}/gu`]);
break;
case "gh-codeview":
script.push(pf.Github_restoreCodeMenu);
break;
case "gh-compat":
script.push(pf.Github_customElements);
script.push(pf.Window_ShadowRoot);
Expand Down
11 changes: 11 additions & 0 deletions lib/polyfills.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7c4e67

Please sign in to comment.