pastebin

About this pastebin

Welcome to the bulix.org / pastebin. Please don't use this pastebin for illegal purposes, defamation or kitten-squashing.

This pastebin is written using PHP and MySQL and relies on Alex Gorbatchev's syntax hhighlighter (JavaScript based). To avoid spam, you will be required to complete a small mathematical challenge when adding a new paste.

Pastebin

Paste #11839: difference between pageWidth,pageHeight,windowWidth,windowHeight

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
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 { // Explorer Mac...would also work in Explorer 6 Strict, 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;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

New paste

  Language:
Private   — Wrap long lines  —  1 + 3 =   —  

30 more recent public pastes


# Title Type Date
1 Untitled ASCII paste by 195.168.200.112 ASCII 20 Nov 2008, 21:48
2 Untitled ASCII paste by 91.172.54.239 ASCII 20 Nov 2008, 21:19
3 Untitled C++ paste by 24.190.28.19 C++ 20 Nov 2008, 01:26
4 aaaaa ASCII 19 Nov 2008, 20:11
5 Untitled ASCII paste by 116.49.67.17 ASCII 19 Nov 2008, 08:11
6 Untitled ASCII paste by 24.22.59.84 ASCII 19 Nov 2008, 00:25
7 Python xlutils Filters Python 19 Nov 2008, 00:09
8 Untitled ASCII paste by 85.195.3.209 ASCII 18 Nov 2008, 22:04
9 Untitled ASCII paste by 85.195.3.209 ASCII 18 Nov 2008, 22:02
10 Untitled ASCII paste by 86.138.25.57 ASCII 18 Nov 2008, 13:49
11 Untitled XML/HTML paste by 90.227.235.228 XML/HTML 18 Nov 2008, 13:37
12 xorg.conf ASCII 18 Nov 2008, 07:35
13 Untitled PHP paste by 168.120.50.72 PHP 17 Nov 2008, 05:53
14 Untitled ASCII paste by 76.106.0.187 ASCII 17 Nov 2008, 02:39
15 Common Functions PHP 17 Nov 2008, 01:19
16 Untitled PHP paste by 76.106.0.187 PHP 17 Nov 2008, 01:05
17 Untitled PHP paste by 76.106.0.187 PHP 17 Nov 2008, 00:57
18 Login PHP 17 Nov 2008, 00:55
19 Untitled Visual Basic paste by 217.211.80.109 Visual Basic 16 Nov 2008, 21:58
20 Untitled ASCII paste by 64.198.244.3 ASCII 16 Nov 2008, 20:34
21 Untitled ASCII paste by 64.198.244.3 ASCII 16 Nov 2008, 20:28
22 nvidia make log ASCII 15 Nov 2008, 15:33
23 Untitled ASCII paste by 86.164.113.159 ASCII 13 Nov 2008, 23:27
24 Untitled Java paste by 87.194.35.141 Java 13 Nov 2008, 16:43
25 Untitled ASCII paste by 82.243.231.30 ASCII 12 Nov 2008, 02:36
26 Untitled ASCII paste by 76.178.26.234 ASCII 11 Nov 2008, 23:34
27 java version ASCII 11 Nov 2008, 23:31
28 Untitled C++ paste by 86.129.206.36 C++ 11 Nov 2008, 22:51
29 Untitled C++ paste by 86.129.206.36 C++ 11 Nov 2008, 22:42
30 Untitled ASCII paste by 76.121.208.173 ASCII 11 Nov 2008, 13:00

Powered by the Bulix.org Code Pastebin, by Maxime Petazzoni. View pastebin statistics.