Removed modern client export code.
This commit is contained in:
parent
331c7c49a5
commit
111057bd7b
3 changed files with 0 additions and 84 deletions
|
@ -9,7 +9,6 @@
|
|||
#include submitbox.js
|
||||
#include title.js
|
||||
#include utility.js
|
||||
#include mami/settings.js
|
||||
|
||||
var AmiChat = function(chat, title, parent) {
|
||||
var container = $e({ attrs: { id: 'chat' } });
|
||||
|
@ -76,8 +75,6 @@ var AmiChat = function(chat, title, parent) {
|
|||
if(parent !== undefined)
|
||||
pub.appendTo(parent);
|
||||
|
||||
if(MamiSettings.isSupported())
|
||||
optionIcons.create('export', 'Export modern client settings', 'export', () => MamiSettings.exportFile());
|
||||
optionIcons.create('unembed', 'Unembed any embedded media', 'unembed', function() {
|
||||
var buttons = $c('js-unembed-btn');
|
||||
while(buttons.length > 0)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include loadoverlay.js
|
||||
#include mszauth.js
|
||||
#include ts_chat.js
|
||||
#include mami/settings.js
|
||||
|
||||
(function() {
|
||||
var loading = new AmiLoadingOverlay(document.body, true);
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
#include utility.js
|
||||
|
||||
const MamiSettings = (function() {
|
||||
const isSupported = () => {
|
||||
if(navigator.userAgent.indexOf('MSIE') >= 0)
|
||||
return false;
|
||||
if(navigator.userAgent.indexOf('Trident/') >= 0)
|
||||
return false;
|
||||
|
||||
if(!('Blob' in window) || !('prototype' in window.Blob)
|
||||
|| window.Blob.prototype.constructor.name !== 'Blob')
|
||||
return false;
|
||||
|
||||
if(!('AudioContext' in window) && !('webkitAudioContext' in window))
|
||||
return false;
|
||||
|
||||
if(!('URL' in window) || !('createObjectURL' in window.URL)
|
||||
|| window.URL.prototype.constructor.name !== 'URL')
|
||||
return false;
|
||||
|
||||
if(!('localStorage' in window))
|
||||
return false;
|
||||
try {
|
||||
var testVar = 'test';
|
||||
localStorage.setItem(testVar, testVar);
|
||||
if(localStorage.getItem(testVar) !== testVar)
|
||||
throw '';
|
||||
localStorage.removeItem(testVar);
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
eval('const c = 1; let l = 2;');
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
eval('for(const i of ["a", "b"]);');
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const exportFile = () => {
|
||||
const data = { a: 'Mami Settings Export', v: 1, d: [] };
|
||||
|
||||
for(let i = 0; i < localStorage.length; ++i) {
|
||||
const key = localStorage.key(i);
|
||||
if(key.substring(0, 4) !== 'umi-')
|
||||
continue;
|
||||
|
||||
data.d.push({
|
||||
i: key.substring(4),
|
||||
v: JSON.parse(localStorage.getItem(key)),
|
||||
});
|
||||
}
|
||||
|
||||
const exp = $e('a', {
|
||||
href: URL.createObjectURL(new Blob(
|
||||
[btoa(JSON.stringify(data))],
|
||||
{ type: 'application/octet-stream' }
|
||||
)),
|
||||
download: 'settings.mami',
|
||||
target: '_blank',
|
||||
style: { display: 'none' }
|
||||
});
|
||||
document.body.appendChild(exp);
|
||||
exp.click();
|
||||
$r(exp);
|
||||
};
|
||||
|
||||
return {
|
||||
isSupported: isSupported,
|
||||
exportFile: exportFile,
|
||||
};
|
||||
})();
|
Loading…
Reference in a new issue