getting more browser-ready-tastic
This commit is contained in:
		
							parent
							
								
									a44478de87
								
							
						
					
					
						commit
						cc3f24daf0
					
				| @ -35,6 +35,7 @@ | |||||||
|     "escape-string-regexp": "~1.0.2", |     "escape-string-regexp": "~1.0.2", | ||||||
|     "marked": "~0.3.2", |     "marked": "~0.3.2", | ||||||
|     "js-yaml": "~3.2.5", |     "js-yaml": "~3.2.5", | ||||||
|     "path": "~3.46.1" |     "path": "~3.46.1", | ||||||
|  |     "forEachAsync": "~5.0.2" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
|     , marked        = exports.marked        || require('marked') |     , marked        = exports.marked        || require('marked') | ||||||
|     , forEachAsync  = exports.forEachAsync  || require('foreachasync').forEachAsync |     , forEachAsync  = exports.forEachAsync  || require('foreachasync').forEachAsync | ||||||
|     , sha1sum       = exports.sha1sum       || require('./lib/deardesi-node').sha1sum |     , sha1sum       = exports.sha1sum       || require('./lib/deardesi-node').sha1sum | ||||||
|     , frontmatter   = exports.frontmatter   || require('./lib/frontmatter').Frontmatter |     , frontmatter   = exports.Frontmatter   || require('./lib/frontmatter').Frontmatter | ||||||
|     , safeResolve   = exports.safeResolve   || require('./lib/deardesi-utils').safeResolve |     , safeResolve   = exports.safeResolve   || require('./lib/deardesi-utils').safeResolve | ||||||
|     , getStats      = exports.getStats      || require('./lib/deardesi-node').getStats |     , getStats      = exports.getStats      || require('./lib/deardesi-node').getStats | ||||||
|     , getContents   = exports.getContents   || require('./lib/deardesi-node').getContents |     , getContents   = exports.getContents   || require('./lib/deardesi-node').getContents | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ | |||||||
|     <script src="./bower_components/marked/lib/marked.js"></script> |     <script src="./bower_components/marked/lib/marked.js"></script> | ||||||
|     <script src="./bower_components/js-yaml/dist/js-yaml.js"></script> |     <script src="./bower_components/js-yaml/dist/js-yaml.js"></script> | ||||||
|     <script src="./bower_components/path/path.js"></script> |     <script src="./bower_components/path/path.js"></script> | ||||||
|  |     <script src="./bower_components/forEachAsync/forEachAsync.js"></script> | ||||||
| 
 | 
 | ||||||
|     <!-- Libs --> |     <!-- Libs --> | ||||||
|     <script src="./lib/deardesi-utils.js"></script> |     <script src="./lib/deardesi-utils.js"></script> | ||||||
|  | |||||||
| @ -1,13 +1,4 @@ | |||||||
| /*jshint -W054 */ | /*jshint -W054 */ | ||||||
| var tmpglobal |  | ||||||
|   ; |  | ||||||
| 
 |  | ||||||
| try { |  | ||||||
|   tmpglobal = new Function('return this')(); |  | ||||||
| }  catch(e) { |  | ||||||
|   tmpglobal = window; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ;(function (exports) { | ;(function (exports) { | ||||||
|   'use strict'; |   'use strict'; | ||||||
| 
 | 
 | ||||||
| @ -115,14 +106,89 @@ try { | |||||||
| 
 | 
 | ||||||
|   exports.hashsum = hashsum; |   exports.hashsum = hashsum; | ||||||
|   exports.sha1sum = sha1sum; |   exports.sha1sum = sha1sum; | ||||||
| }('undefined' !== typeof exports && exports || tmpglobal)); | }('undefined' !== typeof exports && exports || window)); | ||||||
| 
 | 
 | ||||||
| ;(function () { | ;(function () { | ||||||
|   'use strict'; |   'use strict'; | ||||||
| 
 | 
 | ||||||
|  |   function request() { | ||||||
|  |   } | ||||||
|  |   request.get = function (url/*, query*/) { | ||||||
|  |     // Return a new promise.
 | ||||||
|  |     return new Promise(function(resolve, reject) { | ||||||
|  |       // Do the usual XHR stuff
 | ||||||
|  |       var req = new XMLHttpRequest() | ||||||
|  |         ; | ||||||
|  | 
 | ||||||
|  |       req.onload = function() { | ||||||
|  |         // This is called even on 404 etc
 | ||||||
|  |         // so check the status
 | ||||||
|  |         if (200 === req.status) { | ||||||
|  |           // Resolve the promise with the response text
 | ||||||
|  |           resolve(req.response); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           // Otherwise reject with the status text
 | ||||||
|  |           // which will hopefully be a meaningful error
 | ||||||
|  |           reject(Error(req.statusText)); | ||||||
|  |         } | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       // Handle network errors
 | ||||||
|  |       req.onerror = function() { | ||||||
|  |         reject(Error("Network Error")); | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       // Make the request
 | ||||||
|  |       req.open('GET', url); | ||||||
|  |       req.send(); | ||||||
|  |     }); | ||||||
|  |   }; | ||||||
|  |   request.post = function (url/*, query*/, body) { | ||||||
|  |     // Return a new promise.
 | ||||||
|  |     return new Promise(function(resolve, reject) { | ||||||
|  |       // Do the usual XHR stuff
 | ||||||
|  |       var req = new XMLHttpRequest() | ||||||
|  |         ; | ||||||
|  | 
 | ||||||
|  |       req.onload = function() { | ||||||
|  |         // This is called even on 404 etc
 | ||||||
|  |         // so check the status
 | ||||||
|  |         if (200 === req.status) { | ||||||
|  |           // Resolve the promise with the response text
 | ||||||
|  |           resolve(req.response); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           // Otherwise reject with the status text
 | ||||||
|  |           // which will hopefully be a meaningful error
 | ||||||
|  |           reject(Error(req.statusText)); | ||||||
|  |         } | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       // Handle network errors
 | ||||||
|  |       req.onerror = function() { | ||||||
|  |         reject(Error("Network Error")); | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       req.open('POST', url); | ||||||
|  |       req.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); | ||||||
|  |       // Make the request
 | ||||||
|  |       req.send(JSON.stringify(body, null, '  ')); | ||||||
|  |     }); | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   exports.getCollectionMeta = function (collections) { | ||||||
|  |     return request.post('/api/fs/walk?_method=GET&dotfiles=true&extensions=md,markdown,jade,htm,html', { | ||||||
|  |       dirs: collections | ||||||
|  |     }).then(function (resp) { | ||||||
|  |       return JSON.parse(resp.responseText); | ||||||
|  |     }); | ||||||
|  |   }; | ||||||
|  |   /* | ||||||
|   exports.getStats |   exports.getStats | ||||||
|   exports.getContents |   exports.getContents | ||||||
|   exports.getMetaCache |   exports.getMetaCache | ||||||
|   exports.getContentCache |   exports.getContentCache | ||||||
|  |   */ | ||||||
|   //require('./db').create(path.join(_dirname, 'db.json'))
 |   //require('./db').create(path.join(_dirname, 'db.json'))
 | ||||||
| }()); | }('undefined' !== typeof exports && exports || window)); | ||||||
|  | |||||||
| @ -96,7 +96,8 @@ | |||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   exports.Frontmatter.Frontmatter = exports.Frontmatter = {}; |   exports.Frontmatter = exports.Frontmatter = {}; | ||||||
|  |   exports.Frontmatter.Frontmatter = exports.Frontmatter; | ||||||
|   exports.Frontmatter.readText = readFrontMatter; |   exports.Frontmatter.readText = readFrontMatter; | ||||||
|   exports.Frontmatter.separateText = separateText; |   exports.Frontmatter.separateText = separateText; | ||||||
|   exports.Frontmatter.parse = parseText; |   exports.Frontmatter.parse = parseText; | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| 'use strict'; | ;(function (exports) { | ||||||
|  |   'use strict'; | ||||||
| 
 | 
 | ||||||
| module.export.verify = function (conf) { |   exports.verifyConfig = function (conf) { | ||||||
|     if (!conf.NuhohSpec) { |     if (!conf.NuhohSpec) { | ||||||
|       throw new Error("missing key NuhohSpec"); |       throw new Error("missing key NuhohSpec"); | ||||||
|     } |     } | ||||||
| @ -53,4 +54,5 @@ module.export.verify = function (conf) { | |||||||
|     if (!conf.widgets) { |     if (!conf.widgets) { | ||||||
|       throw new Error("missing key root"); |       throw new Error("missing key root"); | ||||||
|     } |     } | ||||||
| }; |   }; | ||||||
|  | }('undefined' !== typeof exports && exports || window)); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user