Skip to content

Instantly share code, notes, and snippets.

@tinybeans
tinybeans / gist:4777f88ad1b707441788
Created May 16, 2014 15:54
記事 n 件をランダムに取得するテンプレート - RandomArray プラグインバージョン
<mt:DynamicMTML>
<mt:Ignore section="解説 01">
変数を初期化します。
</mt:Ignore>
<mt:SetVar name="ids">
<mt:SetVar name="entries">
<mt:Ignore section="解説 02">
@tinybeans
tinybeans / 3345.css
Created September 29, 2014 20:42
公開された記事は編集出来ないようにする簡易ロック機能を Movable Type の記事投稿画面に導入してみる
/* ==================================================
Lock Screen
================================================== */
#mtapp-lock-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999;
@tinybeans
tinybeans / flexibleSearch-conf.js
Created February 27, 2015 12:46
flexibleSearch.js で本文の100文字だけ表示して、後ろに ... を付けるサンプル
(function ($) {
$('#search').flexibleSearch({
searchDataPath: "/flexibleSearch/search.json",
searchFormAction: "/flexibleSearch/search.html",
loadingImgPath: "/flexibleSearch/loading.gif",
resultItemTmpl: [
'<dl>',
'{{#items}}',
'<dt><a href="{{url}}" title="{{title}}">{{&title}}</a></dt>',
'<dd><span>{{&body}}...</span><a href="{{url}}">[続きを読む]</a></dd>',
@tinybeans
tinybeans / flexibleSearch-conf.js
Created February 27, 2015 21:36
flexibleSearch.js で複数の JSON ファイルを切り替えて検索するサンプル
(function ($) {
$('#search').flexibleSearch({
searchFormCreation: false,
searchDataPath: {
search_A: "/flexibleSearch/search.json",
search_B: "/flexibleSearch/search2.json",
},
searchFormAction: "/flexibleSearch/search.html",
loadingImgPath: "/flexibleSearch/loading.gif",
resultItemTmpl: [
@tinybeans
tinybeans / snippets.cson
Last active September 21, 2016 05:27
MTML Completions for ATOM
# ==================================================
# MTML Completions for ATOM [start]
# ==================================================
'.text.md, .text.plain, .text.html.basic, .text.html.php, .source.js, .source.css, .source.yaml':
'current_mapping="1"':
'prefix': 'current_mapping="1"'
'body': 'current_mapping=\"${1:1}\"'
'with_index="1"':
@tinybeans
tinybeans / 0_reuse_code.js
Created March 10, 2016 05:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<mt:EntryJSONTableItems>
<mt:IfEntryJSONTableItem key=“foo">
<mt:EntryJSONTableItem key=“foo”>
</mt:IfEntryJSONTableItem>
<mt:Else>
do something when items is empty
</mt:EntryJSONTableItems>
@tinybeans
tinybeans / MTAppTemplateSelectorWidget.js
Last active June 24, 2016 01:26
$.MTAppTemplateSelectorWidget();
(function($){
// ---------------------------------------------------------------------
// $.MTAppTemplateSelectorWidget();
// ---------------------------------------------------------------------
// Latest update: 2016/06/24
//
// テンプレートの編集画面に、テンプレート一覧のドロップダウンリストウィジェットを追加し、
// 選択したテンプレートの編集画面にジャンプします。
//
@tinybeans
tinybeans / MTAppAssetFields.js
Last active August 12, 2016 12:26
MTAppAssetFields.js
(function($){
// ---------------------------------------------------------------------
// $(foo).MTAppAssetFields();
// ---------------------------------------------------------------------
// Latest update: 2016/07/01
//
// input:text で MT 標準の「アイテム」ダイアログを利用できるようにします。
// id, filename, url, thumnail(imageのみ)の値を JSON で保存します。
// ---------------------------------------------------------------------
@tinybeans
tinybeans / MTAppListingEntryGroup.js
Created July 13, 2016 23:20
MTAppListing でブログ記事グループ的なことをやってみる(カテゴリ追加)
(function($){
// 元記事:http://bit-part.net/blog/2015/01/mtapplisting.html
$('#customfield_bpentrylist').MTAppListing({
url: '<mt:Var name="config.CGIPath"><mt:Var name="config.DataAPIScript">/v1/sites/<mt:BlogID>/entries',
data: {
limit: 9999999,
// categories を追加します
fields: 'id,title,categories'
},