    
jQuery(document).ready(function($){ 
//  C H E C K    I F    E N A B L E D
if ( genolveO.genolve_enabled === 'TRUE' ) {
  document.getQueryVariable=function(variable) {
    var query = window.location.search.substring(1);
    //alert("window.location.search:"+window.location.search);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
      var pair = vars[i].split("=");
      if(pair[0] == variable){return pair[1];}
      }
    return(null);
    }
  var addGenolve = function(){
    window.setTimeout(function(){
      //alert('addGenolve fired');
			$('.components-panel__body-title').off('click.gnlv');
			$('.components-panel__body-title').on('click.gnlv',addGenolve); // for toggle featured image control
      // might be able to get post from js var _wpMediaViewsL10n 
      //alert("genolve admin found? $('.editor-post-featured-image')"+$('.editor-post-featured-image').length);
      // pre-5.0 selector #postimagediv .inside
      //<a id="gnlv-make-featured" class="thickbox"  href="admin.php?page=genolve-toolkit-settings&tab=designeditor">Make image with Genolve</a>
      if($('#mkgenolvefi').length==0)
        $('.editor-post-featured-image').append('<button id="mkgenolvefi" class="components-button is-link" onclick="window.open(\'admin.php?page=genolve-toolkit-settings&tab=designeditor&postid=\'+document.getQueryVariable(\'post\'),\'_blank\')">Make image with Genolve</button>');},700);
    }
  
  window.setTimeout(addGenolve,1700);
      
  window.setTimeout(function(){
    $('button.edit-post-sidebar__panel-tab').on('click',addGenolve);
    },700);
		
		


} // end genolve enabled
	 

});


