mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update indexedDb
This commit is contained in:
parent
232f5dba67
commit
9e9ffda3e6
6 changed files with 56 additions and 37 deletions
58
dashboard-ui/thirdparty/jquery.unveil-custom.js
vendored
58
dashboard-ui/thirdparty/jquery.unveil-custom.js
vendored
|
@ -12,7 +12,10 @@
|
|||
|
||||
var unveilId = 0;
|
||||
|
||||
$.fn.unveil = function (threshold, callback) {
|
||||
// Test search before setting to 0
|
||||
var threshold = 100;
|
||||
|
||||
$.fn.unveil = function () {
|
||||
|
||||
var $w = $(window),
|
||||
th = threshold || 0,
|
||||
|
@ -68,7 +71,7 @@
|
|||
var lazyItems = $(".lazy", this);
|
||||
|
||||
if (lazyItems.length) {
|
||||
lazyItems.unveil(0);
|
||||
lazyItems.unveil();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -76,7 +79,7 @@
|
|||
|
||||
$.fn.lazyImage = function (url) {
|
||||
|
||||
return this.attr('data-src', url).unveil(0);
|
||||
return this.attr('data-src', url).unveil();
|
||||
};
|
||||
|
||||
})(window.jQuery || window.Zepto);
|
||||
|
@ -96,6 +99,17 @@
|
|||
dataBase.createObjectStore(imagesStoreName);
|
||||
}
|
||||
|
||||
function setImageIntoElement(elem, url) {
|
||||
|
||||
if (elem.tagName === "DIV") {
|
||||
|
||||
elem.style.backgroundImage = "url('" + url + "')";
|
||||
|
||||
} else {
|
||||
elem.setAttribute("src", url);
|
||||
}
|
||||
}
|
||||
|
||||
function openDb() {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
@ -281,34 +295,19 @@
|
|||
|
||||
self.setImageInto = function (elem, url) {
|
||||
|
||||
//if (!self.db()) {
|
||||
// if (elem.tagName === "DIV") {
|
||||
|
||||
// elem.style.backgroundImage = "url('" + url + "')";
|
||||
|
||||
// } else {
|
||||
// elem.setAttribute("src", url);
|
||||
// }
|
||||
// return;
|
||||
//}
|
||||
function onFail() {
|
||||
setImageIntoElement(elem, url);
|
||||
}
|
||||
|
||||
openPromise.done(function () {
|
||||
|
||||
self.getImageUrl(url).done(function (localUrl) {
|
||||
|
||||
if (elem.tagName === "DIV") {
|
||||
setImageIntoElement(elem, localUrl);
|
||||
|
||||
elem.style.backgroundImage = "url('" + localUrl + "')";
|
||||
}).fail(onFail);
|
||||
|
||||
} else {
|
||||
elem.setAttribute("src", localUrl);
|
||||
}
|
||||
|
||||
}).fail(function() {
|
||||
new simpleImageStore().setImageInto(elem, url);
|
||||
});
|
||||
|
||||
});
|
||||
}).fail(onFail);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -317,16 +316,7 @@
|
|||
|
||||
var self = this;
|
||||
|
||||
self.setImageInto = function (elem, url) {
|
||||
|
||||
if (elem.tagName === "DIV") {
|
||||
|
||||
elem.style.backgroundImage = "url('" + url + "')";
|
||||
|
||||
} else {
|
||||
elem.setAttribute("src", url);
|
||||
}
|
||||
};
|
||||
self.setImageInto = setImageIntoElement;
|
||||
}
|
||||
|
||||
if ($.browser.safari && indexedDB) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue