Temp fix by Murmurs
This commit is contained in:
parent
f57f1b05d5
commit
e987d62fd9
|
@ -37,7 +37,7 @@ var BetterImageViewer = (() => {
|
||||||
twitter_username: ''
|
twitter_username: ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
version: '1.3.5',
|
version: '1.3.6',
|
||||||
description: 'Move between images in the entire channel with arrow keys, image zoom enabled by clicking and holding, scroll wheel to zoom in and out, hold shift to change lens size. Image previews will look sharper no matter what scaling you have, and will take up as much space as possible.',
|
description: 'Move between images in the entire channel with arrow keys, image zoom enabled by clicking and holding, scroll wheel to zoom in and out, hold shift to change lens size. Image previews will look sharper no matter what scaling you have, and will take up as much space as possible.',
|
||||||
github: 'https://github.com/1Lighty',
|
github: 'https://github.com/1Lighty',
|
||||||
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/BetterImageViewer/BetterImageViewer.plugin.js'
|
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/BetterImageViewer/BetterImageViewer.plugin.js'
|
||||||
|
@ -46,7 +46,7 @@ var BetterImageViewer = (() => {
|
||||||
{
|
{
|
||||||
title: 'fixed',
|
title: 'fixed',
|
||||||
type: 'fixed',
|
type: 'fixed',
|
||||||
items: ['Terminate plugin until fix is found.']
|
items: ['Fixed image zoom.']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
defaultConfig: [
|
defaultConfig: [
|
||||||
|
@ -1314,11 +1314,10 @@ var BetterImageViewer = (() => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
WebpackModules.getByProps('openModal', 'hasModalOpen').closeModal(`${this.name}_DEP_MODAL`);
|
ModalStack.popWithKey(`${this.name}_DEP_MODAL`);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
onStart() {
|
onStart() {
|
||||||
return;
|
|
||||||
if (!overlayDOMNode) {
|
if (!overlayDOMNode) {
|
||||||
overlayDOMNode = document.createElement('div');
|
overlayDOMNode = document.createElement('div');
|
||||||
overlayDOMNode.className = 'biv-overlay';
|
overlayDOMNode.className = 'biv-overlay';
|
||||||
|
@ -1472,7 +1471,6 @@ var BetterImageViewer = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStop() {
|
onStop() {
|
||||||
return;
|
|
||||||
this.promises.state.cancelled = true;
|
this.promises.state.cancelled = true;
|
||||||
Patcher.unpatchAll();
|
Patcher.unpatchAll();
|
||||||
Dispatcher.unsubscribe('MESSAGE_DELETE', this.handleMessageDelete);
|
Dispatcher.unsubscribe('MESSAGE_DELETE', this.handleMessageDelete);
|
||||||
|
@ -1569,7 +1567,8 @@ var BetterImageViewer = (() => {
|
||||||
__BIV_data: _this.props.__BIV_data,
|
__BIV_data: _this.props.__BIV_data,
|
||||||
__BIV_index: _this.props.__BIV_data ? _this.props.__BIV_data.images.findIndex(m => m.src === _this.props.src) : -1,
|
__BIV_index: _this.props.__BIV_data ? _this.props.__BIV_data.images.findIndex(m => m.src === _this.props.src) : -1,
|
||||||
__BIV_isSearch: isSearch,
|
__BIV_isSearch: isSearch,
|
||||||
__BIV_settings: this.settings
|
__BIV_settings: this.settings,
|
||||||
|
renderLinkComponent: (e) => React.createElement(BdApi.findModuleByDisplayName('MaskedLink'), e)
|
||||||
},
|
},
|
||||||
e
|
e
|
||||||
)
|
)
|
||||||
|
@ -1954,8 +1953,8 @@ var BetterImageViewer = (() => {
|
||||||
}
|
}
|
||||||
stop() {}
|
stop() {}
|
||||||
handleMissingLib() {
|
handleMissingLib() {
|
||||||
const a = BdApi.findModuleByProps('openModal', 'hasModalOpen');
|
const a = BdApi.findModuleByProps('isModalOpenWithKey');
|
||||||
if (a && a.hasModalOpen(`${this.name}_DEP_MODAL`)) return;
|
if (a && a.isModalOpenWithKey(`${this.name}_DEP_MODAL`)) return;
|
||||||
const b = !global.XenoLib,
|
const b = !global.XenoLib,
|
||||||
c = !global.ZeresPluginLibrary,
|
c = !global.ZeresPluginLibrary,
|
||||||
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
|
d = (b && c) || ((b || c) && (XenoLibOutdated || ZeresPluginLibraryOutdated)),
|
||||||
|
@ -1967,74 +1966,65 @@ var BetterImageViewer = (() => {
|
||||||
let a = `The ${d ? 'libraries' : 'library'} `;
|
let a = `The ${d ? 'libraries' : 'library'} `;
|
||||||
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
|
return b || XenoLibOutdated ? ((a += 'XenoLib '), (c || ZeresPluginLibraryOutdated) && (a += 'and ZeresPluginLibrary ')) : (c || ZeresPluginLibraryOutdated) && (a += 'ZeresPluginLibrary '), (a += `required for ${this.name} ${d ? 'are' : 'is'} ${b || c ? 'missing' : ''}${XenoLibOutdated || ZeresPluginLibraryOutdated ? (b || c ? ' and/or outdated' : 'outdated') : ''}.`), a;
|
||||||
})(),
|
})(),
|
||||||
g = BdApi.findModuleByDisplayName('Text'),
|
g = BdApi.findModuleByProps('push', 'update', 'pop', 'popWithKey'),
|
||||||
h = BdApi.findModuleByDisplayName('ConfirmModal'),
|
h = BdApi.findModuleByDisplayName('Text'),
|
||||||
i = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself. This is not intentional, something went wrong, errors are in console.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
|
i = BdApi.findModule(a => a.defaultProps && a.key && 'confirm-modal' === a.key()),
|
||||||
if (!a || !h || !g) return console.error(`Missing components:${(a ? '' : ' ModalStack') + (h ? '' : ' ConfirmationModalComponent') + (g ? '' : 'TextElement')}`), i();
|
j = () => BdApi.alert(e, BdApi.React.createElement('span', {}, BdApi.React.createElement('div', {}, f), `Due to a slight mishap however, you'll have to download the libraries yourself.`, c || ZeresPluginLibraryOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=2252', target: '_blank' }, 'Click here to download ZeresPluginLibrary')) : null, b || XenoLibOutdated ? BdApi.React.createElement('div', {}, BdApi.React.createElement('a', { href: 'https://betterdiscord.net/ghdl?id=3169', target: '_blank' }, 'Click here to download XenoLib')) : null));
|
||||||
class j extends BdApi.React.PureComponent {
|
if (!g || !i || !h) return j();
|
||||||
|
class k extends BdApi.React.PureComponent {
|
||||||
constructor(a) {
|
constructor(a) {
|
||||||
super(a), (this.state = { hasError: !1 }), (this.componentDidCatch = a => (console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a))), (this.render = () => (this.state.hasError ? null : this.props.children));
|
super(a), (this.state = { hasError: !1 });
|
||||||
|
}
|
||||||
|
componentDidCatch(a) {
|
||||||
|
console.error(`Error in ${this.props.label}, screenshot or copy paste the error above to Lighty for help.`), this.setState({ hasError: !0 }), 'function' == typeof this.props.onError && this.props.onError(a);
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
return this.state.hasError ? null : this.props.children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let k = !1,
|
class l extends i {
|
||||||
l = !1;
|
submitModal() {
|
||||||
const m = a.openModal(
|
this.props.onConfirm();
|
||||||
b => {
|
}
|
||||||
if (l) return null;
|
}
|
||||||
try {
|
let m = !1;
|
||||||
return BdApi.React.createElement(
|
const n = g.push(
|
||||||
j,
|
a =>
|
||||||
{ label: 'missing dependency modal', onError: () => (a.closeModal(m), i()) },
|
BdApi.React.createElement(
|
||||||
BdApi.React.createElement(
|
k,
|
||||||
h,
|
{
|
||||||
Object.assign(
|
label: 'missing dependency modal',
|
||||||
{
|
onError: () => {
|
||||||
header: e,
|
g.popWithKey(n), j();
|
||||||
children: BdApi.React.createElement(g, { size: g.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] }),
|
}
|
||||||
red: !1,
|
},
|
||||||
confirmText: 'Download Now',
|
BdApi.React.createElement(
|
||||||
cancelText: 'Cancel',
|
l,
|
||||||
onCancel: b.onClose,
|
Object.assign(
|
||||||
onConfirm: () => {
|
{
|
||||||
if (k) return;
|
header: e,
|
||||||
k = !0;
|
children: [BdApi.React.createElement(h, { size: h.Sizes.SIZE_16, children: [`${f} Please click Download Now to download ${d ? 'them' : 'it'}.`] })],
|
||||||
const b = require('request'),
|
red: !1,
|
||||||
c = require('fs'),
|
confirmText: 'Download Now',
|
||||||
d = require('path'),
|
cancelText: 'Cancel',
|
||||||
e = BdApi.Plugins && BdApi.Plugins.folder ? BdApi.Plugins.folder : window.ContentManager.pluginsFolder,
|
onConfirm: () => {
|
||||||
f = () => {
|
if (m) return;
|
||||||
(global.XenoLib && !XenoLibOutdated) ||
|
m = !0;
|
||||||
b('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (b, f, g) => {
|
const a = require('request'),
|
||||||
try {
|
b = require('fs'),
|
||||||
if (b || 200 !== f.statusCode) return a.closeModal(m), i();
|
c = require('path'),
|
||||||
c.writeFile(d.join(e, '1XenoLib.plugin.js'), g, () => {});
|
d = () => {
|
||||||
} catch (b) {
|
(global.XenoLib && !XenoLibOutdated) || a('https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js', (a, d, e) => (a || 200 !== d.statusCode ? (g.popWithKey(n), j()) : void b.writeFile(c.join(BdApi.Plugins.folder, '1XenoLib.plugin.js'), e, () => {})));
|
||||||
console.error('Fatal error downloading XenoLib', b), a.closeModal(m), i();
|
};
|
||||||
}
|
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated ? a('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (a, e, f) => (a || 200 !== e.statusCode ? (g.popWithKey(n), j()) : void (b.writeFile(c.join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), f, () => {}), d()))) : d();
|
||||||
});
|
}
|
||||||
};
|
},
|
||||||
!global.ZeresPluginLibrary || ZeresPluginLibraryOutdated
|
a
|
||||||
? b('https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js', (b, g, h) => {
|
|
||||||
try {
|
|
||||||
if (b || 200 !== g.statusCode) return a.closeModal(m), i();
|
|
||||||
c.writeFile(d.join(e, '0PluginLibrary.plugin.js'), h, () => {}), f();
|
|
||||||
} catch (b) {
|
|
||||||
console.error('Fatal error downloading ZeresPluginLibrary', b), a.closeModal(m), i();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
: f();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
b,
|
|
||||||
{ onClose: () => {} }
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} catch (b) {
|
),
|
||||||
return console.error('There has been an error constructing the modal', b), (l = !0), a.closeModal(m), i(), null;
|
void 0,
|
||||||
}
|
`${this.name}_DEP_MODAL`
|
||||||
},
|
|
||||||
{ modalKey: `${this.name}_DEP_MODAL` }
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
get [Symbol.toStringTag]() {
|
get [Symbol.toStringTag]() {
|
||||||
|
|
Loading…
Reference in New Issue