IE compatibility :/
This commit is contained in:
parent
0907850fbb
commit
f3497fbcdb
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
var messages = {
|
var messages = {
|
||||||
'overwrite': '<?php _e('This will overwrite the current transcript. Are you sure?', 'what-did-they-say') ?>',
|
'overwrite': '<?php _e('This will overwrite the current transcript. Are you sure?', 'what-did-they-say') ?>',
|
||||||
'delete': '<?php _e('This will delete the queued transcript. Are you sure?', 'what-did-they-say') ?>',
|
'delete_message': '<?php _e('This will delete the queued transcript. Are you sure?', 'what-did-they-say') ?>',
|
||||||
'approved': '<?php _e('Transcript approved and posted. You can further edit it below.', 'what-did-they-say') ?>',
|
'approved': '<?php _e('Transcript approved and posted. You can further edit it below.', 'what-did-they-say') ?>',
|
||||||
'deleted': '<?php _e('Transcript deleted.', 'what-did-they-say') ?>',
|
'deleted': '<?php _e('Transcript deleted.', 'what-did-they-say') ?>',
|
||||||
'scene_heading': '<?php _e('Enter the scene heading:', 'what-did-they-say') ?>',
|
'scene_heading': '<?php _e('Enter the scene heading:', 'what-did-they-say') ?>',
|
||||||
'scene_action': '<?php _e('Enter the scene action:', 'what-did-they-say') ?>',
|
'scene_action': '<?php _e('Enter the scene action:', 'what-did-they-say') ?>',
|
||||||
'dialog_name': '<?php _e('Enter the character name:', 'what-did-they-say') ?>',
|
'dialog_name': '<?php _e('Enter the character name:', 'what-did-they-say') ?>',
|
||||||
'dialog_direction': '<?php _e('Enter the direction in which the character is speaking:', 'what-did-they-say') ?>',
|
'dialog_direction': '<?php _e('Enter the direction in which the character is speaking:', 'what-did-they-say') ?>',
|
||||||
'dialog_speech': '<?php _e('Enter what the character is speaking:', 'what-did-they-say') ?>',
|
'dialog_speech': '<?php _e('Enter what the character is speaking:', 'what-did-they-say') ?>'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
|
@ -9,11 +9,11 @@
|
||||||
)
|
)
|
||||||
?></p>
|
?></p>
|
||||||
<div class="queued-transcription transcript"><?php echo do_shortcode($transcript['transcript']) ?></div>
|
<div class="queued-transcription transcript"><?php echo do_shortcode($transcript['transcript']) ?></div>
|
||||||
<div class="queued-transcription-raw" style="display:none"><?php echo $transcript['transcript'] ?></div>
|
<pre class="queued-transcription-raw" style="display:none"><?php echo $transcript['transcript'] ?></pre>
|
||||||
<div class="transcript-action-links">
|
<div class="transcript-action-links">
|
||||||
<?php if (current_user_can('approve_transcriptions')) { ?>
|
<?php if (current_user_can('approve_transcriptions')) { ?>
|
||||||
<a href="#" class="approve-transcript button">Approve</a> |
|
<a href="#" class="approve-transcript button">Approve</a> |
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a href="#" class="delete-transcript button">Delete</a> |
|
<a href="#" class="delete-transcript button">Delete</a> |
|
||||||
<a href="#" class="edit-transcript button">Edit</a>
|
<a href="#" class="edit-transcript-button button">Edit</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -70,3 +70,7 @@
|
||||||
padding: 1em 0;
|
padding: 1em 0;
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.queued-transcription-raw {
|
||||||
|
display: none
|
||||||
|
}
|
|
@ -48,10 +48,10 @@ Event.observe(window, 'load', function() {
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
var range = document.selection.createRange();
|
var range = document.selection.createRange();
|
||||||
var stored_range = range.duplicate();
|
var stored_range = range.duplicate();
|
||||||
stored_range.moveToElementText( element );
|
stored_range.moveToElementText(current_transcript);
|
||||||
stored_range.setEndPoint( 'EndToEnd', range );
|
stored_range.setEndPoint('EndToEnd', range);
|
||||||
element.selectionStart = stored_range.text.length - range.text.length;
|
current_transcript.selectionStart = stored_range.text.length - range.text.length;
|
||||||
element.selectionEnd = element.selectionStart + range.text.length;
|
current_transcript.selectionEnd = current_transcript.selectionStart + range.text.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
var start = current_transcript.selectionStart;
|
var start = current_transcript.selectionStart;
|
||||||
|
@ -106,16 +106,19 @@ Event.observe(window, 'load', function() {
|
||||||
function wdts_setup_approve_transcript_clicker(b) {
|
function wdts_setup_approve_transcript_clicker(b) {
|
||||||
b.observe('click', function(e) {
|
b.observe('click', function(e) {
|
||||||
Event.stop(e);
|
Event.stop(e);
|
||||||
var lang = b.parentNode.parentNode.select("input[name*=[language]]").shift();
|
|
||||||
var post_id = b.parentNode.parentNode.parentNode.select("input[name*=[post_id]]").shift();
|
var p = $(b.parentNode.parentNode);
|
||||||
var key = b.parentNode.parentNode.select("input[name*=[key]]").shift();
|
|
||||||
|
var lang = p.select("input[name*=[language]]").shift();
|
||||||
|
var post_id = p.select("input[name*=[post_id]]").shift();
|
||||||
|
var key = p.select("input[name*=[key]]").shift();
|
||||||
if (lang && post_id && key) {
|
if (lang && post_id && key) {
|
||||||
lang = lang.value;
|
lang = lang.value;
|
||||||
post_id = post_id.value;
|
post_id = post_id.value;
|
||||||
key = key.value;
|
key = key.value;
|
||||||
var editor = $('wdts-transcripts-' + lang);
|
var editor = $('wdts-transcripts-' + lang);
|
||||||
|
|
||||||
var raw_transcript = b.parentNode.parentNode.select(".queued-transcription-raw").shift();
|
var raw_transcript = p.select(".queued-transcription-raw").shift();
|
||||||
if (raw_transcript && editor) {
|
if (raw_transcript && editor) {
|
||||||
var ok = true;
|
var ok = true;
|
||||||
if (editor.value.match(/[^ ]/)) {
|
if (editor.value.match(/[^ ]/)) {
|
||||||
|
@ -123,7 +126,6 @@ function wdts_setup_approve_transcript_clicker(b) {
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
editor.value = raw_transcript.innerHTML;
|
editor.value = raw_transcript.innerHTML;
|
||||||
var p = b.parentNode.parentNode;
|
|
||||||
|
|
||||||
new Ajax.Request(
|
new Ajax.Request(
|
||||||
ajax_url, {
|
ajax_url, {
|
||||||
|
@ -159,13 +161,15 @@ function wdts_setup_delete_transcript_clicker(b) {
|
||||||
b.observe('click', function(e) {
|
b.observe('click', function(e) {
|
||||||
Event.stop(e);
|
Event.stop(e);
|
||||||
|
|
||||||
if (confirm(messages.delete)) {
|
var p = $(b.parentNode.parentNode);
|
||||||
var post_id = b.parentNode.parentNode.parentNode.select("input[name*=[post_id]]").shift();
|
|
||||||
var key = b.parentNode.parentNode.select("input[name*=[key]]").shift();
|
if (confirm(messages.delete_message)) {
|
||||||
|
var post_id = p.select("input[name*=[post_id]]").pop();
|
||||||
|
var key = p.select("input[name*=[key]]").pop();
|
||||||
|
|
||||||
if (post_id && key) {
|
if (post_id && key) {
|
||||||
post_id = post_id.value;
|
post_id = post_id.value;
|
||||||
key = key.value;
|
key = key.value;
|
||||||
var p = b.parentNode.parentNode;
|
|
||||||
|
|
||||||
new Ajax.Request(
|
new Ajax.Request(
|
||||||
ajax_url, {
|
ajax_url, {
|
||||||
|
@ -191,28 +195,26 @@ function wdts_setup_edit_transcript_clicker(b) {
|
||||||
b.observe('click', function(e) {
|
b.observe('click', function(e) {
|
||||||
Event.stop(e);
|
Event.stop(e);
|
||||||
|
|
||||||
var target = b.parentNode.parentNode;
|
var p = $(b.parentNode.parentNode);
|
||||||
|
|
||||||
var transcript = target.select('.transcript').pop();
|
var transcript = p.select('.transcript').pop();
|
||||||
var textnode = new Element('textarea', { style: 'height: 200px; width: 90%' });
|
var textnode = new Element('textarea', { style: 'height: 200px; width: 90%' });
|
||||||
var action_links = target.select('.transcript-action-links').pop();
|
var action_links = p.select('.transcript-action-links').pop();
|
||||||
textnode.value = target.select('.queued-transcription-raw').pop().innerHTML;
|
textnode.value = p.select('.queued-transcription-raw').pop().innerHTML;
|
||||||
|
|
||||||
b.parentNode.parentNode.insertBefore(textnode, transcript);
|
p.insertBefore(textnode, transcript);
|
||||||
transcript.hide();
|
transcript.hide();
|
||||||
|
|
||||||
var post_id = target.select("input[name*=[post_id]]").shift();
|
var post_id = p.select("input[name*=[post_id]]").shift();
|
||||||
var key = target.select("input[name*=[key]]").shift();
|
var key = p.select("input[name*=[key]]").shift();
|
||||||
|
|
||||||
var submitter = new Element('button').update('Update Transcript');
|
var submitter = new Element('button').update('Update Transcript');
|
||||||
submitter.observe('click', function(e) {
|
submitter.observe('click', function(e) {
|
||||||
top.console.log(post_id);
|
|
||||||
top.console.log(key);
|
|
||||||
if (post_id && key) {
|
if (post_id && key) {
|
||||||
post_id = post_id.value;
|
post_id = post_id.value;
|
||||||
key = key.value;
|
key = key.value;
|
||||||
|
|
||||||
new Ajax.Updater(target, ajax_url, {
|
new Ajax.Updater(p, ajax_url, {
|
||||||
'method': 'post',
|
'method': 'post',
|
||||||
'parameters': {
|
'parameters': {
|
||||||
'wdts[_nonce]': nonce,
|
'wdts[_nonce]': nonce,
|
||||||
|
@ -222,27 +224,25 @@ function wdts_setup_edit_transcript_clicker(b) {
|
||||||
'wdts[transcript]': textnode.value
|
'wdts[transcript]': textnode.value
|
||||||
},
|
},
|
||||||
'onComplete': function() {
|
'onComplete': function() {
|
||||||
new Effect.Highlight(target);
|
new Effect.Highlight(p);
|
||||||
wdts_add_clickers(target);
|
wdts_add_clickers(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
b.parentNode.parentNode.appendChild(submitter);
|
p.appendChild(submitter);
|
||||||
action_links.parentNode.removeChild(action_links);
|
action_links.parentNode.removeChild(action_links);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function wdts_add_clickers(p) {
|
function wdts_add_clickers(p) {
|
||||||
top.console.log(p);
|
p.select('.edit-transcript-button').each(function(b) { wdts_setup_edit_transcript_clicker(b); });
|
||||||
p.select('.edit-transcript').each(function(b) { top.console.log(b); wdts_setup_edit_transcript_clicker(b); });
|
|
||||||
p.select('.approve-transcript').each(function(b) { wdts_setup_approve_transcript_clicker(b); });
|
p.select('.approve-transcript').each(function(b) { wdts_setup_approve_transcript_clicker(b); });
|
||||||
p.select('.delete-transcript').each(function(b) { wdts_setup_delete_transcript_clicker(b); });
|
p.select('.delete-transcript').each(function(b) { wdts_setup_delete_transcript_clicker(b); });
|
||||||
}
|
}
|
||||||
|
|
||||||
wdts_add_clickers($$('body')[0]);
|
wdts_add_clickers($$('body').pop());
|
||||||
|
|
||||||
if (language_selector) {
|
if (language_selector) {
|
||||||
switch_transcript();
|
switch_transcript();
|
||||||
Event.observe(window, 'load', switch_transcript);
|
Event.observe(window, 'load', switch_transcript);
|
||||||
|
|
|
@ -218,6 +218,7 @@ function the_media_transcript_queue_editor() {
|
||||||
<h3><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
|
<h3><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
|
||||||
<form method="post" class="transcript-editor">
|
<form method="post" class="transcript-editor">
|
||||||
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
|
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
|
||||||
|
<?php include(dirname(__FILE__) . '/classes/partials/_editor-script.inc'); ?>
|
||||||
<input type="submit" value="Modify Transcript" />
|
<input type="submit" value="Modify Transcript" />
|
||||||
</form>
|
</form>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
Loading…
Reference in New Issue