Format - k08045kk/CopyTabTitleUrl GitHub Wiki

Format

You can freely create copy strings using the format ${value}.

  • Idea✨ (Unimplemented): Allows you to choose the prefix and suffix.
    • Example: ${value}, %value%, {{value}}

Standard

format description version
${title} Page title v0.0.7
${url} Page URL v0.0.7
${enter} Newline characters (Windows:\r\n, Mac/Linux:\n) v0.0.9
${$} $ v1.5.4

β€» Non-standard features will not work unless "Extended Mode" is enabled.

Basic

format description version
${title} Page title v0.0.7
${url} Page URL v0.0.7
${markdown}πŸ—‘οΈ ${title} markdown escapes v2.1.0 - v3.1.0 πŸ§ͺ
${frameUrl} Frame URL or page URL (β€»1) v3.1.0 πŸ§ͺ
${text} Selection text or page title (β€»2) v1.5.2 πŸ§ͺ
${selectionText}
${selectedText}πŸ—‘οΈ
Selection text or blank text (β€»2) v2.2.1, v3.1.0 πŸ§ͺ
${linkText} Link text or page title (β€»3) v2.1.0 πŸ§ͺ (Firefox only 🦊)
${linkUrl}, ${link} Link URL or page URL (β€»3) v2.1.0 πŸ§ͺ
${src} "src" URL or page URL (β€»4) v2.1.0 πŸ§ͺ
${linkSelectionTitle} Link text or Selection text or page title (β€»2,3) v2.2.0 πŸ§ͺ
${selectionLinkTitle} Selection text or link text or page title (β€»2,3) v2.2.0 πŸ§ͺ
${linkSrcUrl} Link URL or "src" URL or page URL (β€»2,3,4) v2.2.0 πŸ§ͺ
${srcLinkUrl} "src" URL or link URL or page URL (β€»2,3,4) v2.2.0 πŸ§ͺ
${index} Serial number from 0 per window v1.5.2 πŸ§ͺ
${tabId}, $(id}πŸ—‘οΈ Tab ID v2.1.0 πŸ§ͺ, v1.5.2 πŸ§ͺ
${windowId} Tab host window ID v2.1.0 πŸ§ͺ
${favIconUrl} Favicon URL or blank text v1.6.0, v3.1.0 πŸ§ͺ
${strippedUrl} URL without site tracking v----- πŸ§ͺ✨

β€»1: Used in the context menus.
β€»2: Used in the selection context menus.
γ€€γ€€You can use it outside of the context menu by enabling [Use content script for active tab πŸ§ͺπŸ§ͺ].
β€»3: Used in the link context menu.
β€»4: Used in the image context menu.
β€»πŸ—‘οΈ Deprecated: ${TITLE}, ${URL}, ${ENTER}, ${TEXT}, ${selectedText}, ${INDEX}, ${id}, ${ID}

Character code

format description version
${enter} Newline characters (Windows:\r\n, Mac/Linux:\n) v0.0.9
${CR}, ${r}πŸ—‘οΈ Carriage Return (\r) v1.1.1, v1.5.2 πŸ§ͺ
${LF}, ${n}πŸ—‘οΈ Line Feed (\n) v1.1.1, v1.5.2 πŸ§ͺ
${TAB}, ${t}πŸ—‘οΈ Horizontal Tab (\t) v0.0.9, v1.5.2 πŸ§ͺ
${$} $ v1.5.4
${xXX}πŸ—‘οΈ Specify the character code in hexadecimal of "XX". v----- πŸ§ͺ✨

β€»πŸ—‘οΈ Deprecated: ${\r}, ${\n}, ${\t}, ${r}, ${n}, ${t}, ${cr}, ${lf}, ${tab}
β€» In particular, the use of ${tab} is discouraged. (because it may be used in Programmable Format)

Info (Context Menu)

format description version
${infoButton} 0:left / 1:middle / 2:right v3.4.0 (Firefox Only 🦊)
${infoEditable} true / false v3.4.0
${infoFrameId} v3.4.0
${infoFrameUrl} v3.4.0
${infoLinkText} v3.4.0 (Firefox Only 🦊)
${infoLinkUrl} v3.4.0
${infoMediaType} v3.4.0
${infoModifiers} [], ["Ctrl"], ["Shift","Ctrl"], ... v3.4.0 (Firefox Only 🦊)
${infoPageUrl} v3.4.0
${infoSelectionText} v3.4.0
${infoSrcUrl} v3.4.0
${infoTargetElementId} v3.4.0 (Firefox Only 🦊)

β€» see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/OnClickData
β€» You can also browse from multiple tabs.

Date

format description version
${yyyy}, ${yy}, ${y}
${YYYY}, ${YY}, ${Y}
year v1.5.4, v3.1.0 πŸ§ͺ
${MM}, ${M} month v1.5.4 πŸ§ͺ
${dd}, ${d}
${DD}, ${D}
day of month v1.5.4, v3.1.0 πŸ§ͺ
${HH}, ${H} hours (24 hours) v1.5.4 πŸ§ͺ
${hh}, ${h} hours (12 hours) v1.5.4 πŸ§ͺ
${mm}, ${m} minutes v1.5.4 πŸ§ͺ
${ss}, ${s} seconds v1.5.4 πŸ§ͺ
${SSS}, ${S} milliseconds v1.5.4 πŸ§ͺ
${AA}, ${aa} AM/PM, am/pm v2.2.2 πŸ§ͺ
${AAAA}, ${aaaa} A.M./P.M., a.m./p.m. v2.2.2 πŸ§ͺ
${W} Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday v2.2.2 πŸ§ͺ
${WWW} Sun/Mon/Tue/Wed/Thu/Fri/Sat v2.2.2 πŸ§ͺ
${day}, ${dayOfWeek} 0=Sun/1=Mon/2=Tue/3=Wed/4=Thu/5=Fri/6=Sat v3.1.0 πŸ§ͺ
${time} Elapsed time since epoch (milliseconds) v3.1.0 πŸ§ͺ
${timezoneOffset} minute offset from UTC v3.1.0 πŸ§ͺ

β€» ${yyyy}-${MM}-${dd}T${HH}:${mm}:${ss}.${SSS}
γ€€2020-04-03T00:48:23.456

URL

format description version
${href} URL
Similar:
${protocol:}${username:password@}${host}${pathname}${search}${hash}
v1.5.6 πŸ§ͺ
${origin} URL origin β€»1
Similar: ${protocol:}${host}
v1.5.6 πŸ§ͺ
${protocol} protocol:
β€»2
v1.5.6 πŸ§ͺ
${protocol:} protocol:(//) v3.5.20 πŸ§ͺ
${username} (username) v3.1.0 πŸ§ͺ
${password} (password) v3.1.0 πŸ§ͺ
${username@} (username@) v3.1.0 πŸ§ͺ
${username:password@} (username(:password)@) v3.1.0 πŸ§ͺ
${host} hostname(:port) v1.5.6 πŸ§ͺ
${hostname} hostname v1.5.6 πŸ§ͺ
${port} (port) v1.5.6 πŸ§ͺ
${:port} (:port) v1.5.6 πŸ§ͺ
${pathname} /pathname v1.5.6 πŸ§ͺ
${search} (?param) v1.5.6 πŸ§ͺ
${hash} (#hash) v1.5.6 πŸ§ͺ

β€» If (data) does not exist, it is treated as an empty string.
β€» ${protocol}//${host}${pathname}${search}${hash}
γ€€https://example.com/path/file?key=value&query#hash
β€» window.URL - Web API | MDN
β€»1: May return null for protocols other than: http, https, ftp, ws, wss
β€»2: It is commonly used as "${protocol}//", but be aware that this will cause issues with the following URL:
γ€€γ€€about:about
γ€€γ€€view-source:https://[email protected]/k08045kk

Sample

Plain:
${title}${enter}${url}
${title}
${url}

Markdown:
[${title}](${url})

HTML:
<a href="${url}">${title}</a>
<a href="${url}">${title}</a><br/>
<p><a href="${url}">${title}</a></p>
<a href="${url}" target="_blank" rel="noopener">${title}</a>

LaTeX:
\url{${url}}
\href{${url}}{${title}}
	
Redmine:
"${title}":${url}

reStructuredText:
`${title} <${url}>`_

β€» No automatic escaping to format strings is performed.

Programmable Format

  • [Enable programmable format πŸ§ͺπŸ§ͺ] [v3.1.0]
    • Alias, function name: programmable format, programmable
    • The format can be extended using functions and assignments.
      • Please do not write complicated processing using this function.
      • This feature exists to connect multiple features.
        • browser information, regular expressions, user scripts, external programs.
    • I believe this functionality does not apply to remote code.
      • If it turns out to be remote code or something similar, I will protect the extension by removing this feature.
    • The option appears when you enable [Use Extended Edit Mode πŸ§ͺ].
    • Please check the source code for details on this feature.
      • /background/compiler.js

Literal / Value

format description version
${integer} β€»1
Example: ${123}, ${-1}
Number
Only integer values are allowed.
v3.1.0 πŸ§ͺπŸ§ͺ
${"string"}, ${'string'} β€»2
Example: ${"ζ–‡ε­—εˆ—"}
String
"}" cannot be used. There is also no escape processing.
v3.1.0 πŸ§ͺπŸ§ͺ
${undefined} undefined (Not the string "undefined ") v3.1.0 v3.2.0 πŸ§ͺπŸ§ͺ
${null} null (Not the string "null") v3.1.0 v3.2.0 πŸ§ͺπŸ§ͺ
${true} true (Boolean) v3.1.0 πŸ§ͺπŸ§ͺ
${false} false (Boolean) v3.1.0 πŸ§ͺπŸ§ͺ
${NaN} NaN (Number.NaN) v3.1.0 πŸ§ͺπŸ§ͺ
${Infinity} Infinity (Number.POSITIVE_INFINITY) v3.1.0 πŸ§ͺπŸ§ͺ
${dollar} "$" v3.5.13 πŸ§ͺπŸ§ͺ
${lbrace} "{" v3.5.13 πŸ§ͺπŸ§ͺ
${rbrace} "}" v3.5.13 πŸ§ͺπŸ§ͺ
${language} navigator.language v3.5.16 πŸ§ͺπŸ§ͺ
${tabs.length} Total number of tabs to copy v----- πŸ§ͺπŸ§ͺ✨
${tabsLength} Total number of tabs to copy v3.1.0 πŸ§ͺπŸ§ͺ
${tabsIndex} Sequential number of tab to copy (from 0) v3.2.0 πŸ§ͺπŸ§ͺ
${tab.prop} chrome.tabs.Tab β€»3 v----- πŸ§ͺπŸ§ͺ✨
${tabProp} chrome.tabs.Tab β€»3 v3.1.0 πŸ§ͺπŸ§ͺ

β€» Types are automatically converted.
γ€€Example: ${Math.not(false)}, ${Math.not(0)}, ${Math.not(-0)},
γ€€γ€€γ€€γ€€γ€€γ€€${Math.not(null)}, ${Math.not(NaN)}, ${Math.not('')} // output: true
γ€€Example: ${Math.not('string')}, ${Math.not('false')}, ${Math.not(-1)} // output: false
β€»1: Numeric values should be defined in a form that matches the following regular expression: /^[+\-]?\d+$/
β€»2: String values should be defined in a form that matches the following regular expression: /^("[^"}]*"|'[^'}]*')$/
β€»3: see https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab

System Function

format description version
${System.log(...args)} WebExtension background DevTools Console β€»1 v3.4.2, v3.5.12 πŸ§ͺπŸ§ͺ
${System.compile(arg)} Treat arg as format (Function processing) v----- πŸ§ͺπŸ§ͺ✨
${Math.fn()} calculation / control functions v3.1.0 πŸ§ͺπŸ§ͺ
${Boolean.fn()} boolean functions v----- πŸ§ͺπŸ§ͺ✨
${Number.fn()} number functions v----- πŸ§ͺπŸ§ͺ✨
${String.fn()} string functions v3.1.0 πŸ§ͺπŸ§ͺ
${Date.fn()} date functions v3.1.0 πŸ§ͺπŸ§ͺ
${Array.fn()} array functions v----- πŸ§ͺπŸ§ͺ✨
${gloablThis["gprop"]}πŸ—‘οΈ
Example: ${globalThis["tab.status"]}
Accessing properties that contain symbols v3.1.0 πŸ§ͺπŸ§ͺ

β€»1: Enable browser developer mode
Math.fn(): add / sub / mul / div / mod / and / or / not / random
Math.fn(): lt / lte / gt / gte / eq / neq / seq / nseq / cond / ncond / any
String.fn(): fromCharCode / fromCodePoint
γ€€γ€€see String - JavaScript | MDN
Date.fn(): toDateString / toISOString / toString / toTimeString / toUTCString / toLocaleDateString / toLocaleString / toLocaleTimeString
γ€€γ€€see Date - JavaScript | MDN
Array.fn(): at / concat / includes / indexOf / isArray / join / pop / push / reverse / shift / slice / splice / unshift / with
γ€€γ€€see Array - JavaScript | MDN

Value Function

format description version
${in}
Example: ${title}
value v3.1.0 πŸ§ͺπŸ§ͺ
${out=in}
Example: ${x=title}
Assignment. No output is produced.
Assignment to reserved words is not possible. β€»1
v3.1.0 πŸ§ͺπŸ§ͺ
${in[idx]}, ${in[key]}
Example: ${x='["a","b","c"]'}${x[1]}
Example: ${x='[1,2,3]'}${x["length"]}
Accessing Array and Object. v3.1.0 πŸ§ͺπŸ§ͺ
${in.fn}
Example: ${title.length}
property access v3.1.0 πŸ§ͺπŸ§ͺ
${in.fn(arg1,arg2)}
Example: ${title.slice(-4)}
Function. Up to 2 arguments. v3.1.0, v3.5.12 πŸ§ͺπŸ§ͺ

β€» Some specifications differ from standard JavaScript functions.
β€»1: Reserved words (reserved words may increase in the future)
γ€€γ€€Math, String, true, false, null, undefined, NaN, Infinity, $, title, url

in Function

format version
in.replace(pattern: RegExp, replacement: string): string v3.1.0 πŸ§ͺπŸ§ͺ
in.replaceAll(pattern: RegExp, replacement: string): string v3.1.0 πŸ§ͺπŸ§ͺ
in.match(regexp: RegExp, flags: string): string[],empty v3.1.0 πŸ§ͺπŸ§ͺ
in.search(regexp: RegExp): number v3.1.0 πŸ§ͺπŸ§ͺ
in.concat(...args: string): string v3.1.0, v3.5.12 πŸ§ͺπŸ§ͺ
in.localeCompare(compareString: string): number v----- πŸ§ͺπŸ§ͺ✨
in.matchAll(regexp: RegExp): Iterator<string[]> v----- πŸ§ͺπŸ§ͺ✨
...

in.fn: length
in.fn(): replace / replaceAll / match / search / substring / slice / padStart / padEnd / at / charAt / charCodeAt / codePointAt / repeat / startsWith / endsWith / includes / indexOf / lastIndexOf / normalize / concat / split / isWellFormed / trim / trimStart / trimEnd / toLocaleLowerCase / toLocaleUpperCase / toLowerCase / toString / toUpperCase / toWellFormed / valueOf
see String - JavaScript | MDN
β€» Items that are not significantly different from JavaScript will be omitted.
β€» Arguments that accept regular expressions only accept regular expressions.
β€» Returns an empty string instead of null.

Sample

Markdown escaped title:
format = ${title.replaceAll(text0,'\$&')}
${text0} = [*_\\`#+\-.!{}[\]()]

Amazon.com shortened URL
format = ${url.replace(text0,"$1$2")}
${text0} = ^(https?:\/\/www\.amazon\.(?:com|co\.jp))(?:\/.*)?(\/dp\/\w+)[\/\?#]?.*$

Localize the day of week
format = ${text0[dayOfWeek]}
${text0} = ["ζ—₯","月","火","ζ°΄","木","金","土"]

Localize the AM/PM
format = ${ampm=Math.div(H,12)}${text0[ampm]}
${text0} = ["εˆε‰","午後"]

Control character output
format = ${String.fromCodePoint(9)}

Branch processing for each site
format = ${text0[hostname]}
${text0} = {"www.google.com":"Google","github.com":"GitHub"}

Branch processing for each site
format = ${x=Math.eq(hostname,text0)}${Math.cond(x,"Google")}${Math.condn(x,"not Google")}
${text0} = www.google.com

Remarks

  • If parsing fails, leave the syntax as is.
    • ${x}->${x}
  • If an error occurs during execution, include the error.
    • ${x}->${x}[Error: ....]
  • The syntax must not contain whitespace.
    • ${x.replace('abc', 'xyz')}
    • error ^
  • Note that assignment breaks existing variables.
  • Compilation of separator is performed only once, at the beginning.
    • This feature comes into play when setting initial values.
  • At this time, we disclaim all warranties including compatibility.

Scripting

  • [Use content script for active tab πŸ§ͺπŸ§ͺ] [v3.1.0]
    • Alias, function name: scripting, content script
    • Use page content using content script.
    • Selection text can be used outside of context menus.
    • Works on active tab.
      • Use activeTab permission.
      • Does not use host permission.
    • Idea✨ (Unimplemented): Option to force disable the script: ${scripting=false}
    • Idea✨ (Unimplemented): Option to force enable the script: ${scripting=true}
    • The option appears when you enable [Use Extended Edit Mode πŸ§ͺ].
    • Please check the source code for details on this feature.
      • /background/scripting.js
  • [Use content script for all frames πŸ§ͺπŸ§ͺ] [v3.4.4]
    • Selection text works even when subframes are selected.
      • If the selection spans multiple frames, the selected string of the first frame will be output.
    • Currently, this feature has no effect on anything other than the selection string.
    • However, there seems to be a problem with some sites not returning responses (#66)
      • Therefore, we set a timeout of 150ms.
    • It is recommended that this setting not be easily enabled and only be enabled when necessary.
  • [Inject content script after page loaded πŸ§ͺπŸ§ͺ] (v3.5.6)
    • βœ… If enabled, insert the content scripts after the page loading is complate.
      • This timing is commonly referred to as document_idle.
      • In a slow-loading environment, this feels slower than expected.
      • If you wait for the page to load, you may feel uncomfortable with pop-ups and other displays.
    • ⬜ If disabled, the script will be inserted immediately.
      • Therefore, the page may not have finished loading. It is also possible that the user script has not yet been executed.
      • As a result, retrieval of some data may fail.
        • ${pageTitle}, ${pageH1}, ${pageText0}, etc...
format description version
${scripting} true / false v3.1.0 πŸ§ͺπŸ§ͺ
${pageError} error message v3.4.4 πŸ§ͺπŸ§ͺ
${canonicalUrl} ${pageCanonicalUrl} or ${ogUrl} or ${url} v3.1.0 πŸ§ͺπŸ§ͺ
${ogpUrl} ${ogUrl} or ${pageCanonicalUrl} or ${url} v3.1.0 πŸ§ͺπŸ§ͺ
${ogpImage} ${ogImage} or ${pageImageSrc} v3.1.0 πŸ§ͺπŸ§ͺ
${ogpTitle} ${ogTitle} or ${metaTitle} or ${pageTitle} or ${title} v3.1.0 πŸ§ͺπŸ§ͺ
${ogpDescription} ${ogDescription} or ${metaDescription} v3.1.0 πŸ§ͺπŸ§ͺ
format description version
${pageTitle} document.title v3.1.0 v3.2.0 πŸ§ͺπŸ§ͺ
${pageURL} document.URL v3.2.0 πŸ§ͺπŸ§ͺ
${pageCharset} document.characterSet v3.2.0 πŸ§ͺπŸ§ͺ
${pageContentType} document.contentType v3.2.0 πŸ§ͺπŸ§ͺ
${pageCookie} document.cookie v3.2.0 πŸ§ͺπŸ§ͺ
${pageDir} document.dir v3.2.0 πŸ§ͺπŸ§ͺ
${pageDoctype} document.doctype v3.2.0 πŸ§ͺπŸ§ͺ
${pageLastModified} document.lastModified v3.2.0 πŸ§ͺπŸ§ͺ
${pageReferrer} document.referrer v3.2.0 πŸ§ͺπŸ§ͺ
${pageLang} document.documentElement.lang v3.2.0 πŸ§ͺπŸ§ͺ
${pageCanonicalUrl} <link rel="canonical" href="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${pageImageSrc} <link rel="image_src" href="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${pageDescription} ${metaDescription} or ${ogDescription} v3.1.0 πŸ§ͺπŸ§ͺ
${pageH1} <h1>...</h1> v3.1.0 πŸ§ͺπŸ§ͺ
${pageHs} <h1>...</h1> or <h2>...</h2> or ... v----- πŸ§ͺπŸ§ͺ✨
${pageAhrefs} <a href="..."> v----- πŸ§ͺπŸ§ͺ✨
${pageImages} <img src="..."> v----- πŸ§ͺπŸ§ͺ✨
${pageURLs} all frame URLs v----- πŸ§ͺπŸ§ͺ✨
${pageSelectionText} window.getSelection().toString() v3.1.0 πŸ§ͺπŸ§ͺ
${pageSelectionAhrefs} selection hrefs v----- πŸ§ͺπŸ§ͺ✨
${pageSelectionSrcs} selection srcs v----- πŸ§ͺπŸ§ͺ✨
${pagePointerAhref} document.elementFromPoint(), href v----- πŸ§ͺπŸ§ͺ✨
${pagePointerSrc} document.elementFromPoint(), src v----- πŸ§ͺπŸ§ͺ✨
${pagePrompt} window.prompt() β€»1,2,3 v3.2.0 πŸ§ͺπŸ§ͺ
format description version
${metaCharset} <meta name="charset" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaDescription} <meta name="description" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaKeywords} <meta name="keywords" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaGenerator} <meta name="generator" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaAuthor} <meta name="author" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaCopyright} <meta name="copyright" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaReplyTo} <meta name="reply-to" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaTel} <meta name="tel" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaFax} <meta name="fax" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaCode} <meta name="code" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaTitle} <meta name="title" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaBuild} <meta name="build" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaCreationDate} <meta name="creation date" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaDate} <meta name="date" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaLanguage} <meta name="language" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaApplicationName} <meta name="application-name" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${metaThemeColor} <meta name="theme-color" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
format description version
${ogTitle} <meta property="og:title" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogType} <meta property="og:type" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogUrl} <meta property="og:url" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogImage} <meta property="og:image" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogSiteName} <meta property="og:site_name" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogDescription} <meta property="og:description" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogLocale} <meta property="og:locale" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogDeterminer} <meta property="og:determiner" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogAudio} <meta property="og:audio" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
${ogVideo} <meta property="og:video" content="..."> v3.1.0 πŸ§ͺπŸ§ͺ
format description version
${console.log(msg)}πŸ—‘οΈ
Substitute: ${System.log()}
v----- πŸ§ͺπŸ§ͺ✨
${window.alert(message)}πŸ—‘οΈ v----- πŸ§ͺπŸ§ͺ✨
${window.confirm(message)}πŸ—‘οΈ v----- πŸ§ͺπŸ§ͺ✨
${window.prompt(message,default)}πŸ—‘οΈ
Substitute:${pagePrompt}
v----- πŸ§ͺπŸ§ͺ✨

β€» Scripting does not work on pages where content scripts do not work.
γ€€ Example: chrome://, mozilla.org
β€» It may be changed to ${scripting.prop} in the future.
β€»1: [Show completion popup] does not work.
β€»2: Does not work with mobile popup display.
β€»3: ${pagePrompt} has no timeout setting. Therefore, processing may stop.
γ€€γ€€ Please consider carefully when using (#66)
β€» Scripting does not work on pages where content scripts do not work.

Remarks

  • Creating strings with multiple conditions
    • ${metaTitle} or ${ogTitle} or ${pageTitle} or ${title}
    • ${x=title}${x=Math.cond(pageTitle)}${x=Math.cond(ogTitle)}${x=Math.cond(metaTitle)}${x}
  • If there are items, output them together with subordinate sentences.
    • ... or ... θͺ¬ζ˜Žγ€Œ..description.」
    • ...${x=' θͺ¬ζ˜Žγ€Œ'.concat(ogpDescription,'」')}${Math.cond(ogpDescription,x)}
  • Creating a snippet
    • Description: ${ogpDescription.snippet(100)}
    • Description: ${x=ogpDescription.slice(0,100)}${x=x.trim()}${len=ogpDescription.length}${y=Math.gte(len,100)}${z=''}${z=Math.cond(y,'...')}${x.concat(z)}

Scripting (main world)

  • [Enable content script for main world πŸ§ͺπŸ§ͺ] [v3.3.6]
    • Alias, function name: scripting, main scripting, main content script
    • Non-string values are treated as strings: window.CopyTabTitleUrl?.text0?.toString() ?? ''
    • Read values from main world. However, no writing is done.
    • If you write a value to window, it may be used as fingerprinting. Please use with caution.
    • Possible use is to switch format on a site-by-site basis.
      • ${pageText0} or ${title}${enter}${url}
      • ${Math.cond(pageText0)}${x=title.concat(enter,url)}${Math.condn(pageText0,x)}
    • Possible use is to write a user script to describe an overly complex format.
format description version
${pageText0} - ${pageText9} window.CopyTabTitleUrl.text0 - .text9 v3.3.6 πŸ§ͺπŸ§ͺ

User script sample

// ==UserScript==
// @name        window.CopyTabTitleUrl.text0
// @include     *
// @grant       none
// ==/UserScript==

window.CopyTabTitleUrl = window.CopyTabTitleUrl || {};
window.CopyTabTitleUrl.text0 = 'main world text';

Text

  • [Enable ${text0} - ${text9} πŸ§ͺπŸ§ͺ] [v3.3.4]
    • Alias, function name: Text, ${textn}
    • The option appears when you enable [Use Extended Edit Mode πŸ§ͺ].
format description version
${text0} - ${text9} free input string ("}" can be included.) v3.1.0 v3.3.4 πŸ§ͺπŸ§ͺ

Extended Context Menu

  • [Enable ${menu} πŸ§ͺπŸ§ͺ] [v3.4.1]
    • Alias, function name: Extended Context Menu, ${menu}
    • You must enable [Enable programmable format πŸ§ͺπŸ§ͺ][Enable ${text0} - ${text9} πŸ§ͺπŸ§ͺ] to use it.
    • ${text0} = ${menu=true}${menuTitle='format10'}${menuTarget='tab'}[${title}](${url})
    • Expansion to format strings needs to be considered. (if there is a strong demand, we will consider it)
    • If you need this feature, please let me know how to use it. (how many, format)
format description version
${menu} true / "true" v3.4.1 πŸ§ͺπŸ§ͺ
${menuType} normal / separator / default:normal v3.4.1 πŸ§ͺπŸ§ͺ
${menuTarget} tab / window / all / default:tab v3.4.1 πŸ§ͺπŸ§ͺ
${menuTitle} Title text (default: formatn) v3.4.1 πŸ§ͺπŸ§ͺ
${menuContexts} ["page","selection"] (default: user setting) β€»1 v3.4.1 πŸ§ͺπŸ§ͺ
${menuDocumentUrlPatterns} ["*://example.com/*"] (default: none) β€»2 v3.4.1 πŸ§ͺπŸ§ͺ
${menuTargetUrlPatterns} ["*://*.example.com/*","*://*.example.net/*"] (default: none) β€»2 v3.4.1 πŸ§ͺπŸ§ͺ

β€»1: see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/ContextType
β€»2: see https://developer.chrome.com/docs/extensions/develop/concepts/match-patterns

Others

  • Set the start and end text of the text to copy πŸ§ͺπŸ§ͺ [v3.4.3]
    • Alias, function name: ${copyStartText}, ${copyEndText}
    • You must enable [Enable programmable format πŸ§ͺπŸ§ͺ] to use it.
    • Enable JSON format for objects and arrays.
      • separator = ${startText='["'}", "${endText='"]'}
      • separator = ${startText='{'}, ${endText=String.fromCharCode(125)}
format description version
${copyStartText} start text to copy v3.4.3 πŸ§ͺπŸ§ͺ
${copyEndText} end text to copy v3.4.3 πŸ§ͺπŸ§ͺ
${copySeparator} separator to copy v3.4.3 πŸ§ͺπŸ§ͺ

Remarks

  • There is a function to delete the spaces of line feed characters that are automatically inserted when copying and pasting to the options screen. This is useful when writing complex formats.
    • [Remove newlines when paste πŸ§ͺπŸ§ͺ]
  • For processes that are too complex, consider using external programs, user scripts, or bookmarklets.
    • The following functions allow you to decorate the output. This is useful when having external programs read data.
      • ${copyStartText}, ${copyEndText}, ${copySeparator}
    • The following functions allow you to copy input from user scripts.
      • This makes writing complex code easier.
      • Additionally, browser actions, context menus, and shortcut key launch actions become available.
      • ${pageText0} - ${pageText9}
    • A sample user script or bookmarklet is shown below. Please consider copying without using this extension.

UserScript or Bookmarklet

(function() {
  window.addEventListener('copy', function(event) {
    event.preventDefault();
    event.stopImmediatePropagation();
    
    var text = '['+document.title+']('+document.URL+')';
    event.clipboardData.setData('text/plain', text);
  }, {capture:true, once:true});
  document.execCommand('copy');
})();
javascript:(function(){window.addEventListener('copy',function(a){a.preventDefault();a.stopImmediatePropagation();a.clipboardData.setData('text/plain','['+document.title+']('+document.URL+')')},{capture:!0,once:!0});document.execCommand('copy')})();
⚠️ **GitHub.com Fallback** ⚠️