resources/assets/js/keywords_search.js
//Search the iframe and count the keywords
Search the iframe and count the keywords
Search the iframe and count the keywords
function countKeywords($keywords, $iframeContents, keywordLabelClassName, $keywordsButton) {
        var totalKeywordsFound = 0;
        var $keywordOccurences=[];
        $.each($keywords,function(){
            var $keywordItem=$(this);
             var keyword = $(this).find('a').text().trim().toString();
            $iframeContents.find('html').mark(keyword,{
                done: function (totalMatches) {
                    $keywordItem.find('.' + keywordLabelClassName).text(totalMatches);
                    totalKeywordsFound += totalMatches;
                    $keywordItem.unbind('click').click(function(){
                        navigateKeywords($keywordOccurences,$iframeContents,keyword)
                    });
                },
                noMatch:function(keyword){
                    console.log('not found');
                },
                each:function(keyword){
                         if(!isHidden(keyword)){
                             $keywordOccurences.push(keyword);
                         }
                },
                'exclude':['meta','title','img','input'],
                'separateWordSearch':false,
                'accurancy':'exactly'
            });
        });
        $keywordsButton.find('.keywords-count').addClass(keywordLabelClassName).
            text(totalKeywordsFound);
    }
function countKeywords ( $keywords , $iframeContents , keywordLabelClassName , $keywordsButton ) { var totalKeywordsFound = 0 ; var $keywordOccurences = [ ] ; $ . each ( $keywords , function ( ) { var $keywordItem = $ ( this ) ; var keyword = $ ( this ) . find ( 'a' ) . text ( ) . trim ( ) . toString ( ) ; $iframeContents . find ( 'html' ) . mark ( keyword , { done : function ( totalMatches ) { $keywordItem . find ( '.' + keywordLabelClassName ) . text ( totalMatches ) ; totalKeywordsFound += totalMatches ; $keywordItem . unbind ( 'click' ) . click ( function ( ) { navigateKeywords ( $keywordOccurences , $iframeContents , keyword ) } ) ; } , noMatch : function ( keyword ) { console . log ( 'not found' ) ; } , each : function ( keyword ) { if ( ! isHidden ( keyword ) ) { $keywordOccurences . push ( keyword ) ; } } , 'exclude' : [ 'meta' , 'title' , 'img' , 'input' ] , 'separateWordSearch' : false , 'accurancy' : 'exactly' } ) ; } ) ; $keywordsButton . find ( '.keywords-count' ) . addClass ( keywordLabelClassName ) . text ( totalKeywordsFound ) ; }
Search the iframe and count the keywords
Search the iframe and count the keywords