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:
Shish
2013-07-05 22:32:01 +01:00
parent e4bfa7df70
commit 47c1b5d094
9 changed files with 36 additions and 16 deletions

View File

@ -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);
});
}
});
});