This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (HTMLScriptElement.supports && HTMLScriptElement.supports('speculationrules')) { | |
console.log('Your browser supports the Speculation Rules API.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (HTMLScriptElement.supports?.('speculationrules')) { | |
const specScript = document.createElement('script'); | |
specScript.type = 'speculationrules'; | |
const specRules = { | |
prerender: [ | |
{ | |
urls: ['/next.html'], | |
}, | |
], | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="speculationrules"> | |
{ | |
"prerender": [ | |
{ | |
"source": "list", | |
"urls": ["next.html", "next2.html"], | |
"eagerness": "moderate" | |
}, | |
{ | |
"where": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media all and (display-mode: picture-in-picture) { | |
...... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipWindow.addEventListener("pagehide", (event) => { | |
const chatScreen Container = document.querySelector("#chat-screen-container"); | |
const pipChatScreen = event.target.querySelector("#chat-screen"); | |
playerContainer.append(pipPlayer); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipButton.addEventListener("click", async () => { | |
const chatScreen = document.querySelector("#chat-screen"); | |
// Open a Picture-in-Picture window. | |
const pipWindow = await documentPictureInPicture.requestWindow(); | |
// Copy style sheets over from the initial document | |
// so that the player looks the same. | |
[...document.styleSheets].forEach((styleSheet) => { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipButton.addEventListener('click', async () => { | |
const chatScreen = document.querySelector("#chat-screen"); | |
// Open a Picture-in-Picture window. | |
const pipWindow = await documentPictureInPicture.requestWindow(); | |
// Move the player to the Picture-in-Picture window. | |
pipWindow.document.body.append(chatScreen); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button popovertarget="my-popover" class="trigger-btn"> Open Popover </button> | |
<div id="my-popover" popover=manual> | |
<p>I am a popover with more information. Hit the close button or toggle to close me.<p> | |
<button class="close-btn" popovertarget="my-popover" popovertargetaction="hide"> | |
<span aria-hidden="true">❌</span> | |
<span class="sr-only">Close</span> | |
</button> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button popovertarget="my-popover"> Open Popover </button> | |
<div id="my-popover" popover> | |
<p>I am a popover with more information. Hit <kbd>esc</kbd> or click away to close me.<p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const model = genAI.getGenerativeModel({ model: "gemini-pro" }); | |
const prompt = `This is an article or news from website ${request.body.url}. Please summary to ${paragraph} paragraph in the ${language} lanaguage. This is full article ${plainContent}`; | |
const result = await model.generateContent([prompt]); | |
console.log(result.response.text()); |
NewerOlder