javascript cleanups
This commit is contained in:
parent
361cb19bd0
commit
33588e1ba4
@ -260,7 +260,7 @@ class WhatDidTheySayAdmin {
|
|||||||
*/
|
*/
|
||||||
function the_transcript_opener($content = '') {
|
function the_transcript_opener($content = '') {
|
||||||
ob_start(); ?>
|
ob_start(); ?>
|
||||||
<div class="wdts-transcript-opener"> [
|
<div class="wdts-transcript-opener" style="display:none"> [
|
||||||
<a href="#" class="wdts-opener"><?php _e('Show transcripts') ?></a>
|
<a href="#" class="wdts-opener"><?php _e('Show transcripts') ?></a>
|
||||||
<a href="#" class="wdts-closer"><?php _e('Hide transcripts') ?></a>
|
<a href="#" class="wdts-closer"><?php _e('Hide transcripts') ?></a>
|
||||||
] </div>
|
] </div>
|
||||||
|
@ -47,7 +47,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
|
|||||||
stored_range.moveToElementText(transcript);
|
stored_range.moveToElementText(transcript);
|
||||||
stored_range.setEndPoint('EndToEnd', range);
|
stored_range.setEndPoint('EndToEnd', range);
|
||||||
transcript.selectionStart = stored_range.text.length - range.text.length;
|
transcript.selectionStart = stored_range.text.length - range.text.length;
|
||||||
transcript.selectionEnd = current_transcript.selectionStart + range.text.length;
|
transcript.selectionEnd = transcript.selectionStart + range.text.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
var start = transcript.selectionStart;
|
var start = transcript.selectionStart;
|
||||||
@ -63,7 +63,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
|
|||||||
case 'scene-action':
|
case 'scene-action':
|
||||||
var message = tag.replace('-', '_');
|
var message = tag.replace('-', '_');
|
||||||
if (new_content) {
|
if (new_content) {
|
||||||
var content = prompt(WhatDidTheySay.messages[message]);
|
var content = prompt(WhatDidTheySay.messages[message], '');
|
||||||
if (content) {
|
if (content) {
|
||||||
injector.inject('[' + tag + ']' + content + "[/" + tag + "]\n", start);
|
injector.inject('[' + tag + ']' + content + "[/" + tag + "]\n", start);
|
||||||
}
|
}
|
||||||
@ -73,15 +73,15 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'dialog':
|
case 'dialog':
|
||||||
var name = prompt(WhatDidTheySay.messages.dialog_name);
|
var name = prompt(WhatDidTheySay.messages.dialog_name, '');
|
||||||
if (name) {
|
if (name) {
|
||||||
var direction = prompt(WhatDidTheySay.messages.dialog_direction);
|
var direction = prompt(WhatDidTheySay.messages.dialog_direction, '');
|
||||||
var tag = '[dialog name="' + name + '"';
|
var tag = '[dialog name="' + name + '"';
|
||||||
if (direction) { tag += ' direction="' + direction + '"'; }
|
if (direction) { tag += ' direction="' + direction + '"'; }
|
||||||
tag += ']';
|
tag += ']';
|
||||||
|
|
||||||
if (new_content) {
|
if (new_content) {
|
||||||
var speech = prompt(WhatDidTheySay.messages.dialog_speech);
|
var speech = prompt(WhatDidTheySay.messages.dialog_speech, '');
|
||||||
|
|
||||||
if (speech) {
|
if (speech) {
|
||||||
tag += speech + "[/dialog]\n";
|
tag += speech + "[/dialog]\n";
|
||||||
|
@ -105,5 +105,7 @@ $$('.wdts-transcript-container').each(function(d) {
|
|||||||
} else {
|
} else {
|
||||||
bundle.show(); closer.show(); opener.hide();
|
bundle.show(); closer.show(); opener.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opener_container.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -210,12 +210,18 @@ function the_media_transcript_queue_editor() {
|
|||||||
$new_transcript_id = md5(rand());
|
$new_transcript_id = md5(rand());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<p>[ <a id="wdts-opener-<?php echo $id = md5(rand()) ?>" href="#"><?php _e('Edit/Add Transcripts', 'what-did-they-say') ?></a> ]</p>
|
<div style="display:none">
|
||||||
|
[ <a id="wdts-opener-<?php echo $id = md5(rand()) ?>" href="#"><?php _e('Edit/Add Transcripts', 'what-did-they-say') ?></a> ]
|
||||||
|
</div>
|
||||||
|
<noscript>
|
||||||
|
<p>JavaScript is required to edit transcripts.</p>
|
||||||
|
</noscript>
|
||||||
<div id="wdts-<?php echo $id ?>" style="display:none">
|
<div id="wdts-<?php echo $id ?>" style="display:none">
|
||||||
<h3 class="wdts"><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
|
<h3 class="wdts"><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
|
||||||
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
|
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$($('wdts-opener-<?php echo $id ?>').parentNode).show();
|
||||||
$('wdts-opener-<?php echo $id ?>').observe('click', function(e) {
|
$('wdts-opener-<?php echo $id ?>').observe('click', function(e) {
|
||||||
Event.stop(e);
|
Event.stop(e);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user