livecode-static/docs/assets/js/bf28df8a.7b9c7c94.js
2025-06-11 22:23:49 +08:00

1 line
3.6 KiB
JavaScript

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["133"],{2281:function(e,o,r){r.r(o),r.d(o,{default:()=>p,frontMatter:()=>a,metadata:()=>t,assets:()=>d,toc:()=>c,contentTitle:()=>i});var t=JSON.parse('{"id":"bookmarklet","title":"Bookmarklet","description":"LiveCodes allows importing code from a wide variety of sources.","source":"@site/docs/bookmarklet.mdx","sourceDirName":".","slug":"/bookmarklet","permalink":"/docs/bookmarklet","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/bookmarklet.mdx","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"Windi CSS","permalink":"/docs/languages/windicss"},"next":{"title":"GitHub Action \u26A1","permalink":"/docs/gh-action"}}'),n=r("5893"),s=r("65");let a={},i="Bookmarklet",d={},c=[{value:"Add Bookmarklet",id:"add-bookmarklet",level:2},{value:"Example Usage",id:"example-usage",level:2}];function l(e){let o={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,s.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.header,{children:(0,n.jsx)(o.h1,{id:"bookmarklet",children:"Bookmarklet"})}),"\n",(0,n.jsxs)(o.p,{children:["LiveCodes allows ",(0,n.jsx)(o.a,{href:"/docs/features/import",children:"importing code"})," from a ",(0,n.jsx)(o.a,{href:"/docs/features/import#sources",children:"wide variety of sources"}),"."]}),"\n",(0,n.jsxs)(o.p,{children:["Instead of manually copy/pasting URLs to import, adding ",(0,n.jsx)(o.strong,{children:'"Edit in LiveCodes"'})," bookmarklet to the browser bookmarks bar can be a more convenient way. It opens LiveCodes in a new window and imports the current webpage URL."]}),"\n",(0,n.jsx)(o.h2,{id:"add-bookmarklet",children:"Add Bookmarklet"}),"\n",(0,n.jsx)(o.p,{children:"Drag this link to the browser bookmarks bar:"}),"\n",(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:'<a href=\'javascript:(()=>{window.open("https://livecodes.io/?x="+encodeURIComponent(location.href),"_blank");})();\'>Edit in LiveCodes</a>'}}),"\n",(0,n.jsx)("br",{}),"\n",(0,n.jsx)(o.p,{children:"or manually create a new bookmark in your browser and add this code as its URL:"}),"\n",(0,n.jsx)(o.pre,{children:(0,n.jsx)(o.code,{className:"language-js",children:'javascript:(()=>{window.open("https://livecodes.io/?x="+encodeURIComponent(location.href),"_blank");})();\n'})}),"\n",(0,n.jsx)(o.h2,{id:"example-usage",children:"Example Usage"}),"\n",(0,n.jsx)(o.p,{children:"After adding the bookmarklet to your browser (see above), open this GitHub directory:"}),"\n",(0,n.jsx)(o.p,{children:(0,n.jsx)(o.a,{href:"https://github.com/bradtraversy/50projects50days/tree/master/expanding-cards",children:"https://github.com/bradtraversy/50projects50days/tree/master/expanding-cards"})}),"\n",(0,n.jsx)(o.p,{children:"Then click on the bookmarklet."}),"\n",(0,n.jsxs)(o.p,{children:["LiveCodes playground should open in a new window and ",(0,n.jsx)(o.a,{href:"/docs/features/import",children:"import"})," the directory files (each file in the appropriate editor). It just works!"]})]})}function p(e={}){let{wrapper:o}={...(0,s.a)(),...e.components};return o?(0,n.jsx)(o,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},65:function(e,o,r){r.d(o,{Z:function(){return i},a:function(){return a}});var t=r(7294);let n={},s=t.createContext(n);function a(e){let o=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(o):{...o,...e}},[o,e])}function i(e){let o;return o=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:a(e.components),t.createElement(s.Provider,{value:o},e.children)}}}]);