Changeset 33046 for lang/javascript

Show
Ignore:
Timestamp:
05/04/09 14:21:14 (4 years ago)
Author:
trashsuite
Message:

* キャッシュ有効期限切れ時に,コンフィグの更新がなければ延々 HEAD をくり返すバグを fix
* HEAD で 302 が帰ってきた時にキャッシュの有効期限をリセットするようにした

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/hatena/hatena_haiku_hidden_invalid_entries.user.js

    r33024 r33046  
    22// @name           Hidden invalid entries for Hatena Haiku 
    33// @namespace      http://www.trashsuite.org/ 
    4 // @version        3.0.16 
     4// @version        3.0.17 
    55// @copyright      2009+, MINASE Kaede (http://www.trashsuite.org/) 
    66// @license        MIT License; http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license 
     
    205205  { 
    206206    this.NAME          = 'Hidden invalid entries for Hatena Haiku' 
    207     this.VERSION       = '3.0.16' 
     207    this.VERSION       = '3.0.17' 
    208208    this.HATENA        = unsafeWindow.Hatena 
    209209    this.CONFIG_SERVER = 'http://hhhie.trashsuite.org/' 
     
    272272        return (v >= 0 && v < 10) ? '0' + v.toString() : v 
    273273      }).join(':') 
     274    } 
     275 
     276    // キャッシュ有効期限をリセット 
     277    this.reset_cache_expire = function() 
     278    { 
     279      this.config.expire = this.CACHE_EXPIRE + (+ new Date) 
    274280    } 
    275281 
     
    537543        onload : function(res) 
    538544        { 
    539           // 304 なら終了 
    540           if(res.status == 304) return true 
     545          // 304 ならキャッシュの有効期限をリセットして終了 
     546          if(res.status == 304) { 
     547            this.reset_cache_expire() 
     548            return true 
     549          } 
    541550 
    542551          GM_xmlhttpRequest({ 
     
    551560              this.config.hidden_words    = this.config.hidden_words.concat(config.hidden_words) 
    552561              this.config.last_modified   = (new Date).toUTCString() 
    553               this.config.expire = this.CACHE_EXPIRE + (+ new Date) 
     562              this.reset_cache_expire() 
    554563              GM_setValue('config', this.config.toSource()) 
    555564            }.bind(this)