git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@70 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+1
-69
@@ -7,75 +7,7 @@
|
||||
define(['jquery', 'backbone'],
|
||||
function ($, Backbone) {
|
||||
|
||||
var Images = {
|
||||
prefix: "images",
|
||||
getThumb: function (id) {
|
||||
var val = this._get(id);
|
||||
if(val.thumb !== "")
|
||||
return val.thumb;
|
||||
|
||||
var response = $.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/photo/thumbnail/" + id + "/1",
|
||||
type: 'GET',
|
||||
async: false
|
||||
}).responseText;
|
||||
val.thumb = response;
|
||||
this._set(id, val);
|
||||
return val.thumb;
|
||||
},
|
||||
getMedium: function (id) {
|
||||
var val = this._get(id);
|
||||
if(val.medium !== "")
|
||||
return val.medium;
|
||||
|
||||
var response = $.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/photo/medium/" + id + "/1",
|
||||
type: 'GET',
|
||||
async: false
|
||||
}).responseText;
|
||||
val.medium = response;
|
||||
this._set(id, val);
|
||||
return val.medium;
|
||||
},
|
||||
getFull: function (id) {
|
||||
var val = this._get(id);
|
||||
if(val.full !== "")
|
||||
return val.full;
|
||||
|
||||
var response = $.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/api/photo/" + id + "/1",
|
||||
type: 'GET',
|
||||
async: false
|
||||
}).responseText;
|
||||
val.full = response;
|
||||
this._set(id, val);
|
||||
return val.full;
|
||||
},
|
||||
_set:function(id, item){
|
||||
var list = JSON.parse(window.localStorage.getItem(this.prefix));
|
||||
if(list !== null)
|
||||
{
|
||||
list[id] = item;
|
||||
window.localStorage.setItem(this.prefix, JSON.stringify(list));
|
||||
}
|
||||
},
|
||||
_get:function(id){
|
||||
var ret = null;
|
||||
var item = JSON.parse(window.localStorage.getItem(this.prefix));
|
||||
if(item === null){
|
||||
item = {};
|
||||
window.localStorage.setItem(this.prefix, JSON.stringify(item));
|
||||
ret = { thumb: "", medium: "", full:""};
|
||||
}
|
||||
else if(item[id] === undefined){
|
||||
ret = { thumb: "", medium: "", full:""};
|
||||
}
|
||||
else{
|
||||
ret = item[id];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
var Images = {
|
||||
};
|
||||
|
||||
return Images;
|
||||
|
||||
Reference in New Issue
Block a user