Update PNG_info_web.js
Browse files- PNG_info_web.js +650 -437
PNG_info_web.js
CHANGED
|
@@ -1,457 +1,670 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
var table = signed_crc_table();
|
| 44 |
-
/* charCodeAt is the best approach for binary strings */
|
| 45 |
-
var use_buffer = typeof Buffer !== 'undefined';
|
| 46 |
-
function crc32_bstr(bstr) {
|
| 47 |
-
if(bstr.length > 32768) if(use_buffer) return crc32_buf_8(new Buffer(bstr));
|
| 48 |
-
var crc = -1, L = bstr.length - 1;
|
| 49 |
-
for(var i = 0; i < L;) {
|
| 50 |
-
crc = table[(crc ^ bstr.charCodeAt(i++)) & 0xFF] ^ (crc >>> 8);
|
| 51 |
-
crc = table[(crc ^ bstr.charCodeAt(i++)) & 0xFF] ^ (crc >>> 8);
|
| 52 |
-
}
|
| 53 |
-
if(i === L) crc = (crc >>> 8) ^ table[(crc ^ bstr.charCodeAt(i)) & 0xFF];
|
| 54 |
-
return crc ^ -1;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
function crc32_buf(buf) {
|
| 58 |
-
if(buf.length > 10000) return crc32_buf_8(buf);
|
| 59 |
-
for(var crc = -1, i = 0, L=buf.length-3; i < L;) {
|
| 60 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 61 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 62 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 63 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 64 |
-
}
|
| 65 |
-
while(i < L+3) crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 66 |
-
return crc ^ -1;
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
function crc32_buf_8(buf) {
|
| 70 |
-
for(var crc = -1, i = 0, L=buf.length-7; i < L;) {
|
| 71 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 72 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 73 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 74 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 75 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 76 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 77 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 78 |
-
crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 79 |
-
}
|
| 80 |
-
while(i < L+7) crc = (crc >>> 8) ^ table[(crc^buf[i++])&0xFF];
|
| 81 |
-
return crc ^ -1;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
/* much much faster to intertwine utf8 and crc */
|
| 85 |
-
function crc32_str(str) {
|
| 86 |
-
for(var crc = -1, i = 0, L=str.length, c, d; i < L;) {
|
| 87 |
-
c = str.charCodeAt(i++);
|
| 88 |
-
if(c < 0x80) {
|
| 89 |
-
crc = (crc >>> 8) ^ table[(crc ^ c) & 0xFF];
|
| 90 |
-
} else if(c < 0x800) {
|
| 91 |
-
crc = (crc >>> 8) ^ table[(crc ^ (192|((c>>6)&31))) & 0xFF];
|
| 92 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|(c&63))) & 0xFF];
|
| 93 |
-
} else if(c >= 0xD800 && c < 0xE000) {
|
| 94 |
-
c = (c&1023)+64; d = str.charCodeAt(i++) & 1023;
|
| 95 |
-
crc = (crc >>> 8) ^ table[(crc ^ (240|((c>>8)&7))) & 0xFF];
|
| 96 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|((c>>2)&63))) & 0xFF];
|
| 97 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|((d>>6)&15)|(c&3))) & 0xFF];
|
| 98 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|(d&63))) & 0xFF];
|
| 99 |
-
} else {
|
| 100 |
-
crc = (crc >>> 8) ^ table[(crc ^ (224|((c>>12)&15))) & 0xFF];
|
| 101 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|((c>>6)&63))) & 0xFF];
|
| 102 |
-
crc = (crc >>> 8) ^ table[(crc ^ (128|(c&63))) & 0xFF];
|
| 103 |
-
}
|
| 104 |
-
}
|
| 105 |
-
return crc ^ -1;
|
| 106 |
-
}
|
| 107 |
-
CRC32.table = table;
|
| 108 |
-
CRC32.bstr = crc32_bstr;
|
| 109 |
-
CRC32.buf = crc32_buf;
|
| 110 |
-
CRC32.str = crc32_str;
|
| 111 |
-
}));
|
| 112 |
-
/* crc32.js (C) 2014-2015 SheetJS -- http://sheetjs.com */
|
| 113 |
-
/* vim: set ts=2: */
|
| 114 |
-
// import crc32 from './crc32.js'
|
| 115 |
-
|
| 116 |
-
// Used for fast-ish conversion between uint8s and uint32s/int32s.
|
| 117 |
-
// Also required in order to remain agnostic for both Node Buffers and
|
| 118 |
-
// Uint8Arrays.
|
| 119 |
-
var uint8 = new Uint8Array(4)
|
| 120 |
-
var int32 = new Int32Array(uint8.buffer)
|
| 121 |
-
var uint32 = new Uint32Array(uint8.buffer)
|
| 122 |
-
|
| 123 |
-
function extractChunks (data) {
|
| 124 |
-
if (data[0] !== 0x89) throw new Error('Invalid .png file header')
|
| 125 |
-
if (data[1] !== 0x50) throw new Error('Invalid .png file header')
|
| 126 |
-
if (data[2] !== 0x4E) throw new Error('Invalid .png file header')
|
| 127 |
-
if (data[3] !== 0x47) throw new Error('Invalid .png file header')
|
| 128 |
-
if (data[4] !== 0x0D) throw new Error('Invalid .png file header: possibly caused by DOS-Unix line ending conversion?')
|
| 129 |
-
if (data[5] !== 0x0A) throw new Error('Invalid .png file header: possibly caused by DOS-Unix line ending conversion?')
|
| 130 |
-
if (data[6] !== 0x1A) throw new Error('Invalid .png file header')
|
| 131 |
-
if (data[7] !== 0x0A) throw new Error('Invalid .png file header: possibly caused by DOS-Unix line ending conversion?')
|
| 132 |
-
|
| 133 |
-
var ended = false
|
| 134 |
-
var chunks = []
|
| 135 |
-
var idx = 8
|
| 136 |
-
|
| 137 |
-
while (idx < data.length) {
|
| 138 |
-
// Read the length of the current chunk,
|
| 139 |
-
// which is stored as a Uint32.
|
| 140 |
-
uint8[3] = data[idx++]
|
| 141 |
-
uint8[2] = data[idx++]
|
| 142 |
-
uint8[1] = data[idx++]
|
| 143 |
-
uint8[0] = data[idx++]
|
| 144 |
-
|
| 145 |
-
// Chunk includes name/type for CRC check (see below).
|
| 146 |
-
var length = uint32[0] + 4
|
| 147 |
-
var chunk = new Uint8Array(length)
|
| 148 |
-
chunk[0] = data[idx++]
|
| 149 |
-
chunk[1] = data[idx++]
|
| 150 |
-
chunk[2] = data[idx++]
|
| 151 |
-
chunk[3] = data[idx++]
|
| 152 |
-
|
| 153 |
-
// Get the name in ASCII for identification.
|
| 154 |
-
var name = (
|
| 155 |
-
String.fromCharCode(chunk[0]) +
|
| 156 |
-
String.fromCharCode(chunk[1]) +
|
| 157 |
-
String.fromCharCode(chunk[2]) +
|
| 158 |
-
String.fromCharCode(chunk[3])
|
| 159 |
-
)
|
| 160 |
-
|
| 161 |
-
// The IHDR header MUST come first.
|
| 162 |
-
if (!chunks.length && name !== 'IHDR') {
|
| 163 |
-
throw new Error('IHDR header missing')
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
// The IEND header marks the end of the file,
|
| 167 |
-
// so on discovering it break out of the loop.
|
| 168 |
-
if (name === 'IEND') {
|
| 169 |
-
ended = true
|
| 170 |
-
chunks.push({
|
| 171 |
-
name: name,
|
| 172 |
-
data: new Uint8Array(0)
|
| 173 |
-
})
|
| 174 |
-
|
| 175 |
-
break
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
// Read the contents of the chunk out of the main buffer.
|
| 179 |
-
for (var i = 4; i < length; i++) {
|
| 180 |
-
chunk[i] = data[idx++]
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
// Read out the CRC value for comparison.
|
| 184 |
-
// It's stored as an Int32.
|
| 185 |
-
uint8[3] = data[idx++]
|
| 186 |
-
uint8[2] = data[idx++]
|
| 187 |
-
uint8[1] = data[idx++]
|
| 188 |
-
uint8[0] = data[idx++]
|
| 189 |
-
|
| 190 |
-
var crcActual = int32[0]
|
| 191 |
-
var crcExpect = CRC32.buf(chunk)
|
| 192 |
-
if (crcExpect !== crcActual) {
|
| 193 |
-
throw new Error(
|
| 194 |
-
'CRC values for ' + name + ' header do not match, PNG file is likely corrupted'
|
| 195 |
-
)
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
// The chunk data is now copied to remove the 4 preceding
|
| 199 |
-
// bytes used for the chunk name/type.
|
| 200 |
-
var chunkData = new Uint8Array(chunk.buffer.slice(4))
|
| 201 |
-
|
| 202 |
-
chunks.push({
|
| 203 |
-
name: name,
|
| 204 |
-
data: chunkData
|
| 205 |
-
})
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
if (!ended) {
|
| 209 |
-
throw new Error('.png file ended prematurely: no IEND header was found')
|
| 210 |
-
}
|
| 211 |
-
|
| 212 |
-
return chunks
|
| 213 |
-
}
|
| 214 |
-
//decode
|
| 215 |
-
function decode (data) {
|
| 216 |
-
if (data.data && data.name) {
|
| 217 |
-
data = data.data
|
| 218 |
-
}
|
| 219 |
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
text += String.fromCharCode(code)
|
| 236 |
-
} else {
|
| 237 |
-
throw new Error('Invalid NULL character found. 0x00 character is not permitted in tEXt content')
|
| 238 |
-
}
|
| 239 |
-
}
|
| 240 |
-
}
|
| 241 |
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
}
|
|
|
|
|
|
|
| 246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
|
|
|
|
|
|
|
|
|
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
try {
|
| 255 |
-
chunks = extractChunks(new Uint8Array(buf));
|
| 256 |
-
console.log(chunks)
|
| 257 |
-
} catch (err) {
|
| 258 |
-
return chunks;
|
| 259 |
-
}
|
| 260 |
-
let textChunks = chunks
|
| 261 |
-
.filter(function (chunk) {
|
| 262 |
-
return chunk.name === "tEXt" || chunk.name === "iTXt";
|
| 263 |
-
})
|
| 264 |
-
console.log(textChunks)
|
| 265 |
-
textChunks=textChunks.map(function (chunk) {
|
| 266 |
-
if (chunk.name === "iTXt") {
|
| 267 |
-
let data = chunk.data.filter((x) => x != 0x0);
|
| 268 |
-
let txt = new TextDecoder().decode(data);
|
| 269 |
-
return {
|
| 270 |
-
keyword: "信息",
|
| 271 |
-
text: txt.slice(10),
|
| 272 |
-
};
|
| 273 |
-
}
|
| 274 |
-
return decode(chunk.data);
|
| 275 |
-
});
|
| 276 |
-
console.log(textChunks);
|
| 277 |
-
return textChunks;
|
| 278 |
-
}
|
| 279 |
|
|
|
|
|
|
|
| 280 |
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
};
|
| 297 |
-
xhr.send();
|
| 298 |
-
});
|
| 299 |
}
|
| 300 |
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
}
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
});
|
| 325 |
-
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
}
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
const elem = document.querySelector('gradio-app');
|
| 332 |
-
const shadowRoot = elem
|
| 333 |
-
const png_info = await delayPng_info()
|
| 334 |
-
png_info.addEventListener('change', (e) => {
|
| 335 |
// 获取用户选择的文件
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
shadowRoot.querySelectorAll('#txt2img_height input')[0].value=Number(result.Size.split('x')[1])
|
| 395 |
-
shadowRoot.querySelectorAll('#txt2img_height input')[0].dispatchEvent(inputEvent);
|
| 396 |
-
|
| 397 |
-
shadowRoot.querySelectorAll('#txt2img_height input')[1].value=Number(result.Size.split('x')[1])
|
| 398 |
-
shadowRoot.querySelectorAll('#txt2img_height input')[1].dispatchEvent(inputEvent);
|
| 399 |
-
|
| 400 |
-
shadowRoot.querySelector('#txt2img_seed input').value=Number(result.Seed)
|
| 401 |
-
shadowRoot.querySelector('#txt2img_seed input').dispatchEvent(inputEvent);
|
| 402 |
-
|
| 403 |
-
//高清修复
|
| 404 |
-
shadowRoot.querySelector('#txt2img_enable_hr input').checked = !!result.Hiresupscaler
|
| 405 |
-
shadowRoot.querySelector('#txt2img_enable_hr input').dispatchEvent(changeEvent)
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
if(!!result.Hiresupscaler){
|
| 409 |
-
const inputElement = document.querySelector("#txt2img_hr_upscaler > label > div > div.wrap-inner.svelte-a6vu2r > div > input");
|
| 410 |
-
const mousevent = new MouseEvent('mousedown', {
|
| 411 |
-
view: window,
|
| 412 |
-
bubbles: true,
|
| 413 |
-
cancelable: true
|
| 414 |
-
});
|
| 415 |
-
inputElement.dispatchEvent(mousevent);
|
| 416 |
-
queueMicrotask(() => {//将函数加入到任务队列待下一次轮询在执行
|
| 417 |
-
// console.log(`[data-value="${result.Hiresupscaler}"]`)
|
| 418 |
-
// shadowRoot.querySelector(`[data-value="${result.Hiresupscaler}"]`).click()
|
| 419 |
-
const listElem = shadowRoot.querySelector(`[data-value="${result.Hiresupscaler}"]`);
|
| 420 |
-
listElem.dispatchEvent(mousevent);
|
| 421 |
-
});
|
| 422 |
-
}
|
| 423 |
-
|
| 424 |
-
// const listElem = document.querySelector("#txt2img_hr_upscaler > label > div > ul > li:nth-child(3)");
|
| 425 |
-
// const listElem = shadowRoot.querySelector(`[data-value="${result.Hiresupscaler}"]`);
|
| 426 |
-
// const event = new MouseEvent("mousedown", { bubbles: true });
|
| 427 |
-
// listElem.dispatchEvent(event);
|
| 428 |
-
|
| 429 |
-
// shadowRoot.querySelector('#txt2img_hr_upscaler .single-select').innerText = result.Hiresupscaler||'None'
|
| 430 |
-
// shadowRoot.querySelector('#txt2img_hr_upscaler .single-select').dispatchEvent(changeEvent)
|
| 431 |
-
|
| 432 |
-
shadowRoot.querySelectorAll('#txt2img_hires_steps input')[0].value=Number(result.Hiressteps)||0
|
| 433 |
-
shadowRoot.querySelectorAll('#txt2img_hires_steps input')[0].dispatchEvent(inputEvent);
|
| 434 |
-
|
| 435 |
-
shadowRoot.querySelectorAll('#txt2img_hires_steps input')[1].value=Number(result.Hiressteps)||0
|
| 436 |
-
shadowRoot.querySelectorAll('#txt2img_hires_steps input')[1].dispatchEvent(inputEvent);
|
| 437 |
-
|
| 438 |
-
shadowRoot.querySelectorAll('#txt2img_denoising_strength input')[0].value=Number(result.Denoisingstrength)||0
|
| 439 |
-
shadowRoot.querySelectorAll('#txt2img_denoising_strength input')[0].dispatchEvent(inputEvent);
|
| 440 |
-
|
| 441 |
-
shadowRoot.querySelectorAll('#txt2img_denoising_strength input')[1].value=Number(result.Denoisingstrength)||0
|
| 442 |
-
shadowRoot.querySelectorAll('#txt2img_denoising_strength input')[1].dispatchEvent(inputEvent);
|
| 443 |
-
|
| 444 |
-
shadowRoot.querySelectorAll('#txt2img_hr_scale input')[0].value=Number(result.Hiresupscale)||1
|
| 445 |
-
shadowRoot.querySelectorAll('#txt2img_hr_scale input')[0].dispatchEvent(inputEvent);
|
| 446 |
-
|
| 447 |
-
shadowRoot.querySelectorAll('#txt2img_hr_scale input')[1].value=Number(result.Hiresupscale)||1
|
| 448 |
-
shadowRoot.querySelectorAll('#txt2img_hr_scale input')[1].dispatchEvent(inputEvent);
|
| 449 |
-
|
| 450 |
-
}
|
| 451 |
-
},100)
|
| 452 |
});
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 456 |
-
png_info_edit()
|
| 457 |
-
});
|
|
|
|
| 1 |
+
(()=>{
|
| 2 |
+
var CRC32;
|
| 3 |
+
(function (factory) {
|
| 4 |
+
if (typeof DO_NOT_EXPORT_CRC === "undefined") {
|
| 5 |
+
if ("object" === typeof exports) {
|
| 6 |
+
factory(exports);
|
| 7 |
+
} else if ("function" === typeof define && define.amd) {
|
| 8 |
+
define(function () {
|
| 9 |
+
var module = {};
|
| 10 |
+
factory(module);
|
| 11 |
+
return module;
|
| 12 |
+
});
|
| 13 |
+
} else {
|
| 14 |
+
factory((CRC32 = {}));
|
| 15 |
+
}
|
| 16 |
+
} else {
|
| 17 |
+
factory((CRC32 = {}));
|
| 18 |
+
}
|
| 19 |
+
})(function (CRC32) {
|
| 20 |
+
CRC32.version = "0.3.0";
|
| 21 |
+
/* see perf/crc32table.js */
|
| 22 |
+
function signed_crc_table() {
|
| 23 |
+
var c = 0,
|
| 24 |
+
table = new Array(256);
|
| 25 |
+
|
| 26 |
+
for (var n = 0; n != 256; ++n) {
|
| 27 |
+
c = n;
|
| 28 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 29 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 30 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 31 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 32 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 33 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 34 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 35 |
+
c = c & 1 ? -306674912 ^ (c >>> 1) : c >>> 1;
|
| 36 |
+
table[n] = c;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;
|
| 40 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
var table = signed_crc_table();
|
| 43 |
+
/* charCodeAt is the best approach for binary strings */
|
| 44 |
+
var use_buffer = typeof Buffer !== "undefined";
|
| 45 |
+
function crc32_bstr(bstr) {
|
| 46 |
+
if (bstr.length > 32768)
|
| 47 |
+
if (use_buffer) return crc32_buf_8(new Buffer(bstr));
|
| 48 |
+
var crc = -1,
|
| 49 |
+
L = bstr.length - 1;
|
| 50 |
+
for (var i = 0; i < L; ) {
|
| 51 |
+
crc = table[(crc ^ bstr.charCodeAt(i++)) & 0xff] ^ (crc >>> 8);
|
| 52 |
+
crc = table[(crc ^ bstr.charCodeAt(i++)) & 0xff] ^ (crc >>> 8);
|
| 53 |
+
}
|
| 54 |
+
if (i === L) crc = (crc >>> 8) ^ table[(crc ^ bstr.charCodeAt(i)) & 0xff];
|
| 55 |
+
return crc ^ -1;
|
| 56 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
function crc32_buf(buf) {
|
| 59 |
+
if (buf.length > 10000) return crc32_buf_8(buf);
|
| 60 |
+
for (var crc = -1, i = 0, L = buf.length - 3; i < L; ) {
|
| 61 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 62 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 63 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 64 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 65 |
+
}
|
| 66 |
+
while (i < L + 3) crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 67 |
+
return crc ^ -1;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
function crc32_buf_8(buf) {
|
| 71 |
+
for (var crc = -1, i = 0, L = buf.length - 7; i < L; ) {
|
| 72 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 73 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 74 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 75 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 76 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 77 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 78 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 79 |
+
crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 80 |
+
}
|
| 81 |
+
while (i < L + 7) crc = (crc >>> 8) ^ table[(crc ^ buf[i++]) & 0xff];
|
| 82 |
+
return crc ^ -1;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/* much much faster to intertwine utf8 and crc */
|
| 86 |
+
function crc32_str(str) {
|
| 87 |
+
for (var crc = -1, i = 0, L = str.length, c, d; i < L; ) {
|
| 88 |
+
c = str.charCodeAt(i++);
|
| 89 |
+
if (c < 0x80) {
|
| 90 |
+
crc = (crc >>> 8) ^ table[(crc ^ c) & 0xff];
|
| 91 |
+
} else if (c < 0x800) {
|
| 92 |
+
crc = (crc >>> 8) ^ table[(crc ^ (192 | ((c >> 6) & 31))) & 0xff];
|
| 93 |
+
crc = (crc >>> 8) ^ table[(crc ^ (128 | (c & 63))) & 0xff];
|
| 94 |
+
} else if (c >= 0xd800 && c < 0xe000) {
|
| 95 |
+
c = (c & 1023) + 64;
|
| 96 |
+
d = str.charCodeAt(i++) & 1023;
|
| 97 |
+
crc = (crc >>> 8) ^ table[(crc ^ (240 | ((c >> 8) & 7))) & 0xff];
|
| 98 |
+
crc = (crc >>> 8) ^ table[(crc ^ (128 | ((c >> 2) & 63))) & 0xff];
|
| 99 |
+
crc =
|
| 100 |
+
(crc >>> 8) ^ table[(crc ^ (128 | ((d >> 6) & 15) | (c & 3))) & 0xff];
|
| 101 |
+
crc = (crc >>> 8) ^ table[(crc ^ (128 | (d & 63))) & 0xff];
|
| 102 |
+
} else {
|
| 103 |
+
crc = (crc >>> 8) ^ table[(crc ^ (224 | ((c >> 12) & 15))) & 0xff];
|
| 104 |
+
crc = (crc >>> 8) ^ table[(crc ^ (128 | ((c >> 6) & 63))) & 0xff];
|
| 105 |
+
crc = (crc >>> 8) ^ table[(crc ^ (128 | (c & 63))) & 0xff];
|
| 106 |
}
|
| 107 |
+
}
|
| 108 |
+
return crc ^ -1;
|
| 109 |
}
|
| 110 |
+
CRC32.table = table;
|
| 111 |
+
CRC32.bstr = crc32_bstr;
|
| 112 |
+
CRC32.buf = crc32_buf;
|
| 113 |
+
CRC32.str = crc32_str;
|
| 114 |
+
});
|
| 115 |
|
| 116 |
+
var uint8 = new Uint8Array(4);
|
| 117 |
+
var int32 = new Int32Array(uint8.buffer);
|
| 118 |
+
var uint32 = new Uint32Array(uint8.buffer);
|
| 119 |
+
|
| 120 |
+
function extractChunks(data) {
|
| 121 |
+
if (data[0] !== 0x89) throw new Error("Invalid .png file header");
|
| 122 |
+
if (data[1] !== 0x50) throw new Error("Invalid .png file header");
|
| 123 |
+
if (data[2] !== 0x4e) throw new Error("Invalid .png file header");
|
| 124 |
+
if (data[3] !== 0x47) throw new Error("Invalid .png file header");
|
| 125 |
+
if (data[4] !== 0x0d)
|
| 126 |
+
throw new Error(
|
| 127 |
+
"Invalid .png file header: possibly caused by DOS-Unix line ending conversion?"
|
| 128 |
+
);
|
| 129 |
+
if (data[5] !== 0x0a)
|
| 130 |
+
throw new Error(
|
| 131 |
+
"Invalid .png file header: possibly caused by DOS-Unix line ending conversion?"
|
| 132 |
+
);
|
| 133 |
+
if (data[6] !== 0x1a) throw new Error("Invalid .png file header");
|
| 134 |
+
if (data[7] !== 0x0a)
|
| 135 |
+
throw new Error(
|
| 136 |
+
"Invalid .png file header: possibly caused by DOS-Unix line ending conversion?"
|
| 137 |
+
);
|
| 138 |
+
|
| 139 |
+
var ended = false;
|
| 140 |
+
var chunks = [];
|
| 141 |
+
var idx = 8;
|
| 142 |
+
|
| 143 |
+
while (idx < data.length) {
|
| 144 |
+
// Read the length of the current chunk,
|
| 145 |
+
// which is stored as a Uint32.
|
| 146 |
+
uint8[3] = data[idx++];
|
| 147 |
+
uint8[2] = data[idx++];
|
| 148 |
+
uint8[1] = data[idx++];
|
| 149 |
+
uint8[0] = data[idx++];
|
| 150 |
+
|
| 151 |
+
// Chunk includes name/type for CRC check (see below).
|
| 152 |
+
var length = uint32[0] + 4;
|
| 153 |
+
var chunk = new Uint8Array(length);
|
| 154 |
+
chunk[0] = data[idx++];
|
| 155 |
+
chunk[1] = data[idx++];
|
| 156 |
+
chunk[2] = data[idx++];
|
| 157 |
+
chunk[3] = data[idx++];
|
| 158 |
+
|
| 159 |
+
// Get the name in ASCII for identification.
|
| 160 |
+
var name =
|
| 161 |
+
String.fromCharCode(chunk[0]) +
|
| 162 |
+
String.fromCharCode(chunk[1]) +
|
| 163 |
+
String.fromCharCode(chunk[2]) +
|
| 164 |
+
String.fromCharCode(chunk[3]);
|
| 165 |
+
|
| 166 |
+
// The IHDR header MUST come first.
|
| 167 |
+
if (!chunks.length && name !== "IHDR") {
|
| 168 |
+
throw new Error("IHDR header missing");
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
// The IEND header marks the end of the file,
|
| 172 |
+
// so on discovering it break out of the loop.
|
| 173 |
+
if (name === "IEND") {
|
| 174 |
+
ended = true;
|
| 175 |
+
chunks.push({
|
| 176 |
+
name: name,
|
| 177 |
+
data: new Uint8Array(0),
|
| 178 |
+
});
|
| 179 |
+
|
| 180 |
+
break;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
// Read the contents of the chunk out of the main buffer.
|
| 184 |
+
for (var i = 4; i < length; i++) {
|
| 185 |
+
chunk[i] = data[idx++];
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
// Read out the CRC value for comparison.
|
| 189 |
+
// It's stored as an Int32.
|
| 190 |
+
uint8[3] = data[idx++];
|
| 191 |
+
uint8[2] = data[idx++];
|
| 192 |
+
uint8[1] = data[idx++];
|
| 193 |
+
uint8[0] = data[idx++];
|
| 194 |
+
|
| 195 |
+
var crcActual = int32[0];
|
| 196 |
+
var crcExpect = CRC32.buf(chunk);
|
| 197 |
+
if (crcExpect !== crcActual) {
|
| 198 |
+
throw new Error(
|
| 199 |
+
"CRC values for " +
|
| 200 |
+
name +
|
| 201 |
+
" header do not match, PNG file is likely corrupted"
|
| 202 |
+
);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
// The chunk data is now copied to remove the 4 preceding
|
| 206 |
+
// bytes used for the chunk name/type.
|
| 207 |
+
var chunkData = new Uint8Array(chunk.buffer.slice(4));
|
| 208 |
+
|
| 209 |
+
chunks.push({
|
| 210 |
+
name: name,
|
| 211 |
+
data: chunkData,
|
| 212 |
+
});
|
| 213 |
+
}
|
| 214 |
|
| 215 |
+
if (!ended) {
|
| 216 |
+
throw new Error(".png file ended prematurely: no IEND header was found");
|
| 217 |
+
}
|
| 218 |
|
| 219 |
+
return chunks;
|
| 220 |
+
}
|
| 221 |
+
//decode
|
| 222 |
+
function decode(data) {
|
| 223 |
+
if (data.data && data.name) {
|
| 224 |
+
data = data.data;
|
| 225 |
+
}
|
| 226 |
|
| 227 |
+
var naming = true;
|
| 228 |
+
var text = "";
|
| 229 |
+
var name = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
+
for (var i = 0; i < data.length; i++) {
|
| 232 |
+
var code = data[i];
|
| 233 |
|
| 234 |
+
if (naming) {
|
| 235 |
+
if (code) {
|
| 236 |
+
name += String.fromCharCode(code);
|
| 237 |
+
} else {
|
| 238 |
+
naming = false;
|
| 239 |
+
}
|
| 240 |
+
} else {
|
| 241 |
+
if (code) {
|
| 242 |
+
text += String.fromCharCode(code);
|
| 243 |
+
} else {
|
| 244 |
+
throw new Error(
|
| 245 |
+
"Invalid NULL character found. 0x00 character is not permitted in tEXt content"
|
| 246 |
+
);
|
| 247 |
+
}
|
| 248 |
+
}
|
|
|
|
|
|
|
|
|
|
| 249 |
}
|
| 250 |
|
| 251 |
+
return {
|
| 252 |
+
keyword: name,
|
| 253 |
+
text: text,
|
| 254 |
+
};
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
const inputEvent = new Event("input");
|
| 258 |
+
const changeEvent = new Event("change");
|
| 259 |
+
let shadowRoot = null;
|
| 260 |
+
let result = {};
|
| 261 |
+
let png_info_blob = {};
|
| 262 |
+
//readNovelAITag源码参考于秋叶大佬
|
| 263 |
+
const readNovelAITag = async (file) => {
|
| 264 |
+
const buf = await file.arrayBuffer();
|
| 265 |
+
let chunks = [];
|
| 266 |
+
try {
|
| 267 |
+
chunks = extractChunks(new Uint8Array(buf));
|
| 268 |
+
} catch (err) {
|
| 269 |
+
return chunks;
|
| 270 |
}
|
| 271 |
+
let textChunks = chunks.filter(function (chunk) {
|
| 272 |
+
return chunk.name === "tEXt" || chunk.name === "iTXt";
|
| 273 |
+
});
|
| 274 |
+
textChunks = textChunks.map(function (chunk) {
|
| 275 |
+
if (chunk.name === "iTXt") {
|
| 276 |
+
let data = chunk.data.filter((x) => x != 0x0);
|
| 277 |
+
let txt = new TextDecoder().decode(data);
|
| 278 |
+
return {
|
| 279 |
+
keyword: "信息",
|
| 280 |
+
text: txt.slice(10),
|
| 281 |
+
};
|
| 282 |
+
}
|
| 283 |
+
return decode(chunk.data);
|
| 284 |
+
});
|
| 285 |
+
return textChunks;
|
| 286 |
+
};
|
| 287 |
+
|
| 288 |
+
//dom转blob
|
| 289 |
+
async function convertDomImageToBlob(imageElement) {
|
| 290 |
+
const imageUrl = imageElement.src;
|
| 291 |
+
// const file = new File([blob], 'filename.png', {type: blob.type});
|
| 292 |
+
return await readStoragePng(imageUrl);
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
//base64转blob
|
| 296 |
+
async function readStoragePng(dataURI) {
|
| 297 |
+
var byteString = atob(dataURI.split(",")[1]);
|
| 298 |
+
|
| 299 |
+
// 获取 MIME 类型
|
| 300 |
+
var mimeString = dataURI.split(",")[0].split(":")[1].split(";")[0];
|
| 301 |
+
|
| 302 |
+
// 创建 Blob 对象
|
| 303 |
+
var blob = new Blob(
|
| 304 |
+
[
|
| 305 |
+
new Uint8Array(byteString.length).map(function (_, i) {
|
| 306 |
+
return byteString.charCodeAt(i);
|
| 307 |
+
}),
|
| 308 |
+
],
|
| 309 |
+
{ type: mimeString }
|
| 310 |
+
);
|
| 311 |
+
|
| 312 |
+
return blob;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
//图片存到本地
|
| 316 |
+
let imgStorage=(img)=>{
|
| 317 |
+
localStorage.setItem("png_info_img", img.src);
|
| 318 |
+
}
|
| 319 |
+
//延迟获取dom到pnginfo_image更新完后
|
| 320 |
+
let delayPng_info = function () {
|
| 321 |
+
return new Promise((resolve) => {
|
| 322 |
+
this.shadowRoot = document.querySelector("gradio-app");
|
| 323 |
+
const observer = new MutationObserver((mutations) => {
|
| 324 |
+
mutations.forEach((mutation) => {
|
| 325 |
+
// 如果 id 为 pnginfo_image 的子元素被添加到 gradio-app 元素中
|
| 326 |
+
if (
|
| 327 |
+
mutation.addedNodes.length &&
|
| 328 |
+
mutation.addedNodes[0].id === "pnginfo_image"
|
| 329 |
+
) {
|
| 330 |
+
// 取消监听
|
| 331 |
+
observer.disconnect();
|
| 332 |
+
// 获取 id 为 pnginfo_image 的元素并进行操作
|
| 333 |
+
resolve(mutation.addedNodes[0]);
|
| 334 |
+
}
|
| 335 |
+
});
|
| 336 |
+
});
|
| 337 |
+
observer.observe(this.shadowRoot, { childList: true, subtree: true });
|
| 338 |
+
});
|
| 339 |
+
};
|
| 340 |
+
|
| 341 |
+
let txt2ImgFormFill = () => {
|
| 342 |
+
shadowRoot=this.shadowRoot
|
| 343 |
+
let result = this.result;
|
| 344 |
+
const inputEvent = new Event("input");
|
| 345 |
+
const changeEvent = new Event("change", {
|
| 346 |
+
bubbles: true,
|
| 347 |
+
});
|
| 348 |
+
shadowRoot.querySelector('[class="tab-nav scroll-hide svelte-1g805jl"]').children[0].click();
|
| 349 |
+
|
| 350 |
+
shadowRoot.querySelectorAll(
|
| 351 |
+
"#setting_CLIP_stop_at_last_layers input"
|
| 352 |
+
)[0].value = Number(result.Clipskip);
|
| 353 |
+
shadowRoot
|
| 354 |
+
.querySelectorAll("#setting_CLIP_stop_at_last_layers input")[0]
|
| 355 |
+
.dispatchEvent(inputEvent);
|
| 356 |
+
|
| 357 |
+
shadowRoot.querySelectorAll(
|
| 358 |
+
"#setting_CLIP_stop_at_last_layers input"
|
| 359 |
+
)[1].value = Number(result.Clipskip);
|
| 360 |
+
shadowRoot
|
| 361 |
+
.querySelectorAll("#setting_CLIP_stop_at_last_layers input")[1]
|
| 362 |
+
.dispatchEvent(inputEvent);
|
| 363 |
+
|
| 364 |
+
shadowRoot.querySelector("#txt2img_prompt textarea").value = result.prompt;
|
| 365 |
+
shadowRoot
|
| 366 |
+
.querySelector("#txt2img_prompt textarea")
|
| 367 |
+
.dispatchEvent(inputEvent);
|
| 368 |
+
|
| 369 |
+
shadowRoot.querySelector("#txt2img_neg_prompt textarea").value =
|
| 370 |
+
result.negativePrompt;
|
| 371 |
+
shadowRoot
|
| 372 |
+
.querySelector("#txt2img_neg_prompt textarea")
|
| 373 |
+
.dispatchEvent(inputEvent);
|
| 374 |
+
|
| 375 |
+
shadowRoot.querySelectorAll("#txt2img_steps input")[0].value = Number(
|
| 376 |
+
result.Steps
|
| 377 |
+
);
|
| 378 |
+
shadowRoot
|
| 379 |
+
.querySelectorAll("#txt2img_steps input")[0]
|
| 380 |
+
.dispatchEvent(inputEvent);
|
| 381 |
+
|
| 382 |
+
shadowRoot.querySelectorAll("#txt2img_steps input")[1].value = Number(
|
| 383 |
+
result.Steps
|
| 384 |
+
);
|
| 385 |
+
shadowRoot
|
| 386 |
+
.querySelectorAll("#txt2img_steps input")[1]
|
| 387 |
+
.dispatchEvent(inputEvent);
|
| 388 |
+
|
| 389 |
+
shadowRoot.querySelector(`[value="${result.Sampler}"]`).checked = true;
|
| 390 |
+
shadowRoot
|
| 391 |
+
.querySelector(`[value="${result.Sampler}"]`)
|
| 392 |
+
.dispatchEvent(changeEvent);
|
| 393 |
+
|
| 394 |
+
shadowRoot.querySelectorAll("#txt2img_width input")[0].value = Number(
|
| 395 |
+
result.Size.split("x")[0]
|
| 396 |
+
);
|
| 397 |
+
shadowRoot
|
| 398 |
+
.querySelectorAll("#txt2img_width input")[0]
|
| 399 |
+
.dispatchEvent(inputEvent);
|
| 400 |
+
|
| 401 |
+
shadowRoot.querySelectorAll("#txt2img_width input")[1].value = Number(
|
| 402 |
+
result.Size.split("x")[0]
|
| 403 |
+
);
|
| 404 |
+
shadowRoot
|
| 405 |
+
.querySelectorAll("#txt2img_width input")[1]
|
| 406 |
+
.dispatchEvent(inputEvent);
|
| 407 |
+
|
| 408 |
+
shadowRoot.querySelectorAll("#txt2img_height input")[0].value = Number(
|
| 409 |
+
result.Size.split("x")[1]
|
| 410 |
+
);
|
| 411 |
+
shadowRoot
|
| 412 |
+
.querySelectorAll("#txt2img_height input")[0]
|
| 413 |
+
.dispatchEvent(inputEvent);
|
| 414 |
+
|
| 415 |
+
shadowRoot.querySelectorAll("#txt2img_height input")[1].value = Number(
|
| 416 |
+
result.Size.split("x")[1]
|
| 417 |
+
);
|
| 418 |
+
shadowRoot
|
| 419 |
+
.querySelectorAll("#txt2img_height input")[1]
|
| 420 |
+
.dispatchEvent(inputEvent);
|
| 421 |
+
|
| 422 |
+
shadowRoot.querySelector("#txt2img_seed input").value = Number(result.Seed);
|
| 423 |
+
shadowRoot.querySelector("#txt2img_seed input").dispatchEvent(inputEvent);
|
| 424 |
+
|
| 425 |
+
//高清修复
|
| 426 |
+
shadowRoot.querySelector("#txt2img_enable_hr input").checked =
|
| 427 |
+
!!result.Hiresupscaler;
|
| 428 |
+
shadowRoot
|
| 429 |
+
.querySelector("#txt2img_enable_hr input")
|
| 430 |
+
.dispatchEvent(changeEvent);
|
| 431 |
+
|
| 432 |
+
if (!!result.Hiresupscaler) {
|
| 433 |
+
const inputElement = document.querySelector(
|
| 434 |
+
"#txt2img_hr_upscaler > label > div > div.wrap-inner.svelte-a6vu2r > div > input"
|
| 435 |
+
);
|
| 436 |
+
const mousevent = new MouseEvent("mousedown", {
|
| 437 |
+
view: window,
|
| 438 |
+
bubbles: true,
|
| 439 |
+
cancelable: true,
|
| 440 |
+
});
|
| 441 |
+
inputElement.dispatchEvent(mousevent);
|
| 442 |
+
queueMicrotask(() => {
|
| 443 |
+
//将函数加入到任务队列待下一次轮询在执行
|
| 444 |
+
const listElem = shadowRoot.querySelector(
|
| 445 |
+
`[data-value="${result.Hiresupscaler}"]`
|
| 446 |
+
);
|
| 447 |
+
listElem.dispatchEvent(mousevent);
|
| 448 |
+
});
|
| 449 |
}
|
| 450 |
+
|
| 451 |
+
shadowRoot.querySelectorAll("#txt2img_hires_steps input")[0].value =
|
| 452 |
+
Number(result.Hiressteps) || 0;
|
| 453 |
+
shadowRoot
|
| 454 |
+
.querySelectorAll("#txt2img_hires_steps input")[0]
|
| 455 |
+
.dispatchEvent(inputEvent);
|
| 456 |
+
|
| 457 |
+
shadowRoot.querySelectorAll("#txt2img_hires_steps input")[1].value =
|
| 458 |
+
Number(result.Hiressteps) || 0;
|
| 459 |
+
shadowRoot
|
| 460 |
+
.querySelectorAll("#txt2img_hires_steps input")[1]
|
| 461 |
+
.dispatchEvent(inputEvent);
|
| 462 |
+
|
| 463 |
+
shadowRoot.querySelectorAll("#txt2img_denoising_strength input")[0].value =
|
| 464 |
+
Number(result.Denoisingstrength) || 0;
|
| 465 |
+
shadowRoot
|
| 466 |
+
.querySelectorAll("#txt2img_denoising_strength input")[0]
|
| 467 |
+
.dispatchEvent(inputEvent);
|
| 468 |
+
|
| 469 |
+
shadowRoot.querySelectorAll("#txt2img_denoising_strength input")[1].value =
|
| 470 |
+
Number(result.Denoisingstrength) || 0;
|
| 471 |
+
shadowRoot
|
| 472 |
+
.querySelectorAll("#txt2img_denoising_strength input")[1]
|
| 473 |
+
.dispatchEvent(inputEvent);
|
| 474 |
+
|
| 475 |
+
shadowRoot.querySelectorAll("#txt2img_hr_scale input")[0].value =
|
| 476 |
+
Number(result.Hiresupscale) || 1;
|
| 477 |
+
shadowRoot
|
| 478 |
+
.querySelectorAll("#txt2img_hr_scale input")[0]
|
| 479 |
+
.dispatchEvent(inputEvent);
|
| 480 |
+
|
| 481 |
+
shadowRoot.querySelectorAll("#txt2img_hr_scale input")[1].value =
|
| 482 |
+
Number(result.Hiresupscale) || 1;
|
| 483 |
+
shadowRoot
|
| 484 |
+
.querySelectorAll("#txt2img_hr_scale input")[1]
|
| 485 |
+
.dispatchEvent(inputEvent);
|
| 486 |
+
};
|
| 487 |
+
|
| 488 |
+
let img2ImgFormFill = () => {
|
| 489 |
+
let result = this.result;
|
| 490 |
+
const inputEvent = new Event("input");
|
| 491 |
+
const changeEvent = new Event("change", {
|
| 492 |
+
bubbles: true,
|
| 493 |
});
|
| 494 |
+
this.shadowRoot.querySelector('[class="tab-nav scroll-hide svelte-1g805jl"]').children[1].click();
|
| 495 |
+
this.shadowRoot.querySelectorAll('#mode_img2img button')[0].click()
|
| 496 |
+
|
| 497 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[0].value = Number(result.Clipskip)
|
| 498 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[0].dispatchEvent(inputEvent);
|
| 499 |
+
|
| 500 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[1].value = Number(result.Clipskip)
|
| 501 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[1].dispatchEvent(inputEvent);
|
| 502 |
+
|
| 503 |
+
this.shadowRoot.querySelector('#img2img_prompt textarea').value = result.prompt
|
| 504 |
+
this.shadowRoot.querySelector('#img2img_prompt textarea').dispatchEvent(inputEvent);
|
| 505 |
+
|
| 506 |
+
this.shadowRoot.querySelector('#img2img_neg_prompt textarea').value = result.negativePrompt
|
| 507 |
+
this.shadowRoot.querySelector('#img2img_neg_prompt textarea').dispatchEvent(inputEvent);
|
| 508 |
+
|
| 509 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[0].value = Number(result.Steps)
|
| 510 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[0].dispatchEvent(inputEvent);
|
| 511 |
+
|
| 512 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[1].value = Number(result.Steps)
|
| 513 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[1].dispatchEvent(inputEvent);
|
| 514 |
+
|
| 515 |
+
this.shadowRoot.querySelectorAll(`[value="${result.Sampler}"]`)[1].checked = true;
|
| 516 |
+
this.shadowRoot.querySelectorAll(`[value="${result.Sampler}"]`)[1].dispatchEvent(changeEvent)
|
| 517 |
+
|
| 518 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[0].value = Number(result.Size.split('x')[0])
|
| 519 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[0].dispatchEvent(inputEvent);
|
| 520 |
+
|
| 521 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[1].value = Number(result.Size.split('x')[0])
|
| 522 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[1].dispatchEvent(inputEvent);
|
| 523 |
+
|
| 524 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[0].value = Number(result.Size.split('x')[1])
|
| 525 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[0].dispatchEvent(inputEvent);
|
| 526 |
+
|
| 527 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[1].value = Number(result.Size.split('x')[1])
|
| 528 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[1].dispatchEvent(inputEvent);
|
| 529 |
+
|
| 530 |
+
this.shadowRoot.querySelector('#img2img_seed input').value = Number(result.Seed)
|
| 531 |
+
this.shadowRoot.querySelector('#img2img_seed input').dispatchEvent(inputEvent);
|
| 532 |
+
//图生图调用pnginfo的png
|
| 533 |
+
const file = new File([this.png_info_blob], 'example.png');
|
| 534 |
+
const dataTransfer = new DataTransfer();
|
| 535 |
+
dataTransfer.items.add(file);
|
| 536 |
+
const fileList = dataTransfer.files;
|
| 537 |
+
this.shadowRoot.querySelector("#img2img_image input").files = fileList;
|
| 538 |
+
this.shadowRoot.querySelector('#img2img_image input').dispatchEvent(changeEvent);
|
| 539 |
+
};
|
| 540 |
+
|
| 541 |
+
let inpaintTabFormFill=()=> {
|
| 542 |
+
let result = this.result;
|
| 543 |
+
const inputEvent = new Event("input");
|
| 544 |
+
const changeEvent = new Event("change", {
|
| 545 |
+
bubbles: true,
|
| 546 |
});
|
| 547 |
+
this.shadowRoot.querySelector('[class="tab-nav scroll-hide svelte-1g805jl"]').children[1].click();
|
| 548 |
+
this.shadowRoot.querySelectorAll('#mode_img2img button')[2].click()
|
| 549 |
+
|
| 550 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[0].value = Number(result.Clipskip)
|
| 551 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[0].dispatchEvent(inputEvent);
|
| 552 |
+
|
| 553 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[1].value = Number(result.Clipskip)
|
| 554 |
+
this.shadowRoot.querySelectorAll('#setting_CLIP_stop_at_last_layers input')[1].dispatchEvent(inputEvent);
|
| 555 |
+
|
| 556 |
+
this.shadowRoot.querySelector('#img2img_prompt textarea').value = result.prompt
|
| 557 |
+
this.shadowRoot.querySelector('#img2img_prompt textarea').dispatchEvent(inputEvent);
|
| 558 |
+
|
| 559 |
+
this.shadowRoot.querySelector('#img2img_neg_prompt textarea').value = result.negativePrompt
|
| 560 |
+
this.shadowRoot.querySelector('#img2img_neg_prompt textarea').dispatchEvent(inputEvent);
|
| 561 |
+
|
| 562 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[0].value = Number(result.Steps)
|
| 563 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[0].dispatchEvent(inputEvent);
|
| 564 |
+
|
| 565 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[1].value = Number(result.Steps)
|
| 566 |
+
this.shadowRoot.querySelectorAll('#img2img_steps input')[1].dispatchEvent(inputEvent);
|
| 567 |
+
|
| 568 |
+
this.shadowRoot.querySelectorAll(`[value="${result.Sampler}"]`)[1].checked = true;
|
| 569 |
+
this.shadowRoot.querySelectorAll(`[value="${result.Sampler}"]`)[1].dispatchEvent(changeEvent)
|
| 570 |
+
|
| 571 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[0].value = Number(result.Size.split('x')[0])
|
| 572 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[0].dispatchEvent(inputEvent);
|
| 573 |
+
|
| 574 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[1].value = Number(result.Size.split('x')[0])
|
| 575 |
+
this.shadowRoot.querySelectorAll('#img2img_width input')[1].dispatchEvent(inputEvent);
|
| 576 |
+
|
| 577 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[0].value = Number(result.Size.split('x')[1])
|
| 578 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[0].dispatchEvent(inputEvent);
|
| 579 |
+
|
| 580 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[1].value = Number(result.Size.split('x')[1])
|
| 581 |
+
this.shadowRoot.querySelectorAll('#img2img_height input')[1].dispatchEvent(inputEvent);
|
| 582 |
+
|
| 583 |
+
this.shadowRoot.querySelector('#img2img_seed input').value = Number(result.Seed)
|
| 584 |
+
this.shadowRoot.querySelector('#img2img_seed input').dispatchEvent(inputEvent);
|
| 585 |
+
//图生图调用pnginfo的png
|
| 586 |
+
const file = new File([this.png_info_blob], 'example.png');
|
| 587 |
+
const dataTransfer = new DataTransfer();
|
| 588 |
+
dataTransfer.items.add(file);
|
| 589 |
+
const fileList = dataTransfer.files;
|
| 590 |
+
this.shadowRoot.querySelector("#img2maskimg input").files = fileList;
|
| 591 |
+
this.shadowRoot.querySelector('#img2maskimg input').dispatchEvent(changeEvent);
|
| 592 |
+
};
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
//PNGinfo事件
|
| 596 |
+
async function png_info_edit() {
|
| 597 |
+
let png_info = await delayPng_info();
|
| 598 |
+
this.result = JSON.parse(localStorage.getItem("tempPngInfo")) || {};
|
| 599 |
+
if (this.result.fillType === "txt2img") {
|
| 600 |
+
txt2ImgFormFill();
|
| 601 |
+
}
|
| 602 |
+
if (this.result.fillType === "img2img") {
|
| 603 |
+
img2ImgFormFill();
|
| 604 |
+
}
|
| 605 |
+
if (this.result.fillType === "inpaint_tab") {
|
| 606 |
+
inpaintTabFormFill();
|
| 607 |
}
|
| 608 |
|
| 609 |
+
//注册图片解析事件
|
| 610 |
+
png_info.addEventListener("change", (e) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
// 获取用户选择的文件
|
| 612 |
+
setTimeout(async () => {
|
| 613 |
+
const png_info_img = await png_info.querySelector("img");
|
| 614 |
+
imgStorage(png_info_img)
|
| 615 |
+
let png_info_blob = await convertDomImageToBlob(png_info_img);
|
| 616 |
+
this.png_info_blob = png_info_blob;
|
| 617 |
+
let res = await readNovelAITag(png_info_blob);
|
| 618 |
+
this.shadowRoot.querySelector(
|
| 619 |
+
"#tab_pnginfo > div > div > div:nth-child(2) > div:nth-child(3)"
|
| 620 |
+
).innerText = res.length ? res[0].text : "这不是一张stablediffusion图片";
|
| 621 |
+
|
| 622 |
+
//js对象形式转化
|
| 623 |
+
const result = {};
|
| 624 |
+
// const match = inputString.match(/(?<=prompt:)(.*)(?=Negative prompt:)/s)[0].trim();]
|
| 625 |
+
result.prompt = res[0].text.match(/(.*)(?=Negative prompt:)/s)[0].trim();
|
| 626 |
+
result.negativePrompt = res[0].text
|
| 627 |
+
.match(/(?<=Negative prompt:)(.*)(?=Steps:)/s)[0]
|
| 628 |
+
.trim();
|
| 629 |
+
let resArr = res[0].text
|
| 630 |
+
.split(result.negativePrompt)[1]
|
| 631 |
+
.trim()
|
| 632 |
+
.split(",");
|
| 633 |
+
resArr.forEach((e) => {
|
| 634 |
+
result[e.split(":")[0].replaceAll(" ", "")] = e.split(":")[1].trim();
|
| 635 |
+
});
|
| 636 |
+
this.result = result;
|
| 637 |
+
|
| 638 |
+
//txt2img
|
| 639 |
+
this.shadowRoot.querySelector("#txt2img_tab").onclick = () => {
|
| 640 |
+
this.result.fillType = "txt2img";
|
| 641 |
+
localStorage.setItem("tempPngInfo", JSON.stringify(this.result));
|
| 642 |
+
txt2ImgFormFill();
|
| 643 |
+
};
|
| 644 |
+
//img2img
|
| 645 |
+
this.shadowRoot.querySelector("#tab_pnginfo #img2img_tab").onclick =
|
| 646 |
+
() => {
|
| 647 |
+
this.result.fillType = "img2img";
|
| 648 |
+
localStorage.setItem("tempPngInfo", JSON.stringify(this.result));
|
| 649 |
+
img2ImgFormFill();
|
| 650 |
+
};
|
| 651 |
+
//inpaint_tab
|
| 652 |
+
this.shadowRoot.querySelector("#tab_pnginfo #inpaint_tab").onclick =
|
| 653 |
+
() => {
|
| 654 |
+
this.result.fillType = "inpaint_tab";
|
| 655 |
+
localStorage.setItem("tempPngInfo", JSON.stringify(this.result));
|
| 656 |
+
inpaintTabFormFill();
|
| 657 |
+
};
|
| 658 |
+
}, 100);
|
| 659 |
+
});
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
document.addEventListener("DOMContentLoaded", async () => {
|
| 663 |
+
//初始化图生图图片
|
| 664 |
+
if(localStorage.getItem("png_info_img"))
|
| 665 |
+
this.png_info_blob = await readStoragePng(
|
| 666 |
+
localStorage.getItem("png_info_img")
|
| 667 |
+
);
|
| 668 |
+
png_info_edit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
});
|
| 670 |
+
})()
|
|
|
|
|
|
|
|
|
|
|
|