/* * @title 「ココログ用検索」の検索ボックスを任意のココログに * @description http://java.cocolog-nifty.com/blog/2005/10/javascript_c163.html の移植版(jQuery使用) * @include * * @license MIT License */ (function(){ 'use strict'; window.cocolog_ajax_search_options = { color : '#ffcc33' , truncation_length : 80 , entry_per_page : 20 , max_concurrent_load : 10 , display_search_form : true , search_box_id : 'search_box' , search_credit_id : 'search_credit' , debug : true }; function check() { var $ = window.jQuery; if (!$) { setTimeout(check, 100); return; } function addSearchForm() { var form = $([ '
' ].join('\n')), old_form = $( '#' + cocolog_ajax_search_options.search_box_id ).parents('form').first(); if ( 0 < old_form.size() ) { old_form.replaceWith(form); } else { $('#left,#right,#alpha:has(div.module),#beta:has(div.module),#gamma:has(div.module)').last().prepend(form); } $('html,body').animate({scrollTop: form.offset().top - 32}, 'fast'); } addSearchForm(); $.getScript('http://furyu.tea-nifty.com/script/jq-highlight.js', function() { $.getScript('http://furyu.tea-nifty.com/script/jq-cocolog_ajax_search.js', function() { }); }); } var script = document.createElement('script'); script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'; document.documentElement.appendChild(script); check(); })();