mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-01-12 07:58:05 +00:00
Fixed img.bi support
This commit is contained in:
parent
a58f06a47d
commit
608f18b707
@ -323,16 +323,23 @@ function imagePreview(link) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getImgbi(link) {
|
function getImgbi(link) {
|
||||||
var params = link.split('!');
|
var originLink = link;
|
||||||
imgBiJSDownload(params[0].replace('#','') + 'download/' + params[1], params[2], new XMLHttpRequest(), link);
|
if (link.indexOf('#/' > 0)) var link = link.replace('#/', '#!');
|
||||||
|
|
||||||
function imgBiJSDownload(url, pass, request, link) {
|
var params = link.split('!');
|
||||||
|
var url = params[0].replace('#','') + 'download/' + params[1];
|
||||||
|
var pass = params[2];
|
||||||
|
|
||||||
|
imgBiJSDownload(url, pass, new XMLHttpRequest(), link, originLink);
|
||||||
|
|
||||||
|
function imgBiJSDownload(url, pass, request, link, originLink) {
|
||||||
request.open('GET', url);
|
request.open('GET', url);
|
||||||
|
|
||||||
request.onload = function() {
|
request.onload = function() {
|
||||||
if (request.status == 200) {
|
if (request.status == 200) {
|
||||||
var result = sjcl.decrypt(pass,request.responseText);
|
var result = sjcl.decrypt(pass,request.responseText);
|
||||||
if (result) {
|
if (result) {
|
||||||
var elem = $('img[data-imgbi="'+link+'"]')[0];
|
var elem = $('img[data-imgbi="'+originLink+'"]')[0];
|
||||||
elem.src = result;
|
elem.src = result;
|
||||||
} else {
|
} else {
|
||||||
console.log('Failed to decrypt image');
|
console.log('Failed to decrypt image');
|
||||||
|
Loading…
Reference in New Issue
Block a user