D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
htdocs
/
modules
/
site-import
/
scripts
/
Filename :
hint.js
back
Copy
// Copyright 1999-2018. Plesk International GmbH. All Rights Reserved. function getHint(message, element) { return { _elementHint: null, _elementHintPopover: null, _doNotShowAnymore: false, show: function () { if (this._elementHint) { return; // already visible } if (this._doNotShowAnymore) { return; // use clicked close button - do not bother him/her anymore } var elementSourceUrlHintCloseButton = new Element('button', {'class': 'site-import-hint-close-button'}).insert( new Element('span', {'class': 'site-import-hint-close-button-icon'}).update( '<svg><use xlink:href="' + migratorImage('symbols.svg') + '#i-cross-mark"></use></svg>' ) ); this._elementHintPopover = new Element( 'div', {'class': 'site-import-hint-popover', 'style': 'position: absolute; z-index: 1050;'} ).insert( new Element( 'div', {'class': 'site-import-hint-popover-inner'} ).insert( elementSourceUrlHintCloseButton ).insert( new Element('div', {'class': 'site-import-hint-popover-content'}).insert( new Element('p').update(message) ) ) ).insert( new Element('span', {'class': 'site-import-hint-popover-arrow', 'style': 'top: 0px;'}) ); this._elementHint = new Element( 'div', {'class': 'site-import-hint-layer'} ).insert( this._elementHintPopover ); this.updatePosition(); $(document.body).insert(this._elementHint); var self = this; elementSourceUrlHintCloseButton.observe('click', function () { self.hide(); self._doNotShowAnymore = true; }); window.addEventListener('resize', function (event) { self.updatePositionMultipleTimes(50, 1000); }); }, hide: function () { if (!this._elementHint) { return; } this._elementHint.remove(); this._elementHint = null; this._elementHintPopover = null; }, updatePosition: function () { if (!this._elementHintPopover) { return; } this._elementHintPopover.style.left = ( element.cumulativeOffset().left + element.getWidth() ) + 'px'; this._elementHintPopover.style.top = element.cumulativeOffset().top + 'px'; }, // If bound element moves smoothly, it is required to update position // multiple times until bound element stops moving. updatePositionMultipleTimes: function (updateDelay, duration) { var self = this; this.updatePosition(); if (duration > 0) { setTimeout( function() { self.updatePositionMultipleTimes(updateDelay, duration - updateDelay); }, updateDelay ); } } }; }