Skip to content

Instantly share code, notes, and snippets.

@kawahara
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawahara/f4489d13ba3c8604b83b to your computer and use it in GitHub Desktop.
Save kawahara/f4489d13ba3c8604b83b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<!--
Copyright (c) 2014 Rakuten, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<title>Sample</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<style>
body {
padding-top: 20px;
padding-bottom: 30px;
}
</style>
</head>
<body role="document">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">私のサンプルページ</a>
</div>
<div class="navbar-collapse collapse">
<p class="navbar-text navbar-right">
</p>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="jumbotron">
<h1>うどん特集ページ</h1>
<p>うどん特集のページです。みんなうどん食べてね。</p>
</div>
<div class="container">
<div class="row">
<div class="col-md-6">
<h1>商品リンク</h1>
<table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><div style="border:1px solid;margin:0px;padding:6px 0px;width:320px;text-align:center;float:left"><a href="http://hb.afl.rakuten.co.jp/hgc/12c18d75.b537c150.12c18d76.9f4c7498/?pc=http%3a%2f%2fitem.rakuten.co.jp%2fmengokoro%2f100702%2f%3fscid%3daf_link_tbl&amp;m=http%3a%2f%2fm.rakuten.co.jp%2fmengokoro%2fi%2f10000010%2f" target="_blank"><img src="http://hbb.afl.rakuten.co.jp/hgb/?pc=http%3a%2f%2fthumbnail.image.rakuten.co.jp%2f%400_mall%2fmengokoro%2fcabinet%2f03803388%2fimg62508642.jpg%3f_ex%3d300x300&amp;m=http%3a%2f%2fthumbnail.image.rakuten.co.jp%2f%400_mall%2fmengokoro%2fcabinet%2f03803388%2fimg62508642.jpg%3f_ex%3d80x80" alt="日本三大うどんのひとつ『五島うどん』は、長崎県五島列島の、美しい風土と潮風の中で、中国か..." border="0" style="margin:0px;padding:0px"></a><p style="font-size:12px;line-height:1.4em;text-align:left;margin:0px;padding:2px 6px"><a href="http://hb.afl.rakuten.co.jp/hgc/12c18d75.b537c150.12c18d76.9f4c7498/?pc=http%3a%2f%2fitem.rakuten.co.jp%2fmengokoro%2f100702%2f%3fscid%3daf_link_tbl&amp;m=http%3a%2f%2fm.rakuten.co.jp%2fmengokoro%2fi%2f10000010%2f" target="_blank">日本三大うどんのひとつ『五島うどん』は、長崎県五島列島の、美しい風土と潮風の中で、中国か...</a><br><span style="">価格:12,860円(税込、送料込)</span><br></p></div></td></tr></table>
</div>
<div class="col-md-6">
<h1>モーションウィジェット</h1>
<!-- Rakuten Widget FROM HERE --><script type="text/javascript">rakuten_design="slide";rakuten_affiliateId="12c18df7.e07ecf65.12c18df8.6e71a0ab";rakuten_items="ctsmatch";rakuten_genreId=0;rakuten_size="468x160";rakuten_target="_blank";rakuten_theme="gray";rakuten_border="off";rakuten_auto_mode="off";rakuten_genre_title="off";rakuten_recommend="on";</script><script type="text/javascript" src="http://xml.affiliate.rakuten.co.jp/widget/js/rakuten_widget.js"></script><!-- Rakuten Widget TO HERE -->
</div>
</div>
<div>
<h1>うどん商品情報</h1>
<div id="result">
</div>
<!-- Template -->
<script id="tmplResult" type="text/x-jquery-tmpl">
<div class="row">
{{each result.Items}}
{{if $index != 0 && $index % 5 == 0 }}
</div>
<div class="row">
{{/if}}
<div class="col-md-2">
{{if imageFlag}}
<a href="${affiliateUrl}" target="_blank">
<img src="${mediumImageUrls[0]}" />
</a>
{{/if}}
<p>
<a href="${affiliateUrl}" target="_blank">${itemName}</a>
</p>
<p>価格 ${formattedItemPrice}円
{{if taxFlag == 0}}
(税込)
{{else}}
(税抜)
{{/if}}
{{if postageFlag == 0}}
(送料込)
{{else}}
(送料別)
{{/if}}
</p>
</div>
{{/each}}
</div>
</script>
</div>
<div>
<h1>うどんホテル情報</h1>
<div id="hotelResult"></div>
<script id="hotelTmpl" type="text/x-jquery-tmpl">
<div class="row">
{{each result.hotels}}
{{if $index != 0 && $index % 4 == 0 }}
</div>
<div class="row">
{{/if}}
<div class="col-md-3">
<a href="${$value[0].hotelBasicInfo.hotelInformationUrl}" target="_blank">
<img src="${$value[0].hotelBasicInfo.hotelThumbnailUrl}" />
</a>
<p>
<a href="${$value[0].hotelBasicInfo.hotelInformationUrl}" target="_blank">
${$value[0].hotelBasicInfo.hotelName}
</a>
</p>
</div>
{{/each}}
</div>
</script>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script>
<script>
// API Call
$.ajax({
url: "https://app.rakuten.co.jp/services/api/IchibaItem/Search/20140222?format=json&keyword=%E3%81%86%E3%81%A9%E3%82%93&affiliateId=12c1918c.6de23724.12c1918d.7ef3cc68&sort=-affiliateRate&minPrice=5000&hits=8&postageFlag=1&formatVersion=2&applicationId=1051542176863886370",
dataType: 'jsonp',
success: function(data) {
$(data.Items).each(function(i, item) {
item.formattedItemPrice = numeral(item.itemPrice).format('0,0');
});
$("#tmplResult").tmpl({
result: data
}).appendTo("#result");
}
});
$.ajax({
url: "https://app.rakuten.co.jp/services/api/Travel/SimpleHotelSearch/20131024?format=json&affiliateId=12c1918c.6de23724.12c1918d.7ef3cc68&largeClassCode=japan&middleClassCode=kagawa&smallClassCode=takamatsu&formatVersion=2&applicationId=1051542176863886370&hits=8",
dataType: 'jsonp',
success: function(data) {
$("#hotelTmpl").tmpl({
result: data
}).appendTo("#hotelResult");
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment