Ultimate Div Popup

This is for use in a script use with @require.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/1638/4073/Ultimate%20Div%20Popup.js

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           Ultimate Div Popup
// @description    This is for use in a script use with @require.
// @exclude        *
// ==/UserScript==
function createDivPopup(content,css,bgImage,imp){
	if(!content){content='';}
	if(!css){css='';}
	if(!bgImage){bgImage='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kJCwEbAIsAo5oAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12NgYGCoBwAAhACAxkwJbwAAAABJRU5ErkJggg==';}
	if(!imp){imp=''}
	var pageHeight=window.innerHeight;
	var pageWidth=window.innerWidth;
	var div=document.createElement('div');
	div.id='GM_divPopup';
	div.setAttribute('style','z-index:9001/* its over nine thousand*/'+imp+';width:100%'+imp+';height:100%'+imp+';position:fixed'+imp+';top:0px'+imp+';left:0px'+imp+';background-repeat:repeat'+imp+';background-image:url('+bgImage+')'+imp+'');
	div.innerHTML='<style type="text/css">'+css+'</style>'+
		'<a id="GM_closeDivPopup" style="border: 5px solid white'+imp+'; padding: 5px'+imp+';-moz-border-radius: 10px'+imp+';text-decoration: none'+imp+'; color: white'+imp+'; position: absolute'+imp+'; top: 5px'+imp+'; right: 5px'+imp+';z-index:9002'+imp+';background-color:black'+imp+';" onclick="this.parentNode.parentNode.removeChild(this.parentNode);return false">Close</a>'+
		'<div style="margin-left:58px'+imp+';margin-top:41px'+imp+';height:'+(pageHeight-82)+'px'+imp+';width:'+(pageWidth-116)+'px'+imp+';">'+
			'<div>'+
				'<table id="GM_divPopupContentHolder" style="margin-left:auto'+imp+';margin-right:auto'+imp+';"><tr><td>'+content+'</td></tr></table>'+
			'</div>'+
		'</div>';
	document.body.appendChild(div);
	var contentHolder=document.getElementById('GM_divPopupContentHolder');
	var topMargin=pageHeight/2-contentHolder.offsetHeight/2;
	if (topMargin<0){topMargin=0;}
	contentHolder.parentNode.setAttribute('style','max-height:'+(pageHeight-82)+'px'+imp+';max-width:'+(pageWidth-116)+'px'+imp+';width:'+(contentHolder.offsetWidth+20)+'px'+imp+';height:'+(contentHolder.offsetHeight+20)+'px'+imp+';margin-top:'+topMargin+'px'+imp+';margin-left:auto'+imp+';margin-right:auto'+imp+';overflow:auto'+imp+';');
}