5_cloudsearch_touch_module.tpl.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php if(!defined('IN_DISCUZ')) exit('Access Denied'); function tpl_global_header_mobile($searchparams, $srchotquery) {
  2. global $_G;?><?php
  3. $__CURMODULE = CURMODULE;$__FORMHASH = FORMHASH;$return = <<<EOF
  4. EOF;
  5. if(!empty($searchparams['url'])) {
  6. $return .= <<<EOF
  7. <style>
  8. .keyword {padding:0 10px;margin-bottom: 100px;}
  9. .keyword a{ background:#FFF;border: 1px solid #DDDDDD; color: #336699; display: inline-block; margin-bottom: 10px; margin-right: 10px; padding: 3px 10px; white-space: nowrap;}
  10. .keyword a:hover {background-color: none;}
  11. </style>
  12. <script type="text/javascript">
  13. $(document).ready(function() {
  14. var obj = $('#searchform');
  15. if(obj.length > 0) {
  16. var getstr = {mod:'search', srchtype:'title', srhfid:0, srhlocality:'{$_G['basescript']}::{$__CURMODULE}', source:'txt.form_
  17. EOF;
  18. if($_G['setting']['mobile']['mobilesimpletype']) {
  19. $return .= <<<EOF
  20. sim
  21. EOF;
  22. } else {
  23. $return .= <<<EOF
  24. nor
  25. EOF;
  26. }
  27. $return .= <<<EOF
  28. .a', wap:'yes', fId:0};
  29. EOF;
  30. if(is_array($searchparams['params'])) foreach($searchparams['params'] as $key => $value) {
  31. $return .= <<<EOF
  32. getstr.{$key} = '{$value}';
  33. EOF;
  34. }
  35. $return .= <<<EOF
  36. var str = '';
  37. for(var i in getstr) {
  38. str += '<input type="hidden" name="'+ i +'" value="'+ getstr[i] +'">';
  39. }
  40. obj.append(str);
  41. obj.attr('action', '{$searchparams['url']}').attr('method', 'get');
  42. obj.on('submit', function() {
  43. obj.append('<input type="hidden" name="q" value="' + $('#scform_srchtxt').val() + '">');
  44. });
  45. EOF;
  46. if($_G['setting']['srchhotkeywords']) {
  47. $return .= <<<EOF
  48. var str = '';
  49. str += '<div class="keyword cl">';
  50. EOF;
  51. if(is_array($_G['setting']['srchhotkeywords'])) foreach($_G['setting']['srchhotkeywords'] as $val) { if($val=trim($val)) { } if($encodeval=rawurlencode(trim($val))) { if(!empty($searchparams['url'])) {
  52. $return .= <<<EOF
  53. str += '<a href="{$searchparams['url']}?q={$encodeval}&source=txt.hotsearch_
  54. EOF;
  55. if($_G['setting']['mobile']['mobilesimpletype']) {
  56. $return .= <<<EOF
  57. sim
  58. EOF;
  59. } else {
  60. $return .= <<<EOF
  61. nor
  62. EOF;
  63. }
  64. $return .= <<<EOF
  65. .a{$srchotquery}&wap=yes" target="_blank" sc="1">{$val}</a>';
  66. EOF;
  67. } else {
  68. $return .= <<<EOF
  69. str += '<a href="search.php?mod=forum&amp;srchtxt={$encodeval}&amp;formhash={$__FORMHASH}&amp;searchsubmit=true&amp;source=txt.hotsearch_
  70. EOF;
  71. if($_G['setting']['mobile']['mobilesimpletype']) {
  72. $return .= <<<EOF
  73. sim
  74. EOF;
  75. } else {
  76. $return .= <<<EOF
  77. nor
  78. EOF;
  79. }
  80. $return .= <<<EOF
  81. .a&amp;wap=yes" target="_blank" class="xi2" sc="1">{$val}</a>';
  82. EOF;
  83. } } }
  84. $return .= <<<EOF
  85. str += '</div>';
  86. obj.after(str);
  87. EOF;
  88. }
  89. $return .= <<<EOF
  90. }
  91. });
  92. </script>
  93. EOF;
  94. }
  95. $return .= <<<EOF
  96. EOF;
  97. ?><?php return $return;?><?php }?>