historystamp historystamp - 5 months ago 12
HTML Question

How to I find javascript source in web page?

I would like to examine the source code for a javascript function in a
web page

In firefox inspector, I've clicked on
enter image description here

I see:

<a href="/thread/7629335?start=75&amp;tstart=0" title="last" onclick="jspaginate.init('last', '6'); return false;" class="js-pagination-next j-paginate-last">last</a>

I would like to find the source to jspaginate.init

I've clicked on the Debugger tab, but I do not see jspaginate.init.

Source should be on the page somewhere shouldn't it?

I'm running Firefox 48.0 in Mac OS 10.10.5. I'm in the inspector.
enter image description here


Install firebug, activate it, activate the script panel too and then look for the jspaginate object. In a js file you will find it:

var jspaginate = {
    loading: false,
    init: function(action, last){
        var view = this,
            target, current;
        if(this.loading !== true){
            if(action === 'first'){
                target = 0;
                view.update(target, 0);
            }else if(action === 'prev'){
                current = parseInt(view.data.pageIndex)-1;
                target = (current)*view.data.range;
                view.update(target, current);
            }else if(action === 'next'){
                current = parseInt(view.data.pageIndex)+1;
                target = (current)*view.data.range;
                view.update(target, current);
            }else if(action === 'last'){
                current = parseInt(last)-1;
                target = (current)*view.data.range;
                view.update(target, current);
    update: function(target, current){
        this.data.pageIndex = current;
        this.pushState(target, current);
    pushState: function(target, current){
        var state = { 'page_id': current, 'user_id': 2 },
            title = 'Page'+ current,
            url = '?start='+target+'&tstart=0';
        history.pushState(state, title, url);
    loadingSequence: function(){
        this.loading = true;
        $j('.j-pagination').append('<div class="j-loading-big"><span></span></div>');
    removeLoading: function(){
        this.loading = false;
    updateUI: function(data){
        $j('html, body').animate({
            scrollTop: ($j(".all-replies-container").offset().top -180)
        }, 800);

    getData: function(target){
        var view = this,
            tId = (this.data.threadId).split('/')[2],
            urlString = jive.app.url({path:'/inline-thread.jspa?thread='+tId+'&start='+target+'&tstart=0'});
            url: urlString,
            cache: true,
            async: true,
            dataType : 'html'
        }).success(function(data) {
        }).error(function(data) {