Questions of Varying Natures

Working on a new template and need help? Come here for support.

Moderator: Help Desk Team

Questions of Varying Natures

Postby Guest » December 17th, 2009, 12:39 am

Hello! One for now.

I moved the "rating" code (or rather, where the rating code would show up) down to another spot below the comic and now the rate part won't actually show up. Help?

Example: http://lovefeast.thewebcomic.com/comics/750416/001-13/

This happens on all my comics/template tests because they all use the exact same code for the Comic template.

Code: Select all

<script type="text/javascript">

document.onkeyup = KeyCheck;       

function KeyCheck(e)

{
   var KeyID = (window.event) ? event.keyCode : e.keyCode;
   switch(KeyID)

   {
      case 37:
      window.location = "{NAV_PREV}";
      break;

      case 39:
      window.location = "{NAV_NEXT}";
      break;
   }
}

</script>

<script type="JavaScript">

var dir = "http://i26.photobucket.com/albums/c146/senshuu/gaia/px/";
var pic_unselected = "tinyumbriblue2.gif";
var pic_selected = "tinyumbripink2.gif";

// "Buffers" the image to the browser
document.write('<img style="display: none" src="' + dir + pic_unselected + '" alt="" />');
document.write('<img style="display: none" src="' + dir + pic_selected + '" alt="" />');

<!-- BEGIN switch_user_has_voted -->
var default_rating = {switch_user_has_voted.RATING};
var rate_it_pic = "http://www.smackjeeves.com/templates/default/images/your-rating-2.gif";
<!-- END switch_user_has_voted -->
<!-- BEGIN switch_user_hasnt_voted -->
var default_rating = 0;
var rate_it_pic = "http://www.smackjeeves.com/templates/default/images/rate-it.gif";
<!-- END switch_user_hasnt_voted -->

function build_vote()
{
   document.write('<img id="text" src="' + rate_it_pic + '" alt="" /><ul>');
   for (n = 1; n<= 5; n++)
   {
      if (n <= default_rating)
      {
         default_pic = pic_selected;
      } else {
         default_pic = pic_unselected;
      }

      document.write('<li><a href="#" onClick="vote(' + n + '); return false;" onMouseOver="rateover(' + n + ');" onMouseOut="rateover(default_rating);"><img src="' + dir + default_pic + '" name="star_' + n + '" alt="" /></a></li>');
   }
   document.write('</ul>');
}

function rateover(star_num)
{
   
   for (n = 1; n <= 5; n++)
   {
      if (n <= star_num)
      {
         da_code = 'document.star_' + n + '.src="' + dir + pic_selected + '"';
      } else {
         da_code = 'document.star_' + n + '.src="' + dir + pic_unselected + '"';
      }
      
      eval(da_code);
   }
}

function vote(rating)
{
   var new_window = window.open("/ratecomic.php?cid={COMIC_ID}&rating=" + rating, "sj_ratecomic", "height=300, width=400");
   new_window.focus();
}

</script>

<div id="comic-container">

<div id="comic-header">

</div> <!-- end comic header -->

<!-- BEGIN comic_image -->

<a href="{NAV_NEXT}">{comic_image.FORMATTED}</a>

<!-- Sets custom Next/Prev images -->
<script type="text/javascript">
if (document.getElementById('sj_nav_next_img'))
   document.getElementById('sj_nav_next_img').src = 'http://www.smackjeeves.com/templates/default/images/nav_next.png';
if (document.getElementById('sj_nav_prev_img'))
   document.getElementById('sj_nav_prev_img').src = 'http://www.smackjeeves.com/templates/default/images/nav_prev.png';
</script>

<!-- END comic_image -->
<!-- BEGIN switch_no_comic_image -->
<img src="http://www.smackjeeves.com/images/image_na.gif" alt="" />
<!-- END switch_no_comic_image -->

</div> <!-- end comic container -->

<div class="comicnav">

   <h2><a href="{NAV_FIRST}">FIRST</a> &bull;
   <a href="{NAV_PREV}">PREV</a> &bull;
   <a href="{NAV_NEXT}">NEXT</a> &bull;
   <a href="{NAV_LAST}">LAST</a></h2>

   <form name="jumpbox" method="GET">
      <input type="hidden" name="url" value="{SITE_URL}">
      <input type="hidden" name="page" value="comic">
      <select name="url" onchange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }">
         <option value="-1">------ Jump To ------</option>
         <!-- BEGIN jumpbox -->
         <option value="{jumpbox.COMIC_URL}">#{jumpbox.COMIC_NUMBER} - {jumpbox.COMIC_TITLE}</option>
         <!-- END jumpbox -->
      </select>
   </form>


</div> <!-- end comicnav -->


<div id="rate">Average Rating: <strong>{AVERAGE_RATING}</strong> &bull; <script type="JavaScript">build_vote();</script> </div>


<script type="javascript" type="text/javascript"
src="http://www.smackjeeves.com/templates/default/jsbookmark.js">
</script>

<h1><a href="/postcomment.php?cid={COMIC_ID}" onClick="var new_window = window.open('/postcomment.php?cid={COMIC_ID}', 'sj_comment', 'height=350, width=420'); new_window.focus(); return false;"><span class="post-me">Post Comment!</span></a></h1>

<div id="comments_container">

   <!-- BEGIN switch_author_comments -->
   <h2 class="sub-title">Author's Word</h2>
   <!-- END switch_author_comments -->
   
   <!-- BEGIN loop_author_comments -->
   <h2 class="cpost-header">
   <span class="edelete">
   <!-- BEGIN switch_user_can_edit -->
   <a href="{loop_author_comments.EDIT_LINK}" onClick="var new_window = window.open('{loop_author_comments.EDIT_LINK}', 'sj_comment', 'height=400, width=550'); new_window.focus(); return false;">Edit</a>
   <!-- END switch_user_can_edit -->

   <!-- BEGIN switch_user_can_delete -->
   <a href="{loop_author_comments.DELETE_LINK}" onClick="var new_window = window.open('{loop_author_comments.DELETE_LINK}', 'sj_comment', 'height=320, width=420'); new_window.focus(); return false;">Delete</a>
   <!-- END switch_user_can_delete -->
   </span>

   <a href="{loop_author_comments.POSTER_PROFILE_URL}" target="_profile">{loop_author_comments.NAME}</a> <span class="comment-date">{loop_author_comments.DATE_POSTED}</span></h2>
   
   <p>
   <!-- BEGIN switch_poster_avatar -->
   <img src="{loop_author_comments.POSTER_AVATAR_IMG_SRC}" height="{loop_author_comments.POSTER_AVATAR_IMG_HEIGHT}" width="{loop_author_comments.POSTER_AVATAR_IMG_WIDTH}" class="avatar" alt="{loop_author_comments.NAME}" />
   <!-- END switch_poster_avatar -->

   <div class="authorheader">{loop_author_comments.POST_TITLE}</div>
   <div class="authorpost">{loop_author_comments.MESSAGE}</div>

   </p>
   <!-- END loop_author_comments -->
   
   <!-- BEGIN switch_user_comments -->
   <h2 class="sub-title">Comments</h2>
   <!-- END switch_user_comments -->
   
   <!-- BEGIN loop_user_comments -->
   <h2 class="cpost-header">
   <span class="edelete">
   <!-- BEGIN switch_user_can_edit -->
   <a href="{loop_user_comments.EDIT_LINK}" onClick="var new_window = window.open('{loop_user_comments.EDIT_LINK}', 'sj_comment', 'height=320, width=420'); new_window.focus(); return false;">Edit</a>
   <!-- END switch_user_can_edit -->
   <!-- BEGIN switch_user_can_delete -->
   <a href="{loop_user_comments.DELETE_LINK}" onClick="var new_window = window.open('{loop_user_comments.DELETE_LINK}', 'sj_comment', 'height=320, width=420'); new_window.focus(); return false;">Delete</a>
   <!-- END switch_user_can_delete -->
   </span>

   <a href="{loop_user_comments.POSTER_PROFILE_URL}" target="_profile">{loop_user_comments.NAME}</a> <span class="comment-date">{loop_user_comments.DATE_POSTED}</span></h2>

   <p>
   <!-- BEGIN switch_poster_avatar -->
   <img src="{loop_user_comments.POSTER_AVATAR_IMG_SRC}" height="{loop_user_comments.POSTER_AVATAR_IMG_HEIGHT}" width="{loop_user_comments.POSTER_AVATAR_IMG_WIDTH}" class="avatar" alt="{loop_user_comments.NAME}" />
   <!-- END switch_poster_avatar -->

   <div class="pagecommentsheader">{loop_user_comments.POST_TITLE}</div>
   <div class="pagecomments">{loop_user_comments.MESSAGE}</div>

   </p>
   <!-- END loop_user_comments -->

</div>



Any help is appreciated. :mrgreen:
Guest
 

Re: Questions of Varying Natures

Postby Pyroman » December 17th, 2009, 4:18 am

Change this part:
Code: Select all
<script type="JavaScript">

var dir = "http://i26.photobucket.com/albums/c146/senshuu/gaia/px/";
var pic_unselected = "tinyumbriblue2.gif";
var pic_selected = "tinyumbripink2.gif";


So it is script langauge instead of type:
Code: Select all
<script language="JavaScript">

var dir = "http://i26.photobucket.com/albums/c146/senshuu/gaia/px/";
var pic_unselected = "tinyumbriblue2.gif";
var pic_selected = "tinyumbripink2.gif";


And do the same for this part:
Code: Select all
<div id="rate">Average Rating: <strong>{AVERAGE_RATING}</strong> &bull; <script type="JavaScript">build_vote();</script> </div>

Code: Select all
<div id="rate">Average Rating: <strong>{AVERAGE_RATING}</strong> &bull; <script language="JavaScript">build_vote();</script> </div>


That should do it. It's a bit hard to test, though, so let me know if you have any issues.
ImageImage
ImageImage
Image
User avatar
Pyroman
 
Posts: 1118
Joined: January 28th, 2006, 12:40 am
Location: Australia

Re: Questions of Varying Natures

Postby Guest » December 22nd, 2009, 5:27 pm

Ohh, I see... actually, I just changed them to
Code: Select all
<script type="text/javascript">
(since "language" is technically invalid, lol I change stuff a lot) and now it works. Yay!

Now, I just need to figure out how to get the rating images in line with the line about rating (what I was originally trying to do before things disappeared), and oh, is there a way to make "Rate It" not an image?

Thank you :D
Guest
 


Return to Template Development & Support

Who is online

Users browsing this forum: Bing [Bot] and 4 guests