summaryrefslogtreecommitdiff
path: root/imdb-lookup/js/app.js
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-12-23 01:35:48 +0100
committerYves Fischer <yvesf-git@xapek.org>2014-12-23 01:35:48 +0100
commit94a86bb23d97c2fd1bc38fca73b99e72a7fdfa8e (patch)
treebecf09c66ee26dc2dd4f7fd26652fbd296baf828 /imdb-lookup/js/app.js
parent82f5bd6a4aff840f21076a8bf47a022d08b1dddf (diff)
downloadscripts-94a86bb23d97c2fd1bc38fca73b99e72a7fdfa8e.tar.gz
scripts-94a86bb23d97c2fd1bc38fca73b99e72a7fdfa8e.zip
remove jinja
Diffstat (limited to 'imdb-lookup/js/app.js')
-rw-r--r--imdb-lookup/js/app.js117
1 files changed, 0 insertions, 117 deletions
diff --git a/imdb-lookup/js/app.js b/imdb-lookup/js/app.js
deleted file mode 100644
index f341497..0000000
--- a/imdb-lookup/js/app.js
+++ /dev/null
@@ -1,117 +0,0 @@
-var App = Ember.Application.create();
-App.ApplicationAdapter = DS.FixtureAdapter.extend();
-
-App.Router.map(function() { // put your routes here
-});
-
-App.IndexRoute = Ember.Route.extend({
- model: function() {
- return this.store.findAll('movie');
- }
-});
-
-App.Movie = DS.Model.extend({
- title: DS.attr('string'),
- path: DS.attr('string'),
- poster: DS.attr('string'),
- tagline: DS.attr('string'),
- plot: DS.attr('string'),
- website: DS.attr('string'),
- release: DS.attr('string'),
- movieFiles: DS.attr(),
-
- imdbRating: DS.attr('int'),
- imdbVotes: DS.attr('int'),
-
- omdbTomatoConsensus: DS.attr('string'),
- omdbTomato: DS.attr('int'),
- omdbUserTomato: DS.attr('int'),
- omdbTomatoRating: DS.attr(),
- omdbTomatoUserRating: DS.attr(),
-
- tmdbId: DS.attr('int'),
-
- linkTmdb: function() {
- return "http://www.themoviedb.org/movie/" + this.get('tmdbId');
- }.property('tmdbId'),
- linkImdb: function() {
- return "http://www.imdb.com/title/" + this.get('id');
- }.property('id'),
- linkLetterboxd: function() {
- return "http://letterboxd.com/tmdb/" + this.get('tmdbId');
- }.property('tmdbId'),
- linkOfdb: function() {
- return "http://www.ofdb.de/view.php?page=suchergebnis&Kat=IMDb&SText=" + this.get('id');
- }.property('id'),
- linkRotten: function() {
- return "http://www.rottentomatoes.com/search/?search=" + encodeURIComponent(this.get('title'));
- }.property('title')
-});
-
-App.IndexController = Ember.ArrayController.extend({
- page: 1,
- perPage: "10",
- sortProperties: ["title"],
- visiblePerPage: ["10", "20", "25", "50", "100", "250", "500"],
- pages: function() {
- var list = [];
- var prev = null;
- var sortProperty = this.get("sortProperties")[0];
- for (var i = 1; i <= this.get("pagesCount"); i++) {
- var pageContent = this._getPaginatedContent(i);
- var p1 = pageContent[0].get(sortProperty);
- var runningLabel = "";
- if (sortProperty == "title") {
- p1 = p1[0];
- } else if (sortProperty == "imdbRating") {
- p1 = Math.round(p1);
- } else if (sortProperty == "imdbVotes") {
- p1 = Math.floor(p1 / 1000) + "k";
- } else if (sortProperty == "release") {
- p1 = parseInt(p1.slice(0,4));
- p1 = Math.floor(p1 / 10) * 10;
- } else {
- prev = p1;
- }
- if (p1 != prev) {
- runningLabel = "" + p1;
- prev = p1;
- }
- list.push({number: i, runningLabel: runningLabel});
- }
- return list;
- }.property('page','perPage','sortProperties'),
- paginatedContent: function() {
- var page = this.get('page');
- return this._getPaginatedContent(page);
- }.property('arrangedContent.[]', 'page', 'perPage'),
- pagesCount: function() {
- return Math.ceil(this.get("content.length") / parseInt(this.get("perPage")))
- }.property('content.[]', 'perPage'),
- _getPaginatedContent: function(page) {
- var perPage = parseInt(this.get('perPage'));
- var start = (page - 1 ) * perPage;
- var end = page * perPage;
- return this.get('arrangedContent').slice(start, end)
- },
- actions: {
- sortBy: function(property) {
- this.set('sortProperties', [property]);
- this.set('sortAscending', !this.get('sortAscending'));
- },
- setPage: function(property) {
- this.set('page', property)
- }
- }
-});
-
-
-Ember.Handlebars.helper('filelink', function(value, options) {
- return new Ember.Handlebars.SafeString('<a href="' + value + '">' + decodeURI(value) + '</span>');
-});
-
-function dataCb(data) {
- App.Movie.FIXTURES = data;
-}
-window['dataCb'] = dataCb;
-