-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqlik-isolated.min.js
3 lines (3 loc) · 2.83 KB
/
qlik-isolated.min.js
1
2
3
/*! qlik-isolated - v1.0.5 | 2017-08-03
* Hari Vikas Janarthanan (hrivks@gmail.com) | MIT License | https://github.com/hrivks/qlik-isolated#readme */
var qlikIsolated=function(){function e(){var e=i+n+"resources";return'<html><head><script src="'+e+'/assets/external/requirejs/require.js"><\/script></head><body><p>Isolated iframe to load Qlik.js </p><script>try {require.config({ baseUrl: "'+e+'" });require(["js/qlik"], function(q) { parent.qlikIsolated._qFrameLoadSuccess(q); });} catch(e) { parent.qlikIsolated._qFrameLoadFailure(e); }<\/script></body></html>'}function o(e,o,t,l,a,n,g,I,b,y){if("string"!=typeof e)throw"qlik-Isolated: appid must be a vaild string";if("string"!=typeof o&&"string"!=typeof t)throw"qlik-Isolated: obj or sheet must be a vaild string";var h=l||i;if(!h)throw"qlik-Isolated: baseUrl is required";var L="";L+=a?u:"",L+=g?f:"",L+=b?k:"",L=(L+=I?q:"").substring(0,L.lastIndexOf(",")),o=o||"",t=t||"",h+=m.replace(r,e).replace(s,o).replace(d,L).replace(c,t),n&&(h+=p),y&&y instanceof Array&&(h+="&select="+y.join("&select="));var C=document.createElement("iframe");return C.style.border="none",C.style.width="100%",C.style.height="100%",C.className="qlik-isolated",C.src=h,C}var t,i,l,a,n="/",r="#APPID#",s="#OBJ#",d="#OPT#",c="#SHEET#",u="currsel,",f="nointeraction,",q="noselections,",k="noanimate,",p="&select=clearall",m="/single/?appid="+r+"&obj="+s+"&sheet="+c+"&opt="+d;return{getQlik:function(o,r){if(!o&&!i)throw"qlik-Isolated: Qlik Server URL is required";var s=new Promise(function(e,o){l=e,a=o});if(t)return l(t),s;i=o||i,n=r||n;var d=document.createElement("iframe");return d.style.display="none",d.id="qFrame",document.body.appendChild(d),d.contentWindow.document.open(),d.contentWindow.document.write(e()),d.contentWindow.document.close(),s},getObjectIsolated:function(e,t,i,l,a,n,r,s,d,c,u){if(!e)throw"qlik-Isolated: element must be a HTML element or a jQuery selection";var f=o(t,i,l,a,n,r,s,d,c,u);e.append(f)},getSelectionBarIsolated:function(e,t,i,l,a,n,r,s){if(!e)throw"qlik-Isolated: element must be a HTML element or a jQuery selection";var d=o(t,"CurrentSelections","",i,!1,l,a,n,r,s);d.className="qlik-isolated qlik-isolated-selection-bar",d.style.marginTop="-50px",e.append(d)},_qFrameLoadSuccess:function(e){l(t=e)},_qFrameLoadFailure:function(e){a(e)},version:"1.0.5"}}();"undefined"!=typeof qlikIsolatedLoadConfig&&"string"==typeof qlikIsolatedLoadConfig.url&&qlikIsolated.getQlik(qlikIsolatedLoadConfig.url,qlikIsolatedLoadConfig.prefix).then(function(e){console.log("qlik-isolated: qlik.js auto loaded"),qlikIsolatedLoadConfig.makeGlobal&&(window.qlik=e),"function"==typeof qlikIsolatedLoadConfig.successCallback&&qlikIsolatedLoadConfig.successCallback(e)},function(e){console.log("qlik-isolated: error auto loading qlik"),console.log(e),"function"==typeof qlikIsolatedLoadConfig.failureCallback&&qlikIsolatedLoadConfig.failureCallback(e)});