Skip to content

PatchWork AutoFix #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion html.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default class Html extends PureComponent {
<div id="root" dangerouslySetInnerHTML={{ __html: contentMarkup }} />
<script
defer
src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.zh-Hant-TW"
src="https://cdnjs.cloudflare.com/ajax/libs/polyfill/3.52.1/polyfill.min.js?features=Intl.~locale.zh-Hant-TW"
/>
<script
dangerouslySetInnerHTML={{
Expand Down Expand Up @@ -143,3 +143,4 @@ export default class Html extends PureComponent {
)
}
}

134 changes: 67 additions & 67 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
if (location.href.includes('howdz.xyz')) {
importScripts('https://cdn.staticfile.org/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}
// Cache css/js/font.
workbox.routing.registerRoute(
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);
// Cache image.
workbox.routing.registerRoute(
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)
// Cache video
workbox.routing.registerRoute(
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)
if (location.href.includes('howdz.xyz')) {
importScripts('https://cdnjs.cloudflare.com/ajax/libs/workbox-sw/7.0.0/workbox-sw.js')
workbox.setConfig({
debug: false,
});
console.log('sw.js is load by CDN!')
} else {
importScripts('./workbox/workbox-sw.js')
workbox.setConfig({
debug: false,
modulePathPrefix: './workbox/'
});
console.log('sw.js is load by local!')
}

// Cache css/js/font.
workbox.routing.registerRoute(
({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'font',
new workbox.strategies.CacheFirst({
cacheName: 'css-js-font',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
]
})
);

// Cache image.
workbox.routing.registerRoute(
({ request }) => request.destination === 'image',
new workbox.strategies.StaleWhileRevalidate({
cacheName: 'image',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
})
]
})
)

// Cache video
workbox.routing.registerRoute(
({ request }) => request.destination === 'video',
new workbox.strategies.CacheFirst({
cacheName: 'video',
plugins: [
new workbox.cacheableResponse.CacheableResponsePlugin({
statuses: [200],
}),
new workbox.expiration.ExpirationPlugin({
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
}),
new workbox.rangeRequests.RangeRequestsPlugin()
]
})
)

2 changes: 1 addition & 1 deletion v.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let body=`<!DOCTYPE html>
</div>
</div>
<iframe src="" id="play" width="100%" height="50%" frameborder="0" allowfullscreen scrolling="no" style="position:absolute"></iframe>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
function init() {
document.getElementById("jk");
Expand Down