From 296d7d6b5e3568b2bcc305f0d78a2007cb298d5d Mon Sep 17 00:00:00 2001 From: umorigu Date: Tue, 26 Sep 2017 04:04:00 +0900 Subject: [PATCH] Show no support message --- en.lng.php | 2 ++ ja.lng.php | 2 ++ plugin/search2.inc.php | 9 +++++++++ skin/search2.js | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/en.lng.php b/en.lng.php index 5d01765..470104b 100644 --- a/en.lng.php +++ b/en.lng.php @@ -53,6 +53,8 @@ $_msg_help = 'View Text Formatting Rules'; $_msg_week = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); $_msg_content_back_to_top = '
'; $_msg_word = 'These search terms have been highlighted:'; +$_msg_unsupported_webbrowser = 'This function doesn\'t support your current Web browser.'; +$_msg_use_alternative_link = 'Please go to the following link destination: $1'; /////////////////////////////////////// // Symbols diff --git a/ja.lng.php b/ja.lng.php index f86aad3..0704d6c 100644 --- a/ja.lng.php +++ b/ja.lng.php @@ -55,6 +55,8 @@ $_msg_help = 'テキスト整形のルールを表示する'; $_msg_week = array('日','月','火','水','木','金','土'); $_msg_content_back_to_top = '
'; $_msg_word = 'これらのキーワードがハイライトされています:'; +$_msg_unsupported_webbrowser = 'この機能はお使いのWebブラウザには対応していません。'; +$_msg_use_alternative_link = 'リンク先の機能をご利用ください: $1'; /////////////////////////////////////// // Symbols diff --git a/plugin/search2.inc.php b/plugin/search2.inc.php index 05930b6..c6d0f1b 100644 --- a/plugin/search2.inc.php +++ b/plugin/search2.inc.php @@ -166,6 +166,7 @@ function plugin_search2_search_form($s_word = '', $type = '', $bases = array()) global $_search_pages, $_search_all; global $_msg_andresult, $_msg_orresult, $_msg_notfoundresult; global $_search_detail, $_search_searching; + global $_msg_unsupported_webbrowser, $_msg_use_alternative_link; $script = get_base_uri(); $h_search_text = htmlsc($s_word); @@ -211,7 +212,15 @@ EOD; $result_page_panel = ''; } + $plain_search_link = '' . htmlsc($_btn_search) . ''; + $alt_msg = str_replace('$1', $plain_search_link, $_msg_use_alternative_link); return << +

$_msg_unsupported_webbrowser $alt_msg

+ +

+ $_msg_unsupported_webbrowser $alt_msg +

diff --git a/skin/search2.js b/skin/search2.js index ce4a0e2..766dcf1 100644 --- a/skin/search2.js +++ b/skin/search2.js @@ -553,8 +553,15 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( var target = document.getElementById('body'); walkElement(target); } + function showNoSupportMessage() { + var pList = document.getElementsByClassName('_plugin_search2_nosupport_message'); + for (var i = 0; i < pList.length; i++) { + var p = pList[i]; + p.style.display = 'block'; + } + } function isEnabledFetchFunctions() { - if (window.fetch && document.querySelector) { + if (window.fetch && document.querySelector && window.JSON) { return true; } return false; @@ -569,7 +576,10 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( return false; } colorSearchTextInBody(); - if (! isEnabledFetchFunctions()) return; + if (! isEnabledFetchFunctions()) { + showNoSupportMessage(); + return; + } if (! isEnableServerFunctions()) return; replaceSearchWithSearch2(); hookSearch2(); -- 2.11.0