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']:
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")

View File

@ -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__)

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);
}
}
}
/**

View File

@ -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 = "<img src='" + imgPath + "' />";
$('#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;
};
};

View File

@ -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 += "<div class='searchResults'></div>";
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();
});
});
}
});
}

View File

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