jquery.json-viewer icon indicating copy to clipboard operation
jquery.json-viewer copied to clipboard

Tip about span classes

Open Gelogo opened this issue 6 months ago • 0 comments

Just downloaded your pretty nice project and it's perfect for my new little webpage. While integrating I've done a little change to assign separate classes for keys and values. My edits (jquery.json-viewer.js):

  • Lines 58, 61, 63, 65: html += '<span class="json-value json...
  • Line 102: '<span class="json-key json...

I felt into this bc in my case both, keys and values, are json-string. After this changes, whether there is a default assignment or leave the customization to the user, nvm, now it's possible to manage separately. Maybe also assign a specific class based on the data type. eg css:

.json-key.json-string {
	color: #c92c2c;
	font-weight: bold;
}

.json-value.json-string {
	color: #2a7bde;
}

.json-value.json-number {
	color: #008000;
}

.json-value.json-boolean {
	color: #aa0d91;
}

.json-value.json-null {
	color: #666666;
}

I'm not that into js, there might be other ways to achieve it better.

Greetings

Gelogo avatar Jun 02 '25 11:06 Gelogo