Skip to content

Commit 5ab63f7

Browse files
committed
Update demo site
1 parent 10cba8a commit 5ab63f7

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,5 @@ node_modules
174174
bower_components
175175

176176
demos/json/data.json
177+
178+
node-package/public-suffix-list.txt

node-package/jsonary-bundle.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var fs = require('fs');
22
var http = require('http');
33
var https = require('https');
44
var path = require('path');
5+
var urlModule = require('url');
56

67
var bundleModule = require('./create-bundle.js');
78
var cookieClient = require('./cookie-client');
@@ -100,19 +101,9 @@ function modifyJsonaryForServer(Jsonary) {
100101
// Make an actual HTTP request, defaulting to the current server if just path is given
101102
Jsonary.ajaxFunction = function (params, callback) {
102103
requestCount++;
103-
var uri = new Jsonary.Uri(params.url);
104-
var isHttps = (uri.scheme == 'https');
104+
var options = urlModule.parse(params.url);
105+
var isHttps = (options.protocol == 'https');
105106
var httpModule = isHttps ? https : http;
106-
var options = {};
107-
if (uri.domain) {
108-
options.domain = uri.domain;
109-
options.host = options.domain;
110-
options.path = params.url.split(options.host).slice(1).join(options.host);
111-
} else {
112-
options.domain = 'localhost';
113-
options.port = SERVER_PORT;
114-
options.path = params.url;
115-
}
116107
options.method = params.method;
117108
var cookieString = Jsonary.server.cookies.cookieStringForRequest(options.domain, options.path, isHttps);
118109
options.headers = {

test/site.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var express = require('express');
22
var url = require('url');
33
var http = require('http');
44
var https = require('https');
5-
var jsonaryBundle = require('./jsonary-bundle');
5+
var jsonaryBundle = require('../node-package/jsonary-bundle');
66

77
var app = express();
88
app.use(express.bodyParser());
@@ -11,18 +11,29 @@ var jsonaryJsBundle;
1111
function createBundles() {
1212
var bundle = jsonaryBundle.fresh();
1313
bundle.add('renderers/site');
14+
// extra plugins and renderers
15+
bundle.add('../plugins/jsonary.location');
16+
bundle.add('../plugins/jsonary.undo');
17+
bundle.add('../plugins/jsonary.jstl');
18+
bundle.add('../plugins/jsonary.render.table');
19+
bundle.add('../plugins/jsonary.render.generate');
20+
bundle.add('../renderers/string-formats');
21+
bundle.add('../renderers/contributed/full-preview');
22+
bundle.add('../renderers/contributed/full-instances');
23+
bundle.add('../renderers/contributed/adaptive-table');
1424
bundle.add('../renderers/contributed/markdown');
1525

1626
bundle.writeCss('bundle.css');
1727
//bundle.writeCss('bundle.min.css', true);
18-
masterBundle.writeJs('bundle.js');
28+
bundle.writeJs('bundle.js');
1929
//masterBundle.writeJs('bundle.min.js', true);
2030
return bundle;
2131
}
2232
var jsonaryJsBundle = createBundles();
2333

2434
var createJsonary = function () {
2535
var Jsonary = jsonaryJsBundle.instance();
36+
Jsonary.baseUri = 'http://localhost:8080/';
2637
var buttons = [];
2738
Jsonary.render.clearButtons = function () {
2839
buttons = [];

0 commit comments

Comments
 (0)