fix double click issue

This commit is contained in:
Sanj 2012-01-20 20:18:35 +05:30
parent 6eec8b4228
commit 8e06142f35
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import json
import codecs import codecs
def JSONtoHTML(): def JSONtoHTML():
data = json.loads(open("radia.json").read()) data = json.loads(open("radia.json").read())
html = '' html = ''
@ -21,7 +22,6 @@ def JSONtoHTML():
indexFile.write(footer) indexFile.write(footer)
indexFile.close() indexFile.close()
def do(): def do():
f = codecs.open("ChronoArr_Srt.txt", mode="r", encoding="utf-8") f = codecs.open("ChronoArr_Srt.txt", mode="r", encoding="utf-8")
data = json.loads(open("radia.json").read()) data = json.loads(open("radia.json").read())

View File

@ -1,5 +1,11 @@
$(function() { $(function() {
$('.title').data("loading", false);
$('.title').click(function() { $('.title').click(function() {
var $this = $(this);
if ($(this).data("loading")) {
return;
}
$(this).data("loading", true);
var $parent = $(this).parent(); var $parent = $(this).parent();
if ($parent.find('.srtContainer').length > 0) { if ($parent.find('.srtContainer').length > 0) {
@ -12,6 +18,7 @@ $(function() {
var srtFilename = "srt/" + name + ".srt"; var srtFilename = "srt/" + name + ".srt";
var audioFilename = "wav/" + name + ".wav"; var audioFilename = "wav/" + name + ".wav";
$.get(srtFilename, {}, function(srt) { $.get(srtFilename, {}, function(srt) {
$this.data("loading", false);
var txt = srtToTxt(srt, 'tc'); var txt = srtToTxt(srt, 'tc');
var $txtContainer = $('<div />').addClass("srtContainer").data("srt", srt).hide() var $txtContainer = $('<div />').addClass("srtContainer").data("srt", srt).hide()
var $audio = $('<audio />').attr("src", audioFilename).attr("controls", "controls").appendTo($txtContainer); var $audio = $('<audio />').attr("src", audioFilename).attr("controls", "controls").appendTo($txtContainer);