alfred-hipsum
Advanced tools
Comparing version 1.0.0 to 1.0.1
63
index.js
@@ -1,22 +0,47 @@ | ||
'use strict'; | ||
;(async () => { | ||
'use strict' | ||
const alfy = require('alfy'); | ||
const alfy = require('alfy') | ||
const alfredNotifier = require('alfred-notifier') | ||
const api = 'http://hipsterjesus.com/api' | ||
const type = 'hipster-centric'; | ||
const isHTML = 'false'; | ||
const numParagraphs = parseInt(alfy.input, 10) || 1; | ||
// Check for updates | ||
alfredNotifier() | ||
alfy.fetch(api, { | ||
query: { | ||
type: type, | ||
html: isHTML, | ||
paras: numParagraphs | ||
} | ||
}).then(data => { | ||
alfy.output([{ | ||
title: `Hipsum Paragraphs: ${numParagraphs}`, | ||
subtitle: data.text, | ||
arg: data.text | ||
}]); | ||
}); | ||
const apiBase = 'https://hipsum.co/api' | ||
const type = 'hipster-centric' | ||
const startWithLorem = 0 | ||
const numParagraphs = parseInt(alfy.input, 10) || 1 | ||
const numSentences = parseInt(alfy.input, 10) || 1 | ||
let items = [] | ||
// Get paragraphs | ||
const paragraphs = await alfy.fetch(apiBase, { | ||
query: { | ||
type: type, | ||
startWithLorem: startWithLorem, | ||
paras: numParagraphs, | ||
}, | ||
}) | ||
items.push({ | ||
title: `Hipsum paragraphs: ${numParagraphs}`, | ||
subtitle: 'Press enter to copy', | ||
arg: paragraphs.join('\r\n'), | ||
}) | ||
// Get sentences | ||
const sentences = await alfy.fetch(apiBase, { | ||
query: { | ||
type: type, | ||
startWithLorem: startWithLorem, | ||
sentences: numSentences, | ||
}, | ||
}) | ||
items.push({ | ||
title: `Hipsum sentences: ${numSentences}`, | ||
subtitle: 'Press enter to copy', | ||
arg: sentences.join('\r\n'), | ||
}) | ||
alfy.output(items) | ||
})() |
{ | ||
"name": "alfred-hipsum", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Alfred 3 workflow to get hipster filler text.", | ||
@@ -25,2 +25,3 @@ "main": "index.js", | ||
"hipster", | ||
"hipsum", | ||
"placeholder", | ||
@@ -27,0 +28,0 @@ "filler", |
@@ -8,9 +8,7 @@ # Alfred Hipsum | ||
TODO | ||
<!-- ``` | ||
$ npm install --global alfred-hipsum | ||
``` | ||
$ npm install -g alfred-hipsum | ||
``` | ||
*Requires [Node.js](https://nodejs.org) 4+ and the Alfred [Powerpack](https://www.alfredapp.com/powerpack/).* --> | ||
> __Note:__ Requires [Node.js](https://nodejs.org) 4+ and the Alfred [Powerpack](https://www.alfredapp.com/powerpack/). | ||
@@ -22,3 +20,3 @@ | ||
> __Note:__ API is currently broken, so only one paragraph will be returned. | ||
> __⚠️ Note:__ API is currently broken | ||
@@ -30,3 +28,2 @@ | ||
- [Hipsum.co](http://hipsum.co) | ||
- [HipsterJesus](http://hipsterjesus.com) | ||
@@ -33,0 +30,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137624
40
31