diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 27f1268c0..9e9d375a7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -50,26 +50,45 @@ Please consider the following with your pull request: * Make sure we're not leaking styles or breaking the layout of the UI. * The text used as timer description should be tailored to the majority of users. E.g. if ticket ID is an important piece of information, it should be included. If it's not important information (e.g. never actually shown in the UI, only in URLs) it should not be included. -### Private integration +### DOM integration -If you want to integrate `Toggl Button` with your private project on your custom domain you can -assign the domain to `Generic Toggl` integration in settings "Permissions" tab. +If you want to quickly integrate **Toggl Button** with your website. +You can enable the *DOM Integration* in the **Custom Integrations** section for your domain -Your site needs to contain some variation of the following HTML element, where the Toggl Button will -be created as its child: + + +You will have to add one or more `div` in your DOM with the class name `toggl-root`, containing the metadata for the time-entry you want to start, Toggl Button will render a button link as a child of these `divs`. + +The schema for the time-entry metadata is + +```typescript +interface TogglMetadata { + 'class': 'toggl-root' + 'data-description': string + 'data-project-name': string + 'data-project-id'?: number + 'data-tags'?: string // comma separated tag names + 'data-type'?: 'minimal' + 'data-class-name'?: string +} +``` + +The actual DOM node would resemble ```html
``` +See [toggl-button-dom-demo.now.sh](https://toggl-button-dom-demo.now.sh/) for reference. + ## Making changes to the core extension code Please consider future maintainers and the "generic" nature of the extension in mind when writing new features. All changes should be tested across both Chrome and Firefox. diff --git a/src/scripts/origins.js b/src/scripts/origins.js index 1a0c21e64..923910b00 100644 --- a/src/scripts/origins.js +++ b/src/scripts/origins.js @@ -129,7 +129,7 @@ export default { file: 'dokuwiki.js' }, 'dom-integration': { - url: '*://*/*', + url: '*://toggl-button-dom-demo.now.sh/*', name: 'DOM Integration' }, 'draftin.com': {