move query-string-passing to JS rather than embedding in the HTML, so that the HTML can be commonised and cached better
This commit is contained in:
@ -86,6 +86,23 @@ $(document).ready(function() {
|
||||
a = document.getElementById("nextlink");
|
||||
a.href = a.href + '?' + query;
|
||||
}
|
||||
|
||||
/*
|
||||
* If an image list has a data-query attribute, append
|
||||
* that query string to all thumb links inside the list.
|
||||
* This allows us to cache the same thumb for all query
|
||||
* strings, adding the query in the browser.
|
||||
*/
|
||||
$(".shm-image-list").each(function(idx, elm) {
|
||||
var query = $(this).data("query");
|
||||
if(query) {
|
||||
if(window.console) {console.log("Found list with query: "+query);}
|
||||
$(this).find(".shm-thumb-link").each(function(idx2, elm2) {
|
||||
if(window.console) {console.log("Appending to url: "+$(this).attr("href"));}
|
||||
$(this).attr("href", $(this).attr("href") + query);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user