diff --git a/source/AlternatingCase.popclipext/Config.json b/source/AlternatingCase.popclipext/Config.json deleted file mode 100644 index f12df545..00000000 --- a/source/AlternatingCase.popclipext/Config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "Alternating Case", - "identifier": "com.pilotmoon.popclip.extension.alternating-case", - "description": "Change the text to AlTeRnAtInG CaSe, with optional randomness.", - "icon": "noun_sponge_575115.svg", - "popclipVersion": 4225, - "module": "alternating-case.ts" -} \ No newline at end of file diff --git a/source/AlternatingCase.popclipext/Config.ts b/source/AlternatingCase.popclipext/Config.ts new file mode 100644 index 00000000..3ab57f48 --- /dev/null +++ b/source/AlternatingCase.popclipext/Config.ts @@ -0,0 +1,45 @@ +// #popclip +// name: Alternating Case +// identifier: com.pilotmoon.popclip.extension.alternating-case +// description: Change the text to AlTeRnAtInG CaSe, with optional randomness. +// icon: noun_sponge_575115.svg +// popclipVersion: 4225 +// language: typescript +// module: true + +/** + * Make characters alternately upper/lower case, with optional randomness sprinkled in. + */ +function alternatingCase (string: string, options?: {randomness?: boolean}): string { + function rnd (): number { + return options?.randomness === true ? Math.random() : 0 + } + function start (): number { + return rnd() < 0.5 ? 0 : 1 + } + function step (): number { + const x = rnd() + if (x < 0.8) return 2 + if (x < 0.9) return 3 + return 1 + } + const characters = string.toLowerCase().split('') + for (let item = start(); item < characters.length; item += step()) { + characters[item] = characters[item].toUpperCase() + } + return characters.join('') + } + + const extension: Extension = { + action: (selection, options) => { + popclip.pasteText(alternatingCase(selection.text, { randomness: options.randomness as boolean })) + }, + options: [ + { + identifier: 'randomness', + label: 'Add Randomness', + type: 'boolean' + }] + } + export default extension + \ No newline at end of file diff --git a/source/AlternatingCase.popclipext/alternating-case.ts b/source/AlternatingCase.popclipext/alternating-case.ts deleted file mode 100644 index 40f08fa6..00000000 --- a/source/AlternatingCase.popclipext/alternating-case.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * "aLtErNatInG CasE" eXtEnsIoN fOr pOpcLiP, FoR AlL YoUr mEmING NeeDS. - * iCoN: sPonGe bY BeN dAvIs fRoM ThE NoUn pRoJeCt - * @author Nick Moore - * @module AlternatingCase - */ - -/** - * Make characters alternately upper/lower case, with optional randomness sprinkled in. - */ -function alternatingCase (string: string, options?: {randomness?: boolean}): string { - function rnd (): number { - return options?.randomness === true ? Math.random() : 0 - } - function start (): number { - return rnd() < 0.5 ? 0 : 1 - } - function step (): number { - const x = rnd() - if (x < 0.8) return 2 - if (x < 0.9) return 3 - return 1 - } - const characters = string.toLowerCase().split('') - for (let item = start(); item < characters.length; item += step()) { - characters[item] = characters[item].toUpperCase() - } - return characters.join('') -} - -const extension: Extension = { - action: (selection, options) => { - popclip.pasteText(alternatingCase(selection.text, { randomness: options.randomness as boolean })) - }, - options: [ - { - identifier: 'randomness', - label: 'Add Randomness', - type: 'boolean' - }] -} -export default extension diff --git a/source/BundleID.popclipext/Config.ts b/source/BundleID.popclipext/Config.js similarity index 66% rename from source/BundleID.popclipext/Config.ts rename to source/BundleID.popclipext/Config.js index 747486ce..1872363b 100644 --- a/source/BundleID.popclipext/Config.ts +++ b/source/BundleID.popclipext/Config.js @@ -1,14 +1,12 @@ // #popclip // name: Bundle ID -// identifier: com.pilotmoon.popclip.extension.bundleid +// #identifier: com.pilotmoon.popclip.extension.bundleid // description: Show the bundle identifier of the app. // entitlements: [dynamic] // requirements: [] -// popclipVersion: 4225 -// module: true -// language: typescript +// popclipVersion: 4151 -export const actions: PopulationFunction = () => { +exports.actions = () => { if (popclip.context.appIdentifier.length > 0) { return [{ title: popclip.context.appIdentifier, diff --git a/source/BundleID.popclipext/Readme.md b/source/BundleID.popclipext/Readme.md index 70311df0..b1cd13d0 100644 --- a/source/BundleID.popclipext/Readme.md +++ b/source/BundleID.popclipext/Readme.md @@ -1,18 +1,12 @@ # Bundle ID -Display the Bundle Identifier of the application. - -Download: [BundleID.popclipextz](https://github.com/pilotmoon/PopClip-Extensions/raw/master/extensions/BundleID.popclipextz) - -## Description - -The extension display the macOS Bundle Identifier of the application, either when selecting text or when activating PopClip with long-press on an application. +The extension displays the macOS Bundle Identifier of the application, either when selecting text or when activating PopClip with long-press on an application. The bundle ID appears in the text of the action's button. Clicking the button copies the bundle ID to the clipboard. ## About -This is an extension for [PopClip](https://pilotmoon.com/popclip/). +This is an extension for [PopClip](https://www.popclip.app/). ### Author @@ -22,11 +16,6 @@ Nick Moore Requires PopClip 2023.9 or later. -### Links - - -* [GitHub Source](https://github.com/pilotmoon/PopClip-Extensions/tree/master/source/BundleID.popclipext) - ## Changelog ### 25 May 2022