多个 Foursquare“保存”一页上的按钮

发布于 2025-01-05 15:54:10 字数 138 浏览 3 评论 0原文

我正在开发一个显示场地列表的网站,并希望为列表中的每个场地添加一个 Foursquare“保存”按钮。是否可以在单个页面上显示多个 Foursquare“保存”按钮?我尝试创建多个 vCard 块(每个场地一个)并在每个块中插入一个“保存”按钮,但位置未被选取。

I am working on a site that displays a list of venues and would like to add a Foursquare 'save' button for each venue in the list. Is it possible to show multiple Foursquare 'save' buttons on a single page? I've tried creating multiple vCard blocks (one for each venue) and inserting a 'save' button in each block but the locations are not being picked up.

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

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

发布评论

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

评论(3

执妄 2025-01-12 15:54:10

检查 widgets.jswidgets.asyncbundle.js 的源代码后,我发现设置“保存到”的 data-context 属性VCard ID 的 Foursquare' 按钮将链接这两者。就像这样:

<div id="hcard-Station-Amsterdam-Centraal" class="vcard">
    <span class="fn">
        <span class="given-name">Station Amsterdam Centraal</span>
    </span>
    <div class="adr">
        <div class="street-address">stationsplein 15</div>
        <span class="locality">Amsterdam</span>, 
        <span class="region">Amsterdam</span> , 
        <span class="postal-code">1012AB</span>
    </div>
</div>
<div id="hcard-Jaarbeursplein" class="vcard">
    <span class="fn">
        <span class="given-name">Jaarbeursplein</span>
    </span>
    <div class="adr">
        <div class="street-address">Jaarbeursplein</div>
        <span class="locality">Utrecht</span>, 
        <span class="region">Utrecht</span>, 
        <span class="postal-code">3521AL</span>
    </div>
</div>

<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-context="hcard-Station-Amsterdam-Centraal" data-variant="wide">Save to foursquare</a>
<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-context="hcard-Jaarbeursplein" data-variant="wide">Save to foursquare</a>

但事实上,这没有记录在案,它可能会在不久的将来发生变化。

After inspecting the source of the widgets.js and widgets.asyncbundle.js I discovered that setting thedata-context atribute of the 'Save to Foursquare' button to the ID of the VCard will link these two. Like so:

<div id="hcard-Station-Amsterdam-Centraal" class="vcard">
    <span class="fn">
        <span class="given-name">Station Amsterdam Centraal</span>
    </span>
    <div class="adr">
        <div class="street-address">stationsplein 15</div>
        <span class="locality">Amsterdam</span>, 
        <span class="region">Amsterdam</span> , 
        <span class="postal-code">1012AB</span>
    </div>
</div>
<div id="hcard-Jaarbeursplein" class="vcard">
    <span class="fn">
        <span class="given-name">Jaarbeursplein</span>
    </span>
    <div class="adr">
        <div class="street-address">Jaarbeursplein</div>
        <span class="locality">Utrecht</span>, 
        <span class="region">Utrecht</span>, 
        <span class="postal-code">3521AL</span>
    </div>
</div>

<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-context="hcard-Station-Amsterdam-Centraal" data-variant="wide">Save to foursquare</a>
<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-context="hcard-Jaarbeursplein" data-variant="wide">Save to foursquare</a>

But for the fact that this isn't documented, it may be changed in the near future.

筱果果 2025-01-12 15:54:10

尝试使用“data-vid”:

 <!-- Place this anchor tag where you want the button to go -->
<br />
All In PartyRadio Studio<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="50575a55e0e27c7feb062116">Save to foursquare</a>
<br />
Sing Sing Music Hall<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4d47d1fe2165721ebe9ac0d7">Save to foursquare</a>
<br />
Retro Klub<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4d437d813616b60c2764dac2">Save to foursquare</a>
<br />
Tisza Dokk<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4f73231de4b0e3a99689cc61">Save to foursquare</a>
<br />
Zöld Zsiráf Kultúrpart<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4ffad97ef13633933ececa5f">Save to foursquare</a>

<!-- Place this script somewhere after the anchor tag above. If you have multiple buttons, only include the script once. -->
<script type='text/javascript'>
  (function() {
    window.___fourSq = {"uid":"606"};
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://platform.foursquare.com/js/widgets.js';
    s.async = true;
    var ph = document.getElementsByTagName('script')[0];
    ph.parentNode.insertBefore(s, ph);
  })();
</script>

Try this with "data-vid":

 <!-- Place this anchor tag where you want the button to go -->
<br />
All In PartyRadio Studio<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="50575a55e0e27c7feb062116">Save to foursquare</a>
<br />
Sing Sing Music Hall<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4d47d1fe2165721ebe9ac0d7">Save to foursquare</a>
<br />
Retro Klub<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4d437d813616b60c2764dac2">Save to foursquare</a>
<br />
Tisza Dokk<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4f73231de4b0e3a99689cc61">Save to foursquare</a>
<br />
Zöld Zsiráf Kultúrpart<a href="https://foursquare.com/intent/venue.html" class="fourSq-widget" data-vid="4ffad97ef13633933ececa5f">Save to foursquare</a>

<!-- Place this script somewhere after the anchor tag above. If you have multiple buttons, only include the script once. -->
<script type='text/javascript'>
  (function() {
    window.___fourSq = {"uid":"606"};
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://platform.foursquare.com/js/widgets.js';
    s.async = true;
    var ph = document.getElementsByTagName('script')[0];
    ph.parentNode.insertBefore(s, ph);
  })();
</script>
ま昔日黯然 2025-01-12 15:54:10

保存到 foursquare 小部件的正在进行的文档可通过 @ https://developer.foursquare.com 访问/概述/小部件。它们会随着时间的推移而被清理,但应该足以帮助解决这个问题和未来与小部件相关的问题=)。

特别是,有关您需要的“数据上下文”属性的文档将很快推送到链接页面。

The in-progress docs for the save-to-foursquare widget are accessible @ https://developer.foursquare.com/overview/widgets. They'll be cleaned up over time, but should be good enough to help this and future widget-related questions =).

In particular, documentation about the "data-context" attribute you need will be pushed to the linked page soon.

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