Skip to content

Cache+Foreign Order test, some css and Proper User #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13,582 changes: 2,018 additions & 11,564 deletions api.js

Large diffs are not rendered by default.

75 changes: 65 additions & 10 deletions api.min.js

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions article.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<link rel="stylesheet" href="http://node-os.com/css/default.css"/>

<script type="application/javascript" src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script type="text/javascript" src="/api.min.js"></script>
<style>
.more {display:none}
#articles img{max-width:100%}
Expand Down Expand Up @@ -62,7 +61,7 @@ <h3 class="title">{{name}}</h3>
<footer>
Don't worry, it probably was not your fault... probably...<br/>
Even if it was,
<a target="_blank" href="https://github.com/formula1/NodeOS-Blog/issues">just submit an issue :)</a>
<a target="_blank" href="https://github.com/NodeOS/GitBlog/issues">just submit an issue :)</a>
</footer>
</div>
</article>
Expand All @@ -73,7 +72,7 @@ <h1>We store data on your computer</h1>
<div>
<p>
If you login: We store your access token we retrieve from github on your computer as a cookie.
<a href="https://github.com/formula1/AuthProvider/blob/master/index.js#L87">See the Code</a>
<a class="btn btn-primary" href="https://github.com/formula1/AuthProvider/blob/master/index.js#L87">See the Code</a>
</p>
<p class="more">
This is done so that we can access the github api in a verified manner.<br/>
Expand All @@ -82,7 +81,7 @@ <h1>We store data on your computer</h1>
</p>
<p>
By Using the Blog: We store data we get from github on your available local storage.
<a href="https://github.com/formula1/NodeOS-Blog/blob/master/html/footerjs/cacheOrLoad.js#L38">See the Code</a>
<a class="btn btn-primary" href="https://github.com/NodeOS/GitBlog/blob/master/js/cacheOrLoad.js">See the Code</a>
</p>
<p class="more" >
This is done so that you may avoid as many calls to github as possible.<br/>
Expand Down Expand Up @@ -177,13 +176,7 @@ <h3 class="footer-title">Share</h3>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<!-- START: BIND DATA TO VIEW -->
<script type="text/javascript" src="/js/cacheOrLoad.js"></script>
<script type="text/javascript" src="/js/template.js"></script>
<script type="text/javascript" src="/js/utility.js"></script>
<script type="text/javascript" src="/js/error.js"></script>
<script type="text/javascript" src="/js/user.js"></script>
<script type="text/javascript" src="api.js"></script>

<script type="text/javascript">
var num = (function(){
Expand All @@ -205,6 +198,10 @@ <h3 class="footer-title">Share</h3>

jQuery(function($){
if(!num) return;
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");


singleHandler = new Template(
"script.template.blogsingle",
"div.container.blogsingle"
Expand Down Expand Up @@ -260,6 +257,9 @@ <h3 class="footer-title">Share</h3>

jQuery(function($){
if(!num) return;
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");

commentHandler = new Template(
"script.template.comments",
"div.container.comments"
Expand Down
112 changes: 49 additions & 63 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var path = require("path");
var async = require("async");
var browserify = require("browserify");
var ejs = require('ejs');
var UglifyJS = require("uglify-js");


var ob = module.exports = {};
Expand Down Expand Up @@ -59,59 +58,52 @@ ob.compileHTML = function compileHTML(inputdir, templatepath, outputdir, next)

ob.compileJS = function compileJS(inputrequire, outputdir,next)
{
var b = browserify();
var l = inputrequire.length;

while(l--)
{
var item = inputrequire[l];

if(typeof item === "string")
var createBundle = function(inputrequire)
{
var b = browserify();
var l = inputrequire.length;
inputrequire = inputrequire.map(function(item)
{
b.require(item);
continue;
}

if(!item.path)
return next("when specifying something to require, "+
"\n\t you must provide a valid string or"+
"\n\t you must provide an object with {path:\"valid path or name\"}");

b.require(item.path, item.options);
inputrequire[l] = item.path;
}

b.bundle(function(e,buff)
{
if(e) return next(e);

async.parallel(
[
function(next)
if(typeof item === "string")
{
fs.writeFile(outputdir+"/api.js", buff,
function(e)
{
if(e) return next(e);
next(void(0), {input:inputrequire,output:outputdir+"/api.js"});
});
},
function(next)
b.add(path.normalize(item));
return item;
}
if(!item.path)
{
var min = UglifyJS.parse(buff.toString("utf-8"));

min.figure_out_scope();
fs.writeFile(outputdir+"/api.min.js", min.print_to_string(),
function(e)
{
if(e) return next(e);

next(void(0), {input:inputrequire,output:outputdir+"/api.min.js"});
});
throw new Error(
"when specifying something to require, "+
"\n\t you must provide a valid string or"+
"\n\t you must provide an object with {path:\"valid path or name\"}"
);
}
],
next);
});
b.require(path.normalize(item.path), item.options);
return item.path;
});
return b;
};
async.parallel(
[
function(next)
{
createBundle(inputrequire).bundle()
.pipe(fs.createWriteStream(outputdir+"/api.js"))
.on("end",function(){
next(void(0), {input:inputrequire,output:outputdir+"/api.js"});
}).on("error",next)
},
function(next)
{
createBundle(inputrequire).transform({global: true}, 'uglifyify')
.bundle()
.pipe(fs.createWriteStream(outputdir+"/api.min.js"))
.on("end",function()
{
next(void(0), {input:inputrequire,output:outputdir+"/api.min.js"});
}).on("error",next);
}
],
next);
};

ob.compileAll = function compileAll(inputs, templatepath, outputdir, next)
Expand All @@ -121,7 +113,7 @@ ob.compileAll = function compileAll(inputs, templatepath, outputdir, next)
async.parallel(
[
ob.compileHTML.bind(void(0),inputs.dir, templatepath, outputdir),
ob.compileJS.bind(void(0),inputs.require, outputdir)
ob.compileJS.bind(void(0),inputs.add, outputdir)
],
function(e,results)
{
Expand All @@ -143,19 +135,13 @@ if(!module.parent)
{
var inputs =
{
require:
add:
[
"auth-provider",
{
path: __dirname+"/node_modules/highlight.js/lib/index.js",
options:
{
expose: "highlight"
}
},
"querystring",
"async",
// "markdown"
{path:__dirname+"/js/template.js", options:{expose:"template"}},
{path:__dirname+"/js/cacheOrLoad.js", options:{expose:"cache-or-load"}},
__dirname+"/js/utility.js",
__dirname+"/js/error.js",
__dirname+"/js/user.js"
],
dir: __dirname+"/input"
};
Expand Down
17 changes: 6 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<link rel="stylesheet" href="http://node-os.com/css/default.css"/>

<script type="application/javascript" src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script type="text/javascript" src="/api.min.js"></script>
<style>
.more {display:none}
#articles img{max-width:100%}
Expand Down Expand Up @@ -62,7 +61,7 @@ <h3 class="title">{{name}}</h3>
<footer>
Don't worry, it probably was not your fault... probably...<br/>
Even if it was,
<a target="_blank" href="https://github.com/formula1/NodeOS-Blog/issues">just submit an issue :)</a>
<a target="_blank" href="https://github.com/NodeOS/GitBlog/issues">just submit an issue :)</a>
</footer>
</div>
</article>
Expand All @@ -73,7 +72,7 @@ <h1>We store data on your computer</h1>
<div>
<p>
If you login: We store your access token we retrieve from github on your computer as a cookie.
<a href="https://github.com/formula1/AuthProvider/blob/master/index.js#L87">See the Code</a>
<a class="btn btn-primary" href="https://github.com/formula1/AuthProvider/blob/master/index.js#L87">See the Code</a>
</p>
<p class="more">
This is done so that we can access the github api in a verified manner.<br/>
Expand All @@ -82,7 +81,7 @@ <h1>We store data on your computer</h1>
</p>
<p>
By Using the Blog: We store data we get from github on your available local storage.
<a href="https://github.com/formula1/NodeOS-Blog/blob/master/html/footerjs/cacheOrLoad.js#L38">See the Code</a>
<a class="btn btn-primary" href="https://github.com/NodeOS/GitBlog/blob/master/js/cacheOrLoad.js">See the Code</a>
</p>
<p class="more" >
This is done so that you may avoid as many calls to github as possible.<br/>
Expand Down Expand Up @@ -164,19 +163,15 @@ <h3 class="footer-title">Share</h3>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<!-- START: BIND DATA TO VIEW -->
<script type="text/javascript" src="/js/cacheOrLoad.js"></script>
<script type="text/javascript" src="/js/template.js"></script>
<script type="text/javascript" src="/js/utility.js"></script>
<script type="text/javascript" src="/js/error.js"></script>
<script type="text/javascript" src="/js/user.js"></script>
<script type="text/javascript" src="api.js"></script>

<script type="text/javascript">

var listHandler;

jQuery(function($){
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");
listHandler = new Template(
"script.template.bloglist",
"div.container.bloglist"
Expand Down
2 changes: 2 additions & 0 deletions js/bloglist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
var listHandler;

jQuery(function($){
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");
listHandler = new Template(
"script.template.bloglist",
"div.container.bloglist"
Expand Down
4 changes: 4 additions & 0 deletions js/blogsingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ var singleHandler;

jQuery(function($){
if(!num) return;
var Template = require("template");
var cacheOrUriIterator = require("cache-or-load");


singleHandler = new Template(
"script.template.blogsingle",
"div.container.blogsingle"
Expand Down
Loading