DEV Community

Cover image for Import a Garoon Event to Google Calendar Bookmarklet
ahandsel
ahandsel

Posted on • Originally published at github.com

Import a Garoon Event to Google Calendar Bookmarklet

Import a Garoon Event to Google Calendar Bookmarklet

Usage

Initial Setup

  1. Copy the below Garoon_to_Google_Bookmarklet.js code block
  2. Go to Bookmark manager (chrome://bookmarks/) > Click on the at the top-right-corner
  3. Click Add new bookmark & paste the code in the URL field

Importing a Garoon Event to Google Calendar

  1. Go to the Garoon event's page
  2. Click on the Bookmark
  3. Confirm the imported event in Google Calendar & click Save

Not working? 🤔

  • Open browser console
    • Mac: Command+Option+C
    • Windows, Linux, Chrome OS: Control+Shift+C
  • Check if you are getting an error message

Garoon_to_Google_Bookmarklet.js

javascript: (() => {
  const formatTimestamp = (dateString) =>
    new Date(dateString).toISOString().replaceAll(/[-:]|\.\d+/g, '');
  const bodyFormat = (inputText) => inputText.replace(/\n/g, '<br>');
  const addCalendar = (event) => {
    console.log({ event });
    const start = formatTimestamp(event.start.dateTime);
    const end = formatTimestamp(event.end.dateTime);
    const origin = location.origin.replace('.s.', '.');
    const url = `${origin}${location.pathname}?event=${event.id}`;
    const body = bodyFormat(event.notes);
    const params = new URLSearchParams({ action: 'TEMPLATE' });
    params.set('dates', `${start}/${end}`);
    params.set('text', event.subject);
    params.set('location', url);
    params.set('details', body);
    open(`https://www.google.com/calendar/render?${params.toString()}`);
  };
  const event = window.garoon?.schedule?.event?.get();
  if (event === undefined) {
    alert(
      `Error: Not on a Garoon event.\nPlease open a specific Garoon event.`
    );
    return;
  }
  addCalendar(event);
})();
Enter fullscreen mode Exit fullscreen mode

References

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay