Documentation Source Text

Check-in [a4e77179b1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modify the output of the "search" script so that it works better on mobile screens.
Timelines: family | ancestors | descendants | both | mobile-friendly
Files: files | file ages | folders
SHA1: a4e77179b12c5e5f210c68fe8b03633da372276a
User & Date: drh 2016-09-01 01:30:22
Context
2016-09-01
01:54
The "Search" menubar option causes a drop-down search box to appear. check-in: 61608e2d14 user: drh tags: mobile-friendly
01:30
Modify the output of the "search" script so that it works better on mobile screens. check-in: a4e77179b1 user: drh tags: mobile-friendly
00:54
Update the comment on the output_list proc. Use the output_list proc from capi3ref.in to process session.in. check-in: 6f74e2171b user: drh tags: mobile-friendly
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to search/search.tcl.

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
  foreach {key value} [array get ::env] {
    append ret "<tr><td>[htmlize $key]<td>[htmlize $value]"
  }
  append ret "</table>"
  return $ret
}

proc footer {} {
  return {
    <hr>
    <table align=right>
    <td>
      <i>Powered by <a href="http://www.sqlite.org/fts5.html">FTS5</a>.</i>
    </table>
  }
}

#-------------------------------------------------------------------------
# Add an entry to the log database for the current query. Which 
# returns $nRes results.
#
proc search_add_log_entry {nRes} {
  if {[info exists ::A(donotlog)]} return

................................................................................


  # If the query returned more than 10 results, add up to 10 links to 
  # each set of 10 results (first link to results 1-10, second to 11-20, 
  # third to 21-30, as required).
  #
  if {$nRes>10} {
    set s(0) {border: solid #044a64 1px ; padding: 1ex ; margin: 1ex}
    set s(1) "$s(0);background:#044a64;color:white"
    append ret <center><p>
    for {set i 0} {$i < 10 && ($i*10)<$nRes} {incr i} {
      append ret [subst {
        <a style="$s([expr {($iStart/10)==$i}])" 
           href="search?[cgi_encode_args [list q $::A(q) i $i]]">[expr $i+1]</a>
      }]
................................................................................

  db transaction {
    set t [ttime { 
      if {[catch searchresults srchout]} {
        set A(q) [string tolower $A(q)]
        set srchout [searchresults]
      }
      set doc "$srchout [footer]" 
    }]
  }
  append doc "<p>Page generated in $t."
  return $doc

  # return [cgi_env_dump]
}

#=========================================================================








<
<
<
<
<
<
<
<
<
<







 







|







 







|


|







90
91
92
93
94
95
96










97
98
99
100
101
102
103
...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
...
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
  foreach {key value} [array get ::env] {
    append ret "<tr><td>[htmlize $key]<td>[htmlize $value]"
  }
  append ret "</table>"
  return $ret
}











#-------------------------------------------------------------------------
# Add an entry to the log database for the current query. Which 
# returns $nRes results.
#
proc search_add_log_entry {nRes} {
  if {[info exists ::A(donotlog)]} return

................................................................................


  # If the query returned more than 10 results, add up to 10 links to 
  # each set of 10 results (first link to results 1-10, second to 11-20, 
  # third to 21-30, as required).
  #
  if {$nRes>10} {
    set s(0) {border:solid #044a64 1px;padding:1ex;margin:1ex;line-height:300%;}
    set s(1) "$s(0);background:#044a64;color:white"
    append ret <center><p>
    for {set i 0} {$i < 10 && ($i*10)<$nRes} {incr i} {
      append ret [subst {
        <a style="$s([expr {($iStart/10)==$i}])" 
           href="search?[cgi_encode_args [list q $::A(q) i $i]]">[expr $i+1]</a>
      }]
................................................................................

  db transaction {
    set t [ttime { 
      if {[catch searchresults srchout]} {
        set A(q) [string tolower $A(q)]
        set srchout [searchresults]
      }
      set doc $srchout
    }]
  }
  append doc "<p>Page generated by <a href='fts5.html'>FTS5</a> in about $t."
  return $doc

  # return [cgi_env_dump]
}

#=========================================================================