2

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

4

3 回答 3

2

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

<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>

但由于这没有记录在案,它可能会在不久的将来改变。

于 2012-02-16T10:03:26.407 回答
0

用“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>
于 2013-04-25T22:29:14.643 回答
-1

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

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

于 2012-02-23T20:10:25.957 回答