PageSourceSearch

https://fletcherpenney.net/cgi/commenter.js

js fletcherpenney.net collected 2026-10-02 02:32:48 UTC 4,263 bytes, 93 lines download raw bytes

1// Copyright (C) 2010  Fletcher T. Penney <[email protected]>
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation; either version 2 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the
15//    Free Software Foundation, Inc.
16//    59 Temple Place, Suite 330
17//    Boston, MA 02111-1307 USA
18
19function writeCommenterGreeting(){
20	container = document.getElementById("commenter-greeting");
21	var content;
22	var openId;
23	openId = getCookie('OpenID');
24	user = getCookie('User');
25    
26	if (openId != '') {
27		content = '<p>You are signed in as <a href="' + openId + '">' + openId + '</a>.  You may <a href="javascript:forgetMe()">sign out</a>.</p><form action="/cgi/submit_comment.cgi" method="PUT"><label>Name</label><input type="text" name="user" side="25" value="' + user + '"/><label>Comments (may contain MultiMarkdown syntax, but not HTML)</label><textarea name="text" rows="15" columns="40"></textarea><input type="submit" accesskey="s" name="post" value="Submit" /></form>';
28	} else {
29	content = '<p>Please sign in using your <a href="http://en.wikipedia.org/wiki/Openid">OpenID</a>. If you don\'t have an OpenID, you may also email me.  Most people <a href="http://en.wikipedia.org/wiki/List_of_OpenID_providers">already have</a> an OpenID, even if they don\'t know it.</p> <form action="/cgi/openid_send.cgi" method="PUT" > <img src="/images/openid.png" style="border:0px;	background-color:transparent;margin:0px;padding:0px;"/><label for="openid-field">OpenID URL</label><input id="openid-field" type="text" name="openid" size="25"/><input type="submit" value="Login"/></form> '; 
30		}
31	
32	container.innerHTML = content;
33}
34
35
36// Remainder of this document is Copyright (c) 1996-1997 Athenia Associates.
37// http://www.webreference.com/js/
38// License is granted if and only if this entire
39// copyright notice is included. By Tomer Shiran.
40
41    function setCookie (name, value, expires, path, domain, secure) {
42        var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires.toGMTString() : "") +
43            (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
44        document.cookie = curCookie;
45    }
46
47    function getCookie (name) {
48        var prefix = name + '=';
49        var c = document.cookie;
50        var nullstring = '';
51        var cookieStartIndex = c.indexOf(prefix);
52        if (cookieStartIndex == -1)
53            return nullstring;
54        var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
55        if (cookieEndIndex == -1)
56            cookieEndIndex = c.length;
57        return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
58    }
59
60    function deleteCookie (name, path, domain) {
61        if (getCookie(name))
62            document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
63                ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
64    }
65
66    function fixDate (date) {
67        var base = new Date(0);
68        var skew = base.getTime();
69        if (skew > 0)
70            date.setTime(date.getTime() - skew);
71    }
72
73    function rememberMe (f) {
74        var now = new Date();
75        fixDate(now);
76        now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
77        now = now.toGMTString();
78        if (f.author != undefined)
79           setCookie('mtcmtauth', f.author.value, now, '/', '', '');
80        if (f.email != undefined)
81           setCookie('mtcmtmail', f.email.value, now, '/', '', '');
82        if (f.url != undefined)
83           setCookie('mtcmthome', f.url.value, now, '/', '', '');
84    }
85
86    function forgetMe (f) {
87		deleteCookie('OpenID', '/', '');
88		deleteCookie('Comment', '/', '');
89		deleteCookie('User', '/', '');
90		writeCommenterGreeting();
91    }
92
93

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.