DiscordPreview

This commit is contained in:
Mirco Wittrien 2019-01-14 20:12:36 +01:00
parent 6678bc0caf
commit 8f2182fc27
3 changed files with 19 additions and 22 deletions

View File

@ -445,6 +445,7 @@ class ThemeRepo {
};
var messageReceived = e => {
console.log(e);
if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
switch (e.data.reason) {
case "OnLoad":
@ -460,7 +461,7 @@ class ThemeRepo {
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"DarkLight",checked:lightTheme},"*");
break;
case "KeyUp":
keyPressed(e.data.key);
keyPressed(e.data);
break;
}
}
@ -835,12 +836,8 @@ class ThemeRepo {
filename = filename[filename.length - 1];
var file = path.join(BDFDB.getThemesFolder(), filename);
fileSystem.unlink(file, (error) => {
if (error) {
BDFDB.showToast(`Unable to delete Theme "${filename}".`, {type:"danger"});
}
else {
BDFDB.showToast(`Successfully deleted Theme "${filename}".`, {type:"success"});
}
if (error) BDFDB.showToast(`Unable to delete Theme "${filename}".`, {type:"danger"});
else BDFDB.showToast(`Successfully deleted Theme "${filename}".`, {type:"success"});
});
}

View File

@ -690,20 +690,20 @@
</g>
</svg>
</span>
<div class="search-l1Wz-Q theme-light">
<div class="search">
<div class="search-bar">
<div class="search-l1Wz-Q theme-dark">
<div tabindex="0" class="search-2oPWTC" role="button">
<div class="searchBar-3dMhjb searchBar-2_Yu-C">
<div class="DraftEditor-root">
<div class="public-DraftEditorPlaceholder-root">
<div class="public-DraftEditorPlaceholder-inner" id="placeholder-c147v">Search</div>
<div class="public-DraftEditorPlaceholder-inner" id="placeholder-dgtpk" style="white-space: pre-wrap;">Search</div>
</div>
<div class="DraftEditor-editorContainer">
<div aria-describedby="placeholder-c147v" class="public-DraftEditor-content" contenteditable="true" role="textbox" spellcheck="false" style="outline: none; white-space: pre-wrap; word-wrap: break-word;">
<div aria-describedby="placeholder-dgtpk" class="notranslate public-DraftEditor-content" contenteditable="true" role="textbox" spellcheck="false" style="outline: none; user-select: text; white-space: pre-wrap; overflow-wrap: break-word;">
<div data-contents="true">
<div class="" data-block="true" data-editor="c147v" data-offset-key="99l96-0-0">
<div data-offset-key="99l96-0-0" class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr">
<span data-offset-key="99l96-0-0">
<br data-text="true">
<div class="" data-block="true" data-editor="dgtpk" data-offset-key="1d9ir-0-0">
<div data-offset-key="1d9ir-0-0" class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr">
<span data-offset-key="1d9ir-0-0">
<br data-text="true"></br>
</span>
</div>
</div>
@ -711,9 +711,9 @@
</div>
</div>
</div>
<div class="search-bar-icon">
<i class="icon icon-search-bar-eye-glass visible"></i>
<i class="icon icon-search-bar-clear"></i>
<div tabindex="0" class="searchBarIcon-1J6sKG icon-38sknP" role="button">
<i class="icon-3cZ1F_ iconSearchBarEyeGlass-2n38zb visible-3V0mGj"></i>
<i class="icon-3cZ1F_ iconSearchBarClear-2DW-Kr"></i>
</div>
</div>
</div>
@ -741,8 +741,8 @@
<button type="button">10 new messages since Forever</button>
<button type="button">Mark As Read</button>
</div>
<div class="scroller-wrap scrollerWrap-2su1QI">
<div class="messages-3amgkR scroller">
<div class="scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix scrollerWrap-2su1QI scrollerThemed-2oenus themedWithTrack-q8E3vB">
<div class="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix systemPad-3UxEGl messages-3amgkR">
<div class="default-1VPH9n base-34jWEe">
<h1 class="old-h1">Welcome to the beginning of the <strong>#adsdas</strong> channel.</h1>
</div>

View File

@ -2,7 +2,7 @@ window.onload = function () {
window.parent.postMessage({origin:"DiscordPreview",reason:"OnLoad"},"*");
};
window.onkeyup = function (e) {
window.parent.postMessage({origin:"DiscordPreview",reason:"KeyUp",key:e.which},"*");
window.parent.postMessage({origin:"DiscordPreview",reason:"KeyUp",which:e.which,key:e},"*");
};
window.onmessage = function (e) {
if (typeof e.data === "object" && e.data.origin == "ThemeRepo") {