").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});if (typeof siteUrl == 'undefined') var siteUrl = '/'; if (typeof themeUrl == 'undefined') var themeUrl = '/design/default/'; if (typeof adminToken == 'undefined') var adminToken = ''; var adminUrl = siteUrl + 'admin'; if (typeof jsPolyglot == 'undefined') { if (typeof jsPolyglotClass == 'undefined') { function jsPolyglotClass () { this.get = function ( phrase ) { return phrase; }; }; } var jsPolyglot = new jsPolyglotClass(); } function startAdminTooltip () { var tooltipCanClose = false, tooltip, tooltipTarget, bookmark; function trimLeft ( text ) { return text.replace(/^([ \s\t\r\n]|*160;|*32;|*9;|*10;|*13;|*a0;|*20;|*9;|*a;|*d;| |)+/i, ''); }; function isActualString ( test ) { return typeof test == 'string' && trimLeft(test) != ''; }; function createBookmark () { var element = document.createElement('a'); element.setAttribute('href', adminUrl); element.setAttribute('class', 'dashboard'); element.setAttribute('rel', 'nofollow'); element.setAttribute( 'title', jsPolyglot.get('Go to Admin Panel') ); element.innerHTML = '

'; return element; }; function hide ( element ) { element.setAttribute('hidden', 'hidden'); }; function unhide ( element ) { element.removeAttribute('hidden'); }; function unspotTarget () { if (tooltipTarget != null) { tooltipTarget.classList.remove('admin-tooltip-target'); tooltipTarget = null; } }; function closeTooltip () { if (tooltipCanClose) { tooltipCanClose = false; hide(tooltip); unspotTarget(); } }; function createTooltip () { var element = document.createElement('aside'); element.setAttribute('class', 'admin-tooltip'); hide(element); listenMouseLeave(element); element.addEventListener( 'mouseover', function () { tooltipCanClose = false; }, false ); return element; }; function listenMouseLeave ( element ) { element.addEventListener( 'mouseleave', function () { tooltipCanClose = true; setTimeout(closeTooltip, 300); }, false ); }; function listenMouseOver () { var i, j, items; var selectors = [ '[data-country]', '[data-section]', '[data-category]', '[data-brand]', '[data-product]', '[data-kit]', '[data-news]', '[data-article]', '[data-file]', '[data-stock]', '[data-property]', '[data-currency]', '[data-setup]', '[data-config]', '[data-image]', '[data-photo-country]', '[data-photo-section]', '[data-photo-category]', '[data-photo-brand]', '[data-photo-product]', '[data-media-product]', '[data-photo-kit]', '[data-photo-news]', '[data-photo-article]', '[data-photo-file]', '[data-media-file]', '[data-photo-stock]', '[data-poly]' ]; for (i = 0; i < selectors.length; i++) { items = document.querySelectorAll(selectors[i]); for (j = 0; j < items.length; j++) { items[j].addEventListener( 'mouseover', showTooltip, false ); } } }; function init () { bookmark = createBookmark(); tooltip = createTooltip(); tooltipTarget = null; document.body.appendChild(bookmark); document.body.appendChild(tooltip); listenMouseOver(); }; function showTooltip () { tooltipCanClose = false; unhide(tooltip); unspotTarget(); tooltipTarget = this; tooltipTarget.classList.add('admin-tooltip-target'); listenMouseLeave(tooltipTarget); listenMouseLeave(tooltip); var needCenterVertical = false; var html = '', url = adminUrl + '?section=', module = '', moduleList = '', nodeId = '', id = '', token = '&token=' + encodeURIComponent(adminToken), from = '&from=' + encodeURIComponent(window.location), act = '&act='; if (this.hasAttribute('data-country')) { id = this.getAttribute('data-country'); if (id != 0) { module = 'Country'; moduleList = 'Countries'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a country page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-section')) { id = this.getAttribute('data-section'); if (id != 0) { module = 'Section'; moduleList = 'Sections'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a static page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-category')) { id = this.getAttribute('data-category'); if (id != 0) { module = 'Category'; moduleList = 'Categories'; nodeId = '&category_id=' + encodeURIComponent(id); id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a category page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add Product') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-brand')) { id = this.getAttribute('data-brand'); if (id != 0) { module = 'Brand'; moduleList = 'Brands'; nodeId = '&brand_id=' + encodeURIComponent(id); id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a brand page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add Product') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-product')) { id = this.getAttribute('data-product'); if (id != 0) { module = 'Product'; moduleList = 'Products'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a product page:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + ''; } } if (this.hasAttribute('data-kit')) { id = this.getAttribute('data-kit'); if (id != 0) { module = 'ProductsKit'; moduleList = 'ProductsKits'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a products kit page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-news')) { id = this.getAttribute('data-news'); if (id != 0) { module = 'NewsItem'; moduleList = 'News'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a blog post:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + ''; } } if (this.hasAttribute('data-article')) { id = this.getAttribute('data-article'); if (id != 0) { module = 'Article'; moduleList = 'Articles'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a review post:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + ''; } } if (this.hasAttribute('data-stock')) { id = this.getAttribute('data-stock'); if (id != 0) { module = 'Stock'; moduleList = 'Stocks'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a stock page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-file')) { id = this.getAttribute('data-file'); if (id != 0) { module = 'File'; moduleList = 'Files'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a mediafile page:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-property')) { id = this.getAttribute('data-property'); if (id != 0) { module = 'Property'; moduleList = 'Properties'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a product property:') + '' + '
' + '
' + '' + jsPolyglot.get('Move Up') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Add') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Hide') + '' + '' + '
' + '
' + '' + jsPolyglot.get('Move Down') + '' + ''; } } if (this.hasAttribute('data-currency')) { id = this.getAttribute('data-currency'); if (id != 0) { module = 'Currency'; moduleList = 'Currencies'; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a currency:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + ''; } } if (this.hasAttribute('data-setup')) { module = 'Setup'; html = '
' + jsPolyglot.get('This is a setting:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + ''; } if (this.hasAttribute('data-config')) { module = 'ConfigFile'; html = '
' + jsPolyglot.get('This is a config parameter:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + ''; } if (this.hasAttribute('data-image')) { needCenterVertical = true; id = this.getAttribute('data-image'); id = isActualString(id) ? ('&item_id=' + encodeURIComponent(id)) : ''; module = 'Images'; html = '
' + jsPolyglot.get('This is a template image:') + '' + '
' + '
' + '' + jsPolyglot.get('Replace') + '' + ''; } if (id = this.getAttribute('data-photo-country')) module = 'Country'; else if (id = this.getAttribute('data-photo-section')) module = 'Section'; else if (id = this.getAttribute('data-photo-category')) module = 'Category'; else if (id = this.getAttribute('data-photo-brand')) module = 'Brand'; else if (id = this.getAttribute('data-photo-product')) module = 'Product'; else if (id = this.getAttribute('data-photo-kit')) module = 'ProductsKit'; else if (id = this.getAttribute('data-photo-news')) module = 'NewsItem'; else if (id = this.getAttribute('data-photo-article')) module = 'Article'; else if (id = this.getAttribute('data-photo-file')) module = 'File'; else if (id = this.getAttribute('data-photo-stock')) module = 'Stock'; else id = ''; if (isActualString(id)) { needCenterVertical = true; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a ' + module + ' photo:') + '' + '
' + '
' + '' + jsPolyglot.get('Replace') + '' + ''; } if (id = this.getAttribute('data-media-product')) module = 'Product'; else if (id = this.getAttribute('data-media-file')) module = 'File'; else id = ''; if (isActualString(id)) { needCenterVertical = true; id = '&item_id=' + encodeURIComponent(id); html = '
' + jsPolyglot.get('This is a ' + module + ' attachment:') + '' + '
' + '
' + '' + jsPolyglot.get('Replace') + '' + ''; } if (this.hasAttribute('data-poly')) { module = 'Templates'; id = '&item_id=modules'; html = '
' + jsPolyglot.get('This is a polyglot text:') + '' + '
' + '
' + '' + jsPolyglot.get('Edit') + '' + ''; } tooltip.innerHTML = html; var bodyWidth = $('body').width(), bodyHeight = $('body').height(), tooltipWidth = $(tooltip).width(), tooltipHeight = $(tooltip).height(), itemWidth = $(this).outerWidth(), itemHeight = $(this).height(), itemLeft = $(this).offset().left, itemLeftOffset = itemWidth * .5, itemTop = $(this).offset().top, itemTopOffset = (needCenterVertical ? -(itemHeight * .5) : 0); var flipHorizontal = itemLeft + tooltipWidth + 16 > bodyWidth, flipVertical = itemTop + itemTopOffset + tooltipHeight + 16 > bodyHeight; tooltip.style = 'top: ' + (itemTop + itemTopOffset + 4 + itemHeight - (flipVertical ? tooltipHeight + 4 : 0)) + 'px; ' + 'left: ' + (itemLeft + itemLeftOffset - (flipHorizontal ? tooltipWidth - 40 : 0)) + 'px'; }; init(); }; startAdminTooltip();
