PageSourceSearch

http://www.newmediaexplorer.org/chris/quicksub.js

js newmediaexplorer.org collected 2026-10-02 07:37:01 UTC 8,647 bytes, 245 lines download raw bytes

1//\//////////////////////////////////////////////////////////////////////////////////
2//\  quickSub 0.3.5
3//\  Copyright Jason Brome 2003-2005. All rights reserved.
4//\
5//\  By Jason Brome ([email protected]).  Last modified 2005-05-30
6//\  http://www.methodize.org/quicksub/
7//\
8//\  Inspired by the overLIB script by Erik Bosrup ([email protected])
9//\  http://www.bosrup.com/web/overlib/
10//\
11//\  This program is free software; you can redistribute it and/or
12//\  modify it under the terms of the GNU General Public License
13//\  as published by the Free Software Foundation; either version 2
14//\  of the License, or (at your option) any later version.
15//\
16//\  This program is distributed in the hope that it will be useful,
17//\  but WITHOUT ANY WARRANTY; without even the implied warranty of
18//\  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19//\  GNU General Public License for more details.
20//\
21//\  You should have received a copy of the GNU General Public License
22//\  along with this program; if not, write to the Free Software
23//\  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24//\
25//\  Revision History
26//\  0.3.5 Added FeedDemon, Moved Fyuze, Syndirella to Others...
27
28var ESCAPED = 1;
29var UNESCAPED = 2;
30
31var aggregators = new Array( 
32	"AmphetaDesk", "http://127.0.0.1:8888/index.html?add_url=", ESCAPED,
33	"Awasu", "http://127.0.0.1:2604/subscribe?url=", ESCAPED,
34	"Bloglines", "http://www.bloglines.com/sub/", UNESCAPED,
35	"Bot A Blog", "http://www.botablog.com/botthisblog.php?blog=", ESCAPED,
36	"BottomFeeder", "http://127.0.0.1:8666/btf?rss=", ESCAPED,
37	"FeedDemon", "feed:", UNESCAPED,
38	"Headline Viewer", "http://127.0.0.1:8900/add_provider?url=", ESCAPED,
39	"mobilerss", "http://www.mobilerss.net/fastfeed.php?url=", ESCAPED,
40	"My Yahoo!", "http://add.my.yahoo.com/rss?url=", ESCAPED,
41	"NetNewsWire", "feed:", UNESCAPED,
42	"NewsGator Online Services", "http://services.newsgator.com/subscriber/subext.aspx?url=", ESCAPED,
43	"NewsMonster", "newsmonster-subscription:", UNESCAPED,
44	"NewzCrawler", "feed:", UNESCAPED,
45	"nntp//rss", "http://127.0.0.1:7810/?action=addform&URL=", ESCAPED,
46	"Python Desktop Server", "http://127.0.0.1:4334/aggregator/add_redir?url=", ESCAPED,
47	"Radio UserLand", "http://127.0.0.1:5335/system/pages/subscriptions?url=", ESCAPED,
48	"RSS Bandit", "feed:", UNESCAPED,
49	"SharpReader", "http://127.0.0.1:5335/system/pages/subscriptions?url=", ESCAPED,
50	"Shrook", "feed:", UNESCAPED,
51	"Vox Lite", "feed:", UNESCAPED,
52	"Wildgrape", "http://127.0.0.1:8888/NewsDesk.html?add_url=", ESCAPED,
53	"WINKsite", "http://winksite.com/site/quick_add_logon_form.cfm?partner_name=&feed_url=", ESCAPED,
54	"WinRSS", "rss://addrss/", ESCAPED,
55	"Others...", "http://www.methodize.org/quicksub/subscribe.php?url=", ESCAPED
56);
57
58var txtSubscribe = 'Subscribe to this feed:';
59var txtContentHeader = 'Newsreader/Aggregator:';
60var txtWhatIsThis = 'What is this?';
61var txtVersion = "0.3.5";
62
63// Color and font settings for Netscape 4 (CSS Style Sheet used for modern browsers)
64var q_hdrfont = 'Verdana';
65var q_hdrsize = '1';
66var q_hdrcolor = '#FFFFFF';
67var q_bgcolor = '#006699';
68var q_contentfont = 'Verdana';
69var q_contentsize = '1';
70var q_contentbgcolor = '#EEEEEE';
71
72// Internal vars
73var q_frame = self;
74var over = null;
75var oTimer;
76
77// Determine browser type
78var ns4 = (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) == 4);
79var ns6 = (document.getElementById)? true:false;
80var ie4 = (document.all)? true:false;
81if (ie4) {
82	var docRoot = 'document.body';
83}
84
85if (ns4) {
86	var oW = window.innerWidth;
87	var oH = window.innerHeight;
88	window.onresize = function () {if (oW!=window.innerWidth||oH!=window.innerHeight) location.reload();}
89}
90
91if (ie4) {
92	if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {
93		if(document.compatMode && document.compatMode == 'CSS1Compat') {
94			docRoot = 'document.documentElement';
95		}
96	}
97	if (ns6) {
98		ns6 = false;
99	}
100}
101
102// quicksub(url)
103// Loads parameters into global runtime variables.
104function quicksub(oLink, originalUrl) {
105
106	if (oTimer) {
107		clearTimeout(oTimer);
108	}
109
110	var url = escape(originalUrl);
111
112	var text = '<b>' + txtContentHeader + '</b><br>';
113	for(var iCount = 0; iCount < aggregators.length; iCount +=3) {
114		text += ('<a href=\''
115			+ aggregators[iCount + 1] 
116			+ (aggregators[iCount + 2] == ESCAPED ? url : originalUrl)
117			+ '\'>'
118			+ aggregators[iCount]
119			+ '</a><br>');
120	}
121
122	if ( (ns4) || (ie4) || (ns6) ) {
123		q_frame = self;
124		if (ns4) over = q_frame.document.quickSub
125		if (ie4) over = q_frame.quickSub.style
126		if (ns6) over = q_frame.document.getElementById("quickSub");
127	}
128	
129	if(!ns4) {
130		var layerhtml = '<div class=\'qsheader\'>
130' + txtSubscribe + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\"javascript:return closeqs();\" onMouseOver=\"return closeqs();\">[<b>x</b>]</A></div>'
131			+ '<div class=\'qscontent\'>' + text + '</div>'
132			+ '<div class=\'qsfooterWhat\'><a class=\'quicksub\' target=\'quickSub\' href=\'http://www.methodize.org/quicksub/whatisthis.html\' onclick=\'return closeqs();\'>[' + txtWhatIsThis + ']</a></div>'
133			+ '<div class=\'qsfooter\'><a class="quicksub" target="quickSub" href=\'http://www.methodize.org/quicksub/\' onclick=\'return closeqs();\'>quickSub ' + txtVersion + '</a></div>';
134	} else {
135		var closing = "<TD ALIGN=RIGHT><A HREF=\"javascript:return closeqs();\" onMouseOver=\"return closeqs();\"><FONT COLOR=\""+q_hdrcolor+"\" FACE=\""+q_hdrfont+"\" SIZE=\""+q_hdrsize+"\">[<b>x</b>]</FONT></A></TD>";
136		var layerhtml = "<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=\'"+q_bgcolor+"\'><TR><TD>"
137			+"<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD>"
138			+"<B><FONT COLOR=\""+q_hdrcolor+"\" FACE=\""+q_hdrfont+"\" SIZE=\""+q_hdrsize+"\">" + txtSubscribe + "</FONT></B></TD>"+closing+"</TR></TABLE>"
139			+"<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\'"+ q_contentbgcolor + "\'\">"
140			+"<TR><TD VALIGN=TOP><FONT FACE=\""+q_contentfont+"\" SIZE=\""+q_contentsize+"\">"+text+"</FONT></TD></TR>"
141			+"<TR><TD VALIGN=TOP ALIGN=RIGHT><FONT FACE=\""+q_contentfont+"\" SIZE=\""+q_contentsize+"\"><a target=\'quickSub\' href=\'http://www.methodize.org/quicksub/whatisthis.html\' onclick=\'return closeqs();\'>[" + txtWhatIsThis + "]</a></FONT></TD></TR>"
142			+"</TABLE>"
143			+"<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN=RIGHT>"
144			+"<B><a target='quickSub' href=\'http://www.methodize.org/quicksub/\' onclick=\'return closeqs();\'><FONT COLOR=\""+q_hdrcolor+"\" FACE=\""+q_hdrfont+"\" SIZE=\""+q_hdrsize+"\">quickSub " + txtVersion + "</FONT></a></TD></TR></TABLE>"
145			+"</TD></TR></TABLE>";
146	}
147	layerWrite(layerhtml);
148	placeLayer(oLink);
149	showObject(over);
150	
151	return true;
152}
153
154function closeqs() {
155	if (over != null) hideObject(over);
156	return true;
157}
158
159function placeLayer(oLink) {
160	var placeX, placeY, iOffset, aPosition;
161	
162	aPosition = findPosition(oLink);
163	placeX = eval(aPosition[0]);
164	placeY = eval(aPosition[1]) + 16;
165
166	if ( (ns4) || (ie4) ) {
167		over.left = (ie4 ? placeX + 'px' : placeX);
168		over.top = (ie4 ? placeY + 'px' : placeY);
169	} else if (ns6) {
170		over.style.left = placeX + "px";
171		over.style.top = placeY + "px";
172	}
173}
174
175function layerWrite(txt) {
176	if (ns4) {
177		var lyr = q_frame.document.quickSub.document
178		lyr.write(txt)
179		lyr.close()
180	} else if (ie4) {
181		q_frame.document.all["quickSub"].innerHTML = txt
182	} else if (ns6) {
183		range = q_frame.document.createRange();
184		range.setStartBefore(over);
185		domfrag = range.createContextualFragment(txt);
186		while (over.hasChildNodes()) {
187			over.removeChild(over.lastChild);
188		}
189		over.appendChild(domfrag);
190	}
191}
192
193function showObject(obj) {
194	if (ns4) obj.visibility = "show";
195	else if (ie4) obj.visibility = "visible";
196	else if (ns6) obj.style.visibility = "visible";
197}
198
199function hideObject(obj) {
200	if (ns4) obj.visibility = "hide";
201	else if (ie4) obj.visibility = "hidden";
202	else if (ns6) obj.style.visibility = "hidden";
203}
204
205function findPosition (oLink) {
206	if (oLink.offsetParent) {
207		for (var iPosX = 0, iPosY = 0; oLink.offsetParent; oLink = oLink.offsetParent) {
208			iPosX += oLink.offsetLeft;
209			iPosY += oLink.offsetTop;
210		}
211		return [iPosX, iPosY];
212	} else {
213		return [oLink.x, oLink.y];
214	}
215}
216
217function timeqs () {
218	if(!ns4) {
219		var iDelay = 500;
220
221		if (oTimer) {
222			clearTimeout(oTimer);
223		}
224
225		if ((ns4 && over.visibility != 'hide') ||
226			(ie4 && over.visibility != 'hidden') ||
227			(ns6 && over.style.visibility != 'hidden')) {
228			oTimer = setTimeout(hideqs, iDelay);
229		}
230	}
231}
232
233function hideqs () {
234	if (oTimer) {
235		clearTimeout(oTimer);
236	}
237
238	closeqs();
239}
240
241function delayqs () {
242	if (oTimer) {
243		clearTimeout(oTimer);
244	}
245}

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.