add new apps

This commit is contained in:
lxsang 2019-11-24 19:33:14 +00:00
parent 96e7662d6e
commit 7c2cc7dc11
21 changed files with 739 additions and 0 deletions

24
Booklet/README.md Normal file
View File

@ -0,0 +1,24 @@
# Booklet
A tool for my online document hub
## Howto
1. Open the project.apj file with AntOSDK (simply double Click on it)
2. Modify the UI in *assets/scheme.html*
3. Modify application code in *coffees/main.coffee*
4. Modify CSS style in *css/main.css*
5. Other files need to be copied: put in to assets
## Set up build target
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
In the build options dialog, add or remove files that need to be
included into the build
Click **Save**
## Build application
* To build: **Menu > Build > Build** or **ALT-C**
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
* To release: **Menu > Build > Build release** or **ALT-P**

View File

@ -0,0 +1,9 @@
<afx-app-window apptitle="Booklet" width="600" height="500" data-id="Booklet">
<afx-hbox >
<afx-tree-view data-id = "toc-ui" data-width="200"></afx-tree-view>
<afx-resizer data-width="3"></afx-resizer>
<div data-id = "mycontainer">
<textarea data-id="markarea" ></textarea>
</div>
</afx-hbox>
</afx-app-window>

View File

@ -0,0 +1,24 @@
# Booklet
A tool for my online document hub
## Howto
1. Open the project.apj file with AntOSDK (simply double Click on it)
2. Modify the UI in *assets/scheme.html*
3. Modify application code in *coffees/main.coffee*
4. Modify CSS style in *css/main.css*
5. Other files need to be copied: put in to assets
## Set up build target
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
In the build options dialog, add or remove files that need to be
included into the build
Click **Save**
## Build application
* To build: **Menu > Build > Build** or **ALT-C**
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
* To release: **Menu > Build > Build release** or **ALT-P**

324
Booklet/build/debug/main.js Normal file
View File

@ -0,0 +1,324 @@
(function() {
var Book, Booklet, BookletChapter, BookletEntry, BookletFile, BookletFolder, BookletSection;
Booklet = class Booklet extends this.OS.GUI.BaseApplication {
constructor(args) {
super("Booklet", args);
}
main() {
this.initEditor();
return this.resizeContent();
}
initEditor() {
var markarea, me;
markarea = this.find("markarea");
this.container = this.find("mycontainer");
this.previewOn = false;
this.currfile = "Untitled".asFileHandler();
this.editormux = false;
me = this;
this.editor = new SimpleMDE({
element: markarea,
autofocus: true,
tabSize: 4,
indentWithTabs: true,
toolbar: [
"bold",
"italic",
"heading",
"|",
"quote",
"code",
"unordered-list",
"ordered-list",
"|",
"link",
"image",
"table",
"horizontal-rule",
"|",
{
name: "preview",
className: "fa fa-eye no-disable",
action: function(e) {
me.previewOn = !me.previewOn;
return SimpleMDE.togglePreview(e);
}
}
]
});
//if(self.previewOn) toggle the highlight
//{
// var container = self._scheme.find(self,"Text")
// .$element.getElementsByClassName("editor-preview");
// if(container.length == 0) return;
// var codes = container[0].getElementsByTagName('pre');
// codes.forEach(function(el){
// hljs.highlightBlock(el);
// });
// //console.log(code);
//}
this.on("hboxchange", function(e) {
return me.resizeContent();
});
this.bindKey("ALT-N", function() {
return me.actionFile(`${me.name}-New`);
});
this.bindKey("ALT-O", function() {
return me.actionFile(`${me.name}-Open`);
});
return this.createBook();
}
createBook() {
var book, c1, c2, f1, f2, f3, f4, sec1, sec2, sec3;
book = new Book("home://test");
c1 = new BookletChapter(book, "Chapter one");
c2 = new BookletChapter(book, "Chapter two");
sec1 = new BookletSection(c1, "section 1 in c1");
sec2 = new BookletSection(c1, "section 2 in c1");
sec3 = new BookletSection(c2, "section 1 in c2");
f1 = new BookletFile(sec1);
f2 = new BookletFile(sec2);
f3 = new BookletFile(sec3);
f4 = new BookletFile(sec1);
return console.log(book.toc());
}
resizeContent() {
var cheight, children, statusbar, titlebar, toolbar;
children = ($(this.container)).children();
titlebar = (($(this.scheme)).find(".afx-window-top"))[0];
toolbar = children[1];
statusbar = children[4];
cheight = ($(this.scheme)).height() - ($(titlebar)).height() - ($(toolbar)).height() - ($(statusbar)).height() - 40;
return ($(children[2])).css("height", cheight + "px");
}
menu() {
var me, menu;
me = this;
menu = [
{
text: "__(File)",
child: [
{
text: "__(New booklet)",
dataid: `${this.name}-New`,
shortcut: "A-N"
},
{
text: "__(Open a booklet)",
dataid: `${this.name}-Open`,
shortcut: "A-O"
}
],
onmenuselect: function(e) {
return me.actionFile(e.item.data.dataid);
}
}
];
return menu;
}
actionFile(e) {
return console.log("Action file fired");
}
};
/*
me = @
switch e
when "#{@name}-Open"
@openDialog "FileDiaLog", ( d, f ) ->
me.open "#{d}/#{f}".asFileHandler()
, __("Open file")
when "#{@name}-New"
@currfile = "Untitled".asFileHandler()
@currfile.cache = ""
@editor.value("")
*/
Booklet.dependencies = ["mde/simplemde.min"];
this.OS.register("Booklet", Booklet);
BookletEntry = class BookletEntry {
constructor(name1) {
this.name = name1;
this.markAsDirty();
}
save() {}
remove() {}
markAsDirty() {
return this.dirty = true;
}
markAsClean() {
return this.dirty = false;
}
toc() {}
};
BookletFolder = class BookletFolder extends BookletEntry {
constructor(name) {
super(name);
}
save() {}
remove() {}
rename(newname) {}
};
Book = class Book extends BookletFolder {
constructor(path, name) {
super(name);
this.path = path;
this.chapters = [];
this.metaFile = `${this.path}/meta.json`.asFileHandler();
}
addChapter(chap) {
chap.book = this;
return this.chapters.push(chap);
}
size() {
return this.chapters.length;
}
toc() {
var v;
return {
name: this.name,
path: this.path,
meta: this.metaFile.path,
entries: (function() {
var i, len, ref, results;
ref = this.chapters;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
v = ref[i];
results.push(v.toc());
}
return results;
}).call(this)
};
}
};
BookletChapter = class BookletChapter extends BookletFolder {
constructor(book1, name) {
super(name);
this.book = book1;
this.book.addChapter(this);
this.sections = [];
this.path = `${this.book.path}/${this.book.size()}`;
this.metaFile = `${this.path}/meta.json`.asFileHandler();
this.descFile = `${this.path}/chapter.md`.asFileHandler();
}
addSection(sec) {
sec.chapter = this;
return this.sections.push(sec);
}
size() {
return this.sections.length;
}
toc() {
var v;
return {
name: this.name,
path: this.path,
meta: this.metaFile.path,
description: this.descFile.path,
entries: (function() {
var i, len, ref, results;
ref = this.sections;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
v = ref[i];
results.push(v.toc());
}
return results;
}).call(this)
};
}
};
BookletSection = class BookletSection extends BookletFolder {
constructor(chapter, name) {
super(name);
this.chapter = chapter;
this.chapter.addSection(this);
this.path = `${this.chapter.path}/${this.chapter.size()}`;
this.files = [];
this.descFile = `${this.path}/section.md`.asFileHandler();
}
addFile(file) {
file.section = this;
return this.files.push(file);
}
toc() {
var v;
return {
name: this.name,
path: this.path,
description: this.descFile.path,
entries: (function() {
var i, len, ref, results;
ref = this.files;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
v = ref[i];
results.push(v.toc());
}
return results;
}).call(this)
};
}
size() {
return this.files.length;
}
};
BookletFile = class BookletFile extends BookletEntry {
constructor(section) {
super("");
this.section = section;
this.section.addFile(this);
this.path = `${this.section.path}/${this.section.size()}.md`;
this.handle = this.path.asFileHandler();
}
getTitle() {}
toc() {
return {
name: this.name,
path: this.path
};
}
};
}).call(this);

View File

@ -0,0 +1,13 @@
{
"app":"Booklet",
"name":"Booklet",
"description":"",
"info":{
"author": "",
"email": ""
},
"version":"0.0.1-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"]
}

View File

@ -0,0 +1,9 @@
<afx-app-window apptitle="Booklet" width="600" height="500" data-id="Booklet">
<afx-hbox >
<afx-tree-view data-id = "toc-ui" data-width="200"></afx-tree-view>
<afx-resizer data-width="3"></afx-resizer>
<div data-id = "mycontainer">
<textarea data-id="markarea" ></textarea>
</div>
</afx-hbox>
</afx-app-window>

View File

@ -0,0 +1,106 @@
class BookletEntry
constructor: (@name) ->
@markAsDirty()
save: () ->
remove: () ->
markAsDirty: () -> @dirty = true
markAsClean: () -> @dirty = false
toc: () ->
class BookletFolder extends BookletEntry
constructor: (name) ->
super name
save: () ->
remove: () ->
rename: (newname) ->
class Book extends BookletFolder
constructor: (@path, name) ->
super name
@chapters = []
@metaFile = "#{@path}/meta.json".asFileHandler()
addChapter: (chap) ->
chap.book = @
@chapters.push chap
size: () ->
return @chapters.length
toc: () ->
return {
name: @name,
path: @path,
meta: @metaFile.path,
entries: v.toc() for v in @chapters
}
class BookletChapter extends BookletFolder
constructor: (@book, name) ->
super name
@book.addChapter @
@sections = []
@path = "#{@book.path}/#{@book.size()}"
@metaFile = "#{@path}/meta.json".asFileHandler()
@descFile = "#{@path}/chapter.md".asFileHandler()
addSection: (sec) ->
sec.chapter = @
@sections.push sec
size: () ->
return @sections.length
toc: () ->
return {
name: @name,
path: @path,
meta: @metaFile.path,
description: @descFile.path,
entries: v.toc() for v in @sections
}
class BookletSection extends BookletFolder
constructor: (@chapter, name) ->
super name
@chapter.addSection @
@path = "#{@chapter.path}/#{@chapter.size()}"
@files = []
@descFile = "#{@path}/section.md".asFileHandler()
addFile: (file) ->
file.section = @
@files.push file
toc: () ->
return {
name: @name,
path: @path,
description: @descFile.path,
entries: v.toc() for v in @files
}
size: () ->
return @files.length
class BookletFile extends BookletEntry
constructor: (@section) ->
super ""
@section.addFile @
@path = "#{@section.path}/#{@section.size()}.md"
@handle = @path.asFileHandler()
getTitle: () ->
toc: () ->
return {
name: @name,
path: @path
}

102
Booklet/coffees/main.coffee Normal file
View File

@ -0,0 +1,102 @@
class Booklet extends this.OS.GUI.BaseApplication
constructor: ( args ) ->
super "Booklet", args
main: () ->
@initEditor()
@resizeContent()
initEditor: ()->
markarea = @find "markarea"
@container = @find "mycontainer"
@previewOn = false
@currfile = "Untitled".asFileHandler()
@editormux = false
me = @
@editor = new SimpleMDE
element: markarea
autofocus: true
tabSize: 4
indentWithTabs: true
toolbar: [
"bold", "italic", "heading", "|", "quote", "code",
"unordered-list", "ordered-list", "|", "link",
"image", "table", "horizontal-rule", "|",
{
name: "preview",
className: "fa fa-eye no-disable",
action: (e) ->
me.previewOn = !me.previewOn
SimpleMDE.togglePreview e
#if(self.previewOn) toggle the highlight
#{
# var container = self._scheme.find(self,"Text")
# .$element.getElementsByClassName("editor-preview");
# if(container.length == 0) return;
# var codes = container[0].getElementsByTagName('pre');
# codes.forEach(function(el){
# hljs.highlightBlock(el);
# });
# //console.log(code);
#}
}
]
@on "hboxchange", (e) -> me.resizeContent()
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
@createBook()
createBook: () ->
book = new Book("home://test", "mybook", @)
c1 = new BookletChapter(book, "Chapter one")
c2 = new BookletChapter(book, "Chapter two")
sec1 = new BookletSection(c1, "section 1 in c1")
sec2 = new BookletSection(c1, "section 2 in c1")
sec3 = new BookletSection(c2, "section 1 in c2")
f1 = new BookletFile(sec1)
f2 = new BookletFile(sec2)
f3 = new BookletFile(sec3)
f4 = new BookletFile(sec1)
console.log(book.toc())
resizeContent: () ->
children = ($ @container).children()
titlebar = (($ @scheme).find ".afx-window-top")[0]
toolbar = children[1]
statusbar = children[4]
cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 40
($ children[2]).css("height", cheight + "px")
menu: () ->
me = @
menu = [{
text: "__(File)",
child: [
{ text: "__(New booklet)", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: "__(Open a booklet)", dataid: "#{@name}-Open", shortcut: "A-O" }
],
onmenuselect: (e) -> me.actionFile e.item.data.dataid
}]
menu
actionFile: (e) ->
console.log "Action file fired"
###
me = @
switch e
when "#{@name}-Open"
@openDialog "FileDiaLog", ( d, f ) ->
me.open "#{d}/#{f}".asFileHandler()
, __("Open file")
when "#{@name}-New"
@currfile = "Untitled".asFileHandler()
@currfile.cache = ""
@editor.value("")
###
Booklet.dependencies = [ "mde/simplemde.min" ]
this.OS.register "Booklet", Booklet

13
Booklet/package.json Normal file
View File

@ -0,0 +1,13 @@
{
"app":"Booklet",
"name":"Booklet",
"description":"",
"info":{
"author": "",
"email": ""
},
"version":"0.0.1-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"]
}

1
Booklet/project.apj Normal file
View File

@ -0,0 +1 @@
{"name":"Booklet","root":"home://workspace/Booklet","css":[],"javascripts":[],"coffees":["coffees/main.coffee","coffees/common.coffee"],"copies":["assets/scheme.html","package.json","README.md"]}

24
DrawIOWrapper/README.md Normal file
View File

@ -0,0 +1,24 @@
# DrawIOWrapper
This is an example project, generated by AntOS Development Kit
## Howto
1. Open the project.apj file with AntOSDK (simply double Click on it)
2. Modify the UI in *assets/scheme.html*
3. Modify application code in *coffees/main.coffee*
4. Modify CSS style in *css/main.css*
5. Other files need to be copied: put in to assets
## Set up build target
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
In the build options dialog, add or remove files that need to be
included into the build
Click **Save**
## Build application
* To build: **Menu > Build > Build** or **ALT-C**
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
* To release: **Menu > Build > Build release** or **ALT-P**

View File

@ -0,0 +1,5 @@
<afx-app-window apptitle="DrawIOWrapper" width="600" height="500" data-id="DrawIOWrapper">
<afx-hbox >
<iframe src="https://www.draw.io" ></iframe>
</afx-hbox>
</afx-app-window>

View File

@ -0,0 +1,24 @@
# DrawIOWrapper
This is an example project, generated by AntOS Development Kit
## Howto
1. Open the project.apj file with AntOSDK (simply double Click on it)
2. Modify the UI in *assets/scheme.html*
3. Modify application code in *coffees/main.coffee*
4. Modify CSS style in *css/main.css*
5. Other files need to be copied: put in to assets
## Set up build target
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
In the build options dialog, add or remove files that need to be
included into the build
Click **Save**
## Build application
* To build: **Menu > Build > Build** or **ALT-C**
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
* To release: **Menu > Build > Build release** or **ALT-P**

View File

@ -0,0 +1,15 @@
(function() {
var DrawIOWrapper;
DrawIOWrapper = class DrawIOWrapper extends this.OS.GUI.BaseApplication {
constructor(args) {
super("DrawIOWrapper", args);
}
main() {}
};
this.OS.register("DrawIOWrapper", DrawIOWrapper);
}).call(this);

View File

@ -0,0 +1,13 @@
{
"app":"DrawIOWrapper",
"name":"DrawIOWrapper",
"description":"",
"info":{
"author": "",
"email": ""
},
"version":"0.0.1-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"]
}

View File

@ -0,0 +1,5 @@
<afx-app-window apptitle="DrawIOWrapper" width="600" height="500" data-id="DrawIOWrapper">
<afx-hbox >
<iframe src="https://www.draw.io" ></iframe>
</afx-hbox>
</afx-app-window>

View File

@ -0,0 +1,7 @@
class DrawIOWrapper extends this.OS.GUI.BaseApplication
constructor: ( args ) ->
super "DrawIOWrapper", args
main: () ->
this.OS.register "DrawIOWrapper", DrawIOWrapper

View File

@ -0,0 +1,13 @@
{
"app":"DrawIOWrapper",
"name":"DrawIOWrapper",
"description":"",
"info":{
"author": "",
"email": ""
},
"version":"0.0.1-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"]
}

View File

@ -0,0 +1,8 @@
{
"name": "DrawIOWrapper",
"root": "home://workspace/DrawIOWrapper",
"css": [],
"javascripts": [],
"coffees": ["coffees/main.coffee"],
"copies": ["assets/scheme.html", "package.json", "README.md"]
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB