(function() { if (!window.leaselinkSlideButton) { window.leaselinkSlideButton = true; var apiUrl = 'https://online.leaselink.pl/createoffer/SecuredMakeNew'; var testApiUrl = 'https://leaselinktest.azurewebsites.net/createoffer/SecuredMakeNew'; var currentScript = document.currentScript; if (!currentScript) { var scripts = document.getElementsByTagName('script'); currentScript = scripts[scripts.length - 1]; } function parseQuery(query) { var Params = new Object(); if (!query) return Params; // return empty object var Pairs = query.split(/[;&]/); for (var i = 0; i < Pairs.length; i++) { var KeyVal = Pairs[i].split('='); if (!KeyVal || KeyVal.length != 2) continue; var key = decodeURIComponent(KeyVal[0]); var val = decodeURIComponent(KeyVal[1]); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function isValidInteger(n) { var val = parseInt(n); return !isNaN(val) && val >= 0; } function loadScript(src, callback) { var r = false, s = document.createElement('script'); s.type = 'text/javascript'; s.src = src; s.onload = s.onreadystatechange = function() { if (!r && (!this.readyState || this.readyState == 'complete')) { r = true; if (callback) callback(); } }; currentScript.parentNode.insertBefore(s, currentScript); } function renderHtml(html) { currentScript.outerHTML += html; } function getQueryString(src) { if (src.startsWith('https://leaselink.pl/shortH/su/')) { params = src.substr(31).split("/"); return "externalId=" + params[0] + "&style=" + params[1]; } return src.replace(/^[^\?]+\??/, ''); } (function(funcName, baseObj) { "use strict"; // The public function name defaults to window.docReady // but you can modify the last line of this function to pass in a different object or method name // if you want to put them in a different namespace and those will be used instead of // window.docReady(...) funcName = funcName || "docReady"; baseObj = baseObj || window; var readyList = []; var readyFired = false; var readyEventHandlersInstalled = false; // call this when the document is ready // this function protects itself against being called more than once function ready() { if (!readyFired) { // this must be set to true before we start calling callbacks readyFired = true; for (var i = 0; i < readyList.length; i++) { // if a callback here happens to add new ready handlers, // the docReady() function will see that it already fired // and will schedule the callback to run right after // this event loop finishes so all handlers will still execute // in order and no new ones will be added to the readyList // while we are processing the list readyList[i].fn.call(window, readyList[i].ctx); } // allow any closures held by these functions to free readyList = []; } } function readyStateChange() { if (document.readyState === "complete") { ready(); } } // This is the one public interface // docReady(fn, context); // the context argument is optional - if present, it will be passed // as an argument to the callback baseObj[funcName] = function(callback, context) { // if ready has already fired, then just schedule the callback // to fire asynchronously, but right away if (readyFired) { setTimeout(function() { callback(context); }, 1); return; } else { // add the function and context to the list readyList.push({ fn: callback, ctx: context }); } // if document already ready to go, schedule the ready function to run // IE only safe when readyState is "complete", others safe when readyState is "interactive" if (document.readyState === "complete" || (!document.attachEvent && document.readyState === "interactive")) { setTimeout(ready, 1); } else if (!readyEventHandlersInstalled) { // otherwise if we don't have event handlers installed, install them if (document.addEventListener) { // first choice is DOMContentLoaded event document.addEventListener("DOMContentLoaded", ready, false); // backup is window load event window.addEventListener("load", ready, false); } else { // must be IE document.attachEvent("onreadystatechange", readyStateChange); window.attachEvent("onload", ready); } readyEventHandlersInstalled = true; } } })("docReady", window); var exec = function($) { var queryString = getQueryString(currentScript.src); var params = parseQuery(queryString); var isTest = params.test && (params.test == 1 || params.test == true || params.test == 'true'); var bottom = '150'; var splittedScriptUrl = currentScript.src.split("/"); var restBottomValue = splittedScriptUrl.pop(); //last param of REST like URL if (!queryString && restBottomValue && splittedScriptUrl.length === 6) { bottom = parseInt(restBottomValue); } else if (!queryString && restBottomValue && splittedScriptUrl.length !== 6) { bottom = 150; } else if (params.bottom && isValidInteger(params.bottom)) { bottom = parseInt(params.bottom); } var html = ''; html += '