サンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$("#search").flexibleSearch({ | |
searchDataPath: "/search.json", | |
searchDataPathPreload: "/search.json", | |
searchFormCreation: false, | |
loadingImgPath: "/flexiblesearch/loading.gif", | |
resultItemTmpl: [ | |
'{{#items}}', | |
'<article class="entry clearfix">', | |
'<div class="entry-meta"><time datetime="{{&datetime}}"><span class="year">{{&dateyear}}年</span><span class="monthday">{{&date}}</span></time><a href="{{&categoryarchivelink}}" class="category">{{&category}}</a></div>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"categories":"{% for category in post.categories %}{{ category }}{% unless forloop.last %},{% endunless %}{% endfor %}", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for category in site.categories %} | |
<a href="/search.html?flexiblesearch=1&offset=0&categories={{ category[0] }}" class="list-group-item">{{ category[0] }}</a> | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var searchFormHTML = [ | |
'<form action="/search.html{{action}}" method="GET">', | |
'<input type="hidden" name="flexiblesearch" value="1">', // This element is required. | |
'<input type="hidden" name="offset" value="0">', | |
'<input type="hidden" name="limit" value="' + op.paginate.count + '">', | |
'<div class="input-group">', | |
'<input type="search" name="search" placeholder="{{searchPlaceholder}}" class="fs-text fs-search form-control">', | |
'<span class="input-group-btn">', | |
'<button class="btn btn-default" type="submit" id="fs-search-submit" class="fs-btn fs-submit" value="{{submitBtnText}}"><span class="glyphicon glyphicon-search"></span></button>', | |
'</span>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resultItemHTML = [ | |
'<div id="' + op.resultBlock.blockId + '-items">', | |
'{{#items}}', | |
'<h1><a href="{{&url}}">{{&title}}</a></h1>', | |
'<p>by mersy <span class="glyphicon glyphicon-time"></span> Posted on {{&date}}</p>', | |
'<hr>', | |
'{{/items}}', | |
'</div>' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: default | |
title: 検索結果 | |
--- | |
<div id="fs-result"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="/js/flexibleSearch/mustache.js"></script> | |
<script src="/js/flexibleSearch/flexibleSearch.js"></script> | |
<script type="text/javascript"> | |
(function($){ | |
$("#fs-search").flexibleSearch({ | |
resultBlock: { | |
blockId: "fs-result", | |
loadingImgPath: "/js/flexibleSearch/loading.gif" | |
}, | |
searchDataPath: "/search_data.js", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: none | |
--- | |
{"items":[ | |
{% for post in site.posts %}{"title":"{{ post.title }}", | |
"url":"{{ post.url }}", | |
"date":"{{ post.date | date_to_string }}", | |
"body":"{{ post.content | strip_html | xml_escape | strip_newlines }}"}{% unless forloop.last %},{% endunless %}{% endfor %} | |
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var api = new MT.DataAPI({ | |
baseUrl: "<mt:Var name="website_url">mersy-movabletype/mt-data-api.cgi", | |
clientId: "1234567890" | |
}); | |
var params = { | |
//limit: 10, | |
fields: "id,title,permalink,date,categories" | |
}; |
NewerOlder