Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Add callback and marks options #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

knowgod
Copy link

@knowgod knowgod commented Aug 14, 2015

These 2 commits to make the plugin more configurable by adding 3 new options:

jQuery('#json').JSONView(json, { 
    marks:{
        '+':'++',
        '-':'--',
    },
    on_expand: function(collapser){
        console.log(['on_expand', collapser]);
    },
    on_collapse: function(collapser){
        console.log(['on_collapse', collapser]);
    }
});

jQuery('#json_view').JSONView(batchJson, { marks:{
                    '+':'++',
                    '-':'--',
                }
            });
jQuery('#json_view').JSONView(batchJson, {
                on_expand: function(collapser){
                    console.log(['on_expand', collapser]);
                },
                on_collapse: function(collapser){
                    console.log(['on_collapse', collapser]);
                }
            });
@yesmeck
Copy link
Owner

yesmeck commented Aug 14, 2015

Thanks for the PR.

This plugin is written in CoffeScript, you should edit files under src/ instead of dist/jquery.jsonview.js.

@yesmeck yesmeck changed the title Develop Add callback and marks options Aug 14, 2015
@knowgod
Copy link
Author

knowgod commented Aug 19, 2015

As I'm not familiar with CoffeScript it will take some time to investigate how convert my changes into that.
So probably later I'll try to PR again.
Or you can incorporate my changes at your own.

@codler
Copy link

codler commented Nov 18, 2016

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants