PageSourceSearch

https://911-see-the-evidence.com/bookflip_v4/bookflipjs/bookflip.js

js 911-see-the-evidence.com collected 2026-10-04 18:18:23 UTC 10,506 bytes, 351 lines download raw bytes

1/****************************************************************************
2//** Software License Agreement (BSD License)
3//** Book Flip slideshow script- Copyright 2011, Will Jones (coastworx.com)
4//** This Script is wholly developed and owned by CoastWorx.com
5//** Copywrite: http://www.coastworx.com/
6//** You are free to use this script so long as this coptwrite notices
7//** and link back to http://www.coastworx.com stays intact in its entirety.
8//** If you want to remove the link back to http://www.coastworx.com then purchase a licence.
9//** You are NOT Permitted to claim this script as your own or
10//** use this script for commercial purposes without the express
11//** permission of CoastWorx Technologies!
12//***************************************************************************/
13
14
15//globals advanced------------------->
16var myBook,p1,p2,p3,p4;
17var pageBorderColor="#000000",pageBorderStyle="solid",pageBorderWidth="1";
18var leftCoverPageBorder=false,leftCoverPageBorderColor="#ffffff";
19var startingPage=0;
20var pageBackgroundColor="#CCCCCC",pageFontColor="#ffffff";
21var isMoving=false;
22var nextPage=0;
23
24var ID,numPixels=20;
25var pWidth=300;
26var pHeight=361;
27var pSpeed=15;
28var counter=0;
29var allowPageClick=true;
30var allowNavigation=true,allowAutoflipFromUrl = false;
31var pageShadow=0,pageShadowWidth=80,pageShadowOpacity=60;
32var pageShadowLeftImgUrl  ="black_gradient.png";
33var pageShadowRightImgUrl ="black_gradientr.png";
34var pageNumberPrefix="page ";
35var pBorders;
36var pages=new Array;
37
38function ini(){
39	pBorders=parseInt(pageBorderWidth)*2;
40	var pagesDiv=document.getElementById("pages");
41	j=0;
42	for(var i=0;i<pagesDiv.childNodes.length;i++){
43		if(pagesDiv.childNodes[i].nodeType == 1){ //element nodes only
44
45			var newElement = pagesDiv.childNodes[i].cloneNode(true);
46			newElement.style.width=pWidth+"px";
47			newElement.style.height=pHeight+"px";
48
49			document.getElementById("bookflip").appendChild(newElement);
50
51			if(pageShadow){createShadow(newElement,j);}; //shadow function
52			if(j>0){createList(newElement,j);}; //create dropdown navigation list
53
54
55			pages[j] = document.getElementById("bookflip").innerHTML;
56			//alert(pages[j]);
57			document.getElementById("bookflip").removeChild(newElement);
58			j++;
59		}
60	}
61	if(myBook=document.getElementById("bookflip")){
62
63		myBook.style.width=((pWidth*2)+(pBorders*2))+'px';
64		myBook.style.height=(pHeight+pBorders)+'px';
65		myBook.style.position="relative";
66		myBook.style.zIndex="0";
67		myBook.style.overflow="hidden";
68
69		for(i=4;i>=1;i--){
70			var myDiv = document.createElement('div');
71			myDiv.style.position="absolute";
72			myDiv.style.left=(pWidth+pBorders)+'px';
73			myDiv.style.top="0px";
74			myDiv.style.width=(pWidth)+"px";
75
76			myDiv.style.height=(pHeight)+"px";
77			myDiv.style.margin="0px";
78			myDiv.style.overflow="hidden";
79			myDiv.style.backgroundColor=pageBackgroundColor;
80			myDiv.style.color=pageFontColor;
81
82			myDiv.style.borderWidth=pageBorderWidth + "px";
83			myDiv.style.borderColor=pageBorderColor;
84			myDiv.style.borderStyle=pageBorderStyle;
85
86			myDiv.setAttribute("id","p"+i);
87
88			myBook.appendChild(myDiv);
89			document.getElementById("p"+i).innerHTML=pages[i-1];
90
91			//turn page by direct click
92			if(allowPageClick){
93				if(number_check(i)){
94					myDiv.onclick=function(e){whichElement(e,true);};
95				}else{
96					myDiv.onclick=function(e){whichElement(e,false);};
97				}
98			}
99			//end page click
100		}
101
102			p1=document.getElementById("p1");
103			p2=document.getElementById("p2");
104			p1.style.left=0+"px";
105			startingPageUrl=0;
106
107			if(allowAutoflipFromUrl){startingPageUrl=autoflipFromUrl();};	//check url or variable for starting page
108			if(startingPageUrl){startingPage=startingPageUrl;};
109			if(startingPage=="e"){startingPage=pages.length-2;};
110			startingPage=parseInt(startingPage);
111			if(startingPage>0){autoFlip(startingPage);};//autoflip on book start up
112	}
113}
114
115function rotateDivs(){
116	if(counter>0){
117		p1=document.getElementById("p1");
118		p2=document.getElementById("p2");
119		p3=document.getElementById("p3");
120		p4=document.getElementById("p4");
121		counter=0;
122
123	}else{
124		p1=document.getElementById("p3");
125		p2=document.getElementById("p4");
126		p3=document.getElementById("p1");
127		p4=document.getElementById("p2");
128		counter=1;
129	}
130}
131
132function clipmeR(){
133	if(isMoving || nextPage<2){return;};
134	isMoving=true;
135
136	rotateDivs();
137
138	p1.innerHTML=pages[nextPage-2];
139	p2.innerHTML=pages[nextPage-1];
140
141	nextPage=nextPage-2;
142	p1.style.clip="rect(0px,"+0+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left)
143	p1.style.zIndex=3;
144	p3.style.zIndex=1;
145	p2.style.clip="rect(0px,"+0+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left)
146	p2.style.zIndex=4;
147	p4.style.zIndex=2;
148
149	selectIndex = nextPage-1;
150	if(selectIndex<0){selectIndex=0;};
151	if(allowNavigation && document.getElementById("flipSelect")){
152		document.getElementById("flipSelect").selectedIndex=selectIndex;
153	}
154
155	goleft(-pWidth,pWidth);
156}
157function goleft(currLeft,currWidth){
158	if(currLeft >=(pWidth-(numPixels*2))){
159		window.clearTimeout(ID);
160		p2.style.left=(pWidth+pBorders)+"px";
161		p1.style.clip=p2.style.clip="rect(0px,"+(pWidth+pBorders)+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left)
162		isMoving=false;
163		return;
164	}
165	currLeft=currLeft+(numPixels*2);//2 * width reveal
166	currWidth = currWidth-numPixels;
167	hideWidth=pWidth-currWidth;
168	p1.style.clip="rect(0px,"+hideWidth+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left) //low to high
169
170	p2.style.clip="rect(0px,"+(pWidth+pBorders)+"px,"+(pHeight+pBorders)+"px,"+currWidth+"px)";//rect(top,right,bottom,left)
171	p2.style.left=currLeft+'px';
172
173	ID = window.setTimeout('goleft('+currLeft+','+currWidth+')',pSpeed);
174}
175function clipmeL(){
176	if(isMoving || (nextPage+4) > pages.length){return;};
177
178	isMoving=true;
179	rotateDivs();
180	//p1.style.borderColor=pageBorderColor; //reset left cover border color
181
182	p1.innerHTML=pages[nextPage+2];
183	p2.innerHTML=pages[nextPage+3];
184	nextPage=nextPage+2;
185
186	p1.style.clip="rect(0px,"+0+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left) clip
187	p1.style.zIndex=5;
188	p2.style.clip="rect(0px,"+0+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left) clip
189
190	p2.style.zIndex=4;
191	p3.style.zIndex=2;
192	p4.style.zIndex=1;
193
194	selectIndex = nextPage-1;
195	if(selectIndex<0){selectIndex=0;};
196	if(allowNavigation && document.getElementById("flipSelect")){
197		document.getElementById("flipSelect").selectedIndex=selectIndex;
198	}
199
200	goright(pWidth*2,0);
201}
202function goright(currLeft,currWidth){
203	if(currLeft <= numPixels*2){
204		//alert("");
205
206		window.clearTimeout(ID);
207		p1.style.clip=p2.style.clip="rect(0px,"+(pWidth+pBorders)+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left)
208		p1.style.left=0+'px';
209		p2.style.left=(pWidth+pBorders)+'px';
210
211		isMoving=false;
212		return;
213	}
214	currLeft=currLeft-(numPixels*2);//2 * width reveal
215	currWidth=currWidth+numPixels;
216	hideWidth = currLeft-pWidth;
217
218	p1.style.clip="rect(0px,"+currWidth+"px,"+(pHeight+pBorders)+"px,"+0+"px)";//rect(top,right,bottom,left) clip
219	p1.style.left=currLeft+'px';
220
221	p2.style.clip="rect(0px,"+(pWidth+pBorders)+"px,"+(pHeight+pBorders)+"px,"+hideWidth+"px)";//rect(top,right,bottom,left)
222	ID = window.setTimeout('goright('+currLeft+','+currWidth+')',pSpeed);
223}
224
225
226function autoFlip(pgNumber){
227	pgNumber=parseInt(pgNumber);
228	chcknextPage=nextPage;
229
230	if(!number_check(pgNumber)){
231		nextPage=pgNumber-1;
232	}else{
233		nextPage=pgNumber-2;
234	}
235	if(pgNumber>chcknextPage){
236		clipmeL();
237	}else{
238		nextPage=nextPage+4;
239		clipmeR();
240	}
241}
242
243//-->worker functions
244function createList(dv,num){
245	if( allowNavigation && document.getElementById("flipSelect") ){
246	num=num-1;
247		var y=document.createElement('option');
248		if(num==0){
249			if(dv.getAttribute("name")){
250				y.text=dv.getAttribute("name");
251			}else{
252				y.text="Cover ";
253			}
254		}else{
255			if(dv.getAttribute("name")){
256				y.text=dv.getAttribute("name");
257			}else{
258				y.text = pageNumberPrefix + num;
259			}
260		}
261		y.value=num;
262		//y.selected="selected";
263			var x=document.getElementById("flipSelect");
264		x.style.display="";
265		x.onchange=function() {this.blur();document.body.focus();autoFlip(this.value);};
266		try{
267			x.add(y,null); // standards compliant
268		}catch(ex){
269			x.add(y); // IE only
270		}
271	}
272}
273
274function createShadow(dv,pg){
275		//alert(pg);
276	if(pg < 1){return};//no shadow page 0
277	if(number_check(pg)){
278
279		var myPngDiv = document.createElement('div');
280		myPngDiv.style.position="absolute";
281		myPngDiv.style.top="0px";
282		myPngDiv.style.left=(pWidth-pageShadowWidth)+'px';
283
284		myPngDiv.style.width=(pageShadowWidth)+"px";
285		myPngDiv.style.height=pHeight+"px";
286		myPngDiv.style.backgroundColor="#000000";
287
288		var ie6 = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
289
290		if( ie6 ) {
291			myPngDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity="+pageShadowOpacity+", FinishOpacity=0, Style=1, StartX="+pageShadowWidth+", FinishX=0, StartY=0, FinishY=0)";
292		}else{
293			myPngDiv.style.background="transparent url("+pageShadowLeftImgUrl+") top right repeat-y";
294		}
295		dv.appendChild(myPngDiv);
296	}
297}
298
299function whichElement(e,dir){
300	var targ;
301	if (!e){
302		var e = window.event;
303	}
304
305	if (e.target){
306		targ = e.target;
307	}else if (e.srcElement) {
308		targ = e.srcElement;
309	}
310
311	if (targ.nodeType == 3){ // defeat Safari bug
312		targ = targ.parentNode;
313	}
314
315	//var tname;
316	pname=targ.parentNode.tagName;
317
318	tname=targ.tagName;
319	if(tname=="A" || tname=="INPUT" || pname=="A" || pname=="INPUT" ){
320		//alert("You clicked on a " + tname + " element. pname:"+pname);
321		return false;
322	}else{
323//		alert("You clicked on a " + tname + " element. pname:"+pname);
324		if(dir){
325			return clipmeL();
326		}else{
327			return clipmeR();
328		}
329	}
330}
331
332function number_check(value) {
333  //  returns true if value is even, false if value is odd
334      return ( 1 - (value%2) )
335}
336
337//get querystring to obtain autoflip value
338function autoflipFromUrl(){
339	var pos;
340	var searchStr = window.location.search;
341	var searchArray = searchStr.substring(1,searchStr.length).split('&');
342	var result = '';
343	for (var i=0; i<searchArray.length; i++) {
344		result = searchArray[i].split('=');
345		if(result[0]=="autoflip"){
346			result=result[1];
347			break;
348		}
349	}
350	return(result);
351}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.