Skip to content

Commit

Permalink
Merge branch 'Ovilia-clickable-title'
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Apr 17, 2016
2 parents 2a85d5d + 8985c36 commit 018e24e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
4 changes: 3 additions & 1 deletion dist/jquery.jsonview.css

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

7 changes: 6 additions & 1 deletion dist/jquery.jsonview.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Licensed under the MIT License.
value = object[prop];
hasContents = true;
key = this.options.escape ? this.jsString(prop) : prop;
output += "<li><span class=\"prop\"><span class=\"q\">\"</span>" + key + "<span class=\"q\">\"</span></span>: " + (this.valueToHTML(value, level + 1));
output += "<li><a class=\"prop\" href=\"javascript:;\"><span class=\"q\">\"</span>" + key + "<span class=\"q\">\"</span></a>: " + (this.valueToHTML(value, level + 1));
if (numProps > 1) {
output += ',';
}
Expand Down Expand Up @@ -146,6 +146,11 @@ Licensed under the MIT License.

Collapser.bindEvent = function(item, options) {
var collapser;
item.firstChild.addEventListener('click', (function(_this) {
return function(event) {
return _this.toggle(event.target.parentNode.firstChild, options);
};
})(this));
collapser = document.createElement('div');
collapser.className = 'collapser';
collapser.innerHTML = options.collapsed ? '+' : '-';
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.jsonview.min.css

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

2 changes: 1 addition & 1 deletion dist/jquery.jsonview.min.js

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

2 changes: 2 additions & 0 deletions src/jquery.jsonview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

.prop {
font-weight: bold;
text-decoration: none;
color: #000;
}

.null {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/collapser.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
class Collapser
@bindEvent: (item, options) ->
item.firstChild.addEventListener('click', (event) =>
@toggle(event.target.parentNode.firstChild, options)
)
collapser = document.createElement('div')
collapser.className = 'collapser'
collapser.innerHTML = if options.collapsed then '+' else '-'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/json_formatter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class JSONFormatter
hasContents = true
key = if @options.escape then @jsString(prop) else prop
output += """
<li><span class="prop"><span class="q">"</span>#{key}<span class="q">"</span></span>: #{@valueToHTML(value, level + 1)}
<li><a class="prop" href="javascript:;"><span class="q">"</span>#{key}<span class="q">"</span></a>: #{@valueToHTML(value, level + 1)}
"""
output += ',' if numProps > 1
output += '</li>'
Expand Down
12 changes: 6 additions & 6 deletions test/json_formatter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ suite 'JSONFormatter', ->
{
<ul class="obj level0">
<li>
<span class="prop">
<a class="prop" href="javascript:;">
<span class="q">"</span>a<span class="q">"</span>
</span>: <span class="num">1</span>
</a>: <span class="num">1</span>
</li>
</ul>
}
Expand All @@ -81,14 +81,14 @@ suite 'JSONFormatter', ->
{
<ul class="obj level0">
<li>
<span class="prop">
<a class="prop" href="javascript:;">
<span class="q">"</span>a<span class="q">"</span>
</span>: {
</a>: {
<ul class="obj level1 collapsible">
<li>
<span class="prop">
<a class="prop" href="javascript:;">
<span class="q">"</span>b<span class="q">"</span>
</span>: <span class="num">1</span>
</a>: <span class="num">1</span>
</li>
</ul>
}
Expand Down

0 comments on commit 018e24e

Please sign in to comment.