Pisan je u Javi. Evo ga.
Code:
<script type="text/javascript" language="javascript">
<!--
var HOST = 'www.mariotomic.com';
// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.
function setCookie (name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value);
curCookie += ((expires) ? ("; expires=" + expires.toGMTString()) : "");
curCookie += ((path) ? ("; path=" + path) : "");
curCookie += ((domain) ? ("; domain=" + domain) : "");
curCookie += ((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function getCookie (name) {
var prefix = name + '=';
var c = document.cookie;
var nullstring = '';
var cookieStartIndex = c.indexOf(prefix);
if (cookieStartIndex == -1)
return nullstring;
var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
if (cookieEndIndex == -1)
cookieEndIndex = c.length;
return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}
function deleteCookie (name, path, domain) {
if (getCookie(name))
{
var delCookie = name + "=";
delCookie += ((path) ? ("; path=" + path) : "");
delCookie += ((domain) ? ("; domain=" + domain) : "");
delCookie += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
document.cookie = delCookie;
}
}
function fixDate (date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0)
date.setTime(date.getTime() - skew);
}
function rememberMe (f) {
var now = new Date();
fixDate(now);
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}
function forgetMe (f) {
deleteCookie('mtcmtmail', '', HOST);
deleteCookie('mtcmthome', '', HOST);
deleteCookie('mtcmtauth', '', HOST);
f.email.value = '';
f.author.value = '';
f.url.value = '';
}
window.oldwinload = window.onload;
window.onload = function ()
{
var cf = document.forms ['comments_form'];
cf.author.value = getCookie ('mtcmtauth');
cf.email.value = getCookie ('mtcmtmail');
cf.url.value = getCookie ('mtcmthome');
cf.bakecookie [(cf.author.value) ? 0 : 1].checked = true;
this.oldwinload;
}
//-->
</script>
I ovo:
Code:
<form method="post" action="http://www.mariotomic.com/cgi-bin/mt-comments.cgi" name="comments_form" onsubmit="if (this.bakecookie[0].checked) rememberMe(this)">
<input type="hidden" name="static" value="1" />
<input type="hidden" name="entry_id" value="59" />
<div id="name_email">
<p>
<input tabindex="1" id="author" name="author" />
<label for="author">Name</label>
<br />
<input tabindex="2" id="email2" name="email" />
<label for="email">Email</label>
<br />
<input tabindex="3" type="text" name="url" id="url2" />
<label for="url">URL</label>
<br />
</p>
</div>
<p><input type="radio" id="remember" onclick="rememberMe(this.form)" name="bakecookie" /><label for="remember">Remember me</label><input type="radio" id="forget" name="bakecookie" onclick="forgetMe(this.form)" value="Forget Info" style="margin-left: 15px;" /><label for="forget">Forget me</label>
<br style="clear: both;" />
</p>
<p> <input type="checkbox" name="subscribe" /> Subscribe to receive comments from this entry</p>
<p><label for="text">You will say this:</label> <br/>
<textarea tabindex="4" id="textarea" name="text" rows="10" cols="75" onfocus="if (this.value == 'You may use HTML tags for style. Leave a blank line for a paragraph.') this.value = '';">You may use HTML tags for style. Leave a blank line for a paragraph.</textarea></p>
<div align="left">
<input type="reset" name="reset" tabindex="5"
value=" Cancel " />
<input type="submit" name="preview" tabindex="6"
value=" Preview " />
<input style="font-weight: bold;" type="submit" name="post"
tabindex="7" value=" Post " />
<input type="button" tabindex="8" onclick="window.open('http://www.photoblogs.org/profile/mariotomic.com')" value="vote for me ; )" />
</div>
</form>
<script type="text/javascript" language="javascript">
<!--
if (document.comments_form.email != undefined)
document.comments_form.email.value = getCookie("mtcmtmail");
if (document.comments_form.author != undefined)
document.comments_form.author.value = getCookie("mtcmtauth");
if (document.comments_form.url != undefined)
document.comments_form.url.value = getCookie("mtcmthome");
if (getCookie("mtcmtauth") || getCookie("mtcmthome")) {
document.comments_form.bakecookie[0].checked = true;
} else {
document.comments_form.bakecookie[1].checked = true;
}
//-->
</script>
Ovde je njena prakticna primena.
Znaci, voleo bih da znam kojom konstrukcijom da kazem strani da pokupi unos sa URL polja i da mu doda /iconfile.ico te da potom, ako slicica postoji, te da je ubaci pored komentara iz kojeg je URL unos pokupljen.
A ono drugo sto me je zanimalo, i sto je pretpostavljam laksi deo, je kako da klasicne dugmice Post, Preview i Cancel mogu da zamenim nekim slicicama.
Hvala na citanju dugog posta, ako nista drugo :)