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
 
(5 intermediate revisions by the same user not shown)
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").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 = "";
document.getElementById("sc-Box_Type").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 114: Line 169:
"Location",
"Location",
"Box Condition",
"Box Condition",
"Box Type",
"Media Format",
"Media Format",
"Platform",
"Platform",
Line 122: Line 178:
parameters.forEach(parameter => {
parameters.forEach(parameter => {
value = get_paramter(parameter)
value = get_paramter(parameter)
if (parameter == "Photo")
{
value = value.replace(":", "-")
}
if (value)
if (value)
{
{
Line 148: Line 208:
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 186: Line 255:
.done(make_page) // Make page after upload finished
.done(make_page) // Make page after upload finished
.fail(function (data) {
.fail(function (data) {
console.log(data);
if ( data = "fileexists-no-change" )
{
make_page();
}
console.log(data);
});
});
}
}
Line 197: Line 270:
});
});
</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 254: Line 326:
<option value="2 - Corner tears, bad crushing, bad fading">2 - Corner tears, bad crushing, bad fading</option>
<option value="2 - Corner tears, bad crushing, bad fading">2 - Corner tears, bad crushing, bad fading</option>
<option value="1 - Water damage, missing parts, bleached">1 - Water damage, missing parts, bleached</option>
<option value="1 - Water damage, missing parts, bleached">1 - Water damage, missing parts, bleached</option>
</select>
</div>
<div>
<label for="sc-Box_Type">Box Type:</label>
<select id="sc-Box_Type">
<option value="">Select Package Type...</option>
<option value="Big Box">Big Box</option>
<option value="Small Box">Small Box</option>
<option value="DVD Case">DVD Case</option>
<option value="Jewel Case">Jewel Case</option>
<option value="Collector's Edition">Collector's Edition</option>
<option value="Binder">Binder</option>
<option value="Clamshell">Clamshell</option>
</select>
</select>


Line 374: Line 461:


<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>

Latest revision as of 17:44, 8 September 2024

Photo
Software Info
Media Format:
Platform: