fixed js indentation

This commit is contained in:
sanj 2010-07-13 17:38:50 +05:30
parent 794febfc6d
commit 30b4f1aeee
8 changed files with 44 additions and 45 deletions

View File

@ -25,7 +25,7 @@ def fetchSrt(request):
if request.GET['id']: if request.GET['id']:
padmaId = request.GET['id'] padmaId = request.GET['id']
track = request.GET['track'] or 'transcript' 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) srt = getHtmlFromUrl(url)
return HttpResponse(srt) return HttpResponse(srt)
else: else:
@ -36,7 +36,10 @@ def index(request):
def listDetail(request): def listDetail(request):
if request.GET: if request.GET:
rDict = {'listId': request.GET['id'] } rDict = {
'listId': request.GET['id'] },
'padma_url': PADMA_URL,
}
return render_to_response("list.html", rDict) return render_to_response("list.html", rDict)
else: else:
return HttpResponse("Please pass me a list id") return HttpResponse("Please pass me a list id")

View File

@ -10,7 +10,7 @@ LOGGING_INTERCEPT_REDIRECTS = True
LOGGING_LOG_SQL = True LOGGING_LOG_SQL = True
LOGGING_SHOW_METRICS = True LOGGING_SHOW_METRICS = True
LOGGING_OUTPUT_ENABLED = True LOGGING_OUTPUT_ENABLED = True
PADMA_URL = "http://padma.local/" PADMA_URL = "http://padma.local"
PROJECT_PATH = os.path.dirname(__file__) PROJECT_PATH = os.path.dirname(__file__)

View File

@ -47,7 +47,7 @@ get html of template with tmpl("foo", json)
// window.PADMA = new padmaApi(); // window.PADMA = new padmaApi();
function callPadma(api, callback, extra_params) { 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; var url = local_json_url + api;
$.getJSON(url, function(json) { $.getJSON(url, function(json) {
callback(json, extra_params); callback(json, extra_params);
@ -73,7 +73,7 @@ get html of template with tmpl("foo", json)
'endTime': '0:00:00', 'endTime': '0:00:00',
'tracks': ['description', 'transcript'], 'tracks': ['description', 'transcript'],
'tmpl_id': '', 'tmpl_id': '',
'baseUrl': 'http://pad.ma/', 'baseUrl': PADMA_BASE_URL || 'http://pad.ma/',
'globalVar': 'PADMA', 'globalVar': 'PADMA',
'localUrl': '/padmaApi/' 'localUrl': '/padmaApi/'
}, options); }, options);

View File

@ -12,17 +12,17 @@ var padmaLayer = function(json, video) {
this.value_html = json.value_html; this.value_html = json.value_html;
this.creator = json.creator; this.creator = json.creator;
var that = this; 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.firstFrame128 = this.firstFrameStr + ".128.jpg";
this.firstFrame320 = this.firstFrameStr + ".320.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.lastFrame128 = this.lastFrameStr + ".128.jpg";
this.lastFrame320 = this.lastFrameStr + ".320.jpg"; this.lastFrame320 = this.lastFrameStr + ".320.jpg";
this.videoSrc128 = this.padmaVideo.meta.urls['128'] + "?t=" + ms2npt(that.time_in); 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.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.videoSrc128 = PADMA_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.videoSrc320 = PADMA_BASE_URL + "v/320/" + padmaVideos[this.video].id + ".ogv?t=" + ms2npt(that.time_in);
} }
padmaLayer.prototype.showResult = function(word) { padmaLayer.prototype.showResult = function(word) {
var that = this; var that = this;
@ -67,7 +67,7 @@ padmaLayer.prototype.getThumbElem = function() {
$('#resultDetails').html(''); $('#resultDetails').html('');
}); });
return e; return e;
} }
padmaLayer.prototype.getVideoElem = function() { padmaLayer.prototype.getVideoElem = function() {
var that = this; var that = this;
@ -89,5 +89,5 @@ padmaLayer.prototype.getVideoElem = function() {
}); });
e.attr("poster", that.firstFrame128); e.attr("poster", that.firstFrame128);
return e; return e;
} }

View File

@ -1,11 +1,9 @@
var BASE_URL = "http://padma.local/";
$(document).ready(function() { $(document).ready(function() {
var apiUrl = "/list/videos?listId=" + listId; var apiUrl = "/list/videos?listId=" + listId;
callPadma(apiUrl, initList); callPadma(apiUrl, initList);
prevSearchTerms = []; prevSearchTerms = [];
});
});
@ -18,7 +16,7 @@ function initList(json) {
var thisVideo = new padmaVideo(videos[v], v); var thisVideo = new padmaVideo(videos[v], v);
padmaVideos.push(thisVideo); padmaVideos.push(thisVideo);
} }
} }
/** /**

View File

@ -7,6 +7,9 @@ $(document).ready(function() {
return; return;
} }
doSearch(val); doSearch(val);
});
});
/* /*
var words = val.split(" "); var words = val.split(" ");
for (var i = 0; i < words.length; i++) { for (var i = 0; i < words.length; i++) {
@ -17,14 +20,6 @@ $(document).ready(function() {
} }
} }
*/ */
});
/*
$('#search').keyup(function() {
});
*/
});
function getVideoById(id) { function getVideoById(id) {
for (var i=0; i < padmaVideos.length; i++) { for (var i=0; i < padmaVideos.length; i++) {
@ -69,7 +64,7 @@ function doSearch(word) {
*/ */
} }
} }
} }
/* /*
@ -95,7 +90,7 @@ function findMatchingLayers(word) {
} }
} }
return matchedLayers; return matchedLayers;
} }
Array.prototype.inArray = function(value) { Array.prototype.inArray = function(value) {
@ -108,5 +103,5 @@ Array.prototype.inArray = function(value) {
} }
} }
return false; return false;
}; };

View File

@ -3,13 +3,13 @@ var padmaVideo = function(json, index) {
this.index = index; this.index = index;
this.title = json.title; this.title = json.title;
this.jq = {}; this.jq = {};
this.poster = BASE_URL + this.id + "/poster.jpg"; this.poster = PADMA_BASE_URL + this.id + "/poster.jpg";
this.timeline = BASE_URL + this.id + "/timeline.png"; this.timeline = PADMA_BASE_URL + this.id + "/timeline.png";
this.wrapperHtml = this.getWrapperHtml() this.wrapperHtml = this.getWrapperHtml()
this.init(); this.init();
this.dataLoaded = false; this.dataLoaded = false;
this.layers = []; this.layers = [];
} }
padmaVideo.prototype.getWrapperHtml = function() { padmaVideo.prototype.getWrapperHtml = function() {
var that = this; var that = this;
@ -34,7 +34,7 @@ padmaVideo.prototype.getWrapperHtml = function() {
html += "<div class='searchResults'></div>"; html += "<div class='searchResults'></div>";
videoElem.html(html); videoElem.html(html);
return videoElem; return videoElem;
} }
/* /*
var Timeline = function(padmaVideo) { var Timeline = function(padmaVideo) {
@ -51,7 +51,7 @@ padmaVideo.prototype.init = function() {
$('#videos').append(that.wrapperHtml); $('#videos').append(that.wrapperHtml);
this.jq = $('#' + that.id); this.jq = $('#' + that.id);
this.loadData(); this.loadData();
} }
padmaVideo.prototype.getLayerById = function(id) { padmaVideo.prototype.getLayerById = function(id) {
var that = this; var that = this;
@ -67,7 +67,7 @@ padmaVideo.prototype.getLayerById = function(id) {
padmaVideo.prototype.metaLoaded = function() { padmaVideo.prototype.metaLoaded = function() {
var that = this; var that = this;
$('#' + that.id + ' .videoMeta').html(that.meta.description_html); $('#' + that.id + ' .videoMeta').html(that.meta.description_html);
} }
padmaVideo.prototype.layersLoaded = function() { padmaVideo.prototype.layersLoaded = function() {
this.dataLoaded = true; this.dataLoaded = true;
@ -80,15 +80,15 @@ padmaVideo.prototype.layersLoaded = function() {
var thisVideo = padmaVideos[index]; var thisVideo = padmaVideos[index];
}); });
*/ */
} }
padmaVideo.prototype.loadData = function() { padmaVideo.prototype.loadData = function() {
var that = this; var that = this;
var metaUrl = BASE_URL + that.id + "/video.js"; var metaUrl = PADMA_BASE_URL + that.id + "/video.js";
$.getScript(metaUrl, function() { $.getScript(metaUrl, function() {
that.meta = video; that.meta = video;
that.metaLoaded(); that.metaLoaded();
var layersUrl = BASE_URL + that.id + "/layers.js"; var layersUrl = PADMA_BASE_URL + that.id + "/layers.js";
$.getScript(layersUrl, function() { $.getScript(layersUrl, function() {
var theseLayers = layers; var theseLayers = layers;
for (var i=0; i < theseLayers.length; i++) { for (var i=0; i < theseLayers.length; i++) {
@ -98,6 +98,6 @@ padmaVideo.prototype.loadData = function() {
that.layersLoaded(); that.layersLoaded();
}); });
}); });
} }

View File

@ -2,6 +2,9 @@
<html> <html>
<head> <head>
<script type="text/javascript" src="/static/js/jquery.js"></script> <script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript">
PADMA_BASE_URL = "{{ padma_url }}";
</script>
{% block head %} {% block head %}
{% endblock %} {% endblock %}