Giter Site home page Giter Site logo

traewelling-widget's Introduction

Traewelling Widget

Latest Release GitHub All Releases Issues GitHub GitHub Sponsors

Traewelling Widget is a iOS widget for Scriptable, which shows some advanced statistics about your logged train rides on Traewelling on your homescreen.

Preview

Installation

  • Download Scriptable from the App Store
  • Download the latest TraewellingWidget.js from releases here.
  • Copy the TraewellingWidget.js to your Scriptable folder in Files (iCloud).

Configure Widget

  • Long press anywhere on your Homescreen and click on the +
  • Search for Scriptable, select the formfactor you want to have and place it wherever you want
  • Long press the widget and click on Edit Widget
  • Select TraewellingWidget, set When interacting to Run Script and paste your (optional) configuration JSON at Parameter. (For configuration, see below)

Authorization

  • After configuration, the widget should state something like this profile is unauthenticated
  • Click on the widget and follow the steps of the authorization flow
  • When done, there should be a pop up window

(Hint: If you have configured a big timespan, f.e. more than 14 days in the past, the script might timeout a few times on first start. This should fix by itself. This happens due to iOS widget timeout limitations. It will work after the script has cached some statistics.)

Configuration

If you want to use a custom configuration. You have to set your configuration as json in the widget parameters.

  • Long press your widget
  • Click Edit Widget
  • Paste your json in Parameter

Profile (Optional)

The profile parameter is used to have multiple widget configurations for different traewelling accounts.

If not set, the default value is used.

Default: 0

Usage:

{
    "profile": "my-second-profile"
}

Days (Optional)

The days parameter is used to analyze all statistics within the specified time range.

If not set, the default value will be used.

Default: 14

Usage:

{
    "days": 28,
}

Date (Optional)

The date parameter is utilized to examine all statistics up to the specified date.

There is no default for the date parameter.

Note: The date parameter will override the days parameter, if set.

Usage:

{
    "date": "2023-10-01",
}

Schemes

If you want to use a custom scheme for your widget, you can set this through the schemes parameter in the configuration.

If not set, the default value will be used.

Default: see in script

Usage:

{
    "schemes": {
        "small": [
            [[["title", "noSpacer", "subtitle", "spacer", "distance", "spacer", "duration", "stations", "delay"]]], 
            [[["title", "noSpacer", "subtitle", "spacer", "distance", "spacer", "purposePersonal", "purposeCommute", "purposeBusiness"]]],
        ], 
        "large": [
            [[["title", "noSpacer", "subtitle", "spacer", "distance", "spacer", "duration", "stations", "delay"], ["moreStats", "minSpeed", "avgSpeed", "maxSpeed", "spacer", "purposePersonal", "purposeCommute", "purposeBusiness", "spacer", "favouriteStation"]], [["latestTrips"]]],
            [[["title", "noSpacer", "subtitle", "spacer", "distance", "spacer", "duration", "stations", "delay"], ["moreStats", "categoryExpress", "categoryRegional", "categoryUrban", "spacer", "purposePersonal", "purposeCommute", "purposeBusiness", "spacer", "favouriteStation"]], [["longestTrips"]]],
            [[["title", "noSpacer", "subtitle", "spacer", "distance", "spacer", "duration", "stations", "delay"], ["moreStats", "minSpeed", "avgSpeed", "maxSpeed", "spacer", "categoryExpress", "categoryRegional", "categoryUrban"]], [[{"name": "highestDelayTrips", "args": {"maxTrips": 3}}]], [[{"name": "fastestTrips", "args": {"maxTrips": 3}}]]]
        ]
    }
}

Scheme Documentation

If you want to use a custom scheme for your widget, you can do so, by modifying the scheme in your configuration.

Troubleshooting

Wrong name of Script

The correct naming of the script is important. Unless the script has the correct name, it wont work. Sometimes Safari or other browser will name downloaded files with increments, if they already exists in the downloads folder. Then you have to rename the downloaded script to TraewellingWidget.js.

Examples:

  • TraewellingWidget (2).js to TraewellingWidget.js
  • TraewellingWidget 2.js to TraewellingWidget.js

The correct naming is important!

Previews

traewelling-widget's People

Contributors

tiuub avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.