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


Groups > comp.lang.javascript > #31070

Re: Is it possible to do AJAX coding on the *same* computer?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Is it possible to do AJAX coding on the *same* computer?
Date 2016-08-05 07:37 +0200
Organization PointedEars Software (PES)
Message-ID <11607840.uLZWGnKmhe@PointedEars.de> (permalink)
References (6 earlier) <9b574432-59c9-4627-80c6-510cd6328118@googlegroups.com> <1778487.oMNUckLgyt@PointedEars.de> <399e366a-a49e-4211-9d39-5d533fd6d9b6@googlegroups.com> <4219161.GXAFRqVoOG@PointedEars.de> <9312865b-68d7-495c-8305-0a08b9b2a91d@googlegroups.com>

Show all headers | View raw


Michael Haufe (TNO) wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Michael Haufe (TNO) wrote:
>> > Given there is no information from the OP, I don't even want to assume
>> > he's even trying to request something from the same domain
>> A distinct possibility.  But then your suggestion makes even less sense
>> to me.
> 
> If there was a standalone html file opened directly from the filesystem,
> that wouldn't be 'localhost', yet it could attempt to make a request to a
> local server with a proper http(s) url. That's what I was referring to

ACK.  If CORS is supported by the client, then it is possible to make 
requests this way if the server sends

Access-Control-Allow-Origin: *

or

Access-Control-Allow-Origin: null

[The latter variant, which corresponds to the CORS specification [1], works 
in Chromium “51.0.2704.79 Built on 8.4, running on Debian stretch/sid (64-
bit)” and Iceweasel 38.1.0.  However, by contrast to the former, CORS would 
then only work from non-HTTP sites like file://… to the HTTP site.]

Stefan Ram has described correctly how to do this with Apache in general.

But the OP has said that they have installed LAMP (Linux Apache MySQL PHP) 
on their machine.  I agree that the OP is a bit vague, but it appears a 
stretch to me to assume that they are meaning requests from “file://”.
 
>> > Is there a free alternative [to buggy, trolled, spammed Google Groups]
>> > that doesn't require me to download a new client across a handful of
>> > machines?
> 
> Nice substitution... so very true

I have read a funny remark to the GG situation yesterday, which I found so 
apt that I added it to my sig file:

  “[…] instead of firing any incompetent programmers they may accidentally
   hire, they send them to a dungeon deep below their main building, where
    they work on making Google Groups worse.”
       –Michael Moroney in <news:nnu48k$c7o$1@pcls7.std.com>

>> I am also working on one: a Web application based on KNode (which is not
>> supported by KDE anymore).
> 
> I'd look forward to seeing it.

As I am to writing it.  Thanks.

> I vaguely recall that one of the group members was working on a
> GreaseMonkey script that would make the GG interface bearable.  That may
> be something worth revisiting. I'd dig through the archives to find it,
> but the GG interface has changed significantly since it was written.

The markup did not change that much, so I was able to tweak my original 
script (which I am not sure I published here) inasfar as that the initial 
thread view is modified (threads recognized as spam by the word filter can 
be marked as such, a [user] stylesheet can then hide them).  While doing 
that I (re)discovered that pattern for when the “load” event is 
insufficient:

  /* or with window.setTimeout(…) and .clearTimeout(…) */
  var interval = window.setInterval(function () {
    var keyElement = document.getElement…(…);
    if (!keyElement || !keyElement.length) return;

    window.clearInterval(interval);

    /* Do things if keyElement is there/non-empty */
  }, pollingInterval);

This pattern is so common that it could be generalized into a method –

  jsx.waitFor(conditionCallback, pollingInterval, actionCallback);

so that you could write instead
  
  var keyElement;

  jsx.waitFor(
    () => {
      keyElement = document.getElement…(…);
      return (!keyElement || !keyElement.length);
    },
    pollingInterval,
    () => {
      /* Do things if keyElement is there/non-empty */
    });

The main problem is that Google Groups is loading threads asynchronously now 
(plus continuous scrolling), and there are no events that I can see that I 
could add a listener for (is there a Google Groups API?); so the marking 
procedure would have to be adapted for continuous polling [sic], too, before 
the script is usable.

As I indicated, I would rather spend the time on writing something 
considerably better than Google Groups, something with which one is also not 
dependent on a single Web site.  But maybe further tweaks would help me in 
both development directions (continuous scrolling is an intriguing concept 
for a newsreader, particularly a Web-based one).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


Thread

Is it possible to do AJAX coding on the *same* computer? bit-naughty@hotmail.com - 2016-08-02 09:49 -0700
  Re: Is it possible to do AJAX coding on the *same* computer? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-02 22:26 -0700
  Re: Is it possible to do AJAX coding on the *same* computer? bit-naughty@hotmail.com - 2016-08-02 23:48 -0700
    Re: Is it possible to do AJAX coding on the *same* computer? Andrew Poulos <ap_prog@hotmail.com> - 2016-08-03 17:58 +1000
      Re: Is it possible to do AJAX coding on the *same* computer? I Am Here <iamhereintheworld@gmail.com> - 2016-08-03 13:16 -0700
        Re: Is it possible to do AJAX coding on the *same* computer? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-03 16:13 -0700
          Re: Is it possible to do AJAX coding on the *same* computer? bit-naughty@hotmail.com - 2016-08-04 06:56 -0700
            Re: Is it possible to do AJAX coding on the *same* computer? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-04 09:37 -0700
              Re: Is it possible to do AJAX coding on the *same* computer? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-04 19:22 +0200
                Re: Is it possible to do AJAX coding on the *same* computer? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-04 10:57 -0700
                Re: Is it possible to do AJAX coding on the *same* computer? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-04 20:20 +0200
                Re: Is it possible to do AJAX coding on the *same* computer? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-04 13:22 -0700
                Re: Is it possible to do AJAX coding on the *same* computer? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-05 07:37 +0200
                User scripts (was: Is it possible to do AJAX coding on the *same* computer?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-06 13:38 +0200
              Re: Is it possible to do AJAX coding on the *same* computer? bit-naughty@hotmail.com - 2016-08-05 12:44 -0700
                Re: Is it possible to do AJAX coding on the *same* computer? Tim Streater <timstreater@greenbee.net> - 2016-08-06 20:08 +0100
  Re: Is it possible to do AJAX coding on the *same* computer? Tim Streater <timstreater@greenbee.net> - 2016-08-06 20:00 +0100
  Re: Is it possible to do AJAX coding on the *same* computer? bit-naughty@hotmail.com - 2016-08-08 04:18 -0700
    Re: Is it possible to do AJAX coding on the *same* computer? Tim Streater <timstreater@greenbee.net> - 2016-08-08 12:23 +0100

csiph-web