text: "use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var iframe_communication=function(){function iframe_communication(){_classCallCheck(this,iframe_communication);this.parentOrigin="";this.init();this.bind_events()}_createClass(iframe_communication,[{key:"init",value:function init(){var searchParams=this.getSearchParamsObj();this.parentOrigin=searchParams.iframe;this.sendMessage({msg_type:"success"})}},{key:"getSearchParamsObj",value:function getSearchParamsObj(){var params={},tokens,regex=/[?&]?([^=]+)=([^&]*)/g;while(tokens=regex.exec(window.location.search)){params[decodeURIComponent(tokens[1])]=decodeURIComponent(tokens[2])}return params}},{key:"bind_events",value:function bind_events(){var self=this;$(document).on("keydown",(function(e){if(e.keyCode===27&&!$("#jGrowl").find("button").length){self.sendCloseEditorMessage()}}));window.onmessage=function(event){self.handleMessage(event)}}},{key:"sendCloseEditorMessage",value:function sendCloseEditorMessage(){this.sendMessage({msg_type:"close_editor"})}},{key:"handleMessage",value:function handleMessage(event){event=event||window.event;if(event.origin!==this.parentOrigin){return}var message=event.data;if(!message){return}switch(message.msg_type){case"search":$("#editor_search_bar").val('"'+message.query+'"').trigger("input");break;default:return}}},{key:"sendMessage",value:function sendMessage(message){if(!this.parentOrigin){return}parent.postMessage(message,this.parentOrigin)}}]);return iframe_communication}();
  