Sha256: 1806a9ca4f6c366707c5302783ea41f8a9fc866bc328b885025c56fceec46071

Contents?: true

Size: 1010 Bytes

Versions: 2

Compression:

Stored size: 1010 Bytes

Contents

controllers.show = function(key) {
  var _this = this;

  var story = _.find(store, function(story) {
    return story.key == key;
  });

  function loadStory(url) {
    var iframe = $("<iframe />");
    $("body").append(iframe);
    iframe.load(function() {
      $("#story").html(iframe[0].contentDocument.body.innerHTML);
      $.twoup.layout();
      iframe.remove();
    });
    iframe.attr("src", url);
  }

  function setVisited(key) {
    if(!localStorage["visited." + key]) localStorage["visited." + key] = "0";
    localStorage["visited." + key] = parseInt(localStorage["visited." + key]) + 1;
  }

  this.init = function() {
    console.log("starting show");
    $("#view-show").show().addClass("current-view");
    loadStory(story.url);
    setVisited(story.key);
  }

  this.render = function() {
  }

  this.destroy = function() {
    console.log("destroying show");
    $("#story").empty();
    $("#view-show").hide().removeClass("current-view");
  }
}

controllers.show.setup = function() {
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
storys-0.1.0 app/js/controllers.show.js
storys-0.0.6 app/js/controllers.show.js