mirror of
https://github.com/donlon/cloudflare-error-page.git
synced 2025-12-19 14:59:28 +00:00
editor/ui: misc fixes
This commit is contained in:
@@ -136,6 +136,9 @@
|
|||||||
"what_can_i_do": "Visit the site before it crashes someday."
|
"what_can_i_do": "Visit the site before it crashes someday."
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if (window.location.search == '') {
|
||||||
|
window.history.pushState('sss', '', '?s');
|
||||||
|
}
|
||||||
|
|
||||||
function extractUrlParam(str, key) {
|
function extractUrlParam(str, key) {
|
||||||
const urlParams = new URLSearchParams(str)
|
const urlParams = new URLSearchParams(str)
|
||||||
@@ -155,20 +158,19 @@
|
|||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
},
|
},
|
||||||
})
|
}).then(response => {
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('failed to get preset');
|
throw new Error('failed to get preset');
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
}).then(result => {
|
||||||
.then(result => {
|
|
||||||
if (result.status != 'ok') {
|
if (result.status != 'ok') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log(result.parameters)
|
console.log(result.parameters)
|
||||||
initialConfig = result.parameters
|
initialConfig = result.parameters
|
||||||
loadConfig(initialConfig);
|
loadConfig(initialConfig);
|
||||||
|
render()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +216,7 @@
|
|||||||
function readConfig() {
|
function readConfig() {
|
||||||
return {
|
return {
|
||||||
title: $('title').value,
|
title: $('title').value,
|
||||||
error_code: Number($('error_code').value) || 0,
|
error_code: Number($('error_code').value) || 500,
|
||||||
more_information: {
|
more_information: {
|
||||||
hidden: !!$('more_hidden').checked,
|
hidden: !!$('more_hidden').checked,
|
||||||
text: $('more_text').value,
|
text: $('more_text').value,
|
||||||
@@ -329,7 +331,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
function exportJSON() {
|
function exportJSON() {
|
||||||
let content = JSON.stringify(lastCfg)
|
let content = JSON.stringify(lastCfg, null, 4)
|
||||||
const file = new File([content], 'cloudflare-error-page-params.json', {
|
const file = new File([content], 'cloudflare-error-page-params.json', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
})
|
})
|
||||||
@@ -417,6 +419,7 @@
|
|||||||
body {
|
body {
|
||||||
zoom: 90%;
|
zoom: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Layout: editor + preview */
|
/* Layout: editor + preview */
|
||||||
.app {
|
.app {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -734,8 +737,8 @@
|
|||||||
|
|
||||||
<label for="what_happened" class="fw-semibold">What happened?</label>
|
<label for="what_happened" class="fw-semibold">What happened?</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<textarea id="what_happened" class="form-control compact" placeholder="There is an internal server error on Cloudflare's network.
|
<textarea id="what_happened" class="form-control compact"
|
||||||
"></textarea>
|
placeholder="There is an internal server error on Cloudflare's network."></textarea>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
|
|
||||||
@@ -784,7 +787,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-2" style="font-size: 0.9em;">You can also embed the error page into your own website. See
|
<div class="mt-2" style="font-size: 0.9em;">You can also embed the error page into your own website. See
|
||||||
<a href="https://github.com/donlon/cloudflare-error-page#quickstart-for-programmers" target="_blank">Quickstart</a> in the
|
<a href="https://github.com/donlon/cloudflare-error-page#quickstart-for-programmers"
|
||||||
|
target="_blank">Quickstart</a> in the
|
||||||
homepage for steps.
|
homepage for steps.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -797,7 +801,7 @@
|
|||||||
<h6><strong>Preview</strong></h6>
|
<h6><strong>Preview</strong></h6>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<iframe id="previewFrame" class="preview-frame" sandbox="allow-same-origin allow-popups allow-forms"></iframe>
|
<iframe id="previewFrame" class="preview-frame" sandbox="allow-scripts"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user