// ==UserScript== // @name 「ココログ最強検索」の検索ボックスを任意のココログに // @description http://java.cocolog-nifty.com/blog/2005/10/javascript_c163.html // @include * // ==/UserScript== /* * @title 「ココログ最強検索」の検索ボックスを任意のココログに * @description http://java.cocolog-nifty.com/blog/2005/10/javascript_c163.html * @include * * @license MIT License */ (function(){ 'use strict'; function check() { var $ = window.jQuery; if (!$) { setTimeout(check, 100); return; } function addSearchForm() { var form = $([ '
' ].join('\n')), old_form = $( '#search_box' ).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'); $( '#search_box' ).focus(); } addSearchForm(); $.getScript('http://java.cocolog-nifty.com/blog/files/javascript/prototype.js', function() { $.getScript('http://java.cocolog-nifty.com/blog/files/javascript/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(); })();