import { detect } from 'detect-browser';
import mobile from 'is-mobile';

const $ = require('jquery');

export default class ihk {
  static getBrowser(){
    return detect();
  }
  static isMobile(){
    return mobile();
  }

  static init() {
    const mobile = ihk.isMobile();
    const browser = ihk.getBrowser();
    const html = $('html');
    html.addClass( mobile ? 'mobile' : 'desktop' );
    html.attr('data-browser', browser.name);
    html.attr('data-os', browser.os);
  }

  static getUrlVars() {
    let vars = {};
    window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
      vars[key] = value;
    });
    return vars;
  }

  static realVH() {
    const vh = window.innerHeight * 0.01;
    document.documentElement.style.setProperty('--viewport-height', vh + 'px');
  }
}


/*
const ihk = {
	browser: detect(),
	mobile: mobile(),
	ready: false,

	init: function () {
		//console.log(this.browser);
		const html = $('html');
		html.addClass( this.mobile ? 'mobile' : 'desktop' );
		html.attr('data-browser', this.browser.name);
		html.attr('data-os', this.browser.os);
	}
}

ihk.getUrlVars = function () {
  var vars = {};
  window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
      vars[key] = value;
  });
  return vars;
};

ihk.realVH = function () {
	var vh = window.innerHeight * 0.01;
  document.documentElement.style.setProperty('--viewport-height', vh + 'px');
};
*/
//export default ihk;
