├── images ├── .DS_Store ├── Main Mockup.png ├── quotes │ ├── .DS_Store │ ├── QuotesConfig.png │ ├── QuotesDisplay.png │ ├── QuotesIphoneMockup.png │ └── QuotesKanyeConfig.png ├── gitRepoPreview.png ├── insulter │ ├── InsulterConfig.png │ ├── InsulterDisplay.png │ └── InsulterIPhoneMockup.png ├── periodicTable │ ├── Periodic Table.png │ ├── PeriodicTableConfig.png │ ├── PeriodicTableDisplay.png │ ├── PeroiodicTablePhone.png │ ├── PeriodicTablePhoneMockup.png │ └── iPhone Periodic Table Widget.png ├── notionIntegrations │ ├── NotionxScriptable.png │ └── re-reads │ │ ├── NotionReReadsConfig.png │ │ ├── NotionReReadsDisplay.png │ │ └── notion-re-reads-mockup.png ├── RandomNumberFact │ ├── RandomNumberFactConfig.png │ ├── RandomNumberFactDisplay.png │ └── randomNumberIphoneMockup.png ├── covidTrackerIndia │ ├── CovidTrackerIndiaConfig.png │ ├── covidTrackerIphoneMockup.png │ └── Covid-tracker-display-image.png ├── covidTrackerIndiaV2 │ ├── CovidTrackerIndiav2Config.png │ ├── CovidTrackerIndia-V2-display.png │ └── covidTrackerIndiav2IphoneMockup.png └── badges │ ├── configurable.svg │ ├── large-widget-badge.svg │ ├── iOS-badge.svg │ ├── medium-widget-badge.svg │ ├── small-widget-badge.svg │ └── scriptableBadge.svg ├── Notion Integrations ├── README.md └── re-reads │ ├── README.md │ └── notion-re-reads.js ├── Insulter ├── README.md └── Insulter.js ├── Covid Tracker - India ├── README.md └── Covid Tracker India.js ├── Random Number Fact ├── README.md └── Random Number Fact.js ├── Quotes ├── README.md └── Quotes.js ├── Covid Tracker v2 - India ├── README.md └── Covid Tracker India v2.js ├── Periodic Table ├── README.md └── Periodic Table.js └── README.md /images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/.DS_Store -------------------------------------------------------------------------------- /images/Main Mockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/Main Mockup.png -------------------------------------------------------------------------------- /images/quotes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/quotes/.DS_Store -------------------------------------------------------------------------------- /images/gitRepoPreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/gitRepoPreview.png -------------------------------------------------------------------------------- /images/quotes/QuotesConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/quotes/QuotesConfig.png -------------------------------------------------------------------------------- /images/quotes/QuotesDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/quotes/QuotesDisplay.png -------------------------------------------------------------------------------- /images/insulter/InsulterConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/insulter/InsulterConfig.png -------------------------------------------------------------------------------- /images/insulter/InsulterDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/insulter/InsulterDisplay.png -------------------------------------------------------------------------------- /images/quotes/QuotesIphoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/quotes/QuotesIphoneMockup.png -------------------------------------------------------------------------------- /images/quotes/QuotesKanyeConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/quotes/QuotesKanyeConfig.png -------------------------------------------------------------------------------- /images/insulter/InsulterIPhoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/insulter/InsulterIPhoneMockup.png -------------------------------------------------------------------------------- /images/periodicTable/Periodic Table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/Periodic Table.png -------------------------------------------------------------------------------- /images/periodicTable/PeriodicTableConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/PeriodicTableConfig.png -------------------------------------------------------------------------------- /images/periodicTable/PeriodicTableDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/PeriodicTableDisplay.png -------------------------------------------------------------------------------- /images/periodicTable/PeroiodicTablePhone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/PeroiodicTablePhone.png -------------------------------------------------------------------------------- /images/notionIntegrations/NotionxScriptable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/notionIntegrations/NotionxScriptable.png -------------------------------------------------------------------------------- /images/RandomNumberFact/RandomNumberFactConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/RandomNumberFact/RandomNumberFactConfig.png -------------------------------------------------------------------------------- /images/RandomNumberFact/RandomNumberFactDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/RandomNumberFact/RandomNumberFactDisplay.png -------------------------------------------------------------------------------- /images/periodicTable/PeriodicTablePhoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/PeriodicTablePhoneMockup.png -------------------------------------------------------------------------------- /images/RandomNumberFact/randomNumberIphoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/RandomNumberFact/randomNumberIphoneMockup.png -------------------------------------------------------------------------------- /images/covidTrackerIndia/CovidTrackerIndiaConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndia/CovidTrackerIndiaConfig.png -------------------------------------------------------------------------------- /images/covidTrackerIndia/covidTrackerIphoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndia/covidTrackerIphoneMockup.png -------------------------------------------------------------------------------- /images/periodicTable/iPhone Periodic Table Widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/periodicTable/iPhone Periodic Table Widget.png -------------------------------------------------------------------------------- /images/covidTrackerIndia/Covid-tracker-display-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndia/Covid-tracker-display-image.png -------------------------------------------------------------------------------- /images/covidTrackerIndiaV2/CovidTrackerIndiav2Config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndiaV2/CovidTrackerIndiav2Config.png -------------------------------------------------------------------------------- /images/notionIntegrations/re-reads/NotionReReadsConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/notionIntegrations/re-reads/NotionReReadsConfig.png -------------------------------------------------------------------------------- /images/covidTrackerIndiaV2/CovidTrackerIndia-V2-display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndiaV2/CovidTrackerIndia-V2-display.png -------------------------------------------------------------------------------- /images/notionIntegrations/re-reads/NotionReReadsDisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/notionIntegrations/re-reads/NotionReReadsDisplay.png -------------------------------------------------------------------------------- /images/notionIntegrations/re-reads/notion-re-reads-mockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/notionIntegrations/re-reads/notion-re-reads-mockup.png -------------------------------------------------------------------------------- /images/covidTrackerIndiaV2/covidTrackerIndiav2IphoneMockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dharmikumbhani/scriptable/HEAD/images/covidTrackerIndiaV2/covidTrackerIndiav2IphoneMockup.png -------------------------------------------------------------------------------- /Notion Integrations/README.md: -------------------------------------------------------------------------------- 1 | # Notion x Scriptable Integrations 2 | Notion with Scriptable 3 | 4 |
5 | 6 | ## Table of Contents 7 | - [❏ List of widgets](#-list-of-widgets) 8 | - [re-reads](#re-reads) 9 | 10 |
11 | 12 | ## [re-reads](https://github.com/dharmikumbhani/scriptable/tree/main/Notion%20Integrations/re-reads) 13 | ![Notion x Scriptable](../images/notionIntegrations/re-reads/NotionReReadsDisplay.png) 14 | 15 | ![iOS widget](../images/badges/large-widget-badge.svg) 16 | 17 | Brings your re-reads (quotes, phrases, one liners from books you found while reading a book) to you **passively** instead of having to actively take time out and going through them. 18 | -------------------------------------------------------------------------------- /images/badges/configurable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /images/badges/large-widget-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /images/badges/iOS-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Insulter/README.md: -------------------------------------------------------------------------------- 1 | ## Insulter - Widget 2 | Gives you a well deserved insult. 3 | 4 | Evil Insult 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | Even i am not sure why. 10 | 11 |
12 | 13 | ## 📖 How to use? 14 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 15 | 2. **Download** the [Insulter.js](./Insulter.js) script. 16 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 17 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 18 | 5. Select widget size (preferable medium widget) and click on **[+ Add widget]** 19 | 6. Configure the newly added widget as [given below](#️-configure). 20 | 21 |
22 | 23 | ## ⚙️ Configure 24 | **Long press** on the widget and click on **Edit Widget ⓘ** 25 | 26 | | Options | Defaults | Change to | 27 | | :------------- |:------------- |:-------------| 28 | | Script | Choose | Insulter| 29 | | While Interacting (optional) | Open App | Run Script | 30 | | Parameters | Text | NA | 31 | 32 | Like so: 33 | 34 | Insulter Configuration 35 | 36 |
37 | 38 | ## ✍️ Feedback 39 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 40 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 41 | 42 |
43 | 44 | ## 🔮 Future updates planned with this widget 45 | Based on response and other time based factors my current plan includes: 46 | - [ ] Delete this stupid widget. 47 | 48 |
49 | 50 | ## ⭐️ Other Credits: 51 | This widget uses the [Evil Insults](https://evilinsult.com) API which is an [open source](https://github.com/EvilInsultGenerator/) initiative. 52 | 53 |
54 | 55 | --- 56 |
57 | Made with 💙 for fun 😉 - DK 58 |
59 | -------------------------------------------------------------------------------- /images/badges/medium-widget-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Covid Tracker - India/README.md: -------------------------------------------------------------------------------- 1 | ## Covid Tracker India - Widget 2 | Shows the latest number of newly confirmed cases and no of recovered patients from any state in India. 3 | 4 | Covid Tracker India 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | A perfect blend of boredom and fear of second wave lead to the creation of this. 10 | 11 |
12 | 13 | ## 📖 How to use? 14 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 15 | 2. **Download** the [Covid Tracker India.js](./Covid%20Tracker%20India.js) script. 16 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 17 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 18 | 5. Select widget size (preferable small widget) and click on **[+ Add widget]** 19 | 6. Configure the newly added widget as [given below](#️-configure). 20 | 21 |
22 | 23 | ## ⚙️ Configure 24 | **Long press** on the widget and click on **Edit Widget ⓘ** 25 | 26 | | Options | Defaults | Change to | 27 | | :------------- |:------------- |:-------------| 28 | | Script | Choose | Covid Tracker India| 29 | | While Interacting (optional) | Open App | Run Script | 30 | | Parameters | Text | State Code eg. "mh" for Maharashtra, "pb" for Punjab.defaults to maharashtra | 31 | 32 | Like so for Maharashtra: 33 | 34 | Covid Tracker India Configuration 35 | 36 |
37 | 38 | ## ✍️ Feedback 39 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 40 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 41 | 42 |
43 | 44 | ## 🔮 Future updates planned with this widget 45 | Based on response and other time based factors my current plan includes: 46 | - [ ] Add district wise support. 47 | 48 |
49 | 50 | ## ⭐️ Other Credits: 51 | This widget uses the [COVID19-India API](https://api.covid19india.org) which is an [open source](https://github.com/covid19india) initiative. 52 | 53 |
54 | 55 | --- 56 | 57 |
58 | Made with 💙 for fun 😉 - DK 59 |
60 | -------------------------------------------------------------------------------- /Random Number Fact/README.md: -------------------------------------------------------------------------------- 1 | ## Random Number Fact - Widget 2 | This widget after every some interval randomly chooses a number and gives a facton that number: 3 | 4 | Random Number Fact in iPhone 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | I just came across scriptable and was intrigued by it. I have no idea about swift/objective-c but was working with javascript for quiet some time and thought this could be a great way to enter the realm of Automation and iOS development + i feel widgets are super cool! 10 | 11 |
12 | 13 | ## 📖 How to use? 14 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 15 | 2. **Download** the [Random Number Fact.js](./Random%20Number%20Fact.js) script. 16 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 17 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 18 | 5. Select widget size (preferable medium widget) and click on **[+ Add widget]** 19 | 6. Configure the newly added widget as [given below](#️-configure). 20 | 21 |
22 | 23 | ## ⚙️ Configure 24 | **Long press** on the widget and click on **Edit Widget ⓘ** 25 | 26 | | Options | Defaults | Change to | 27 | | :------------- |:------------- |:-------------| 28 | | Script | Choose | Random Number Fact| 29 | | While Interacting (optional) | Open App | Run Script | 30 | | Parameters | Text | NA | 31 | 32 | Like so: 33 | 34 | Quotes Configuration 35 | 36 |
37 | 38 | ## ✍️ Feedback 39 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 40 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 41 | 42 |
43 | 44 | ## 🔮 Future updates planned with this widget 45 | Based on response and other time based factors my current plan includes: 46 | - [ ] Adding other trivia given by numbersapi. 47 | 48 |
49 | 50 | ## ⭐️ Other Credits: 51 | This script uses the [numbersapi](http://numbersapi.com) made by or as they like to call it "Hacked up by" [David](http://david-hu.com/2012/03/05/announcing-numbers-api.html) and [Mack](http://mduan.com/). 52 | 53 |
54 | 55 |
56 | Made with 💙 for fun 😉 - DK 57 |
-------------------------------------------------------------------------------- /Quotes/README.md: -------------------------------------------------------------------------------- 1 | ## Quotes - Widget 2 | This widget after every some interval gets you an illuminating quote: 3 | 4 | Quotes widget in iPhone 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | I just came across scriptable and was intrigued by it. I have no idea about swift/objective-c but was working with javascript for quiet some time and thought this could be a great way to enter the realm of Automation and iOS development + i feel widgets are super cool! 10 | 11 |
12 | 13 | ## 📖 How to use? 14 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 15 | 2. **Download** the [Quotes.js](./Quotes.js) script. 16 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 17 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 18 | 5. Select widget size (preferable medium widget) and click on **[+ Add widget]** 19 | 6. Configure the newly added widget as [given below](#️-configure). 20 | 21 |
22 | 23 | ## ⚙️ Configure 24 | **Long press** on the widget and click on **Edit Widget ⓘ** 25 | 26 | | Options | Defaults | Change to | 27 | | :------------- |:------------- |:-------------| 28 | | Script | Choose | Quotes| 29 | | While Interacting (optional) | Open App | Run Script | 30 | | Parameters | Text | "kanye" for quotes from Kanye West, "taylor" for quotes from Taylor Swift, defaults to "general" | 31 | 32 | Like so: 33 | 34 | Quotes Configuration 35 | 36 |
37 | 38 | ## ✍️ Feedback 39 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 40 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 41 | 42 |
43 | 44 | ## 🔮 Future updates planned with this widget 45 | Based on response and other time based factors my current plan includes: 46 | - [ ] Add other famous people on the list 47 | 48 |
49 | 50 | ## ⭐️ Other Credits: 51 | The General Quotes are presented to you with the help of [quotable](https://api.quotable.io) is used. For Kanye West quotes, [Kanye Rest](https://kanye.rest/) made by [Andrew Jazbec](https://github.com/ajzbc/kanye.rest) is used and for Taylor Swift quotes, [Taylor Rest](https://taylor.rest/) made by [Gilles](https://github.com/gillescoolen/taylor.rest) is used. 52 | 53 |
54 | 55 |
56 | Made with 💙 for fun 😉 - DK 57 |
58 | -------------------------------------------------------------------------------- /Covid Tracker v2 - India/README.md: -------------------------------------------------------------------------------- 1 | ## Covid Tracker v2 India - Widget 2 | Displays the latest number of confirmed cases for any state in India along with a graph depicting the trend for the number of cases for the last 7 days. 3 | 4 | Covid Tracker India v2 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | After making the [first version](./../Covid%20Tracker%20-%20India) i was experimenting with other designs and figured this would make for a beautiful widget + the mathematics of programming the graph on the widget excited me; hence. 10 | 11 |
12 | 13 | ## 📖 How to use? 14 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 15 | 2. **Download** the [Covid Tracker India v2.js](./Covid%20Tracker%20India%20v2.js) script. 16 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 17 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 18 | 5. Select widget size (preferable small widget) and click on **[+ Add widget]** 19 | 6. Configure the newly added widget as [given below](#️-configure). 20 | 21 |
22 | 23 | ## ⚙️ Configure 24 | **Long press** on the widget and click on **Edit Widget** 25 | 26 | | Options | Defaults | Change to | 27 | | :------------- |:------------- |:-------------| 28 | | Script | Choose | Covid Tracker India v2| 29 | | While Interacting (optional) | Open App | Run Script | 30 | | Parameters | Text | State Code eg. "mh" for Maharashtra, "pb" for Punjab.defaults to maharashtra | 31 | 32 | Like so for Maharashtra: 33 | 34 | Covid Tracker India Configuration 35 | 36 |
37 | 38 | ## ✍️ Feedback 39 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 40 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 41 | 42 |
43 | 44 | ## 🔮 Future updates planned with this widget 45 | Based on response and other time based factors my current plan includes: 46 | - [ ] Add district vise support. 47 | - [ ] Experiment with linear gradient instead of a solid red (Once the needful functionality is added) 48 | 49 |
50 | 51 | ## ⭐️ Other Credits: 52 | This widget uses the [COVID19-India API](https://api.covid19india.org) which is an [open source](https://github.com/covid19india) initiative. 53 | 54 |
55 | 56 |
57 | Made with 💙 for fun 😉 - DK 58 |
59 | -------------------------------------------------------------------------------- /Insulter/Insulter.js: -------------------------------------------------------------------------------- 1 | // Variables used by Scriptable. 2 | // These must be at the very top of the file. Do not edit. 3 | // icon-color: pink; icon-glyph: dizzy; share-sheet-inputs: plain-text; 4 | 5 | /* ======================================================= 6 | Script Name : Insulter.js 7 | Author : dharmikumbhani201@gmail.com 8 | Version : 1.0.0 9 | Description : 10 | Get a well deserved insult 11 | Dependencies: N/A 12 | Actions : 13 | ======================================================= */ 14 | 15 | 16 | //################################################################## 17 | 18 | //==============BASE URLS 19 | 20 | //--------GENERIC 21 | const GENERATE_RANDOM_INSULT = "https://evilinsult.com/generate_insult.php?lang=en&type=json"; 22 | 23 | const FONT_SIZE_INSULT = 26; 24 | const FONT = Font.boldSystemFont(FONT_SIZE_INSULT); 25 | 26 | //==============COLORS 27 | const COLORS = { 28 | // bg: '#030E49', 29 | bg: '#F2F2F2', 30 | text: '#F20746' 31 | } 32 | 33 | 34 | const data = await fetchRandomInsult(); 35 | const widget = createWidget(data); 36 | Script.setWidget(widget); 37 | Script.complete(); 38 | 39 | 40 | async function fetchRandomInsult(){ 41 | const urlToFetch = GENERATE_RANDOM_INSULT; 42 | const insult_JSON = await fetchJSON(`${urlToFetch}`); 43 | const insult = insult_JSON.insult; 44 | console.log(insult); 45 | return {insult} 46 | } 47 | /** 48 | * Make a REST request and return the response* 49 | * @param {*} url URL to make the request to 50 | * @param {*} headers Headers for the request 51 | */ 52 | async function fetchJSON(url, headers) { 53 | try { 54 | console.log(`Fetching url: ${url}`); 55 | const request = new Request(url); 56 | // req.headers = headers; 57 | const response = await request.loadJSON(); 58 | return response; 59 | } catch (error) { 60 | console.log(`Couldn't fetch ${url}`); 61 | } 62 | } 63 | 64 | //========================== 65 | // Creating Widget function 66 | //----- 67 | function createWidget(data) { 68 | 69 | console.log(`Creating widget with: ${JSON.stringify(data)}`); 70 | const widget = new ListWidget(); 71 | widget.backgroundColor = new Color(COLORS.bg); 72 | 73 | widget.useDefaultPadding(); 74 | 75 | //===STACK 1 - VERTICAL 76 | const insultVerticalStack = widget.addStack(); 77 | insultVerticalStack.layoutVertically(); 78 | 79 | //-------VSTACK - upper spacer 80 | insultVerticalStack.addSpacer(); 81 | 82 | //-------VSTACK - insult 83 | // const upperCaseInsult = data.insult 84 | const insult = insultVerticalStack.addText(`${data.insult.toUpperCase()}`); 85 | insult.textColor = new Color(COLORS.text) 86 | insult.textOpacity = 1.0; 87 | insult.font = FONT; 88 | insult.centerAlignText(); 89 | insult.minimumScaleFactor = 0.5 90 | 91 | //-------VSTACK - lower spacer 92 | 93 | insultVerticalStack.addSpacer(); 94 | return widget; 95 | } 96 | -------------------------------------------------------------------------------- /Periodic Table/README.md: -------------------------------------------------------------------------------- 1 | ## Periodic Table (Elements) - Widget 2 | This widget after every some interval randomly chooses one of 119 elements and displays useful information about it, things like: 3 | 1. Symbol, 4 | 2. Number (Z), 5 | 3. Atomic Mass (A), 6 | 4. Electron Affinity (Eₐ), 7 | 5. Phase 8 | - Solid - ❄️ 9 | - Liquid - 💧 10 | - Gaseous - ♨️ 11 | 6. Name of Element, 12 | 7. Short Summary on it and 13 | 8. Discovered By 14 | 15 | Elements of Periodic Table on iPhone 16 | 17 |
18 | 19 | ## 🙇 Why i made this? 20 | > Widgets could be a great way to consume information passively 21 | 22 | And what better information than the one thats actually gonna be useful for your final Chemistry exam! 23 | I remember during my high school when i had to learn these elements; it was less of a memory and more of a scare. My teachers tried making us learn these elements using lots of acronyms but i still used to forget them; there were bloddy 118 of them during my time. 24 | A suggestion I got from my teacher was, take a big printout of the entire periodic table and stick it somewhere on the wall above your bed and spend 5 minutes reading through it before going off to sleep. 25 | Theoretically this suggestion was great but practically for me it proved quiet useless! I used to end up playing Call of Duty late at night with friends and sleep; spending the last 5 minutes before sleeping looking at the black mirror. 26 | 27 |
28 | 29 | ## 📖 How to use? 30 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 31 | 2. **Download** the [Periodic Table.js](./Periodic%20Table.js) script. 32 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 33 | 4. **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 34 | 5. Select widget size (preferable large widget) and click on **[+ Add widget]** 35 | 6. Configure the newly added widget as [given below](#️-configure). 36 | 37 |
38 | 39 | ## ⚙️ Configure 40 | **Long press** on the widget and click on **Edit Widget ⓘ** 41 | 42 | | Options | Defaults | Change to | 43 | | :------------- |:------------- |:-------------| 44 | | Script | Choose | Periodic Table| 45 | | While Interacting (optional) | Open App | Run Script | 46 | | Parameters | Text | NA | 47 | 48 | Like so: 49 | 50 | Periodic Table Configuration 51 | 52 |
53 | 54 | ## ✍️ Feedback 55 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 56 | widgets that can help us passively learn things should not be just limited to periodic tables; but to various other subjects as well, if you have any such idea in mind, feel free to reach out to me! 57 | 58 |
59 | 60 | ## 🔮 Future updates planned with this widget 61 | Based on response and other time based factors my current plan includes: 62 | - [ ] Change background color depending on light and dark mode 63 | - [ ] Loop through all the elements in order one after the other 64 | - [ ] Control the refresh rate, so one can set it to refresh element daily. 65 | 66 |
67 | 68 | ## ⭐️ Other Credits: 69 | This script uses the [periodic table json](https://github.com/Bowserinator/Periodic-Table-JSON) made by [Bowserinator](https://github.com/Bowserinator) as it's source. 70 | 71 |
72 | 73 | --- 74 | 75 |
76 | Made with 💙 for fun 😉 - DK 77 |
78 | -------------------------------------------------------------------------------- /images/badges/small-widget-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Random Number Fact/Random Number Fact.js: -------------------------------------------------------------------------------- 1 | // Variables used by Scriptable. 2 | // These must be at the very top of the file. Do not edit. 3 | // icon-color: blue; icon-glyph: infinity; 4 | 5 | /* ======================================================= 6 | Script Name : Random Number Fact.js 7 | Author : dharmikumbhani201@gmail.com 8 | Version : 1.0.0 9 | Description : 10 | Fact on a randomly generated number 11 | Dependencies: N/A 12 | Actions : 13 | ======================================================= */ 14 | 15 | 16 | //################################################################## 17 | 18 | //==============BASE URLS 19 | 20 | const BASE_URL = "http://numbersapi.com" 21 | 22 | //===============Font name and sizes 23 | const FONT_NAME_NUMBER = 'Futura-CondensedExtraBold'; 24 | const FONT_NAME_FACT = 'Futura-Medium'; 25 | const FONT_SIZE_NUMBER = 42; //Bold 26 | const FONT_SIZE_FACT_TEXT = 16; //Regular 27 | 28 | //===============Colors 29 | const COLORS = { 30 | blackLG:{ 31 | l: '#000000', 32 | r: '#676767' 33 | }, 34 | purpleLG:{ 35 | l: '#B448B2', 36 | r:'#FF6091' 37 | }, 38 | blueLG:{ 39 | l: '#0038FF', 40 | r:'#3EABFF' 41 | }, 42 | textcolor: '#FFFFFF', 43 | } 44 | 45 | 46 | // Fetch data and create widget 47 | const data = await fetchRandomNumberFact(); 48 | const widget = createWidget(data); 49 | Script.setWidget(widget); 50 | Script.complete(); 51 | 52 | 53 | //========================== 54 | // Fetching Fact using Random Number Generator Function 55 | //----- 56 | async function fetchRandomNumberFact(){ 57 | var randomNumber = getRandomIntInclusive(0,365) 58 | console.log(randomNumber) 59 | 60 | const fact = await fetchText(`${BASE_URL}/${randomNumber}`); 61 | // console.log(fact); 62 | 63 | var regex = new RegExp(".?"+ randomNumber + " "); 64 | // console.log(regex); 65 | 66 | const strippedFact = fact.replace(regex, ""); 67 | console.log(strippedFact); 68 | return { 69 | randomNumber, 70 | strippedFact 71 | } 72 | } 73 | 74 | //========================== 75 | // Random Number Generator 76 | //----- 77 | function getRandomIntInclusive(min, max) { 78 | min = Math.ceil(min); 79 | max = Math.floor(max); 80 | return Math.floor(Math.random() * (max - min + 1) + min); 81 | //The maximum is inclusive and the minimum is inclusive 82 | } 83 | 84 | /** 85 | * Make a REST request and return the response for* 86 | * @param {*} url URL to make the request to 87 | * @param {*} headers Headers for the request 88 | */ 89 | async function fetchText(url, headers) { 90 | try { 91 | console.log(`Fetching url: ${url}`); 92 | const request = new Request(url); 93 | // req.headers = headers; 94 | const response = await request.loadString(); 95 | return response; 96 | } catch (error) { 97 | console.log(`Couldn't fetch ${url}`); 98 | } 99 | } 100 | 101 | //========================== 102 | // Creating Widget function 103 | //----- 104 | function createWidget(data) { 105 | 106 | console.log(`Creating widget with: ${JSON.stringify(data)}`); 107 | 108 | const widget = new ListWidget(); 109 | const bgColor = new LinearGradient(); 110 | bgColor.colors = [new Color(COLORS.purpleLG.l), new Color(COLORS.purpleLG.r)]; 111 | bgColor.locations = [1.0, 0.0]; 112 | bgColor.startPoint = new Point(1, 1); 113 | bgColor.endPont = new Point(0, 0); 114 | widget.backgroundGradient = bgColor; 115 | widget.setPadding(10, 15, 15, 10); 116 | 117 | const stack = widget.addStack(); 118 | stack.layoutVertically(); 119 | stack.spacing = 4; 120 | stack.size = new Size(320, 0); 121 | 122 | // Number Display Text 123 | const randomNumber = stack.addText(`${data.randomNumber}`); 124 | randomNumber.textColor = Color.white(); 125 | randomNumber.textOpacity = 1.0; 126 | randomNumber.font = new Font(FONT_NAME_NUMBER, FONT_SIZE_NUMBER); 127 | 128 | // Fact Display Text 129 | const fact = stack.addText(`${data.strippedFact}`); 130 | fact.textColor = Color.white(); 131 | fact.font = new Font(FONT_NAME_FACT, FONT_SIZE_FACT_TEXT); 132 | 133 | return widget; 134 | } 135 | 136 | -------------------------------------------------------------------------------- /Notion Integrations/re-reads/README.md: -------------------------------------------------------------------------------- 1 | ## notion-re-reads Widget 2 | Brings your re-reads (quotes, phrases, one liners from books you found while reading a book) to you **passively** instead of having to actively take time out and going through them. 3 | 4 | Notion-re-readsxscriptable 5 | 6 |
7 | 8 | ## 🙇 Why i made this? 9 | The list of profound quotes and phrases that i had come across was increasing daily and although i was diligent enough to type them down immediately in notion but was too lazy to find and schedule specific time for going through them.
10 | I needed a way where these re-reads would come to me instead me having to actively take time out to go through all of them.
11 | Hence this widget was made to passively, intermiddently and randomly get me a random re-read that i had typed down. 12 | 13 |
14 | 15 | ## 📖 How to use? 16 | 1. **Download** [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 17 | 2. **Download** the [notion-re-reads.js](./notion-re-reads.js) script. 18 | 3. **Transfer** the downloaded script to the "scriptable" folder on iCloud Drive which should have been created upon downloading of the app. 19 | 4. Go to [developers.notion](https://developers.notion.com) and click on **MY INTEGRATIONS**. 20 | 5. Create a **NEW INTEGRATION** copy the secrete token and paste it inside the double quotes for the variable name **BEARER_TOKEN** inside your notion-re-reads.js file. 21 | 6. Now go to the your notion page where you have all your re-reads and click on **SHARE** and **ADD** the recent integration you made by clicking on invite. 22 | 7. After adding the integration directly copy link to that page (or try: ⌘+L for mac) and paste it inside the double quotes of the variable **NOTION_LINK** inside your notion-re-reads.js file. 23 | 8. Now the final steps of adding the widget to your home screen: 24 |
25 | **Long press** anywhere to enter the "jiggle mode" and click on "**+**" sign present on the top left of your screen. **Scroll down** until you find the Scriptable app and click on it. 26 | 9. Select widget size (preferable large widget) and click on **[+ Add widget]** 27 | 10. Configure the newly added widget as [given below](#️-configure). 28 | 29 |
30 | 31 | ## ⚙️ Configure 32 | **Long press** on the widget and click on **Edit Widget ⓘ** 33 |
34 | Depending on the parameter the widget will display any of the selected type. i.e if you choose the parameter as "quote" then you will get a random quotes that is there in your notion page. 35 | 36 | 37 | | Options | Defaults | Change to | 38 | | :------------- |:------------- |:-------------| 39 | | Script | Choose | notion-re-reads| 40 | | While Interacting (optional) | Open App | Run Script | 41 | | Parameters (optional) | Text | "quote", "paragraph", "heading_1", "heading_2", "heading_3", "bulleted_list_item", "numbered_list_item", "to_do" | 42 | 43 | Like so: 44 | 45 | Insulter Configuration 46 | 47 |
48 | 49 | ## 👨🏻‍💻 How i use this in my workflow 50 | 1. While reading as soon as I come across something profound and feel it could be a great phrase to add it to my vocabulary, i immediately add it to my notion page as a quote.. I call that page Communications Development. 51 | 2. Thats it. Now i let the widget do its work and be rest assured that sometime in future i will surely read it again. 52 | 53 |
54 | 55 | ## ✍️ Feedback 56 | If you have any feature request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 57 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 58 | 59 |
60 | 61 | ## 🔮 Future updates planned with this widget 62 | Based on response and other time based factors my current plan includes: 63 | - [ ] Add Support for randomly selecting from multiple parameters types (quotes + bulleted_list_item, etc). 64 | 65 |
66 | 67 | ## ⭐️ Other Credits: 68 | This widget uses the [Notion](https://developers.notion.com) API. 69 | 70 |
71 | 72 | --- 73 |
74 | Made with 💙 for fun 😉 - DK 75 |
76 | -------------------------------------------------------------------------------- /images/badges/scriptableBadge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scriptable - scripts and widgets for iOS 2 | Collection of widgets and scripts made using scriptable app for iOS 3 | 4 | ![Scriptable App](./images/badges/scriptableBadge.svg)   ![iOS](./images/badges/iOS-badge.svg) 5 | 6 | Scriptable widgets 7 | 8 | 9 | Scriptable is an app that lets you add cool, lightweight widgets as well as automation to your apple devices. 10 | 11 |
12 | 13 | ## Table of Contents 14 | - [❏ List of widgets](#-list-of-widgets) 15 | - [Notion Integrations](#notion-integrations) 16 | - [Covid Tracker India](#covid-tracker-india) 17 | - [Covid Tracker India v2](#covid-tracker-india-v2) 18 | - [Insulter](#insulter) 19 | - [Periodic Table](#periodic-table) 20 | - [Quotes](#quotes) 21 | - [Random Number Fact](#random-number-fact) 22 | - [📖 How to use scriptable widgets?](#-how-to-use-scriptable-widgets) 23 | - [✍️ Feedback](#️-feedback) 24 | 25 |
26 | 27 | ## ❏ List of widgets 28 | ### [Notion Integrations](https://github.com/dharmikumbhani/scriptable/tree/main/Notion%20Integrations) 29 | ![Notion x Scriptable](images/notionIntegrations/NotionxScriptable.png) 30 | 31 | 32 | 33 | Scriptable widgets made using the Notion API. 34 | 35 | ⚠️ Due to recent [closure](https://blog.covid19india.org/2021/08/07/end/) of the covid tracker API, the following widgets might not work! 36 | ### [Covid Tracker India](https://github.com/dharmikumbhani/scriptable/tree/main/Covid%20Tracker%20-%20India) 37 | ![Covid Tracker India Widget](./images/covidTrackerIndia/Covid-tracker-display-image.png) 38 | 39 | 40 | ![iOS widget](./images/badges/small-widget-badge.svg) 41 | 42 | Shows the latest number of newly confirmed cases and no of revcovered patients from any state in India. 43 | 44 | ### [Covid Tracker India v2](https://github.com/dharmikumbhani/scriptable/tree/main/Covid%20Tracker%20v2%20-%20India) 45 | ![Covid Tracker India Widget](./images/covidTrackerIndiaV2/CovidTrackerIndia-V2-display.png) 46 | 47 | ![iOS widget](./images/badges/small-widget-badge.svg) 48 | 49 | Displays the latest number of cofirmed cases for any state in India along with a graph depciting the trend for the number of cases for the last 7 days. 50 | 51 | ### [Insulter](https://github.com/dharmikumbhani/scriptable/tree/main/Insulter) 52 | ![Evil Insults](./images/insulter/InsulterDisplay.png) 53 | 54 | ![iOS widget](./images/badges/medium-widget-badge.svg) 55 | 56 | Petty self explanatory - Gives you a well deserved insult. 57 | 58 | ### [Periodic Table](https://github.com/dharmikumbhani/scriptable/tree/main/Periodic%20Table) 59 | ![Periodic Table Flashcard](./images/periodicTable/PeriodicTableDisplay.png) 60 | 61 | ![iOS widget](./images/badges/large-widget-badge.svg) 62 | 63 | Get details about an element from the periodic table 64 | 65 | ### [Quotes](https://github.com/dharmikumbhani/scriptable/tree/main/Quotes) 66 | ![Quotes Widget](./images/quotes/QuotesDisplay.png) 67 | 68 | ![iOS widget](./images/badges/medium-widget-badge.svg) 69 | 70 | Shows a random quote from famous people like Alber Einstein, John Wolfgang von Goethe 71 | 72 | ### [Random Number Fact](https://github.com/dharmikumbhani/scriptable/tree/main/Random%20Number%20Fact) 73 | ![Random Number Fact Widget](./images/RandomNumberFact/RandomNumberFactDisplay.png) 74 | 75 | ![iOS widget](./images/badges/medium-widget-badge.svg) 76 | 77 | Well gives you a rather intresting fact adout a randomly generated number. 78 | 79 |
80 | 81 | ## 📖 How to use scriptable widgets? 82 | 1. Download the [scriptable app](https://apps.apple.com/in/app/scriptable/id1405459188). 83 | 2. Check if the scriptable folder is created have created a folder having the name "scriptable" in your iCloud drive. 84 | 3. Download the .js script of the respective widget and add it to that scriptable folder. 85 | 4. Long Press anywhere on screen, click on "+" icon, select scriptable app and click on add widget with the size depending on the widget you choose. 86 | 5. "**edit widget ⓘ**" by long pressing it to change the following configurations: 87 | | Options | Defaults | Change to | 88 | | ------------- |:------------- |:-------------| 89 | | Script | Choose | Select widget | 90 | | While Interacting (optional) | Open App | Run Script | 91 | | Parameters | Text | Configurable options, depending on widgets | 92 | 6. More info and configurable options (if any) are availble in the respective folders of widgets. 93 | 94 |
95 | 96 | ## ✍️ Feedback 97 | If you have any feature/widget request or feedback on this feel free to DM me on [Twitter](https://twitter.com/DharmiKumbhani) or mail me at 98 | widgets that can help us passively learn things should not be just limited to facts; but to various other domains as well, if you have any such idea in mind, feel free to reach out to me! 99 | 100 |
101 | 102 | --- 103 | 104 |
105 | Made with 💙 for fun 😉 - DK 106 |
107 | -------------------------------------------------------------------------------- /Quotes/Quotes.js: -------------------------------------------------------------------------------- 1 | // Variables used by Scriptable. 2 | // These must be at the very top of the file. Do not edit. 3 | // icon-color: deep-gray; icon-glyph: quote-right; 4 | // share-sheet-inputs: plain-text; 5 | 6 | /* ======================================================= 7 | Script Name : Quotes.js 8 | Author : dharmikumbhani201@gmail.com 9 | Version : 1.0.0 10 | Description : 11 | Get random quotes 12 | Dependencies: N/A 13 | Actions : 14 | ======================================================= */ 15 | 16 | 17 | //################################################################## 18 | 19 | //==============BASE URLS 20 | 21 | //--------GENERIC 22 | const RANDOM_QUOTE_URL = "https://api.quotable.io/random?maxLength=150"; 23 | 24 | //--------KANYE 25 | const KANYE_QUOTES_URL = "https://api.kanye.rest/"; 26 | 27 | //--------TAYLOR 28 | const TAYLOR_QUOTES_URL = "https://api.taylor.rest/"; 29 | 30 | //--------Game of thrones 31 | const GOT_URL = "https://game-of-thrones-quotes.herokuapp.com/v1/random"; 32 | 33 | //==============Font Names and Sizes 34 | const FONT_NAME_AUTHOR = 'HelveticaNeue-MediumItalic'; 35 | const FONT_SIZE_QUOTE = 20; //Large 36 | const FONT_SIZE_AUTHOR = 12; //Small 37 | 38 | //==============COLORS 39 | const COLORS ={ 40 | grey: { 41 | l: '#606C88', 42 | r: '#3F4C6B', 43 | authorTag: '#C7CAE1' 44 | }, 45 | red: { 46 | l: '#D94A4A', 47 | r: '#BF414C', 48 | authorTag: '#F1E3C7' 49 | }, 50 | electricViolet: { 51 | l: '#4776E6', 52 | r: '#8E54E9', 53 | authorTag: '#FCDDF5' 54 | }, 55 | quoteText: '#FFFFFF' 56 | } 57 | 58 | let API_URL = RANDOM_QUOTE_URL; 59 | let BGCOLOR = { 60 | l: '#606C88', 61 | r: '#3F4C6B', 62 | authorTag: '#C7CAE1' 63 | }; 64 | if (args.widgetParameter === "" || args.widgetParameter === "general"){ 65 | API_URL = RANDOM_QUOTE_URL; 66 | BGCOLOR = { 67 | l: '#606C88', 68 | r: '#3F4C6B', 69 | authorTag: '#C7CAE1' 70 | } 71 | } else if (args.widgetParameter === "kanye") { 72 | API_URL = KANYE_QUOTES_URL; 73 | BGCOLOR = { 74 | l: '#D94A4A', 75 | r: '#BF414C', 76 | authorTag: '#F1E3C7' 77 | } 78 | } else if (args.widgetParameter === "taylor") { 79 | API_URL = TAYLOR_QUOTES_URL; 80 | BGCOLOR = { 81 | l: '#4776E6', 82 | r: '#8E54E9', 83 | authorTag: '#FCDDF5' 84 | } 85 | } 86 | 87 | const data = await fetchRandomQuote(); 88 | const widget = createWidget(data); 89 | Script.setWidget(widget); 90 | Script.complete(); 91 | 92 | 93 | async function fetchRandomQuote(){ 94 | const urlToFetch = API_URL; 95 | const quote_JSON = await fetchJSON(`${urlToFetch}`); 96 | const quote = quote_JSON.content || quote_JSON.quote ; 97 | const author = quote_JSON.author || "Kanye West"; 98 | console.log(quote); 99 | console.log(author); 100 | return { 101 | quote, 102 | author 103 | } 104 | } 105 | 106 | /** 107 | * Make a REST request and return the response* 108 | * @param {*} url URL to make the request to 109 | * @param {*} headers Headers for the request 110 | */ 111 | async function fetchJSON(url, headers) { 112 | try { 113 | console.log(`Fetching url: ${url}`); 114 | const request = new Request(url); 115 | // req.headers = headers; 116 | const response = await request.loadJSON(); 117 | return response; 118 | } catch (error) { 119 | console.log(`Couldn't fetch ${url}`); 120 | } 121 | } 122 | 123 | //========================== 124 | // Creating Widget function 125 | //----- 126 | function createWidget(data) { 127 | 128 | console.log(`Creating widget with: ${JSON.stringify(data)}`); 129 | const widget = new ListWidget(); 130 | const bgColor = new LinearGradient(); 131 | bgColor.colors = [new Color(BGCOLOR.l), new Color(BGCOLOR.r)]; 132 | bgColor.locations = [1.0, 0.0]; 133 | bgColor.startPoint = new Point(1, 1); 134 | bgColor.endPont = new Point(0, 0); 135 | widget.backgroundGradient = bgColor; 136 | widget.setPadding(0, 0, 0, 0); 137 | // widget.useDefaultPadding(); 138 | 139 | //===STACK 1 - VERTICAL 140 | const quoteVerticalStack = widget.addStack(); 141 | quoteVerticalStack.layoutVertically(); 142 | quoteVerticalStack.setPadding(0,20,0, 24) 143 | 144 | //-------VSTACK - upper spacer 145 | quoteVerticalStack.addSpacer(); 146 | 147 | //-------VSTACK - QUOTE 148 | const quote = quoteVerticalStack.addText(`${data.quote}`); 149 | quote.textColor = Color.white() 150 | quote.textOpacity = 1.0; 151 | // quote.font = new Font(FONT_NAME_QUOTE, FONT_SIZE_QUOTE) 152 | quote.font = Font.boldSystemFont(FONT_SIZE_QUOTE); 153 | 154 | //-------VSTACK - lower spacer 155 | quoteVerticalStack.addSpacer(); 156 | 157 | //====STACK 2 - HORIZONTAL 158 | const authorHorizontalStack = widget.addStack() 159 | authorHorizontalStack.layoutHorizontally(); 160 | authorHorizontalStack.setPadding(0, 0,12,24); 161 | // authorHorizontalStack.backgroundColor = new Color(COLORS.red.l) 162 | 163 | //-------HSTAC- left spacer 164 | authorHorizontalStack.addSpacer(); 165 | 166 | //-------HSTAC - AUTHOR TEXT 167 | const author = authorHorizontalStack.addText(`- ${data.author}`); 168 | author.textColor = new Color(BGCOLOR.authorTag); 169 | author.textOpacity = 0.80; 170 | // author.font = Font.italicSystemFont(FONT_SIZE_AUTHOR); 171 | author.rightAlignText(); 172 | author.font = new Font(FONT_NAME_AUTHOR, FONT_SIZE_AUTHOR); 173 | 174 | return widget; 175 | } 176 | -------------------------------------------------------------------------------- /Notion Integrations/re-reads/notion-re-reads.js: -------------------------------------------------------------------------------- 1 | // Variables used by Scriptable. 2 | // These must be at the very top of the file. Do not edit. 3 | // icon-color: deep-gray; icon-glyph: quote-right; 4 | // share-sheet-inputs: plain-text; 5 | 6 | /* ======================================================= 7 | Script Name : notion-re-reads.js 8 | Author : dharmikumbhani201@gmail.com 9 | Version : 1.0.0 10 | Description : Get your re-reads from notion 11 | Dependencies: N/A 12 | Actions : 13 | ======================================================= */ 14 | 15 | 16 | //################################################################## 17 | // ⚠️⚠️⚠️⚠️ TO BE ADDED BY YOU - Mandatory ⚠️⚠️⚠️⚠️ 18 | //============== PASTE INSIDE "" ======================== 19 | const NOTION_LINK = "" 20 | // eg. const NOTION_LINK = "https://www.notion.so/re-reads-9d7ca77104ab4cd198b925711e010860" 21 | const BEARER_TOKEN = "" 22 | // eg. const BEARER_TOKEN = "Bearer secret_8********Js82wu1zQ********A6Z2r***tslyTgrrA" 23 | 24 | //################################################################## 25 | 26 | 27 | const permissibleValuesForSelectorType = { 28 | "quote": "quote", 29 | "paragraph": "paragraph", 30 | "heading_1": "heading_1", 31 | "heading_2": "heading_2", 32 | "heading_3": "heading_3", 33 | "bulleted_list_item": "bulleted_list_item", 34 | "numbered_list_item": "numbered_list_item", 35 | "to_do": "to_do" 36 | } 37 | //============== OTHER EDITABLES 38 | //==============Font Names and Sizes 39 | let selector = "quote" 40 | if (args.widgetParameter != undefined){ 41 | selector = (args.widgetParameter.toLowerCase() in permissibleValuesForSelectorType) ? args.widgetParameter : 'quote'; 42 | } 43 | // Selector Parameter for Configurations: 44 | // Possible values include "paragraph", "heading_1", "heading_2", "heading_3", "bulleted_list_item", "numbered_list_item", "to_do" 45 | 46 | const FONT_NAME_QUOTE = 'BradleyHandITCTT-Bold' 47 | //Refer http://iosfonts.com for other available fonts. 48 | const FONT_SIZE_QUOTE = 24 49 | //=============================== 50 | 51 | 52 | //################################################################## 53 | 54 | let API_URL 55 | 56 | const HEADERS = { 57 | "Accept": "application/json", 58 | 'Notion-Version': '2021-05-11', 59 | "Authorization": `${BEARER_TOKEN}` 60 | } 61 | 62 | //==============COLORS 63 | let BGCOLOR = { 64 | l: '#FFFFFF', 65 | r: '#FFFFFF', 66 | authorTag: '#C7CAE1' 67 | }; 68 | var data 69 | if(NOTION_LINK != "" && BEARER_TOKEN != ""){ 70 | if (args.widgetParameter in permissibleValuesForSelectorType || args.widgetParameter === ""){ 71 | data = await fetchRandomChoosenContentFromNotion(); 72 | } else { 73 | data = `Invalid Parameter input. Valid Parameters include "paragraph", "heading_1", "heading_2", "heading_3", "bulleted_list_item", "numbered_list_item", "to_do" ` 74 | } 75 | } else { 76 | data = "You are missing Notion Link or the Bearer Token" 77 | } 78 | const widget = createWidget(data); 79 | Script.setWidget(widget); 80 | Script.complete(); 81 | 82 | function makeAPILinkFromNotionLink(notionLink){ 83 | const UUID = notionLink.slice(notionLink.length - 32) 84 | const APILink = `https://api.notion.com/v1/blocks/${UUID}/children?page_size=100` 85 | console.log("API End Point:", APILink); 86 | return APILink 87 | } 88 | async function fetchRandomChoosenContentFromNotion(){ 89 | const urlToFetch = makeAPILinkFromNotionLink(NOTION_LINK); 90 | let next_cursor 91 | let allResultsArray = [] 92 | 93 | //Run it the first time 94 | let pageJSON = await fetchJSON(`${urlToFetch}`, HEADERS); 95 | let resultsArray = refiningData(pageJSON) 96 | allResultsArray.push(...resultsArray) 97 | 98 | //Run it the second time and check and keep running 99 | while(pageJSON.next_cursor != undefined && pageJSON.has_more === true) { 100 | next_cursor = pageJSON.next_cursor 101 | 102 | pageJSON = await fetchJSON(`${urlToFetch}`+`&start_cursor=${next_cursor}`, HEADERS); 103 | resultsArray = refiningData(pageJSON) 104 | allResultsArray.push(...resultsArray) 105 | } 106 | // console.log(FullJSObject); 107 | 108 | // console.log(allResultsArray) 109 | // console.log(allResultsArray.length); 110 | 111 | //================= Get Random Number depending on the array length 112 | const randomNumberFromArray = randomSelectorFromArray(allResultsArray) 113 | // console.log(randomNumberFromArray); 114 | 115 | //================= Get Specific Quote Object 116 | const choosenObject = allResultsArray[randomNumberFromArray] 117 | // console.log(choosenObject) 118 | 119 | //================= Get the actual Quote 120 | const content = gettingContentFromChoosenObject(choosenObject) 121 | 122 | return content 123 | } 124 | function refiningData(object){ 125 | const choosenArray = object.results.filter((resultObj)=> resultObj.type === selector) 126 | return choosenArray 127 | } 128 | 129 | function randomSelectorFromArray(arr){ 130 | return random = Math.floor(Math.random()*arr.length) 131 | } 132 | 133 | function gettingContentFromChoosenObject(choosenObject){ 134 | let content= "" 135 | if(choosenObject != undefined) { 136 | const textArray = choosenObject[selector].text; 137 | for(i=0; i confValues[index] = parseInt(confValues[index])); 157 | return { 158 | confirmed, 159 | recovered, 160 | deceased, 161 | dateString, 162 | confValues 163 | } 164 | } 165 | //------------------------------------- 166 | // Fetch Function 167 | //------------------------------------- 168 | /** 169 | * Make a REST request and return the response for* 170 | * @param {*} url URL to make the request to 171 | * @param {*} headers Headers for the request 172 | */ 173 | async function fetchRawData(url, headers) { 174 | try { 175 | console.log(`Fetching url: ${url}`); 176 | const request = new Request(url); 177 | // req.headers = headers; 178 | const response = await request.loadJSON(); 179 | return response; 180 | } catch (error) { 181 | console.log(`Couldn't fetch ${url}`); 182 | } 183 | } 184 | 185 | //------------------------------------- 186 | // Taking the numbers and convetring them to comma seperated values 187 | /** 188 | * @param {*} x number to which commas are to be added 189 | */ 190 | //------------------------------------- 191 | function numberWithCommas(x) { 192 | var parts = x.toString().split("."); 193 | parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); 194 | return parts.join("."); 195 | } 196 | 197 | 198 | 199 | ////========================== 200 | // Full Graph creation = getting points + Drawing graph => returns the image that can directly be used by widgetStack.addImage() 201 | ////========================== 202 | /** 203 | * @param {*} data data of entire confirmed, deceased,recovered and array of the past 7 days confirmed cases 204 | */ 205 | function createGraph(data){ 206 | const points = graphingValues(data) 207 | const image = drawingImage(points) 208 | return image; 209 | } 210 | 211 | //========================== 212 | // Finding values to be used by the image 213 | //------------------------------------- 214 | /** 215 | * @param {*} data data of entire confirmed, deceased,recovered and array of the past 7 days confirmed cases 216 | */ 217 | 218 | function graphingValues(data) { 219 | const arrayOfValues = data.confValues; 220 | const interpolatedArray = gettingYValuesThroughLInter(arrayOfValues); 221 | // console.log(interpolatedArray); 222 | // Inversion of values for the inverted canvas 223 | let invertedArray = [] 224 | invertedArray = interpolatedArray.map(value => GRAPHING.yMax - value); 225 | console.log(invertedArray); 226 | 227 | let graphingPoints = [] 228 | graphingPoints = invertedArray.map((value,index) => new Point(GRAPHING.xOffset*[index], value)); 229 | // console.log(graphingPoints); 230 | 231 | // Main array of points to drawn the entire graph 232 | const points = [ 233 | new Point(0, 84), 234 | ...graphingPoints, 235 | new Point(174, 84) 236 | ] 237 | return points; 238 | } 239 | //------------------------------------- 240 | // Getting Y values 241 | //------------------------------------- 242 | function gettingYValuesThroughLInter(array) { 243 | // lower bound (x1,y1) 244 | const lowerBoundX1 = Math.min(...array); 245 | const lowerBoundY1 = GRAPHING.yMax-68; 246 | 247 | // upper bound (x2,y2) 248 | const upperBoundX2 = Math.max(...array); 249 | const upperBoundY2 = GRAPHING.yMax; 250 | 251 | let interpolatedArray = [] 252 | // getting the interpolated float values 253 | interpolatedArray = array.map(value => { 254 | return lInterp(value,lowerBoundX1, lowerBoundY1, upperBoundX2, upperBoundY2) 255 | }); 256 | // Rounding up the interpolated values 257 | interpolatedArray.forEach((string, index) => interpolatedArray[index] = Math.round(interpolatedArray[index])); 258 | return interpolatedArray; 259 | } 260 | 261 | //------------------------------------- 262 | // Mathematical formula for linear interpolation 263 | //------------------------------------- 264 | function lInterp(x,x1,y1,x2,y2){ 265 | // Mathematical formula 266 | const y = (((y2-y1)/(x2-x1))*(x-x1)) + y1 267 | return y 268 | } 269 | 270 | //------------------------------------- 271 | // Creating the graph/image 272 | //------------------------------------- 273 | /** 274 | * @param {*} points array of "points" (interpolated and inverte) that are to be used to draw the graph 275 | */ 276 | function drawingImage(points){ 277 | 278 | // Creating Path 279 | const path = new Path(); 280 | path.move(points[0]) 281 | path.addLines(points); 282 | path.closeSubpath(); 283 | 284 | //Main Drawing part with inputed paths 285 | let dc = new DrawContext(); 286 | dc.size = GRAPHING.canvasSize; 287 | // console.log(getAllFuncs(dc)); 288 | dc.opaque = false; 289 | dc.addPath(path); 290 | dc.setStrokeColor(new Color(COLORS.redGraphGradient.l, 1.0)); 291 | dc.setLineWidth(1.5); 292 | dc.strokePath(); 293 | dc.addPath(path) 294 | dc.setFillColor(new Color(COLORS.redGraphGradient.l, 0.5)) 295 | dc.fillPath(); 296 | const drawn = dc.getImage(); 297 | 298 | 299 | return drawn 300 | } 301 | 302 | //========================== 303 | // Creating widget function 304 | //========================== 305 | /** 306 | * @param {*} data data of confirmed, deceased, recovered values 307 | * @param {*} image drawn image of the graph 308 | */ 309 | function createWidget(data, image) { 310 | 311 | console.log(`Creating widget with: ${JSON.stringify(data)}`); 312 | 313 | const widget = new ListWidget(); 314 | widget.backgroundGradient = DiagonalLinearGradient(COLORS.lightPurple.l, COLORS.lightPurple.r); 315 | widget.setPadding(0,0,0,0); 316 | 317 | const vStackMain = widget.addStack(); 318 | vStackMain.layoutVertically(); 319 | vStackMain.setPadding(0,0,0,0); 320 | vStackMain.size = new Size(169,169) 321 | 322 | const upperHalf = vStackMain.addStack(); 323 | upperHalf.layoutVertically(); 324 | upperHalf.setPadding(16,16,0,0); 325 | 326 | const state = upperHalf.addText(`${stateName}, ${data.dateString}`); 327 | state.textColor = COLORS.text; 328 | state.textOpacity = 1.0; 329 | state.font = FONTS.stateDate; 330 | 331 | upperHalf.addSpacer(6); 332 | 333 | // Confirmed cases today 334 | const noOfCases = upperHalf.addText(`${data.confirmed}`); 335 | noOfCases.textColor = new Color(COLORS.noOfCases) 336 | noOfCases.textOpacity = 1.0; 337 | noOfCases.font = FONTS.noOfCases; 338 | noOfCases.leftAlignText(); 339 | noOfCases.shadowColor = SHADOW.color; 340 | noOfCases.shadowRadius = SHADOW.radius; 341 | noOfCases.shadowOffset = SHADOW.offset; 342 | 343 | 344 | const newC = upperHalf.addText(`new cases`); 345 | newC.textColor = COLORS.text; 346 | newC.font = FONTS.text; 347 | newC.leftAlignText(); 348 | 349 | const lowerHalf = vStackMain.addStack(); 350 | lowerHalf.layoutHorizontally(); 351 | lowerHalf.setPadding(0,0,0,0); 352 | // lowerHalf.size = new Size(169,0); 353 | lowerHalf.addImage(image); 354 | 355 | return widget; 356 | } 357 | //------------------------------------- 358 | // Gradient creator defaults to diagonal mainly for the background of the widget 359 | //------------------------------------- 360 | function DiagonalLinearGradient(l,r, x1=1, y1=0, x2=0, y2=1){ 361 | const bgColor = new LinearGradient(); 362 | bgColor.colors = [new Color(l), new Color(r)]; 363 | bgColor.locations = [0.0, 1.0]; 364 | bgColor.startPoint = new Point(x1, y1); 365 | bgColor.endPont = new Point(x2,y2); 366 | return bgColor 367 | } 368 | 369 | 370 | //------------------------------------- 371 | // Miscellaneous functions 372 | //------------------------------------- 373 | function getAllFuncs(toCheck) { 374 | var props = []; 375 | var obj = toCheck; 376 | do { 377 | props = props.concat(Object.getOwnPropertyNames(obj)); 378 | } while (obj = Object.getPrototypeOf(obj)); 379 | 380 | return props.sort().filter(function(e, i, arr) { 381 | if (e!=arr[i+1] && typeof toCheck[e] == 'function') return true; 382 | }); 383 | } --------------------------------------------------------------------------------