Skip to content

Instantly share code, notes, and snippets.

View mersy's full-sized avatar

Masashi Yanagiya mersy

View GitHub Profile
@mersy
mersy / 20240109-153032.md
Created January 9, 2024 07:30
202401.md

hoge

サンプル

@mersy
mersy / flexibleSearch-config.js
Last active August 29, 2015 14:17
flexibleSearch テンプレートファイル類(2015-03-19 MT東京-11)
(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>',
"categories":"{% for category in post.categories %}{{ category }}{% unless forloop.last %},{% endunless %}{% endfor %}",
{% for category in site.categories %}
<a href="/search.html?flexiblesearch=1&offset=0&categories={{ category[0] }}" class="list-group-item">{{ category[0] }}</a>
{% endfor %}
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>',
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>'
];
---
layout: default
title: 検索結果
---
<div id="fs-result"></div>
<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",
---
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 %}
]}
@mersy
mersy / dataapifocategory
Last active December 25, 2015 18:49
dataapifocategory
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"
};