var widgetOptions = { id: 192, type:0 }; (function() { var pelem = document.getElementById("widget-status-zakaza"); var fw = 1; var ismob = 0; var lch =0; var lchr = 0; var csor = 0; var rc = 0; var is_strel = 0; var startw = 0; var starth = 0; if(pelem == null) { return; } var dc = pelem.getAttribute('data-content'); widgetOptions.lsze = 'widget-status-zakaza'; widgetOptions.type = 0; var width_ib = 800; var height_ib = 600; var width_i = 800; var height_i = 600; if(ismob == 1) { width_ib = 0; height_ib = 0; } if(dc == 'w-open') { var Util = { extendObject: function(a, b) { for(prop in b){ a[prop] = b[prop]; } return a; }, proto: 'https:' == document.location.protocol ? 'https://' : 'https://' } var options = Util.extendObject({ id: 0, type: 0, bg_color: "FFFFFF" }, widgetOptions); var domain = "status-zakaza.ru/wdg/w.php"; options.widget_url = [Util.proto, domain, "?", "id=", options.id, "&type=", options.type, "&bg_color=", options.bg_color].join(""); options.widget_url += "&url=" + encodeURIComponent(document.location.href); document.getElementById('widget-status-zakaza').onclick = function() { window.open(options.widget_url, "Статус заказа", "width="+(width_i+30) +",height="+(height_i+30)+",resizable=yes,scrollbars=yes,status=yes,location=no,left=100,top=100"); } return; } if(dc == 'w-open-2' || dc == 'w-open-3') { if(dc == 'w-open-3') { var dopssbut = ''; dopssbut = '#widget-status-zakaza{display:block !important;width:200px;text-transform:uppercase;text-align:center;z-index:1000;position:fixed;bottom:0px;padding-left:20px;padding-right:20px;padding-top:10px;padding-bottom: 10px;border-top-left-radius:4px;border-top-right-radius:4px;background:#434343;color:#fefefe;-webkit-box-shadow: 0px 10px 25px -1px rgba(0,0,0,0.75);-webkit-box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);-moz-box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);left:5%;cursor:pointer;font-size:18px;font-weight:bold;opacity:0.9;-webkit-transition: background 0.3s ease-out 0.1s;-moz-transition: background 0.3s ease-out 0.1s;-o-transition: background 0.3s ease-out 0.1s;transition: background 0.3s ease-out 0.1s;}#widget-status-zakaza:hover{background:#4f4f4f;color:#ffffff;-webkit-box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);-moz-box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);box-shadow: 0 12px 25px 8px rgba(0,0,0,0.17);}'; var stElement = document.createElement('style'); stElement.id = 'id-szb'; stElement.innerHTML = dopssbut; document.body.insertBefore(stElement, document.body.nextSibling); } document.getElementById('widget-status-zakaza').onclick = function() { var wh = getPageSize(); var w = wh[2]; var h = wh[3]; if(startw == 0 && starth == 0) { startw = w; starth = h; } var left_of = ((w-(width_ib))/2); var top_of = ((h-(height_ib + 30))/2); if(w < width_ib || w < 400) { width_i = w - 90; left_of = 45; } if(height_ib > h) { top_of = 45; height_i = h - 90 - 40; } else { top_of = ((h-(height_ib + 30))/2); } var width_it = (width_i + 10) + 'px'; var height_it = (height_i + 30 + 10) +'px'; var frblock = '
Статус заказа
'; widgetOptions.lsze = 'wf-status-zakaza'; this.fszElement = document.createElement('div'); this.fszElement.id = 'frblock-sz'; this.fszElement.innerHTML = frblock; document.body.insertBefore(this.fszElement, document.body.nextSibling); pelem = document.getElementById(widgetOptions.lsze); pos = getElementPosition("fr-sz-block"); var width_fr = pos.width; var height_fr = pos.height; width_i = width_fr - 10; //width_i = width_i - 10; /*height_i = height_fr;*/ widgetOptions.rWidth = width_i; widgetOptions.rHeight = height_i; widgetOptions.ismob = 0; document.getElementById('close-sz-win').onclick = function() { var fr_sz_block = document.getElementById('fr-sz-block'); fr_sz_block.style.display = "none"; var frblock_sz = document.getElementById('frblock-sz'); frblock_sz.parentNode.removeChild(frblock_sz); } pelem.setAttribute('style', 'display:block;width:'+ (width_i) + 'px' + ';height:'+(height_i) +'px'); //pelem.innerHTML = width_i +' ' + height_i; if(document.getElementById("widget_iframe_sz") == undefined) { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = "https://status-zakaza.ru/wdg/widget.js?"+Date.now; document.getElementsByTagName('head')[0].appendChild(script); } else { document.getElementById('fr-sz-block').style.display = "block"; createWidget(widgetOptions); } } function resize() { var wh = getPageSize(); var w = wh[2]; var h = wh[3]; if(ismob == 1) { if((startw == w && starth != h)||(startw != w && starth == h)) { return; } } var p_width_i = width_i; var p_height_i = height_i; var top_of =((h-(height_ib + 30))/2); var left_of = ((w-(width_ib))/2); if(w < width_ib || w < 400) { width_i = w - 90; left_of = 45; } else { width_i = width_ib; } if(h < height_ib) { top_of = 45; height_i = h - 90 - 40; } else { height_i = height_ib; top_of = ((h-(height_ib + 30))/2); } var width_it = (width_i + 10) + 'px'; var height_it = (height_i + 30 + 10) +'px'; var frsz = document.getElementById('fr-sz-block'); if(frsz != null) { frsz.setAttribute('style', 'position:fixed;top:'+ top_of +'px;left:' + left_of + 'px;display:block;width:'+width_it+';height:'+height_it +';z-index:2147483648;background:#fff;border:5px solid #eee;border-radius:3px;padding-right:1px;overflow:hidden'); } if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; } lch = Date.now; startw = w; starth = h; if(height_i != p_height_i || width_i != p_width_i) { csor++; setTimeout(ReloadW,200); } } function ReloadW() { if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; } var ct = Date.now; csor = csor - 1; if(ct - lch < 10) { return; } pelem = document.getElementById('wf-status-zakaza'); pelem.innerHTML = '...'; if(is_strel == 1) { return; } if(csor > 0) { return; } if(rc == 10000) { if(ct - lchr < 60000) { return; } else { rc = 0; } } if(ct - lchr < 5000) { rc++; } else { rc = 0; } if(rc > 3) { rc = 10000; lchr = ct; } is_strel = 1; //if(Widget.created) //{ Widget.created = false; //} var pos = getElementPosition("fr-sz-block"); var width_fr = pos.width; width_i = width_fr - 10; widgetOptions.rWidth = width_i; widgetOptions.rHeight = height_i; var pelem = document.getElementById(widgetOptions.lsze); pelem.setAttribute('style', 'display:block;width:'+ (width_i) + 'px' + ';height:'+(height_i) +'px'); pelem.innerHTML = ''; document.getElementById('fr-sz-block').style.display = "block"; createWidget(widgetOptions); is_strel = 0; lch = Date.now; lchr = lch; csor = 0; } window.onresize = resize; return; } pelem.setAttribute('style', 'display:block;width:100%;height:'+height_i+'px;margin:0 auto;'); if(fw == 0) { if(pelem.offsetWidth < width_i) { pelem.setAttribute('style', 'display:block;width:100%;height:'+height_i+'px;margin:0 auto;'); widgetOptions.rWidth = pelem.offsetWidth; } else { pelem.setAttribute('style', 'display:block;width:'+width_i+'px' + ';height:'+height_i+'px;margin:0 auto;'); widgetOptions.rWidth = width_i; } } else { pelem.setAttribute('style', 'display:block;width:100%' + ';height:'+height_i+'px;margin:0 auto;'); widgetOptions.rWidth = pelem.offsetWidth; } var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = "https://status-zakaza.ru/wdg/widget.js"; document.getElementsByTagName('head')[0].appendChild(script); function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode xScroll = document.documentElement.scrollWidth; yScroll = document.documentElement.scrollHeight; } else { // Explorer Mac...would also work in Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } return [pageWidth,pageHeight,windowWidth,windowHeight]; } function getElementPosition(elemId) { var elem = document.getElementById(elemId); var w = elem.offsetWidth; var h = elem.offsetHeight; var l = 0; var t = 0; while (elem) { l += elem.offsetLeft; t += elem.offsetTop; elem = elem.offsetParent; } return {"left":l, "top":t, "width": w, "height":h}; } })();