New Software: Difference between revisions

From Tech Tangents
Jump to navigation Jump to search
(Created page with "<html> <style> input[type=text], input[type=number], #page-create > input, select { display: block; width: 100%; } #page-create { max-width: 30em; } </style> <script> function get_media_format() { let result = ""; // Standad format checkboxes const inputs = document.querySelectorAll("#sc-Media_Format input[type='checkbox']"); inputs.forEach((input) => { if (input.checked) result += input.value + ","; }); // Custom Value for usuual form...")
 
No edit summary
Line 11: Line 11:
#page-create
#page-create
{
{
vertical-align: top;
display: inline-block;
         max-width: 30em;
         max-width: 30em;
}
#page-list-box
{
vertical-align: top;
}
}
</style>
</style>
<script>
<script>
function list_page(page_title)
{
        a = document.createElement("a");
text = document.createTextNode(page_title);
a.appendChild(text);
        a.href="https://wiki.techtangents.net/wiki/"+page_title.replace(" ", "_");
       
li = document.createElement('li');
li.appendChild(a);
document.getElementById("page-list").appendChild(li);
}
function reset_inputs()
{
// Text inputs
const inputst = document.querySelectorAll("#page-create input[type='text']");
inputst.forEach((input) => {
input.value = "";
});
// Media type default
document.getElementById("sc-Media_Type-data").value = "Software";
// Number inputs
inputs = document.querySelectorAll("#page-create input[type='number']");
inputs.forEach((input) => {
input.value = "";
});
// Year default
document.getElementById("sc-Release_Year").value = 1999;
       
        // Condition
document.getElementById("sc-Box_Condition").value = "";
        // Photo file
document.getElementById("sc-file").value = "";
// Standad format checkboxes
const inputsc = document.querySelectorAll("#page-create input[type='checkbox']");
inputsc.forEach((input) => {
input.checked = false;
});
// Re-enable reset
document.getElementById("sc-reset").checked = true;
}


function get_media_format()
function get_media_format()
Line 148: Line 202:
api.postWithToken( 'csrf', params ).done( function ( data ) {
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
console.log( data );
if (document.getElementById("sc-reset").checked)
{
list_page(get_paramter("Title"));
reset_inputs();
return;
}
// Redirect to new page after creating it
// Redirect to new page after creating it
window.location.replace("https://wiki.techtangents.net/wiki/"+get_paramter("Title").replace(" ", "_"));
window.location.replace("https://wiki.techtangents.net/wiki/"+get_paramter("Title").replace(" ", "_"));
Line 197: Line 260:
});
});
</script>
</script>


<form id="page-create">
<form id="page-create">
<fieldset id="photo-info">
<fieldset id="photo-info" style="margin-top:0px;">
<legend>Photo</legend>
<legend>Photo</legend>
<div>
<div>
Line 374: Line 436:


<input type="button" id="tt-button" value="Create Page" />
<input type="button" id="tt-button" value="Create Page" />
<div>
<input type="checkbox" id="sc-reset"
value="reset"
/>
<label for="sc-reset" alt="Clear inputs and disable redirect on submission">Continous Entry</label>
</div>
</form>
</form>


<div id="page-list-box" style="display: inline-block;">
<ul id="page-list" >
</ul>
</div>


</html>
</html>

Revision as of 13:35, 8 September 2024

Photo
Software Info
Media Format:
Platform: