kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

[theme] - [component] - [images as comment links (v2.0)]

###################################
#     IMAGES AS COMMENT LINKS     #
# kunzite1, component-help/888877 #
# overrides:                      #
#  CommentInfo::print_readlink()  #
#  CommentInfo::print_postlink()  #
#  CommentInfo::print()           #
###################################
function CommentInfo::print_readlink() {
  var string img_url    = "";
  var int    img_width  = 0;
  var int    img_height = 0;
  var bool   img_count  = false;

  if($.show_readlink) {
    var Page p      = get_page();
    var string url  = $.read_url;
    var string text = get_plural_phrase($.count, "text_read_comments" + ($p.view == "friends" ? "_friends" : ""));
    if($.screened) {
      $text = $text + " " + $*text_month_screened_comments;
    }

    if($url != "") {
      """<a href="$url">""";
    }
    if($img_url != "") {
      if($img_count) {
        print $.count;
      }
      """<img src="$img_url" width="$img_width" height="$img_height" alt="$text" title="$text" border="0" />""";
    } else {
      print $text;
    }
    if($url != "") {
      """</a>""";
    }
  }
}

function CommentInfo::print_postlink() {
  var string img_url    = "";
  var int    img_width  = 0;
  var int    img_height = 0;

  if($.show_postlink) {
    var Page p      = get_page();
    var string url  = $.post_url;
    var string text = get_plural_phrase(0, "text_post_comment" + ($p.view == "friends" ? "_friends" : ""));
    if($.maxcomments) {
      $url  = "";
      $text = $*text_max_comments;
    }

    if($url != "") {
      """<a href="$url">""";
    }
    if($img_url != "") {
      """<img src="$img_url" width="$img_width" height="$img_height" alt="$text" title="$text" border="0" />""";
    } else {
      print $text;
    }
    if($url != "") {
      """</a>""";
    }
  }
}

function CommentInfo::print() {
  var string text_comment_divider = $*comment_divider;

  if($.show_readlink) {
    $this->print_readlink();
    if($.show_postlink) {
      print $text_comment_divider;
    }
  }
  if($.show_postlink) {
    $this->print_postlink();
  }
}
Tags: admin: deprecated, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 14 comments