Fullcalendar jQuery - 可以从谷歌日历检索颜色吗?

发布于 2024-11-06 15:42:10 字数 442 浏览 0 评论 0原文

我知道可以根据谷歌日历等来源设置事件的颜色,但我想知道是否有任何方法可以自动检索在谷歌日历本身上设置的颜色?

浏览 gcal.js,似乎没有任何关于颜色的推送,但在 google 的 json api(然而 json-c)中,有对颜色的引用。

http://code.google.com/apis/calendar/data /2.0/developers_guide_protocol.html#RetrivingAllCalendars

我想这是对 Fullcalendar 的功能请求的问题,但我想知道我是否遗漏了其中已有的内容?

谢谢你!

I know it is possible to set the colour for events based on a source such as a google calendar, but I was wondering if there is any way to retrieve the colour automatically as it is set on the google calendar itself?

Looking through the gcal.js, there doesn't seem to be anything pushed regarding the colour, but in google's json api (json-c however), there is a reference to the colour.

http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#RetrievingAllCalendars

I suppose it is a matter of a feature request to Fullcalendar but I'm wondering if I am missing something already in there?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

海未深 2024-11-13 15:42:10

日历的颜色不在 XML,ICAL Feed 中。它仅显示在用户可用的日历列表中。它列出了日历并使用:
GCal 命名空间元素参考

Google 日历提供了多种
扩展元件用于
元供稿(列出了
用户的日历)。这些元素是
在 gCal 命名空间中,而不是 Google
数据命名空间,因为它们是
特定于日历

因此不幸的是,gcal.js 不支持获取列表,除非您使用其他插件来获取颜色,否则您将无法获取颜色。


那样的话事情就这么简单了。
在 gcal.js 中推送它 - 我认为您可以在

color: entry['gCal$color']['value'],

Google Source feed 行中添加包含此值的内容:(日历列表 - 不是日历)

<gCal:color value='#2952A3' />          

The color of the calendar is not in the XML,ICAL Feed. It is only shown in the list of calendars available from a user. It lists the calendars and uses the:
GCal namespace element reference

Google Calendar provides several
extension elements for use in a
metafeed (the feed that lists the
user's calendars). These elements are
in the gCal namespace, not the Google
Data namespace, because they're
specific to Calendar

So unfortunately, gcal.js does not support getting the list and you will not get the color unless you use another plugin to do so.


In that case it would have been as easy as this.
In the gcal.js where the push it - I think you can add something in the line of

color: entry['gCal$color']['value'],

Google Source feed contains this value: (Calendar list - not calendar)

<gCal:color value='#2952A3' />          
天邊彩虹 2024-11-13 15:42:10

之前在 回答过 gcal/fullcalendar 问题fullcalendar jQuery - 可以从 Google 日历事件中检索描述吗?。您需要修改 gcal.js 的源代码。您可能只想将 Google 日历对象挂在事件之外(这样您就可以访问颜色和其他所有内容):

events.push({
                        id: entry['gCal$uid']['value'],
                        title: entry['title']['$t'],
                        url: url,
                        start: start,
                        end: end,
                        allDay: allDay,
                        location: entry['gd$where'][0]['valueString'],
                        description: entry['content']['$t'],
                        entry: entry
                    });

Previously answered a gcal/fullcalendar question at fullcalendar jQuery - Possible to retrieve description from Google Calendar events?. You will need to modify the source of gcal.js. You might want to just hang the Google Calendar object off the event (so you can access the color and everything else):

events.push({
                        id: entry['gCal$uid']['value'],
                        title: entry['title']['$t'],
                        url: url,
                        start: start,
                        end: end,
                        allDay: allDay,
                        location: entry['gd$where'][0]['valueString'],
                        description: entry['content']['$t'],
                        entry: entry
                    });
她比我温柔 2024-11-13 15:42:10

我这样做了 https://developers.google.com/ google-apps/calendar/v3/reference/colors/get#examples 但是在 JavaScipt 中。这对我有用。

   function getColors() {
       
         gapi
            .client
            .load('calendar', 'v3')
            .then(function () {
               request = gapi.client.calendar.colors.get({
                  'calendarId': calendarId  -> "Your CalendarID"

               });

               request.then(function (resp) {

                  if (resp.result.error) {
                     reportError('Google Calendar Colors: ' + data.error.message, data.error.errors);

                  } else if (resp) {

                     console.log('--- resp ---');
                     console.log(resp.result);  

                  }
               }, function (reason) {
                  console.log('Error: ' + reason.result.error.message);

               });
            });
      }

I did that https://developers.google.com/google-apps/calendar/v3/reference/colors/get#examples But in JavaScipt. It's works for me.

   function getColors() {
       
         gapi
            .client
            .load('calendar', 'v3')
            .then(function () {
               request = gapi.client.calendar.colors.get({
                  'calendarId': calendarId  -> "Your CalendarID"

               });

               request.then(function (resp) {

                  if (resp.result.error) {
                     reportError('Google Calendar Colors: ' + data.error.message, data.error.errors);

                  } else if (resp) {

                     console.log('--- resp ---');
                     console.log(resp.result);  

                  }
               }, function (reason) {
                  console.log('Error: ' + reason.result.error.message);

               });
            });
      }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文