PageSourceSearch

https://meshdesign.net/designs/feed/ozfeed/template.js?26.11.18.1

js meshdesign.net collected 2026-10-10 02:11:13 UTC 11,148 bytes, 283 lines download raw bytes

1var isIE = testIE();
2var checkInterval = 200;
3var preloadDistance = ($("#page_type").val() == "index") ? 500 : 1500;
4var isUpdating = false;
5var mouseState = "up";
6var base_scroll = getScrollHeight();
7var padding = 250;
8var in_transition = false;
9var entry_timer = cur_select = prev_scroll_pos = 0;
10var id;
11var scrollPos = 0;
12viewport_threshold = 25; 
13var prevRailTop = 0;
14var activeRailTop = 0;
15/////////////////////////////////////////////////////////////////////////////////////////////////
16$(document).ready(function() { 
17	checkForSound(); 
18	$(document).trigger("keyboardShortcuts", [ "feed" ]);	
19	$(document).trigger("loadSearch");
20	$(document).trigger("initToolset");
21	viewport_threshold = $(".feed_header").height() - 2;
22	document.onmousedown = onMouseDown;
23	document.onmouseup = onMouseUp;
24
25	id = $("page_id").value;
26
27	var fromBackButton = false;
28    
29    $("a.next_post").click(function(e) { 
30   		$(document).trigger("showNextFeedProject");    	
31    	e.preventDefault();
32    });
33    
34    $("#moreload_link a").click(function(e) { 
35    	getMoreHistory();
36    	e.preventDefault();
37    });
38	
39	// Move the filter link
40	$(".feed_nav").append($(".view_tag_info"));
41	
42	setRail();
43	$(".entry:first, .project_rail:first").css("borderTop", "1px solid transparent");
44	
45	// Hack to remove the clickability on the <a> in the title on direct links
46	if($("#null_link").length > 0) {
47		$("#null_link").after('<div id="null_div">'+$("#null_link").html()+'</div>');
48
49		$("#null_div").css( {
50		    "color" 			: $("#null_link").css("color"),
51		    "background-color" 	: $("#null_link").css("background-color"),
52		    "text-decoration" 	: $("#null_link").css("text-decoration")
53		} );
54		
55		$("#null_link").remove();
56	}
57	
58	updateScroll();
59	
60	// prevent project rail from stacking up
61	var railFailsafe = setInterval(function(){
62    	$(".project_rail").each(function() { 
63	    	var closestEntry = $(this).closest('.entry');
64	    	
65			if ( closestEntry.offset().top + closestEntry.height() < scrollPos ) {
66	    		
67	    		$(this).css({
68	        		"position":"absolute",
69	        		"top":( closestEntry.height()-$(this).height()  )
70	    		});
71			}
72		});
73	}, 250);
74	
75	Projects.Slideshow.CheckForSlideshow();
76});
77
78////////////////////////////////////////////////////////////////
79function updateScroll(){
80	requestAnimationFrame(updateScroll);
81	
82	var oldScroll = scrollPos;
83	scrollPos = $(window).scrollTop();
84	scrollDelta = scrollPos - oldScroll;
85	
86    if($(".index_view").length == 0) projectRailScroll();
87    if($(".search_results").length == 0) {
88        var within_bounds = ((scrollPos+window.innerHeight) >= ($("body").height()-preloadDistance)) ? true : false;
89        if ((isIE && !isUpdating && within_bounds) || (!isIE && !isUpdating && within_bounds)) {
90        	isUpdating = true;
91			getMoreHistory();
92        }
93	}
94};
95
96/////////////////////////////////////////////////////////////////////////////////////////////////
97function setRail() {
98	$(".entry:not(:has(>.project_rail))").each(function() {
99		$(this).prepend("<div class='project_rail' />");
100		$(".project_title", this).prependTo($(".project_rail", this));
101		$(this).next(".project_footer").appendTo($(".project_rail", this));
102		$(".permalink", this).appendTo($(".project_footer", this));
103		$(".comment_link", this).appendTo($(".project_footer", this));
104		$(".editlink", this).appendTo($(".project_footer", this));
105		$(this).css("minHeight", $(".project_rail", this).height() - 35);
106		$(".project_footer", this).html(function(i, h) {
107            return h.replace(/&nbsp;/gi, "");
108        });
109        $(".project_footer", this).html(function(i, h) {
110            return h.replace(/,/gi, "");
111        });
112        $(".project_footer", this).html(function(i, h) {
113            return h.replace(/Filed under /gi, "");
114        });
115	});
116}
117/////////////////////////////////////////////////////////////////////////////////////////////////
118function projectRailScroll() {
119	var firstProjectID = $(".entry:first").attr("id");
120		firstProjectID =  "#"+firstProjectID;
121	var feedHeaderHeight = $(".feed_header").height() - 1;
122	//var previousProject = activeProjectHeight = activeProject = activeRailHeight = activeRailTop = activeProjectTop = "";
123	var isRubberBanding = false;
124	var activeProject = 0;
125	
126	    if ( scrollPos > -1 && $(document).height() - window.innerHeight > scrollPos ){
127		    isRubberBanding = false;
128	    } else {
129		    isRubberBanding = true;
130	    }
131    		
132		$(".entry:in-viewport").each(function() {
133          activeProject = "#"+$(this).attr("id");
134        });
135        
136        activeProjectHeight = $(activeProject).height();
137        activeProjectTop = ($(activeProject).length > 0) ? $(activeProject).offset().top : false;
138        prevRailTop = activeRailTop;
139        if ( $(activeProject).length > 0) {
140	        if ( scrollDelta >= 0 ) {		        
141            	activeRailTop = Math.max( $(activeProject+ " .project_rail").offset().top, prevRailTop );
142        	} else {
143            	activeRailTop = $(activeProject+ " .project_rail").offset().top;
144        	}
145	        activeRailHeight = $(activeProject+ " .project_rail").height();
146            
147        } else {
148	        activeRailTop = 0;
149	        activeRailHeight = 0;
150        } 
151        
152        $(activeProject+ " .project_rail").css({"position":"fixed","top":feedHeaderHeight});	        
153        
154        // When projects are below the scroll, set them to position to
154p
155        if(activeProjectTop-activeProjectHeight <= scrollPos + feedHeaderHeight) {
156        	$(".project_rail").each(function() { 	        	
157        		if($(this).offset().top >= scrollPos + feedHeaderHeight) {
158        			$(this).css({"position":"absolute","top":"0"});
159        		
160        		}
161        	});
162        }
163        
164        // if this is the first project, set to the top
165        if(activeProject == firstProjectID){
166        	$(firstProjectID+ " .project_rail").css({"position":"absolute","top":"0"});
167        }
168
169		// if the active project rail hits the bottom of the project, stick there
170        if(activeProjectTop && activeProjectHeight-activeRailHeight+activeProjectTop <= scrollPos + feedHeaderHeight) {
171        	$(activeProject+ " .project_rail").css({"position":"absolute","top":(activeProjectHeight-activeRailHeight)});
172        
173        // if the active project is within our viewport	
174        } else if(activeProjectTop && activeProjectTop <= scrollPos + feedHeaderHeight) {
175        	// if the rail hits the project top, stick to the top
176        	if( activeRailTop <= activeProjectTop  ) {
177        		$(activeProject+ " .project_rail").css({"position":"absolute","top":"0"});
178        	
179        	// otherwise, move with the scroll
180        	} else {
181        		$(activeProject+ " .project_rail").css({"position":"fixed","top":feedHeaderHeight});
182        	}
183        }
184}
185/////////////////////////////////////////////////////////////////////////////////////////////////
186$(document).bind("paginationComplete", function(e, dataObj) {	
187	setRail();
188});
189/////////////////////////////////////////////////////////////////////////////////////////////////
190function testIE() {
191	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) return true;
192	else return false;
193}
194/////////////////////////////////////////////////////////////////////////////////////////////////		
195function getMoreHistory() {
196	var indexVal = parseInt($("#current_page").val());
197	var url = $("#url").val();
198	var cat= $("#cat").val();
199	var design= $("#design").val();
200	var viewtype = (parent.length > 0) ? "admin" : "list";
201	if (indexVal <= parseInt($("#total_pages").val())) {
202		$.post("/designs/feed/"+$("#page_type").val()+"-pagination.php", { url: url, cat: cat, design: design, startRow: indexVal, viewtype: viewtype  },addMoreHistory);
203		$("#moreload").show();
204		$("#moreload_link").hide();
205	} else {
206		$("#moreload_link").hide();
207	}
208	return false;
209}
210/////////////////////////////////////////////////////////////////////////////////////////////////
211function failure() {
212	$("#new_page_content").innerHTML = "<p><strong>Could not contact the server.</strong><br />Please wait awhile and try again. <br /><br />We apologize for the inconvenience.</p>";
213}
214/////////////////////////////////////////////////////////////////////////////////////////////////
215function addMoreHistory(data) {
216	$(document).trigger("paginationStart");
217	response = data.substring(0, data.length)
218	if (response == "No results") {
219		$("#moreload").hide();
220		$("#moreload_link").hide();
221	} else {
222		//$("#new_page_content").html($("#new_page_content").html() + response);
223		$("#new_page_content").before(response);
224		$("#moreload").hide();
225		$("#moreload_link").show();
226		$("#current_page").val(parseInt($("#current_page").val()) + parseInt($("#page_limit").val()));
227	}
228	if (navigator.userAgent.indexOf("Safari") == -1 && jQuery.isFunction($.fn.lazyload)) {
229		$("#content_container img").each(function() {
230			if($(this).attr("src") == "_gfx/whiterati.gif") $(this).attr("src",$(this).attr("original"))
231		});
232		$("#content_container img").lazyload({ placeholder : "_gfx/whiterati.gif",  threshold : 100, effect : "fadeIn" });
233	}
234	isUpdating = false;
235	
236	Projects.Slideshow.CheckForSlideshow();
237	
238	if (typeof projectLoadComplete == "function") projectLoadComplete();
239	$(document).trigger("paginationComplete");
240}
241/////////////////////////////////////////////////////////////////////////////////////////////////
242function onMouseDown(){
243	mouseState = "down";
244}
245/////////////////////////////////////////////////////////////////////////////////////////////////
246function onMouseUp(){
247	mouseState = "up";
248}
249/////////////////////////////////////////////////////////////////////////////////////////////////
250
251
252
253// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
254// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
255 
256// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
257 
258// MIT license
259 
260(function() {
261    var lastTime = 0;
262    var vendors = ['ms', 'moz', 'webkit', 'o'];
263    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
264        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
265        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 
266                                   || window[vendors[x]+'CancelRequestAnimationFrame'];
267    }
268 
269    if (!window.requestAnimationFrame)
270        window.requestAnimationFrame = function(callback, element) {
271            var currTime = new Date().getTime();
272            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
273            var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 
274              timeToCall);
275            lastTime = currTime + timeToCall;
276            return id;
277        };
278 
279    if (!window.cancelAnimationFrame)
280        window.cancelAnimationFrame = function(id) {
281            clearTimeout(id);
282        };
283}());

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.