edit location field + saving location field

This commit is contained in:
Iam Naughton Phier 2014-08-06 14:19:30 +03:00
parent 4224cc3066
commit d1e2b9d1bf
4 changed files with 33 additions and 18 deletions

View file

@ -62,6 +62,7 @@
"file": "", "file": "",
"name": "", "name": "",
"amiga": true, "amiga": true,
"filetype": 'plain',
"width": "", "width": "",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
@ -77,6 +78,7 @@
"css": "" "css": ""
}; };
this.empty = { this.empty = {
"location": "",
"slides": this.emptyslidesdef, "slides": this.emptyslidesdef,
"filedata": [] "filedata": []
}; };
@ -97,6 +99,11 @@
Sahli.prototype.edit = function() { Sahli.prototype.edit = function() {
$('#buttonbox').hide(); $('#buttonbox').hide();
$('#dirlocation').change((function(_this) {
return function(event) {
return _this.data.location = event.target.value;
};
})(this));
$('#listsave').button({ $('#listsave').button({
icons: { icons: {
primary: "ui-icon-disk" primary: "ui-icon-disk"

View file

@ -87,6 +87,7 @@ a html template, and a css file.
"file": "", "file": "",
"name": "", "name": "",
"amiga": true, "amiga": true,
"filetype": 'plain',
"width": "", "width": "",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
@ -102,6 +103,7 @@ a html template, and a css file.
"css": "" "css": ""
} }
@empty = { @empty = {
"location": "",
"slides": @emptyslidesdef, "slides": @emptyslidesdef,
"filedata": [ ] "filedata": [ ]
} }
@ -122,6 +124,8 @@ edit button.
edit: -> edit: ->
$('#buttonbox').hide() $('#buttonbox').hide()
$('#dirlocation').change (event) =>
@.data.location = event.target.value
$('#listsave').button {icons: {primary:"ui-icon-disk"}} $('#listsave').button {icons: {primary:"ui-icon-disk"}}
.click => .click =>
console.log dumpjson @.data console.log dumpjson @.data

View file

@ -7,7 +7,7 @@
<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>
--> -->
<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" async defer></script>
<script src="jquery-ui.min.js" type="text/javascript" async defer></script> <script src="jquery-ui.min.js" type="text/javascript" async defer></script>
<script src="/editor/sahliedit.js" type="text/javascript" charset="utf-8" async defer></script> <script src="/editor/sahliedit.js" type="text/javascript" charset="utf-8" async defer></script>
<link rel="stylesheet" href="/editor/sahliedit.css"> <link rel="stylesheet" href="/editor/sahliedit.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/dot-luv/jquery-ui.css"> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/dot-luv/jquery-ui.css">
@ -22,6 +22,7 @@
</div> </div>
<div class='hidden' id='list'> <div class='hidden' id='list'>
<label>Location of Files:<input type="text" id='dirlocation' name="location" value=""></label>
<ol id='sortlist'> <ol id='sortlist'>
</ol> </ol>
<p id='listsave'>Save</p> <p id='listsave'>Save</p>
@ -39,11 +40,11 @@
<input id='entryfile' type="text" name="file" value="" placeholder=""> <input id='entryfile' type="text" name="file" value="" placeholder="">
<input id='entryfilepick' type="file" class='hidden' name="pickfile" value="" placeholder=""> <input id='entryfilepick' type="file" class='hidden' name="pickfile" value="" placeholder="">
</li> </li>
<li> <li>
<label for="file">Title:</label> <label for="file">Title:</label>
<input id='entryname' type="text" name="name" value="" placeholder=""> <input id='entryname' type="text" name="name" value="" placeholder="">
</li> </li>
<li> <li>
<label for="author">Author's name:</label> <label for="author">Author's name:</label>
<input id='entryauthor' type="text" name="author" value="" placeholder=""> <input id='entryauthor' type="text" name="author" value="" placeholder="">
</li> </li>
@ -52,7 +53,7 @@
<div class='groupbox' id='displaydata'> <div class='groupbox' id='displaydata'>
<p>Display:</p> <p>Display:</p>
<div class='drop' id='fl'> <div class='drop' id='fl'>
<li> <li>
<label for="file">Ascii or Ansi?</label> <label for="file">Ascii or Ansi?</label>
<button id='entryamiga' name="amiga" id='amiga' type='button' value='1'>Ascii</button> <button id='entryamiga' name="amiga" id='amiga' type='button' value='1'>Ascii</button>
</li> </li>
@ -71,11 +72,11 @@
<option value="tundra">tundra</option> <option value="tundra">tundra</option>
</select> </select>
</li> </li>
<li> <li>
<label for="width">Width of file:</label> <label for="width">Width of file:</label>
<input id='entrywidth' type="number" name="width" value="80" placeholder=""> <input id='entrywidth' type="number" name="width" value="80" placeholder="">
</li> </li>
<li> <li>
<label for="font">Font:</label> <label for="font">Font:</label>
<select id='entryfont' name="font"> <select id='entryfont' name="font">
<option value="Propaz">Propaz</option> <option value="Propaz">Propaz</option>
@ -86,7 +87,7 @@
</select> </select>
</li> </li>
<div class='45box'> <div class='45box'>
<li> <li>
<label for="color">Text Color:</label> <label for="color">Text Color:</label>
<select name="color" id='entrycolor' class='colorbox'> <select name="color" id='entrycolor' class='colorbox'>
<option value="#E0E0E0">Light Grey</option> <option value="#E0E0E0">Light Grey</option>
@ -107,7 +108,7 @@
<option value="#000000">Black</option> <option value="#000000">Black</option>
</select> </select>
</li> </li>
<li> <li>
<label for="bg">Background color:</label> <label for="bg">Background color:</label>
<select name="bg" id='entrybg' class='colorbox'> <select name="bg" id='entrybg' class='colorbox'>
<option value="#E0E0E0">Light Grey</option> <option value="#E0E0E0">Light Grey</option>
@ -142,21 +143,21 @@
<div class='groupbox' id='optionals'> <div class='groupbox' id='optionals'>
<p>Optional text:</p> <p>Optional text:</p>
<div class='drop'> <div class='drop'>
<li> <li>
<label for="line1">Optional Info line 1:</label> <label for="line1">Optional Info line 1:</label>
<input id='entryline1' type="text" name="line1" value="" placeholder=""> <input id='entryline1' type="text" name="line1" value="" placeholder="">
</li> </li>
<li> <li>
<label for="line2">Optional Info line 2:</label> <label for="line2">Optional Info line 2:</label>
<input id='entryline2' type="text" name="line2" value="" placeholder=""> <input id='entryline2' type="text" name="line2" value="" placeholder="">
</li> </li>
<li> <li>
<label for="text">Optional Text (notes, comments, etc):</label> <label for="text">Optional Text (notes, comments, etc):</label>
<textarea id='entrytext' name='text'></textarea> <textarea id='entrytext' name='text'></textarea>
</li> </li>
</div> </div>
</ul> </ul>
</form> </form>
</div> </div>
</body> </body>
</html> </html>

View file

@ -10,7 +10,7 @@
// Uses fonts by DMG, http://trueschool.se // Uses fonts by DMG, http://trueschool.se
// Uses SixteenColors textmode js library for rendering // Uses SixteenColors textmode js library for rendering
var Sahli = function() { var Sahli = function () {
this.outbox = $('div#outbox'); this.outbox = $('div#outbox');
this.dbox = $('div#drawbox'); this.dbox = $('div#drawbox');
this.image = 0; this.image = 0;
@ -33,9 +33,9 @@ var Sahli = function() {
this.currentpic = 0; this.currentpic = 0;
this.nonfsheight = document.height - 40; this.nonfsheight = document.height - 40;
this.loadpic = function(picdata, inserthere) { this.loadpic = function (picdata, inserthere) {
var jumptable = { var jumptable = {
'plain':this.loadplain(), 'plain':this.loadplain(picdata,inserthere),
'xbin':this.loadxbin(), 'xbin':this.loadxbin(),
'ice':this.loadice(), 'ice':this.loadice(),
'avatar':this.loadavatar(), 'avatar':this.loadavatar(),
@ -46,7 +46,8 @@ var Sahli = function() {
'adf':this.loadadf(), 'adf':this.loadadf(),
'tundra':this.loadtundra() 'tundra':this.loadtundra()
} }
jumptable[picdata.filetype](picdata,inserthere); console.log('here');
jumptable[picdata.filetype];
} }
this.loadplain = function(picdata, inserthere) { this.loadplain = function(picdata, inserthere) {
@ -84,6 +85,7 @@ var Sahli = function() {
}; };
req.open('GET', fname , true); req.open('GET', fname , true);
req.send(null); req.send(null);
}
this.loadansi = function(picdata,inserthere) { this.loadansi = function(picdata,inserthere) {
this.image = new ImageTextModeANSI(); this.image = new ImageTextModeANSI();
@ -99,6 +101,7 @@ var Sahli = function() {
// fix, then deal with. // fix, then deal with.
sahli.loaderror(inserthere,fname,'Not found',404); sahli.loaderror(inserthere,fname,'Not found',404);
} }
}
this.loadxbin = function(picdata,inserthere){ this.loadxbin = function(picdata,inserthere){
alert('xbin'); alert('xbin');