Skip to content
Open
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
6 changes: 6 additions & 0 deletions demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ <h4>Configuration</h4>
<input type="number" ng-model="hoverPreviewFieldCount" ng-disabled="!hoverPreviewEnabled">
</label>
</li>
<li>
<label>
<code>openUrlsInNewWindow</code>
<input type="checkbox" ng-model="openUrlsInNewWindow">
</label>
</li>
</ul>

<h4>Demo</h4>
Expand Down
4 changes: 4 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ app.controller('MainCtrl', function ($scope, $http, JSONFormatterConfig) {
$scope.hoverPreviewEnabled = JSONFormatterConfig.hoverPreviewEnabled;
$scope.hoverPreviewArrayCount = JSONFormatterConfig.hoverPreviewArrayCount;
$scope.hoverPreviewFieldCount = JSONFormatterConfig.hoverPreviewFieldCount;
$scope.openUrlsInNewWindow = JSONFormatterConfig.openUrlsInNewWindow;

$scope.$watch('hoverPreviewEnabled', function(newValue){
JSONFormatterConfig.hoverPreviewEnabled = newValue;
Expand All @@ -15,6 +16,9 @@ app.controller('MainCtrl', function ($scope, $http, JSONFormatterConfig) {
$scope.$watch('hoverPreviewFieldCount', function(newValue){
JSONFormatterConfig.hoverPreviewFieldCount = newValue;
});
$scope.$watch('openUrlsInNewWindow', function(newValue){
JSONFormatterConfig.openUrlsInNewWindow = newValue;
});

$scope.undef = undefined;
$scope.textarea = '{}';
Expand Down
24 changes: 12 additions & 12 deletions dist/json-formatter.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jsonformatter
*
* Version: 0.4.1 - 2015-12-03T03:38:59.933Z
* Version: 0.4.2 - 2015-12-24T14:10:17.232Z
* License: MIT
*/

Expand Down Expand Up @@ -40,13 +40,13 @@
color: red;
}
.json-formatter-row .null {
color: #855a00;
color: #855A00;
}
.json-formatter-row .undefined {
color: #ca0b69;
}
.json-formatter-row .function {
color: #ff20ed;
color: #FF20ED;
}
.json-formatter-row .date {
background-color: rgba(0, 0, 0, 0.05);
Expand All @@ -60,7 +60,7 @@
color: blue;
}
.json-formatter-row .key {
color: #00008b;
color: #00008B;
cursor: pointer;
}
.json-formatter-row .constructor-name {
Expand Down Expand Up @@ -112,38 +112,38 @@
content: "[]";
}
.json-formatter-dark.json-formatter-row .string {
color: #31f031;
color: #31F031;
white-space: pre;
word-wrap: break-word;
}
.json-formatter-dark.json-formatter-row .number {
color: #66c2ff;
color: #66C2FF;
}
.json-formatter-dark.json-formatter-row .boolean {
color: #ec4242;
color: #EC4242;
}
.json-formatter-dark.json-formatter-row .null {
color: #eec97d;
color: #EEC97D;
}
.json-formatter-dark.json-formatter-row .undefined {
color: #ef8fbe;
}
.json-formatter-dark.json-formatter-row .function {
color: #fd48cb;
color: #FD48CB;
}
.json-formatter-dark.json-formatter-row .date {
background-color: rgba(255, 255, 255, 0.05);
}
.json-formatter-dark.json-formatter-row .url {
text-decoration: underline;
color: #027bff;
color: #027BFF;
cursor: pointer;
}
.json-formatter-dark.json-formatter-row .bracket {
color: #9494ff;
color: #9494FF;
}
.json-formatter-dark.json-formatter-row .key {
color: #23a0db;
color: #23A0DB;
cursor: pointer;
}
.json-formatter-dark.json-formatter-row .constructor-name {
Expand Down
22 changes: 18 additions & 4 deletions dist/json-formatter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jsonformatter
*
* Version: 0.4.1 - 2015-12-03T03:38:59.925Z
* Version: 0.4.2 - 2015-12-24T14:10:17.220Z
* License: MIT
*/

Expand All @@ -16,6 +16,7 @@ angular.module('jsonFormatter', ['RecursionHelper'])
var hoverPreviewEnabled = false;
var hoverPreviewArrayCount = 100;
var hoverPreviewFieldCount = 5;
var openUrlsInNewWindow = false;

return {
get hoverPreviewEnabled() {
Expand All @@ -38,12 +39,18 @@ angular.module('jsonFormatter', ['RecursionHelper'])
set hoverPreviewFieldCount(value) {
hoverPreviewFieldCount = parseInt(value, 10);
},

get openUrlsInNewWindow() {
return openUrlsInNewWindow;
},
set openUrlsInNewWindow(value) {
openUrlsInNewWindow = !!value;
},
$get: function () {
return {
hoverPreviewEnabled: hoverPreviewEnabled,
hoverPreviewArrayCount: hoverPreviewArrayCount,
hoverPreviewFieldCount: hoverPreviewFieldCount
hoverPreviewFieldCount: hoverPreviewFieldCount,
openUrlsInNewWindow: openUrlsInNewWindow
};
}
};
Expand Down Expand Up @@ -166,7 +173,14 @@ angular.module('jsonFormatter', ['RecursionHelper'])

scope.openLink = function (isUrl) {
if(isUrl) {
window.location.href = scope.json;
if(!!JSONFormatterConfig.openUrlsInNewWindow){
var win = window.open(scope.json, '_blank');
if(win){ //Browser allowed link to be opened
win.focus();
}
}else{
window.location.href = scope.json;
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions dist/json-formatter.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/json-formatter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading