-
Notifications
You must be signed in to change notification settings - Fork 15
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}}
- Example:
| 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.
| format | description | version |
|---|---|---|
${title} |
Page title | v0.0.7 |
${url} |
Page URL | v0.0.7 |
${markdown} |
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}
| 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} |
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)
| 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.
| 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
| 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://k08045kk@github.com/k08045kk
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.
- [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
| format | description | version |
|---|---|---|
${integer} ※1Example: ${123}, ${-1}
|
Number Only integer values are allowed. |
v3.1.0 🧪🧪 |
${"string"}, ${'string'} ※2Example: ${"文字列"}
|
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
| 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
| 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. |
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
| 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.
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
- 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.
- [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.
- Selection text works even when subframes are selected.
- [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.
- This timing is commonly referred to as
- ⬜ 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...
-
- ✅ If enabled, insert the content scripts after the page loading is complate.
| 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.
- 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)}
- [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 🧪🧪 |
// ==UserScript==
// @name window.CopyTabTitleUrl.text0
// @include *
// @grant unsafeWindow
// ==/UserScript==
const obj = window.CopyTabTitleUrl || {};
obj.text0 = 'main world text';
try {
// Greasemonkey
unsafeWindow.CopyTabTitleUrl = cloneInto(obj, unsafeWindow);
// Greasemonkey requires the use of cloneInto().
} catch {
// Tampermonkey, Violetmonkey
unsafeWindow.CopyTabTitleUrl = obj;
// Tampermonkey requires "@grant unsafeWindow" to be specified.
}
- [Enable
${text0}-${text9}🧪🧪] [v3.3.4]- Alias, function name: Text,
${textn} - The option appears when you enable [Use Extended Edit Mode 🧪].
- Alias, function name: Text,
| format | description | version |
|---|---|---|
${text0} - ${text9}
|
free input string ("}" can be included.) | v3.1.0 v3.3.4 🧪🧪 |
- [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)
- Alias, function name: Extended Context Menu,
| 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
- 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)}
- separator =
- Alias, function name:
| 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 🧪🧪 |
- 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.
- The following functions allow you to decorate the output. This is useful when having external programs read data.
(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')})();