Fix editor to work without a webserver running (dev mode)

This commit is contained in:
Iam Naughton Phier 2014-08-07 16:29:45 +03:00
parent e1c14acd3f
commit d0f5a09f45
4 changed files with 1211 additions and 16 deletions

1178
editor/jquery-ui-dot-luv.css Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.7.1 // Generated by CoffeeScript 1.7.1
(function() { (function() {
var Sahli, ansiorascii, arraytocolor, booltoint, colorindex, colortoarray, colortoname, dec2hex, dumpjson, emptyfiledef, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, sahlicolor, statustobool; var Sahli, ansiorascii, arraytocolor, booltoint, colorindex, colortoarray, colortoname, dec2hex, dumpjson, emptyfiledef, getfilelist, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, sahlicolor, statustobool;
$(function() { $(function() {
return $("h1").hide().slideDown(500); return $("h1").hide().slideDown(500);
@ -145,11 +145,9 @@
icons: { icons: {
primary: "ui-icon-folder-open" primary: "ui-icon-folder-open"
} }
}).click((function(_this) { }).click(function() {
return function() { return getfilelist();
return alert('clicked'); });
};
})(this));
$('#listappend').button({ $('#listappend').button({
icons: { icons: {
primary: "ui-icon-1-n" primary: "ui-icon-1-n"
@ -470,6 +468,14 @@
}); });
}; };
getfilelist = function() {
var location;
location = $("#dirlocation").val();
return $.get("../" + location, function(listing) {
return console.log(listing);
});
};
newsahli = function() { newsahli = function() {
var newentry, sahli; var newentry, sahli;
sahli = new Sahli; sahli = new Sahli;

View file

@ -146,15 +146,15 @@ edit button.
edit: -> edit: ->
$('#buttonbox').hide() $('#buttonbox').hide()
$('#dirlocation').change (event) => $('#dirlocation').change (event) =>
@.data.location = event.target.value @data.location = event.target.value
$('#listsave').button {icons: {primary:"ui-icon-disk"}} $('#listsave').button {icons: {primary:"ui-icon-disk"}}
.click => .click =>
$('#sahlioutput').text dumpjson @.data $('#sahlioutput').text dumpjson @data
$('#dumparea').show 100 $('#dumparea').show 100
console.log dumpjson @.data console.log dumpjson @data
$('#listlist').button {icons: {primary:"ui-icon-folder-open"}} $('#listlist').button {icons: {primary:"ui-icon-folder-open"}}
.click => .click ->
alert 'clicked' getfilelist()
$('#listappend').button {icons: {primary:"ui-icon-1-n"}} $('#listappend').button {icons: {primary:"ui-icon-1-n"}}
.click (event) => .click (event) =>
newentry = new emptyfiledef newentry = new emptyfiledef
@ -400,6 +400,16 @@ A function for changing the fore and background colors of the sahli ascii exampl
console.log 'sahlicolor',fg,bg console.log 'sahlicolor',fg,bg
$('#sahliascii').css {'color':fg,'background':bg} $('#sahliascii').css {'color':fg,'background':bg}
Function for loading the filelist from the specified directory on the server/filesystem.
getfilelist = ->
location = $("#dirlocation").val()
$.get("../#{location}", (listing) ->
console.log listing
)
When clicking 'New' we want to make a brand new Sahli, and then clear out When clicking 'New' we want to make a brand new Sahli, and then clear out
the buttons and create the editor bit as blank. the buttons and create the editor bit as blank.

View file

@ -5,12 +5,13 @@
as it can't be pulled from afar if the network is down. Use remote if you would like, just uncomment as it can't be pulled from afar if the network is down. Use remote if you would like, just uncomment
<script src="//code.jquery.com/jquery-2.1.0.min.js" type="text/javascript" charset="utf-8"></script> <script src="//code.jquery.com/jquery-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.min.js" type="text/javascript" charset="utf-8" ></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.min.js" type="text/javascript" charset="utf-8" ></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/dot-luv/jquery-ui.css">
--> -->
<script src="jquery-2.1.0.min.js" type="text/javascript" async defer></script> <script src="jquery-2.1.0.min.js" type="text/javascript"></script>
<script src="jquery-ui.min.js" type="text/javascript" async defer></script> <script src="jquery-ui.min.js" type="text/javascript"></script>
<script src="/editor/sahliedit.js" type="text/javascript" charset="utf-8" async defer></script> <script src="sahliedit.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="/editor/sahliedit.css"> <link rel="stylesheet" href="sahliedit.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/dot-luv/jquery-ui.css"> <link rel="stylesheet" href="jquery-ui-dot-luv.css">
</head> </head>
<body> <body>
<h1>Sahli Editor</h1> <h1>Sahli Editor</h1>