<% #listItem %>
<tr>
   <td class='uk-text-right'><% story.comments count %></td>
   <td style='max-width: 200px; overflow: hidden;'>
      <a href='<% story.href %>' title='<% ngettext '{0} request' '{0} requests' <% story.requests %> %>' data-uk-tooltip="{pos: 'left'}">
         <% story.summary %>
      </a>
   </td>
   <td><% story.creator %></td>
   <td><% story.modified text %></td>
   <td>
      <% //if <% story.status %> is closed then "<i class='uk-text-muted uk-icon-lock'></i>" %>
      <% //if <% story.status %> is public then "<i class='uk-text-muted uk-icon-unlock'></i>" %>
      <% if <% story.status %> is shared then "<i class='uk-text-muted uk-icon-group'></i>" %>
      <% if <% story.status %> is open then "<i class='uk-text-muted uk-icon-globe'></i>" %>
      <% if <% story.tags count %> is 0 then '' else <% story.tags prefix="<i class='uk-text-muted uk-icon-tags' data-uk-tooltip title='" suffix="'></i>" %> %>
   </td>
   <td style='white-space: nowrap;'>
      <% story.link status <% if <% story.status %> is closed then lock else unlock prefix="<i class='uk-icon-" suffix="'></i>" %> %>
      <% story.link mode <% if <% story.mode %> is hidden then eye-slash else eye prefix="<i class='uk-icon-" suffix="'></i>" %> %>
   </td>
   <td style='white-space: nowrap;' class='uk-text-right'>
      <a href='' data-value="<% story.macro %>" data-text='<% gettext "Please use the copy command." %>' class='av-clipboard-copy'><i class='uk-icon-clipboard'></i></a>
      <% story.link delete "<i class='uk-icon-trash-o'></i>" %>
      <% story.link edit "<i class='uk-icon-pencil'></i>" %>
   </td>
</tr>

<% #links %>
<% if <% story.commentMode %> is open then
   <% if <% site.commentMode %> is enabled then
      <% story.skin Story#links %>
   else
      <% story.skin Story#permalink %>
   %>
else
   <% story.skin Story#permalink %>
%>

<% #search %>
<dt><% this.summary | this.link %></dt>
<dd>Posted <% this.created text %> by <% this.creator %>.</dd>

<% #update %>
<dt><% gettext '{0} user {1} posted a {2} to the site {3}' <% story.created text prefix=<strong> suffix=</strong> %> <% story.creator %> <% if <% story.type %> is Story then <% gettext story %> else <% gettext comment %> %> <% story.site.title | story.link %> %></dt>
<dd><% story.summary %></dd>

<% #referrer %>
referrers.push(new Antville.Referrer("<% param.referrer %>",
      "<% param.text %>", <% param.requests %>));

<% #referrers %>
<a name="backlinks" id="backlinks"></a><br />
<table border="0" cellspacing="0" cellpadding="1">
<script type="text/javascript">
var referrers = [];
<% param.referrers %>
var query = new Antville.Query();
var spamFilter = new Antville.Filter([<% site.spamfilter %>]);
var searchFilter = new Antville.Filter(query.filter);
var searchEngineFilters = [
   new Antville.Filter("http:\/\/.*google.*\?", "q"),
   new Antville.Filter("http:\/\/.*bing.*\?", "q"),
   new Antville.Filter("http:\/\/.*altavista.*\?", "q"),
   new Antville.Filter("http:\/\/.*search\.yahoo.*\?", "p"),
];
var cnt = 0;
var prefix = "<em>Search request:</em> ";
for (var i in referrers) {
   var ref = referrers[i];
   var text = ref.text;
   if (spamFilter.test(ref.url)) {
      continue;
   }
   if (query.filter && !searchFilter.test(ref.url)) {
      continue;
   }
   for (var e in searchEngineFilters) {
      var filter = searchEngineFilters[e];
      if (filter.test(ref.url)) {
         text = ref.compose(filter.key, prefix);
         break;
      }
   }
   if (++cnt == 1) {
      document.writeln('<tr>');
      document.writeln('<td align="right" class="small">&nbsp;</td>');
      document.writeln('<td rowspan="999" class="small">&nbsp;&nbsp;</td>');
      document.writeln('<td class="small"><strong><% gettext Backlinks %></strong></td>');
      document.writeln('</tr>');
   }
   document.writeln('<tr>');
   document.writeln('<td align="right" valign="top" class="small">',
         ref.count, '</td>');
   document.writeln('<td class="small"><a href="', ref.url, '">',
         text, '</a></td>');
   document.writeln('</tr>');
}
</script>
<noscript>
<tr>
<td colspan="3">
<% site.skin $Site#noscript %>
</td>
</tr>
</noscript>
</table>

<% #restore %>
<script type="text/javascript">
$(function() {
   var url = "<% site.href backup.js %>";
   var input = $(".backup :input");

   if (!"<% session.backup %>") {
      $("#restore").hide();
   } else {
      $("#restore").click(function() {
         $(this).hide();
         $.getJSON(url, function(data) {
            $.each(data, function(key, item) {
               $("#" + key).val(item);
            });
         });
      });
   }

   input.blur(function() {
      $("#restore").hide();
      var data = {};
      input.each(function() {
         var ref = $(this);
         data[ref.attr("id")] = $.trim(ref.val());
      });
      $.post(url, data);
      return;;
   });
   return;
});
</script>
