var $ui; var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = '/css/search_history.css'; document.body.appendChild(link); if (typeof jQuery == 'undefined' || typeof jQuery.ui == 'undefined') { var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = '/js/ui/themes/base/jquery.ui.all.css' document.body.appendChild(link); link.onload = function() { } } if (typeof jQuery != 'undefined') { var $bak = $.noConflict(true); } var xhrObj = new XMLHttpRequest(); xhrObj.open('GET', '/js/jquery-1.7.2.min.js', false); xhrObj.send(null); if (xhrObj.status === 200) { var script = document.createElement('script'); script.type = "text/javascript"; script.text = xhrObj.responseText; document.head.appendChild(script); } var xhrObj = new XMLHttpRequest(); xhrObj.open('GET', '/js/ui/jquery-ui-1.8.12.custom.min.js', false); xhrObj.send(null); if (xhrObj.status === 200) { var script = document.createElement('script'); script.type = "text/javascript"; script.text = xhrObj.responseText; document.head.appendChild(script); } $ui = $.noConflict(true); if ($bak) { $ = $bak.noConflict(true); jQuery = $; } function initHistoryList($obj) { $ui.ajax('/ajax/get_search_history.php', { type:'post', cache: false, dataType: 'html', success: function (html) { $ui('body').append(html); var width = $ui('#history_dialog').outerWidth(); var width_min = 400; var width_max = '98%'; if (width < width_min) width = width_min; if ($ui(window).width() < width) width = width_max; $ui('#history_dialog').dialog({ autoOpen: false, title: '最近検索した条件', width: width, show: 'fade', hide: 'fade', position: { my:'center top', at:'center bottom', of: $obj, collision: 'fit fit' }, modal: true }); if ($ui('#history_dialog a').length) { $ui('#history_dialog #history_none').remove(); } $ui('#history_dialog').dialog('open'); }, error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } function openHistoryList(obj) { if ($ui('#history_dialog').length) { $ui('#history_dialog').dialog('open'); } else { initHistoryList($ui(obj)); } }