this is how you cache
This commit is contained in:
parent
51a74bbd73
commit
970ff0d619
22
js/inline.js
22
js/inline.js
@ -1,4 +1,6 @@
|
|||||||
;(function() {
|
;(function() {
|
||||||
|
var cache = {}
|
||||||
|
|
||||||
var inline = function(e) {
|
var inline = function(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
@ -23,13 +25,21 @@
|
|||||||
// XXX WTF the post hover script adds fetched threads to the DOM
|
// XXX WTF the post hover script adds fetched threads to the DOM
|
||||||
selector = '#thread_' + OP + ' ' + selector
|
selector = '#thread_' + OP + ' ' + selector
|
||||||
var $target = $(selector)
|
var $target = $(selector)
|
||||||
add(link, $target)
|
return add(link, $target)
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$.get(this.pathname, function(data) {
|
var url = this.pathname
|
||||||
var $target = $(data).find(selector)
|
var data = cache[url]
|
||||||
add(link, $target)
|
if (data) {
|
||||||
})
|
var $target = $(data).find(selector)
|
||||||
|
return add(link, $target)
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get(url, function(data) {
|
||||||
|
cache[url] = data
|
||||||
|
var $target = $(data).find(selector)
|
||||||
|
add(link, $target)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var add = function(link, $target) {
|
var add = function(link, $target) {
|
||||||
|
Loading…
Reference in New Issue
Block a user