Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Adds Storeinfo page #4

Closed
wants to merge 9 commits into from
8 changes: 4 additions & 4 deletions css/bugreport.css
Expand Up @@ -14,7 +14,7 @@ body {
}

body.light {
background-color: #fefefe;
background-color: #fefefe;
color: #0a0a0a;
}

Expand Down Expand Up @@ -113,7 +113,7 @@ body.light .help-text {
}

.button-group a {
width: 5.6rem;
width: 6.2rem;
}

.button-group .button {
Expand All @@ -129,13 +129,13 @@ body.light .help-text {
}

@media screen and (max-width: 39.9375em) {
.trello > .button {
.workboards > .button {
border-radius: 0.1875rem;
width: 49%;
}
}

.trello {
.workboards {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
Expand Down
2 changes: 2 additions & 0 deletions edit.html
Expand Up @@ -29,12 +29,14 @@
<li class="menu-text">Unofficial Bug Syntax Tool</li>
<li><a href="./"><i class="far fa-plus-square"></i></a></li>
<li class="act-pg"><a href="./edit"><i class="far fa-edit"></i></a></li>
<li><a href="./storeinfo"><i class="fas fa-info"></i></a></li>
<li><a id="switch-mobile"><i class="far fa-sun"></i></a></li>
</ul>
<ul class="menu show-for-medium">
<li class="menu-text">Unofficial Bug Syntax Tool</li>
<li><a href="./"><i class="far fa-plus-square"></i> Create</a></li>
<li class="act-pg"><a href="./edit"><i class="far fa-edit"></i> Edit</a></li>
<li><a href="./storeinfo"><i class="fas fa-info"></i> Store Info</a></li>
</ul>
</div>
<div class="top-bar-right show-for-medium">
Expand Down
44 changes: 21 additions & 23 deletions index.html
Expand Up @@ -12,15 +12,6 @@
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="icon" type="image/png" href="images/favicon-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon" href="images/apple-touch-icon-180x180.png" sizes="180x180" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-101730653-1', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
</head>
<body>
<div class="top-bar">
Expand All @@ -29,12 +20,14 @@
<li class="menu-text">Unofficial Bug Syntax Tool</li>
<li class="act-pg"><a href="./"><i class="far fa-plus-square"></i></a></li>
<li><a href="./edit"><i class="far fa-edit"></i></a></li>
<li><a href="./storeinfo"><i class="fas fa-info"></i></a></li>
<li><a id="switch-mobile"><i class="far fa-sun"></i></a></li>
</ul>
<ul class="menu show-for-medium">
<li class="menu-text">Unofficial Bug Syntax Tool</li>
<li class="act-pg"><a href="./"><i class="far fa-plus-square"></i> Create</a></li>
<li><a href="./edit"><i class="far fa-edit"></i> Edit</a></li>
<li><a href="./storeinfo"><i class="fas fa-info"></i> Store Info</a></li>
</ul>
</div>
<div class="top-bar-right show-for-medium">
Expand All @@ -48,16 +41,15 @@ <h5>Create a bug report</h5>
<div class="callout mbox">
<strong>Remember:</strong>
<ul>
<li>Check the Trello boards and/or bug report channels in case your bug has already been reported: <div class="small button-group trello">
<a class="button" target="_blank" href="https://trello.com/b/AExxR9lU/desktop-bugs"><i class="fas fa-desktop"></i> Desktop</a>
<a class="button" target="_blank" href="https://trello.com/b/Vqrkz3KO/android-beta-bugs"><i class="fab fa-android"></i> Android</a>
<a class="button" target="_blank" href="https://trello.com/b/vLPlnX60/ios-testflight-bugs"><i class="fab fa-apple"></i> iOS</a>
<a class="button" target="_blank" href="https://trello.com/b/UyU76Esh/linux-bugs"><i class="fab fa-linux"></i> Linux</a>
<a class="button" target="_blank" href="https://trello.com/b/Fb0LyRnD/store-bugs"><i class="fas fa-store-alt"></i> Store</a>
<a class="button" target="_blank" href="https://trello.com/b/k6jr4NyY/overlay-bugs"><i class="fas fa-window-restore"></i> Overlay</a>
<li>Check the Workboards and/or bug report channels in case your bug has already been reported: <div class="small button-group workboards">
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/3/"><i class="fas fa-desktop"></i> Desktop</a>
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/1/"><i class="fab fa-android"></i> Android</a>
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/2/"><i class="fab fa-apple"></i> iOS</a>
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/18/"><i class="fab fa-linux"></i> Linux</a>
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/15/"><i class="fas fa-window-restore"></i> Overlay</a>
<a class="button" target="_blank" href="https://bugs.discord.com/project/view/14/"><i class="far fa-window-maximize"></i> Marketing</a>
</div></li>
<li>Screenshots/video may help explain your report and are required for visual bugs. You can post links to these in a client chat channel and ask for a <strong class="bh">Bug Hunter</strong> to attach them for you</li>
<li>Bananas are an excellent source of potassium</li>
</ul>
</div>
<label for="desc-field">Short Description</label>
Expand Down Expand Up @@ -85,7 +77,7 @@ <h5>Create a bug report</h5>
<p class="help-text" id="client-help">The version/build of Discord you're using, e.g. TestFlight 1.9.2 <a data-open="client-ver-modal">(help)</a></p>
<input type="text" id="client-field" aria-describedby="client-help" required>
<label for="sys-field">System Settings</label>
<p class="help-text" id="sys-help">Your system settings including device model (if on mobile), OS, and version, e.g. iPhone 8, iOS 11.0.3</p>
<p class="help-text" id="sys-help">Your system settings including device model (if on mobile), OS, and version, e.g. iPhone 8, iOS 11.0.3<br><i>Use site's stored info here, in the same way as it's done on the bot with a -w for Windows</i></p>
<input type="text" id="sys-field" aria-describedby="sys-help" required>
<div class="callout warn hidden" id="lrg-rep">
<p>Your report is quite large. Consider shortening it to ensure that it can be accepted by Bug Bot and Bug Hunters are able to approve/deny</p>
Expand All @@ -104,16 +96,15 @@ <h4>Finding your Discord client version</h4>
<dd>
<ul>
<li>Open the Settings menu and scroll down</li>
<li>The version number should be listed at the bottom or next to the 'Change Log' entry</li>
<li>Also include if you're using a Testflight (inc. build number) or Alpha/Beta build</li>
<li>The <b>version number</b> should be listed at the bottom or next to the 'Change Log' entry</li>
<li>If you're on the TestFlight version of Discord, the <b>build number</b> is viewable in the TestFlight application</li>
</ul>
</dd>
<dt>Desktop</dt>
<dd>
<ul>
<li>Open Dev Tools using <kbd>Ctrl+Shift+I</kbd> (Windows/Linux) or <kbd>Cmd+Opt+I</kbd> (macOS)</li>
<li>Click the Console tab</li>
<li>Scroll up and find the entry beginning '[BUILD INFO]'</li>
<li>Open Settings</li>
<li>The <b>version channel and number</b> are located at the bottom of the Left menu, below the 'Change Log' and Social Media icons.</li>
</ul>
</dd>
</dl>
Expand All @@ -129,5 +120,12 @@ <h4>Finding your Discord client version</h4>
$(document).foundation();
$(document).ready(pageLoad('create'));
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-145328931-1"></script>
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}

gtag('js', new Date());
gtag('config', 'UA-145328931-1');
</script>
</body>
</html>
111 changes: 85 additions & 26 deletions js/bugreport.js
Expand Up @@ -2,29 +2,45 @@ var field_data = {
desc: {
fn: "Short Description",
ht: "Describe your bug in a single sentence",
al: "title"
al: "-t"
},
exp: {
fn: "Expected Result",
ht: "What *should* happen when following the steps? (i.e. if the bug didn't occur)",
al: "expected"
al: "-e"
},
act: {
fn: "Actual Result",
ht: "What *actually* happens when following the steps?",
al: "actual"
al: "-a"
},
client: {
fn: "Client Version",
ht: "The version/build of Discord you're using, e.g. TestFlight 1.9.2",
al: "cs"
al: "-c"
},
sys: {
fn: "System Settings",
ht: "Your system settings including device model (if on mobile), OS, and version, e.g. iPhone 8, iOS 11.0.3",
al: "ss"
al: "-s"
}
};
var info = false;
if (typeof(Storage) !== 'undefined') {
info = localStorage.getItem('storeinfo');
try { info = JSON.parse(info); }
catch (e) { }
}

if (!info) {
info = {
'w': '',
'i': '',
'a': '',
'm': '',
'l': ''
};
}

var mm = {
dark: {
Expand All @@ -37,22 +53,42 @@ var mm = {
}
};

function infoload() {
$('input[id*="-info"]').each(function(i, item) {
var device = item.id.substring(0,1);
item.value = info[device];
});
if (typeof(Storage) === 'undefined') {
alert('This web browser does not support localStorage. Store info will not function!');
}
}

function updateSyntax() {
var desc = $('#desc-field').val();
var expected = $('#exp-field').val();
var actual = $('#act-field').val();
var client = $('#client-field').val();
var system = $('#sys-field').val();
var storeinfo = system.match(/(?:\B)-(w|m|l|a|i)(?:\b)/i);
if (storeinfo && storeinfo[1]) {
system = system.replace('-' + storeinfo[1], info[storeinfo[1]]);
}

var steps = '';
var bugtext = '';
for (var i = 1; i <= window.sct; i++) {
var step = $('#s' + i + '-field').val();
if (step) {
steps = steps + ' - ' + step;
if (steps == "") {
steps = step;
} else {
steps = steps + ' ~ ' + step;
}
}

}
if (desc && expected && actual && client && system && steps) {
bugtext = '!submit ' + desc + ' | Steps to Reproduce:' + steps + ' Expected Result: ' + expected + ' Actual Result: ' + actual + ' Client Settings: ' + client + ' System Settings: ' + system;
bugtext = '!submit -t ' + desc + ' -r ' + steps + ' -e ' + expected + ' -a ' + actual + ' -c ' + client + ' -s ' + system;
}
$('#syntax').text(bugtext);
$('#lrg-rep').toggleClass('hidden', bugtext.length < 1400);
Expand Down Expand Up @@ -82,23 +118,30 @@ function updateEditSyntax() {
var edit_val = '';
var alias = '';
if (edit_type == 'steps') {
alias = 'str';
alias = '-r';
for (var i = 1; i <= window.sct; i++) {
var step = $('#s' + i + '-field').val();
if (step) {
edit_val = edit_val + ' - ' + step;
if (edit_val == "") { // Fixes issue with first step not using a ~
edit_val = step;
} else {
edit_val = edit_val + ' ~ ' + step;
}
}
}
if (edit_val) {
edit_val = edit_val.substr(1);
}
} else {
edit_val = $('#' + edit_type + '-field').val();
if (edit_type == 'sys') {
var storeinfo = edit_val.match(/(?:\B)-(w|m|l|a|i)(?:\b)/i);
if (storeinfo && storeinfo[1]) {
edit_val = edit_val.replace('-' + storeinfo[1], info[storeinfo[1]]);
}
}
alias = field_data[edit_type].al;
}
var edit_txt = '';
if (edit_id && edit_val) {
edit_txt = '!edit ' + edit_id + ' | ' + alias + ' | ' + edit_val;
edit_txt = '!edit ' + edit_id + ' ' + alias + ' ' + edit_val;
}
$('#edit-syntax').text(edit_txt);
}
Expand All @@ -109,7 +152,7 @@ function updateField(event) {
$('#add-btn').off('click');
$('#del-btn').off('click');
switch(event.target.value) {
case "steps":
case "steps":
var steps_html = '<label>Steps to Reproduce</label><p class="help-text" id="steps-help">Write each step others would have to follow to reproduce the bug. Note: Dashes will be added automatically for each step. To add/remove fields, you can use the buttons below</p><div class="callout mbox" id="steps-fs"><div class="button-group small"><button type="button" class="button" id="add-btn"><i class="fas fa-plus"></i> Add</button><button type="button" class="button" id="del-btn"><i class="fas fa-minus"></i> Remove</button></div><div class="input-group" id="s1-grp"><span class="input-group-label">Step 1</span><input type="text" class="input-group-field" id="s1-field" required></div></div>';
$('#edit-field').html(steps_html);
$('#add-btn').on('click', addStep);
Expand All @@ -123,6 +166,16 @@ function updateField(event) {
}
}

function updateInfo() {
if (typeof(Storage) !== 'undefined') {
$('input[id*="-info"]').each(function(i, item) {
var device = item.id.substring(0,1);
info[device] = item.value;
});
localStorage.setItem('storeinfo', JSON.stringify(info));
}
}

function loadTheme() {
var light = false;
if (typeof(Storage) !== 'undefined') {
Expand Down Expand Up @@ -171,19 +224,25 @@ function pageLoad(page) {
cb_btn = '#edit-copy-btn';
st = '#edit-syntax';
break;
case "storeinfo":
infoload();
$('div#content').on('blur', 'input[id*="-info"]', updateInfo);
break;
}
if (cb_btn !== '' && st !== '') {
var cb = new ClipboardJS(cb_btn, {
text: function(trigger) {
return $(st).text();
}
});
cb.on('success', function(e) {
$(e.trigger).html('Copied');
ga('send', 'event', 'syntax', 'copy');
setTimeout(function() {
$(e.trigger).html('Copy');
}, 2000);
});
}
var cb = new ClipboardJS(cb_btn, {
text: function(trigger) {
return $(st).text();
}
});
cb.on('success', function(e) {
$(e.trigger).html('Copied');
ga('send', 'event', 'syntax', 'copy');
setTimeout(function() {
$(e.trigger).html('Copy');
}, 2000);
});
$('body').on('click', 'a[id*="switch-"]', switchMode);
if (loadTheme()) {
switchMode();
Expand Down