Smileys, part 2
The smiley tutorial was getting awfully long, so I'm covering the comment popups here.
My Comment Preview popup. Changes are bolded.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" />
<title><$MTBlogName$>: Comment Preview</title>
<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
function writeImgTag(code)
{
var cache = document.comments_form.text.value;
this.code = code;
document.comments_form.text.value = cache + code;
document.comments_form.text.focus();
}
//-->
</script>
</head>
<body>
<MTInclude module="smilie_faces">
<div id="banner-commentspop">
<$MTBlogName$>
</div>
<div class="blog">
<div class="comments-head">Previewing your Comment</div>
<div class="comments-body">
<$MTCommentPreviewBody apply_macros="1"$>
<span class="comments-post">Posted by <$MTCommentPreviewAuthorLink spam_protect="1"$> at <$MTCommentPreviewDate$></span>
</div>
<div class="comments-body">
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>">
<input type="hidden" name="entry_id" value="<$MTEntryID$>" />
<input type="hidden" name="static" value="<$MTCommentPreviewIsStatic$>" />
<label for="author">Name:</label><br />
<input id="author" name="author" value="<$MTCommentPreviewAuthor encode_html="1"$>" /><br /><br />
<label for="email">Email Address:</label><br />
<input id="email" name="email" value="<$MTCommentPreviewEmail encode_html="1"$>" /><br /><br />
<label for="url">URL:</label><br />
<input id="url" name="url" value="<$MTCommentPreviewURL encode_html="1"$>" /><br /><br />
<img alt="angry" onclick="writeImgTag(':angry:')" src="/images/smiles/angry.gif" border="0" />
<img alt="beam" onclick="writeImgTag(':beam:')" src="/images/smiles/beam.gif" border="0" />
<img alt="blank" onclick="writeImgTag(':blank:')" src="/images/smiles/blank.gif" border="0" />
<img alt="blush" onclick="writeImgTag(':blush:')" src="/images/smiles/blush.gif" border="0" />
<br />
<label for="text">Comments:</label><br />
<textarea id="text" name="text" rows="10" cols="50"><$MTCommentPreviewBody convert_breaks="0" encode_html="1"$></textarea><br /><br />
<input type="submit" name="preview" value=" Preview " />
<input style="font-weight: bold;" type="submit" name="post" value=" Post " /><br /><br />
</form>
</div>
<div class="comments-head">Previous Comments</div>
<MTComments>
<div class="comments-body">
<$MTCommentBody apply_macros="1"$>
<span class="comments-post">Posted by <$MTCommentAuthorLink spam_protect="1"$> at <$MTCommentDate$></span>
</div>
</MTComments>
</div>
</body>
</html>
My Comment popup (changes are bolded):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" />
<title><$MTBlogName$>: Comment on <$MTEntryTitle$></title>
<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
var HOST = '<$MTBlogHost$>';
// 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) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((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))
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
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 = '';
}
//-->
</script>
<script type="text/javascript" language="javascript">
<!--
function writeImgTag(code)
{
var cache = document.comments_form.text.value;
this.code = code;
document.comments_form.text.value = cache + code;
document.comments_form.text.focus();
}
//-->
</script>
</head>
<body>
<MTInclude module="smiley_faces">
<div id="banner-commentspop">
<$MTBlogName$>
</div>
<div class="blog">
<div class="comments-head">Comments: <$MTEntryTitle$></div>
<MTComments>
<div class="comments-body">
<$MTCommentBody apply_macros="1"$>
<span class="comments-post">Posted by <$MTCommentAuthorLink spam_protect="1"$> at <$MTCommentDate$></span>
</div>
</MTComments>
<MTEntryIfCommentsOpen>
<div class="comments-head">Post a comment</div>
<div class="comments-body">
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>" name="comments_form" onsubmit="if (this.bakecookie[0].checked) rememberMe(this)">
<input type="hidden" name="entry_id" value="<$MTEntryID$>" />
<div style="width:180px; padding-right:15px; margin-right:15px; float:left; text-align:left; border-right:1px dotted #bbb;">
<label for="author">Name:</label><br />
<input tabindex="1" id="author" name="author" /><br /><br />
<label for="email">Email Address:</label><br />
<input tabindex="2" id="email" name="email" /><br /><br />
<label for="url">URL:</label><br />
<input tabindex="3" id="url" name="url" /><br /><br />
</div>
Remember personal info?<br />
<input type="radio" id="bakecookie" name="bakecookie" /><label for="bakecookie">Yes</label><input type="radio" id="forget" name="bakecookie" onclick="forgetMe(this.form)" value="Forget Info" style="margin-left: 15px;" /><label for="forget">No</label><br style="clear: both;" />
<img alt="angry" onclick="writeImgTag(':angry:')" src="/images/smiles/angry.gif" border="0" />
<img alt="beam" onclick="writeImgTag(':beam:')" src="/images/smiles/beam.gif" border="0" />
<img alt="blank" onclick="writeImgTag(':blank:')" src="/images/smiles/blank.gif" border="0" />
<img alt="blush" onclick="writeImgTag(':blush:')" src="/images/smiles/blush.gif" border="0" />
<br />
<label for="text">Comments:</label><br />
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea><br /><br />
<input type="button" onclick="window.close()" value=" Cancel " />
<input type="submit" name="preview" value=" Preview " />
<input style="font-weight: bold;" type="submit" name="post" value=" Post " /><br /><br />
</form>
<script type="text/javascript" language="javascript">
<!--
document.comments_form.email.value = getCookie("mtcmtmail");
document.comments_form.author.value = getCookie("mtcmtauth");
document.comments_form.url.value = getCookie("mtcmthome");
if (getCookie("mtcmtauth")) {
document.comments_form.bakecookie[0].checked = true;
} else {
document.comments_form.bakecookie[1].checked = true;
}
//-->
</script>
</div>
</MTEntryIfCommentsOpen>
</div>
</body>
</html>
2 Comments
2 TrackBacks
Listed below are links to blogs that reference this entry: Smileys, part 2.
TrackBack URL for this entry: http://www.beantowngeek.com/cgi-bin/mt/mt-pong.cgi/148
Adding smileys to your blog - Unix Gal Smileys, part 2 - Unix Gal Brad Choate: MTMacroってのを入れないと使えないみたいです。 付けてみよう!協力求む! Read More
Today was busy! I think people know by now that Rick is home and will watch Kayla while I help them :) I helped Tudy iron out her smilies issues. We used a combination of Girlie's and Lisa's (part 1,... Read More





how do i tweak the javascript so that instead of clicking the smilie on the right and getting an image link, i get the symbol that translates to the smilie as written in the "smiles' macros template?
testing