「ココログ用検索」の検索ボックスを任意のココログに

    @@ -49,7 +49,7 @@ addSearchForm(); $.getScript('https://furyutei.work/script/jq-highlight.js', function() { - $.getScript('https://furyu.furyutei.work/script/jq-cocolog_ajax_search.js', function() { + $.getScript('https://furyutei.work/script/jq-cocolog_ajax_search.js', function() { }); }); }
  • /*
     * @title 「ココログ用検索」の検索ボックスを任意のココログに
     * @description http://java.cocolog-nifty.com/blog/2005/10/javascript_c163.html の移植版(jQuery使用)
     * @include *
     * @javascript_url
     * @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
    ,   look_ahead : false
    ,   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 = $([
                    '<form onsubmit="cocologAjaxSearch( null, jQuery(\'#' + cocolog_ajax_search_options.search_box_id + '\').val() ); return false">'
                ,   '    <input type="search" id="' + cocolog_ajax_search_options.search_box_id + '" name="search_box" value=""  results="5" autosave="tangerine" placeholder="検索語を入力" />'
                ,   '    <input type="submit" value="検索" />'
                ,   '    <span id="search_credit" style="font-size: xx-small; margin-left: 4px;"></span>'
                ,   '</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');
            $( '#' + cocolog_ajax_search_options.search_box_id ).focus();
        }
        addSearchForm();
        
        $.getScript('https://furyutei.work/script/jq-highlight.js', function() {
            $.getScript('https://furyutei.work/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();
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2020/10/29 12:42:51 - 2020-10-29
  2. 2020/10/29 12:39:57 - 2020-10-29
  3. 2020/10/29 12:37:22 - 2020-10-29
  4. 2020/10/29 07:59:16 - 2020-10-29
  5. 2015/09/01 14:50:33 - 2015-09-01
  6. 2015/08/31 21:25:14 - 2015-08-31
  7. 2015/08/31 17:48:29 - 2015-08-31
  8. 2015/08/31 13:37:07 - 2015-08-31
  9. 2015/08/31 13:20:10 - 2015-08-31
  10. 2015/08/31 09:42:07 - 2015-08-31
  11. 2015/08/31 09:41:41 - 2015-08-31
  12. 2015/08/29 06:33:30 - 2015-08-29
  13. 2015/08/29 04:32:53 - 2015-08-29