sander / code-illuminated

Automatically exported from code.google.com/p/code-illuminated
0 stars 0 forks source link

App.processors only once ? #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that the App.processors are processed only the first time.

I've tried to add some 'no-cache', it didn't matter: the file is "Get" only
once, and App.processors processed only once too. (a REST issue ?)

As it was important for internal link (see prev. issue), I've add some
changing date in the url, and the file is "Get" every time, and
App.processors processed each time.

the code: (in the App.processors) changed the href (add a date) on internal
link (when necessary), so that internal link are really "Get".

  function (docs) {
    $(docs).find('a').each(function (i) {
        var d = this.href.indexOf('#');
        var e = this.href.lastIndexOf('#');
        if ( (d > 1) && (d!=e) )
          {
          var txt = this.href.slice(0,e);
          var tyt = this.href.slice(e,this.href.length);
          var now = new Date();
          this.href = txt +  '?date=' + now.getTime() +'&target=' + tyt;
          }
        })
  }

Original issue reported on code.google.com by Denis.Bo...@imag.fr on 19 Feb 2009 at 7:11

GoogleCodeExporter commented 9 years ago
But maybe there is a better solution? (I've not seen why the page was not "get" 
the
second time, and App.processors not processed ; but it could be a reasonible 
choice,
from some point of view)
So, how can you force the processing of App.processors when a 'page' is shown 
(even
the second time)?

Original comment by Denis.Bo...@imag.fr on 20 Feb 2009 at 8:13