Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18520

Re: Implement offline site search?

Message-ID <680559024.28dSeFvmuz@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-02-17 13:18 +0100
Subject Re: Implement offline site search?
Newsgroups comp.lang.javascript
References <haWdnRUFFpDr0IbMnZ2dnUVZ5uidnZ2d@giganews.com> <1605051.1mSJY5JTrl@PointedEars.de> <79CdndDtp9VePL3MnZ2dnUVZ5radnZ2d@giganews.com>

Show all headers | View raw


Robert Crandal wrote:

> "Thomas 'PointedEars' Lahn" <PointedEars@web.de> wrote in message
> news:1605051.1mSJY5JTrl@PointedEars.de...

It is supposed to be an attribution _line_, not a novel.

>> Robert Crandal wrote:
>> >

<http://www.netmeister.org/news/learn2quote.html>
<http://jibbering.com/faq/#posting>
<http://PointedEars.de/faq#posting>

>> There is no Javascript.  But with an ECMAScript implementation such as
>> JavaScript you can, in a sufficiently recent Web browser, use an
>> implementation of the XMLHttpRequest API.
> 
> Our computer runs Windows 7 and I believe our main web browser is
> Internet Explorer 8.0.

It SHOULD be Internet Explorer 9 or later.

> Do you think are Web browser is recent enough?

Yes.

> Is it possibly already equipped with this XMLHttpRequest API that you
> mention?

Yes.  However, it is necessary to use the older ActiveX/COM variant there to 
access local files via “file://…” URIs.  JSX:http.js automatically uses that 
variant there, then.

>> That API, with sufficient permissions granted, allows you to GET listings
>> of (local) files (the format will vary between UAs) and to GET the file
>> contents via URIs.  Having the files' content, you can build from that an
>> index as an Object instance (preferably with empty prototype chain, or a
>> collision-avoiding Map implementation such as JSX:map.js) that ultimately
>> maps words (property names) to a list of files that contain them
>> (references to Array instances of file names, as property values).  [As
>> an optimization, a previous object could also map prefixes to words.]
>>
>> You can store that index in serialized form in Local Storage and from
>> that point forward only use the unserialized form of the index to perform
>> the search until the index needs to be updated.
> 
> Do you know where I can get a very simple example that demonstrates
> how to GET listings of local files?

Yes.

> How about a simple example of how to GET the file contents via URIs??
> I understand many programming concepts, but I'm unfamiliar with this Web
> API that you mention.

Google is your friend. [psf 6.1]

>> As an alternative, you can use other software to build a script resource
>> with the index as an Object instance that you use for searches after you
>> loaded that resource from an HTML document.  An example of that can be
>> found
>> in SELFHTML's offline search; the code quality thereis is awful, but
>> debugging that code could still help.  Probably there are other, better
>> implementations as this is not likely to be an uncommon problem.
> 
> Most of the online documentation for SELFHTML that I found is printed
> in the German language, which I can't read, hehe.

Last I checked there was a version of SELFHTML in English and other 
languages, there are online translators like Google Translate which provide 
a sufficiently exact translation, and the relevant source code is not in 
German.

> I doubt we'd be able to install software on this computer anyways.   8(

AISB, the alternative approach used in SELFHTML is to use software other 
than a client-side ECMAScript implementation to generate the index on a 
computer where you can install software, and use that index on another 
computer where you can not necessarily install software.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Implement offline site search? "Robert Crandal" <rcranz143101@gmail.com> - 2013-02-13 01:23 -0700
  Re: Implement offline site search? Tim Slattery <Slattery_T@bls.gov> - 2013-02-13 09:04 -0500
    Re: Implement offline site search? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-13 15:23 +0100
    Re: Implement offline site search? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-13 15:33 +0100
  Re: Implement offline site search? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-13 15:06 +0100
    Re: Implement offline site search? "Robert Crandal" <rcranz143101@gmail.com> - 2013-02-17 02:24 -0700
      Re: Implement offline site search? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-17 13:18 +0100
        Re: Implement offline site search? John G Harris <niam@jghnorth.org.uk.invalid> - 2013-02-17 16:14 +0000
        Re: Implement offline site search? "Robert Crandal" <rcranz143101@gmail.com> - 2013-02-17 11:54 -0700
          Re: Implement offline site search? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-17 20:52 +0100
            Re: Implement offline site search? "Robert Crandal" <rcranz143101@gmail.com> - 2013-02-17 15:10 -0700
              Re: Implement offline site search? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-17 23:16 +0100
              Re: Implement offline site search? Andrew Poulos <ap_prog@hotmail.com> - 2013-02-18 09:54 +1100
                Re: Implement offline site search? John G Harris <niam@jghnorth.org.uk.invalid> - 2013-02-18 10:17 +0000
                Re: Implement offline site search? "Robert Crandal" <rcranz143101@gmail.com> - 2013-02-18 11:43 -0700
                Re: Implement offline site search? Andrew Poulos <ap_prog@hotmail.com> - 2013-02-19 06:27 +1100
                Re: Implement offline site search? Andrew Poulos <ap_prog@hotmail.com> - 2013-02-19 06:33 +1100
            Re: Implement offline site search? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-02-18 12:23 +0000
  Re: Implement offline site search? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-02-13 10:23 -0700
    Re: Implement offline site search? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-14 10:56 +0100
      Re: Implement offline site search? John G Harris <niam@jghnorth.org.uk.invalid> - 2013-02-14 10:20 +0000
        Re: Implement offline site search? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-14 11:26 +0100
  Re: Implement offline site search? Wally W. <ww84wa@aim.com> - 2013-02-14 08:07 -0500
  Re: Implement offline site search? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-02-14 22:47 +0000
  Re: Implement offline site search? Scott Sauyet <scott.sauyet@gmail.com> - 2013-02-14 18:49 -0800

csiph-web