/script-kiddie/002_script_kiddie/script-kiddie/index.html |
@@ -1,25 +1,4 @@ |
<!DOCTYPE html> |
|
<html lang="en"> |
<head> |
<meta charset="utf-8"> |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
<meta name="description" content="Corrade Nucleon"> |
<meta name="author" content="Wizardry and Steamworks"> |
<link rel="icon" href="favicon.ico"> |
|
<title>Corrade Nucleus - LSL Scripting Environment</title> |
|
<!-- Bootstrap core CSS --> |
<link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
<!-- Corrade Nucleus Fonts --> |
<link href="/css/nucleus/fonts.css" rel="stylesheet" type="text/css"> |
<!-- Customized bootstrap style. --> |
<link href="/css/nucleus/nucleus.css" rel="stylesheet" type="text/css"> |
<!-- Manager for Windows. --> |
<link href="/css/wm/wm.css" rel="stylesheet" type="text/css"> |
<div id="script-kiddie"> |
<!-- Script Kiddie style. --> |
<link href="/script-kiddie/css/style.css" rel="stylesheet" type="text/css"> |
|
@@ -26,12 +5,8 @@ |
<!-- Bootstrap Toggle --> |
<link href="/script-kiddie/node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet" type="text/css"> |
|
</script> |
</head> |
|
<body> |
<!-- Dialog Modal --> |
<div id="avatar-select" class="modal fade bs-example-modal-lg" role="dialog"> |
<div id="script-kiddie-avatar-select" class="modal fade bs-example-modal-lg" role="dialog"> |
<div class="modal-dialog modal-lg"> |
<!-- Modal content--> |
|
@@ -39,63 +14,54 @@ |
<div class="modal-header"> |
<button type="button" class="close" data-dismiss="modal">×</button> |
|
<h1 id="title" class="modal-title">Avatar Selection</h1> |
<h1 class="modal-title">Avatar Selection</h1> |
</div> |
|
<form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
<div id="content" class="modal-body"> |
<form class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
<div class="modal-body"> |
<p>Please enter the avatar firstname and lastname to send the script to.</p> |
<div class="form-group has-feedback"> |
<label for="avatar-firstname">First Name</label> |
<input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
<label for="avatar-lastname">Last Name</label> |
<input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
<label for="script-kiddie-avatar-firstname">First Name</label> |
<input id="script-kiddie-avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
<label for="script-kiddie-avatar-lastname">Last Name</label> |
<input id="script-kiddie-avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
</div> |
</div> |
<div class="modal-footer"> |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
<button id="send-script" type="submit" class="btn btn-primary">Confirm</button> |
<button id="script-kiddie-send-script" type="submit" class="btn btn-primary">Confirm</button> |
</div> |
</form> |
</div> |
</div> |
</div> |
|
<div class="container"> |
<div class="jumbotron"> |
<h1>Corrade Script Kiddie</h1> |
<p class="lead">Script Kiddie is an LSL editor using Corrade as a backend for developing scripts.</p> |
<img src="script-kiddie/img/script-kiddie.png"></div> |
|
<!-- <div id="drag-1" class="draggable"> |
<p> You can drag one element </p> |
</div> --> |
|
<div id="editor-panel" class="panel panel-default draggable movable"> |
<div class="panel panel-default draggable movable"> |
<div class="panel-heading"> |
<form id="script-tools" data-toggle="validator" onSubmit="event.preventDefault();"> |
<button type="button" class="close" data-target="#script-kiddie" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
<form id="script-kiddie-script-tools" data-toggle="validator" onSubmit="event.preventDefault();"> |
<div class="form-group"> |
<button id="compile-script" class="btn btn-default check-image checkButton" type="button" title="Compile script.">Compile</button> |
<button id="tidy-script" class="btn btn-default" type="button" title="Tidy source-code.">Cleanup</button> |
<button id="script-kiddie-compile-script" class="btn btn-default check-image checkButton" type="button" title="Compile script.">Compile</button> |
<button id="script-kiddie-tidy-script" class="btn btn-default" type="button" title="Tidy source-code.">Cleanup</button> |
|
</div> |
<div class="form-group has-feedback"> |
<div class="input-group"> |
<span class="input-group-btn"> |
<input id="store-script" type="checkbox" data-toggle="toggle" data-on="Store" data-off="No Store" data-onstyle="success" disabled="disabled"> |
<input id="script-kiddie-store-script" type="checkbox" data-toggle="toggle" data-on="Store" data-off="No Store" data-onstyle="success" disabled="disabled"> |
</span> |
<input id="script-name" type="text" class="form-control" placeholder="Script Name" aria-describedby="basic-addon1" required> |
<input id="script-kiddie-script-name" type="text" class="form-control" placeholder="Script Name" aria-describedby="basic-addon1" required> |
<span class="input-group-addon">-</span> |
<input id="script-UUID" type="text" class="form-control" aria-describedby="basic-addon2" size="36"> |
<input id="script-kiddie-script-UUID" type="text" class="form-control" aria-describedby="basic-addon2" size="36"> |
<span class="input-group-btn"> |
<button id="give-script" class="btn btn-default" type="button" title="Give script." disabled="disabled">Give</button> |
<button id="script-kiddie-give-script" class="btn btn-default" type="button" title="Give script." disabled="disabled">Give</button> |
</span> |
</div> |
</div> |
</form> |
</div> |
<div class="panel-body" id="editorpanel"> |
<div id="editor" style="height: 500px;">default |
<div class="panel-body"> |
<div id="script-kiddie-editor" style="height: 500px;">default |
{ |
state_entry() |
{ |
@@ -108,40 +74,12 @@ |
} |
} |
</div> |
</div> |
</div> |
|
<div id="error-panel" class="panel panel-default draggable movable"> |
<div class="panel-heading"> |
<p>Compilation Errors</p> |
</div> |
<div class="panel-body" id="errorpanel"> |
<div id="errors"> |
<textarea id="message" class="form-control" rows="5" style="min-width: 100%; max-width: 100%; font-family: monospace; display: none;" readonly></textarea> |
<div> |
<textarea id="script-kiddie-message" class="form-control" rows="5" style="min-width: 100%; max-width: 100%; font-family: monospace; display: none;" readonly></textarea> |
</div> |
</div> |
</div> |
|
<!-- Nucleons --> |
<div class="panel panel-default draggable movable"> |
<div class="panel-heading"> |
<h3 class="panel-title">Nucleons</h3> |
</div> |
<div class="panel-body"> |
<div id="nucleons" class="row"></div> |
</div> |
</div> |
|
</div> <!-- /container --> |
|
<footer class="footer"> |
<p>© 2017 Wizardry and Steamworks</p> |
</footer> |
|
<!-- jQuery --> |
<script src="/node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script> |
<!-- Wizardry and Steamworks JavaScript Includes --> |
<script src="/node_modules/was/dist/was.min.js" type="text/javascript"></script> |
<!-- Bootstrap Javascript --> |
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script> |
<!-- Bootstrap Validator --> |
@@ -155,12 +93,6 @@ |
<script src="/script-kiddie/node_modules/js-beautify/js/lib/beautify.js" type="text/javascript"></script> |
<!-- Velocity --> |
<script src="/script-kiddie/node_modules/velocity-animate/velocity.min.js" type="text/javascript"></script> |
<!-- Interact JS --> |
<script src="/node_modules/interactjs/dist/interact.min.js" type="text/javascript"></script> |
<!-- Manager for Windows. --> |
<script src="/js/wm/wm.js" type="text/javascript"></script> |
<!-- Nucleons Loader --> |
<script src="/js/nucleus/load-nucleons.js" type="text/javascript"></script> |
<script> |
$(document).ready(() => { |
// Auto-complete. |
@@ -167,7 +99,7 @@ |
ace.require("ace/ext/language_tools"); |
|
// Create the editor. |
var editor = ace.edit("editor"); |
var editor = ace.edit("script-kiddie-editor"); |
editor.setTheme("ace/theme/twilight"); |
editor.getSession().setMode("ace/mode/lsl"); |
editor.setOptions({ |
@@ -186,14 +118,14 @@ |
editor.setReadOnly(true); |
|
// Set the button image. |
$('#compile-script').removeClass("check-image"); |
$('#compile-script').removeClass("checkButton"); |
$('#script-kiddie-compile-script').removeClass("check-image"); |
$('#script-kiddie-compile-script').removeClass("checkButton"); |
|
$('#compile-script').removeClass("cross-image"); |
$('#compile-script').removeClass("crossButton"); |
$('#script-kiddie-compile-script').removeClass("cross-image"); |
$('#script-kiddie-compile-script').removeClass("crossButton"); |
|
$('#compile-script').addClass("activity-image"); |
$('#compile-script').addClass("activityButton"); |
$('#script-kiddie-compile-script').addClass("activity-image"); |
$('#script-kiddie-compile-script').addClass("activityButton"); |
|
$.ajax({ |
type: 'POST', |
@@ -210,13 +142,13 @@ |
|
if(success) { |
// Set the button image. |
$('#compile-script').removeClass("activity-image"); |
$('#compile-script').removeClass("activityButton"); |
$('#script-kiddie-compile-script').removeClass("activity-image"); |
$('#script-kiddie-compile-script').removeClass("activityButton"); |
|
$('#compile-script').addClass("check-image"); |
$('#compile-script').addClass("checkButton"); |
$('#script-kiddie-compile-script').addClass("check-image"); |
$('#script-kiddie-compile-script').addClass("checkButton"); |
|
$("#message").velocity("slideUp", { |
$("#script-kiddie-message").velocity("slideUp", { |
duration: 1000 |
}); |
callback(success); |
@@ -224,21 +156,21 @@ |
} |
|
// Move panel to top. |
$('#error-panel').css('z-index', getTopWindowIndex() + 1); |
$('#error-panel').css('position', 'relative'); |
$('#script-kiddie-error-panel').css('z-index', getTopWindowIndex() + 1); |
$('#script-kiddie-error-panel').css('position', 'relative'); |
|
// Set the button image. |
$('#compile-script').removeClass("activity-image"); |
$('#compile-script').removeClass("activityButton"); |
$('#script-kiddie-compile-script').removeClass("activity-image"); |
$('#script-kiddie-compile-script').removeClass("activityButton"); |
|
$('#compile-script').addClass("cross-image"); |
$('#compile-script').addClass("crossButton"); |
$('#script-kiddie-compile-script').addClass("cross-image"); |
$('#script-kiddie-compile-script').addClass("crossButton"); |
|
$("#message").velocity("slideDown", { |
$("#script-kiddie-message").velocity("slideDown", { |
duration: 1000 |
}); |
|
$('#message').val(wasCSVToArray(response.data).join('')); |
$('#script-kiddie-message').val(wasCSVToArray(response.data).join('')); |
callback(success); |
}); |
} |
@@ -252,8 +184,8 @@ |
create: true, |
type: 'agent', |
entity: 'text', |
item: $('#script-UUID').val(), |
target: $('#script-name').val(), |
item: $('#script-kiddie-script-UUID').val(), |
target: $('#script-kiddie-script-name').val(), |
data: lsl |
}, |
dataType: 'json' |
@@ -265,7 +197,7 @@ |
var UUID = data[data.indexOf('item') + 1]; |
|
// Set the inventory UUID of the saved script. |
$('#script-UUID').val(UUID); |
$('#script-kiddie-script-UUID').val(UUID); |
|
localStorage.setItem('nucleus-script-kiddie-script-UUID', UUID); |
} |
@@ -291,7 +223,7 @@ |
return; |
|
// Storing is not enabled so return. |
if($('#store-script').prop('checked') !== true) |
if($('#script-kiddie-store-script').prop('checked') !== true) |
return; |
|
store(data, (success) => { |
@@ -305,19 +237,19 @@ |
}); |
|
// Add click listener for compile button. |
$('#compile-script').on('click', function (e) { |
if($('#compile-script').hasClass("activity-image")) |
$('#script-kiddie-compile-script').on('click', function (e) { |
if($('#script-kiddie-compile-script').hasClass("activity-image")) |
return; |
|
var data = editor.getSession().getValue(); |
compile(data, (success) => {}); |
if($('#store-script').prop('checked') === true) |
if($('#script-kiddie-store-script').prop('checked') === true) |
store(data); |
}); |
|
// Add click listener for tidy button. |
$('#tidy-script').on('click', function (e) { |
if($('#compile-script').hasClass("activity-image")) |
$('#script-kiddie-tidy-script').on('click', function (e) { |
if($('#script-kiddie-compile-script').hasClass("activity-image")) |
return; |
|
// Code cleanup parameters. |
@@ -357,7 +289,7 @@ |
data: { |
command: 'give', |
entity: 'avatar', |
item: $('#script-UUID').val(), |
item: $('#script-kiddie-script-UUID').val(), |
firstname: firstname, |
lastname: lastname, |
permissions: 'c--mvt------------c--mvtc--mvt' |
@@ -369,24 +301,24 @@ |
} |
|
// Add click listener for give button. |
$('#give-script').on('click', function (e) { |
if($('#compile-script').hasClass("activity-image")) |
$('#script-kiddie-give-script').on('click', function (e) { |
if($('#script-kiddie-compile-script').hasClass("activity-image")) |
return; |
|
// Show the popup. |
$('#avatar-select').modal('show'); |
$('#script-kiddie-avatar-select').modal('show'); |
}); |
|
// Add click listener to modal confirmation. |
$('#send-script').on('click', function(e) { |
$('#script-kiddie-send-script').on('click', function(e) { |
// Hide the popup. |
$('#avatar-select').modal('hide'); |
$('#script-kiddie-avatar-select').modal('hide'); |
|
// Disable give button. |
$('#give-script').attr('disabled', true); |
give($('#avatar-firstname').val(), $('#avatar-lastname').val(), (response) => { |
$('#script-kiddie-give-script').attr('disabled', true); |
give($('#script-kiddie-avatar-firstname').val(), $('#script-kiddie-avatar-lastname').val(), (response) => { |
// Enable give button. |
$('#give-script').attr('disabled', false); |
$('#script-kiddie-give-script').attr('disabled', false); |
}); |
}) |
|
@@ -398,16 +330,16 @@ |
// Get the item name from the storage. |
var storeScriptUUID = localStorage.getItem('nucleus-script-kiddie-script-UUID'); |
if (typeof storeScriptUUID == "string") |
$('#script-UUID').val(storeScriptUUID); |
$('#script-kiddie-script-UUID').val(storeScriptUUID); |
|
// Get the item name from the storage. |
var storeScriptName = localStorage.getItem('nucleus-script-kiddie-script-name'); |
if (typeof storeScriptName == "string") |
$('#script-name').val(storeScriptName); |
$('#script-kiddie-script-name').val(storeScriptName); |
|
// Store script name on modification. |
var scriptNameTimerID; |
$('#script-name').on('input',function(e){ |
$('#script-kiddie-script-name').on('input',function(e){ |
var value = $(this).val(); |
if($(this).data('lastval')!= value){ |
|
@@ -421,43 +353,43 @@ |
}); |
|
// Enable storing of script only if the form validates. |
$('#script-tools').on('validated.bs.validator', function (e) { |
if($('#script-tools').has('.has-error').length !== 0) { |
$('#store-script').bootstrapToggle('off'); |
$('#store-script').bootstrapToggle('disable'); |
$('#script-kiddie-script-tools').on('validated.bs.validator', function (e) { |
if($('#script-kiddie-script-tools').has('.has-error').length !== 0) { |
$('#script-kiddie-store-script').bootstrapToggle('off'); |
$('#script-kiddie-store-script').bootstrapToggle('disable'); |
return; |
} |
$('#store-script').bootstrapToggle('enable'); |
$('#script-kiddie-store-script').bootstrapToggle('enable'); |
}); |
|
$('#store-script').change(function() { |
switch($('#store-script').prop('checked')) |
$('#script-kiddie-store-script').change(function() { |
switch($('#script-kiddie-store-script').prop('checked')) |
{ |
case true: |
// Disable script name and UUID. |
$('#script-name').attr('disabled', true); |
$('#script-UUID').attr('disabled', true); |
$('#script-kiddie-script-name').attr('disabled', true); |
$('#script-kiddie-script-UUID').attr('disabled', true); |
|
var data = editor.getSession().getValue(); |
// Store locally on save. |
localStorage.setItem('nucleus-script-kiddie-script-body', data); |
|
$('#give-script').attr('disabled', true); |
$('#script-kiddie-give-script').attr('disabled', true); |
compile(data, (success) => { |
store(data, (success) => { |
// Script was stored successfully. |
// Enable the give button. |
$('#give-script').attr('disabled', false); |
$('#script-kiddie-give-script').attr('disabled', false); |
}); |
}); |
break; |
default: |
// Enable script name and UUID. |
$('#script-name').attr('disabled', false); |
$('#script-UUID').attr('disabled', false); |
$('#script-kiddie-script-name').attr('disabled', false); |
$('#script-kiddie-script-UUID').attr('disabled', false); |
|
// Disable the give button. |
$('#give-script').attr('disabled', true); |
$('#script-kiddie-give-script').attr('disabled', true); |
break; |
} |
}); |
@@ -464,5 +396,4 @@ |
|
}); |
</script> |
</body> |
</html> |
</div> |