-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
4,156 additions
and
1,178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Knot.js Example - Bookstore</title> | ||
<link rel="stylesheet" href="styles/example.css"> | ||
|
||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | ||
|
||
<link rel="stylesheet" href="./styles/github.css"> | ||
<script src="js/highlight.pack"></script> | ||
|
||
<link rel="stylesheet" href="styles/tabpage.css"> | ||
<script type="text/cbs" src="cbs/tabpage.pkg.cbs"></script> | ||
<script type="text/cbs" src="cbs/sourceTab.pkg.cbs"></script> | ||
|
||
|
||
<script src="../src/core/PrivateScope.js"></script> | ||
<script src="../src/core/Utility.js"></script> | ||
<script src="../src/core/Deferred.js"></script> | ||
<script src="../src/core/AttachedData.js"></script> | ||
<script src="../src/core/DataObserver.js"></script> | ||
<script src="../src/core/ArrayMonitor.js"></script> | ||
<script src="../src/core/GlobalSymbolHelper.js"></script> | ||
<script src="../src/core/OptionParser.js"></script> | ||
<script src="../src/core/KnotManager.js"></script> | ||
<script src="../src/core/CBSLoader.js"></script> | ||
<script src="../src/core/HTMLAPProvider.js"></script> | ||
<script src="../src/core/HTMLKnotBuilder.js"></script> | ||
<script src="../src/core/AddonHTMLAPProvider.js"></script> | ||
<script src="../src/core/ComponentAPProvider.js"></script> | ||
<script src="../src/core/WindowHashStatus.js"></script> | ||
<script src="../src/core/KnotInterface.js"></script> | ||
|
||
<link rel="stylesheet" href="styles/tabpage.css"> | ||
<script type="text/cbs" src="cbs/tabpage.pkg.cbs"></script> | ||
<script type="text/cbs" src="cbs/sourceTab.pkg.cbs"></script> | ||
<script src="js/tabpage.js" id="tabPageSource"></script> | ||
<script type="text/javascript" src="js/sourceTab.js"></script> | ||
|
||
<script src="../src/debugger/knot.debug.js"></script> | ||
|
||
<link rel="stylesheet" href="styles/bookstore.css" class="exampleCSS"> | ||
<script src="js/bookstore.js" class="exampleJS"></script> | ||
<script type="text/cbs" src="cbs/bookstore.cbs" class="exampleCBS"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<section class="knot_example"> | ||
<h2>Knot.js example - Bookstore</h2> | ||
<b>All of the text and images are from Amazon.com</b> | ||
|
||
<div id="navMenu"> | ||
<ul> | ||
<li knot-template></li> | ||
</ul> | ||
</div> | ||
|
||
<div id="contentContainer"></div> | ||
|
||
<div id="booksList" knot-template-id="bookListTemplate"> | ||
<ul> | ||
<li knot-template> | ||
<img> | ||
<div></div> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div id="bookDetails" knot-template-id="bookDetailsTemplate"> | ||
<div> | ||
<h2></h2> | ||
<img> | ||
<p></p> | ||
<button>Return</button> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
|
||
<div id="sourceTab" knot-debugger-ignore knot-component="SourceTabPage"> | ||
|
||
</div> | ||
<script type="text/cbs"> | ||
#sourceTab{ | ||
sourceInfo:/sourceCodeInfo.codes | ||
} | ||
</script> | ||
<script> | ||
//collect source codes before knot changes the HTML | ||
window.sourceCodeInfo = {codes:null}; | ||
|
||
window.SourceCodeHelper.collectSourceCodes( | ||
[{selector:".knot_example",title:"HTML", type:"html"}, | ||
{selector:".exampleJS",title:"Javascript", type:"javascript"}, | ||
{selector:".exampleCBS",title:"CBS", type:"cbs"}, | ||
{selector:".exampleCSS",title:"CSS", type:"css"}], | ||
function(res){ | ||
window.sourceCodeInfo.codes = res; | ||
}); | ||
</script> | ||
</body> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
/bookStoreModel{ | ||
selected <= ($hash.category & $hash.book & /bookStoreModel.categories) > @/bookStoreModel.getSelected; | ||
} | ||
|
||
|
||
body{ | ||
dataContext: /bookStoreModel; | ||
} | ||
#navMenu>ul{ | ||
foreach: categories; | ||
|
||
-> >li{ | ||
text: name; | ||
@click: @{ | ||
Knot.setKnotVariant("$hash.category", this.id); | ||
Knot.setKnotVariant("$hash.book", null); | ||
}; | ||
class: (/bookStoreModel.selected.category && *LEFT)>{return value[0]===value[1]?"+selected":"-selected";} | ||
} | ||
} | ||
|
||
#booksList>ul{ | ||
dataContext: category; | ||
|
||
foreach: items; | ||
|
||
-> >li{ | ||
@click: @{Knot.setKnotVariant("$hash.book", this.id);}; | ||
|
||
-> img{ | ||
src: cover | ||
}; | ||
-> div{ | ||
text: name | ||
}; | ||
} | ||
} | ||
|
||
#bookDetails>div{ | ||
dataContext: book; | ||
|
||
-> h2{ | ||
text: name | ||
}; | ||
|
||
-> img{ | ||
src: cover | ||
}; | ||
|
||
-> p{ | ||
innerHTML: intro | ||
}; | ||
|
||
-> button{ | ||
@click: @{Knot.setKnotVariant("$hash.book", null);}; | ||
} | ||
} | ||
|
||
|
||
#contentContainer{ | ||
content[templateSelector: @/bookStoreModel.contentTemplateSelector]: selected | ||
} |
Oops, something went wrong.