From 30b4f1aeee73792fe3e8c10e51f3552cdbab0d1f Mon Sep 17 00:00:00 2001 From: sanj Date: Tue, 13 Jul 2010 17:38:50 +0530 Subject: [PATCH] fixed js indentation --- lists/views.py | 7 +++++-- settings.py | 2 +- static/js/padmaApi.js | 4 ++-- static/js/padmaLayer.js | 20 ++++++++++---------- static/js/padmaList.js | 6 ++---- static/js/padmaSearch.js | 25 ++++++++++--------------- static/js/padmaVideo.js | 22 +++++++++++----------- templates/base.html | 3 +++ 8 files changed, 44 insertions(+), 45 deletions(-) diff --git a/lists/views.py b/lists/views.py index 1c5eac7..2b01e51 100644 --- a/lists/views.py +++ b/lists/views.py @@ -25,7 +25,7 @@ def fetchSrt(request): if request.GET['id']: padmaId = request.GET['id'] track = request.GET['track'] or 'transcript' - url = "%s%s/export/%s.srt" % (PADMA_URL, padmaId, track,) + url = "%s/%s/export/%s.srt" % (PADMA_URL, padmaId, track,) srt = getHtmlFromUrl(url) return HttpResponse(srt) else: @@ -36,7 +36,10 @@ def index(request): def listDetail(request): if request.GET: - rDict = {'listId': request.GET['id'] } + rDict = { + 'listId': request.GET['id'] }, + 'padma_url': PADMA_URL, + } return render_to_response("list.html", rDict) else: return HttpResponse("Please pass me a list id") diff --git a/settings.py b/settings.py index 3101280..6d164de 100644 --- a/settings.py +++ b/settings.py @@ -10,7 +10,7 @@ LOGGING_INTERCEPT_REDIRECTS = True LOGGING_LOG_SQL = True LOGGING_SHOW_METRICS = True LOGGING_OUTPUT_ENABLED = True -PADMA_URL = "http://padma.local/" +PADMA_URL = "http://padma.local" PROJECT_PATH = os.path.dirname(__file__) diff --git a/static/js/padmaApi.js b/static/js/padmaApi.js index dc603be..d4847ed 100644 --- a/static/js/padmaApi.js +++ b/static/js/padmaApi.js @@ -47,7 +47,7 @@ get html of template with tmpl("foo", json) // window.PADMA = new padmaApi(); function callPadma(api, callback, extra_params) { - var local_json_url = "/jPadma?url=http://padma.local"; + var local_json_url = "/jPadma?url=" + PADMA_BASE_URL; var url = local_json_url + api; $.getJSON(url, function(json) { callback(json, extra_params); @@ -73,7 +73,7 @@ get html of template with tmpl("foo", json) 'endTime': '0:00:00', 'tracks': ['description', 'transcript'], 'tmpl_id': '', - 'baseUrl': 'http://pad.ma/', + 'baseUrl': PADMA_BASE_URL || 'http://pad.ma/', 'globalVar': 'PADMA', 'localUrl': '/padmaApi/' }, options); diff --git a/static/js/padmaLayer.js b/static/js/padmaLayer.js index 0d351f6..2e47200 100644 --- a/static/js/padmaLayer.js +++ b/static/js/padmaLayer.js @@ -12,17 +12,17 @@ var padmaLayer = function(json, video) { this.value_html = json.value_html; this.creator = json.creator; var that = this; - this.firstFrameStr = BASE_URL + padmaVideos[this.video].id + "/frame/" + ms2npt(that.time_in); + this.firstFrameStr = PADMA_BASE_URL + padmaVideos[this.video].id + "/frame/" + ms2npt(that.time_in); this.firstFrame128 = this.firstFrameStr + ".128.jpg"; this.firstFrame320 = this.firstFrameStr + ".320.jpg"; - this.lastFrameStr = BASE_URL + padmaVideos[this.video].id + "/frame/" + ms2npt(that.time_out); + this.lastFrameStr = PADMA_BASE_URL + padmaVideos[this.video].id + "/frame/" + ms2npt(that.time_out); this.lastFrame128 = this.lastFrameStr + ".128.jpg"; this.lastFrame320 = this.lastFrameStr + ".320.jpg"; this.videoSrc128 = this.padmaVideo.meta.urls['128'] + "?t=" + ms2npt(that.time_in); this.videoSrc320 = this.padmaVideo.meta.urls['320'] + "?t=" + ms2npt(that.time_in); -// this.videoSrc128 = BASE_URL + "v/128/" + padmaVideos[this.video].id + ".ogv?t=" + ms2npt(that.time_in); -// this.videoSrc320 = BASE_URL + "v/320/" + padmaVideos[this.video].id + ".ogv?t=" + ms2npt(that.time_in); - } +// this.videoSrc128 = PADMA_BASE_URL + "v/128/" + padmaVideos[this.video].id + ".ogv?t=" + ms2npt(that.time_in); +// this.videoSrc320 = PADMA_BASE_URL + "v/320/" + padmaVideos[this.video].id + ".ogv?t=" + ms2npt(that.time_in); +} padmaLayer.prototype.showResult = function(word) { var that = this; @@ -52,7 +52,7 @@ padmaLayer.prototype.getThumbElem = function() { if (that.firstFrame128) { img.attr("src", that.firstFrame128); e.append(img); - } + } e.attr("data-track", that.track); e.attr("data-value", that.value_html); e.mouseover(function() { @@ -65,9 +65,9 @@ padmaLayer.prototype.getThumbElem = function() { $('#resultDetails').html(html); }).mouseout(function() { $('#resultDetails').html(''); - }); + }); return e; - } +} padmaLayer.prototype.getVideoElem = function() { var that = this; @@ -86,8 +86,8 @@ padmaLayer.prototype.getVideoElem = function() { $('#resultDetails').html(html); }).mouseout(function() { $('#resultDetails').html(''); - }); + }); e.attr("poster", that.firstFrame128); return e; - } +} diff --git a/static/js/padmaList.js b/static/js/padmaList.js index f12d8a3..353ec3f 100644 --- a/static/js/padmaList.js +++ b/static/js/padmaList.js @@ -1,11 +1,9 @@ -var BASE_URL = "http://padma.local/"; $(document).ready(function() { var apiUrl = "/list/videos?listId=" + listId; callPadma(apiUrl, initList); prevSearchTerms = []; - - }); +}); @@ -17,8 +15,8 @@ function initList(json) { for (var v=0; v < videos.length; v++) { var thisVideo = new padmaVideo(videos[v], v); padmaVideos.push(thisVideo); - } } +} /** diff --git a/static/js/padmaSearch.js b/static/js/padmaSearch.js index 018c79c..be7df03 100644 --- a/static/js/padmaSearch.js +++ b/static/js/padmaSearch.js @@ -7,6 +7,9 @@ $(document).ready(function() { return; } doSearch(val); + }); +}); + /* var words = val.split(" "); for (var i = 0; i < words.length; i++) { @@ -17,14 +20,6 @@ $(document).ready(function() { } } */ - }); - -/* - $('#search').keyup(function() { - - }); -*/ -}); function getVideoById(id) { for (var i=0; i < padmaVideos.length; i++) { @@ -67,9 +62,9 @@ function doSearch(word) { // var imgHtml = ""; $('#results').append(html); */ - } } } +} /* @@ -89,13 +84,13 @@ function findMatchingLayers(word) { var matchedLayer = padmaVideos[v].layers[l]; // var matchedLayer = new padmaLayer(layers[l], v) matchedLayers.push(matchedLayer); - } - } - } + } + } } } - return matchedLayers; } + return matchedLayers; +} Array.prototype.inArray = function(value) { @@ -105,8 +100,8 @@ Array.prototype.inArray = function(value) { for (i=0; i < this.length; i++) { if (this[i] == value) { return true; - } } + } return false; - }; +}; diff --git a/static/js/padmaVideo.js b/static/js/padmaVideo.js index 25844e7..2359892 100644 --- a/static/js/padmaVideo.js +++ b/static/js/padmaVideo.js @@ -3,13 +3,13 @@ var padmaVideo = function(json, index) { this.index = index; this.title = json.title; this.jq = {}; - this.poster = BASE_URL + this.id + "/poster.jpg"; - this.timeline = BASE_URL + this.id + "/timeline.png"; + this.poster = PADMA_BASE_URL + this.id + "/poster.jpg"; + this.timeline = PADMA_BASE_URL + this.id + "/timeline.png"; this.wrapperHtml = this.getWrapperHtml() this.init(); this.dataLoaded = false; this.layers = []; - } +} padmaVideo.prototype.getWrapperHtml = function() { var that = this; @@ -34,7 +34,7 @@ padmaVideo.prototype.getWrapperHtml = function() { html += "
"; videoElem.html(html); return videoElem; - } +} /* var Timeline = function(padmaVideo) { @@ -51,7 +51,7 @@ padmaVideo.prototype.init = function() { $('#videos').append(that.wrapperHtml); this.jq = $('#' + that.id); this.loadData(); - } +} padmaVideo.prototype.getLayerById = function(id) { var that = this; @@ -67,7 +67,7 @@ padmaVideo.prototype.getLayerById = function(id) { padmaVideo.prototype.metaLoaded = function() { var that = this; $('#' + that.id + ' .videoMeta').html(that.meta.description_html); - } +} padmaVideo.prototype.layersLoaded = function() { this.dataLoaded = true; @@ -80,15 +80,15 @@ padmaVideo.prototype.layersLoaded = function() { var thisVideo = padmaVideos[index]; }); */ - } +} padmaVideo.prototype.loadData = function() { var that = this; - var metaUrl = BASE_URL + that.id + "/video.js"; + var metaUrl = PADMA_BASE_URL + that.id + "/video.js"; $.getScript(metaUrl, function() { that.meta = video; that.metaLoaded(); - var layersUrl = BASE_URL + that.id + "/layers.js"; + var layersUrl = PADMA_BASE_URL + that.id + "/layers.js"; $.getScript(layersUrl, function() { var theseLayers = layers; for (var i=0; i < theseLayers.length; i++) { @@ -96,8 +96,8 @@ padmaVideo.prototype.loadData = function() { that.layers.push(thisLayer); } that.layersLoaded(); - }); }); - } + }); +} diff --git a/templates/base.html b/templates/base.html index 8e00cd2..df870d9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,6 +2,9 @@ + {% block head %} {% endblock %}