{"Postimage":{"link":"^(postimg\\.cc/(gallery/)?\\w{7,8}/?$)|^(?:i\\.(postimg\\.cc/\\w{7,8})/\\S+$(?<!\\?dl=1))","url":": $[1] || $[3]","res":":\nif (!$[2]) return [ $._.match(/http[^?\"]+\\?dl=1/)[0], $._.match(/=\"imagename\">([^<]+)/)[1] ]\n\nif (!this.__bg_request) {\n this.__bg_request_data = {}\n this.__bg_request_id = 9000\n\n this.__bg_request = url => {\n this.__bg_request_id += 1\n Port.send({\n cmd: 'resolve',\n id: this.__bg_request_id,\n params: { rule: { id: $.rule.id } },\n url: url\n })\n return new Promise(resolve => {\n const loop = (data, id) => data[id] ? (resolve(data[id].params._), delete data[id]) : setTimeout(loop, 100, data, id)\n loop(this.__bg_request_data, this.__bg_request_id)\n })\n }\n\n Port.listen(d => d ? d.cmd === 'resolved' && d.id > 9000 ? (this.__bg_request_data[d.id] = d, undefined) : this.onMessage(d) : undefined)\n}\n\nif (!this.__postimg) {\n const P = this.__postimg = { index: 0 }\n\n P.get = async (url, spinner) => {\n if (/i\\.postimg\\.cc/.test(url)) return url\n if (spinner) this.show('load')\n const response = await this.__bg_request(url)\n const full_img_url = response.match(/http[^?\"]+\\?dl=1/)[0]\n this.stack[this.TRG.IMGS_album].every((e, i, a) => e[0] === url ? (a[i][0] = full_img_url, false) : true)\n return full_img_url\n }\n\n P.orig_set = this.set\n this.set = async s => {\n if (!/postimg\\.cc/.test(s)) return P.orig_set(s)\n P.index += 1\n const index = P.index\n const full_img_url = await P.get(s, true)\n if (index === P.index) P.orig_set(full_img_url)\n }\n\n P.orig__preload = this._preload\n this._preload = async s => !/postimg\\.cc/.test(s) ? P.orig__preload(s) : P.orig__preload(await P.get(s))\n}\n\nreturn Object.entries(JSON.parse($._.match(/embed_value=([^}]+})/)[1])).map(e => [ 'https://postimg.cc/' + e[0], e[1][0] ])"}} |